diff options
-rw-r--r-- | build.gradle.kts (renamed from build.gradle) | 11 | ||||
-rw-r--r-- | gradle/wrapper/gradle-wrapper.properties | 4 | ||||
-rw-r--r-- | main/build.gradle | 164 | ||||
-rw-r--r-- | main/build.gradle.kts | 190 | ||||
-rw-r--r-- | main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java | 2 | ||||
-rw-r--r-- | settings.gradle.kts (renamed from settings.gradle) | 6 |
6 files changed, 201 insertions, 176 deletions
diff --git a/build.gradle b/build.gradle.kts index 96752279..a0a3e571 100644 --- a/build.gradle +++ b/build.gradle.kts @@ -1,18 +1,17 @@ /* - * Copyright (c) 2012-2016 Arne Schwabe + * Copyright (c) 2012-2019 Arne Schwabe * Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt */ + buildscript { repositories { - maven { - url 'https://maven.google.com' - } - jcenter() google() + jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath("com.android.tools.build:gradle:3.3.0") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.11") } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 009c3e97..a4556642 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Sep 25 12:04:38 CEST 2018 +#Tue Jan 15 13:45:29 CET 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip diff --git a/main/build.gradle b/main/build.gradle deleted file mode 100644 index aa9d03e0..00000000 --- a/main/build.gradle +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2012-2016 Arne Schwabe - * Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt - */ - -import com.android.builder.model.ProductFlavor - -apply plugin: 'com.android.application' - -apply plugin: 'checkstyle' -checkstyle { - showViolations true -} - -repositories { - jcenter() - maven { url "https://jitpack.io" } - maven { url 'https://maven.google.com' } -} - -dependencies { - implementation 'com.android.support.constraint:constraint-layout:1.1.3' - implementation 'com.android.support:support-annotations:28.0.0' - implementation 'com.android.support:cardview-v7:28.0.0' - implementation 'com.android.support:recyclerview-v7:28.0.0' - // compile 'ch.acra:acra:4.5.0' - implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2' - - testImplementation 'junit:junit:4.12' - testImplementation 'org.mockito:mockito-core:2.16.0' - testImplementation "org.robolectric:robolectric:3.7.1" - - -} - - - -def openvpn3SwigFiles = new File(buildDir, "generated/source/ovpn3swig/ovpn3") - -task ("generateOpenVPN3Swig" ,type:Exec) { - def swigcmd = "swig" - // Workaround for Mac OS X since it otherwise does not find swig and I cannot get - // the Exec task to respect the PATH environment :( - if (file("/usr/local/bin/swig").exists()) - swigcmd = "/usr/local/bin/swig" - - doFirst { - mkdir openvpn3SwigFiles - } - commandLine swigcmd, "-outdir", openvpn3SwigFiles, "-outcurrentdir", "-c++", "-java", "-package", "net.openvpn.ovpn3", - "-Isrc/main/cpp/openvpn3/client", "-Isrc/main/cpp/openvpn3/", - "-o", "${openvpn3SwigFiles}/ovpncli_wrap.cxx", "-oh", "${openvpn3SwigFiles}/ovpncli_wrap.h", - "src/main/cpp/openvpn3/javacli/ovpncli.i" -\ -} - -android { - compileSdkVersion 28 - - defaultConfig { - minSdkVersion 14 - targetSdkVersion 28 - versionCode = 160 - versionName = "0.7.7" - - externalNativeBuild { - cmake { - arguments '-DANDROID_TOOLCHAIN=clang', - '-DANDROID_STL=c++_static' - //abiFilters "arm64-v8a" - } - } - } - - externalNativeBuild { - cmake { - path "src/main/cpp/CMakeLists.txt" - } - } - - sourceSets { - main { - assets.srcDirs = ['src/main/assets', 'build/ovpnassets'] - } - - normal { - java.srcDirs =["src/ovpn3/java/", openvpn3SwigFiles] - } - - noovpn3 { - } - - debug { - - } - - release { - - } - } - - signingConfigs { - release - } - - lintOptions { - enable 'BackButton', 'EasterEgg', 'StopShip', 'IconExpectedSize', 'GradleDynamicVersion', 'NewerVersionAvailable' - warning 'ImpliedQuantity', 'MissingQuantity' - disable 'MissingTranslation', 'UnsafeNativeCodeLocation' - } - - buildTypes { - release { - signingConfig signingConfigs.release - } - } - - flavorDimensions "implementation" - - productFlavors { - noovpn3 { - dimension "implementation" - buildConfigField 'boolean', 'openvpn3', 'false' - } - normal { - dimension "implementation" - buildConfigField 'boolean', 'openvpn3', 'true' - } - - } - - - compileOptions { - targetCompatibility 1.8 - sourceCompatibility 1.8 - } -} - -// ~/.gradle/gradle.properties -if (project.hasProperty('keystoreFile') && - project.hasProperty('keystorePassword') && - project.hasProperty('keystoreAliasPassword')) { - android.signingConfigs.release.storeFile = file(keystoreFile) - android.signingConfigs.release.storePassword = keystorePassword - android.signingConfigs.release.keyPassword = keystoreAliasPassword - android.signingConfigs.release.keyAlias = keystoreAlias -} else { - android.buildTypes.release.signingConfig = null -} - -// Ensure native build is run before assets, so assets are ready to be merged into the apk -android.applicationVariants.all { variant -> - variant.mergeAssets.dependsOn(variant.externalNativeBuildTasks) -} - - -android.applicationVariants.all { variant -> - variant.productFlavors.each { - if (it.dimension == 'implementation' && it.name != 'noovpn3') - variant.getJavaCompiler().dependsOn(generateOpenVPN3Swig) - - } - -}
\ No newline at end of file diff --git a/main/build.gradle.kts b/main/build.gradle.kts new file mode 100644 index 00000000..35af282a --- /dev/null +++ b/main/build.gradle.kts @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2012-2016 Arne Schwabe + * Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt + */ + +plugins { + id ("com.android.application") + id ("checkstyle") +} + +apply { + plugin("kotlin-android") + plugin("kotlin-android-extensions") +} + +/* +checkstyle { + showViolations(true) +} +*/ + +repositories { + jcenter() + maven (url ="https://jitpack.io") + google() +} + +dependencies { + implementation ("com.android.support.constraint:constraint-layout:1.1.3") + implementation ("com.android.support:support-annotations:28.0.0") + implementation ("com.android.support:cardview-v7:28.0.0") + implementation ("com.android.support:recyclerview-v7:28.0.0") + implementation ("com.github.PhilJay:MPAndroidChart:v3.0.2") + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.11") + + testImplementation ("junit:junit:4.12") + testImplementation ("org.mockito:mockito-core:2.16.0") + testImplementation ("org.robolectric:robolectric:4.1") +} + + + +val openvpn3SwigFiles = File(buildDir, "generated/source/ovpn3swig/ovpn3") + +//task ("generateOpenVPN3Swig" , Exec.class) { +tasks.register<Exec>("generateOpenVPN3Swig") +{ + var swigcmd = "swig" + // Workaround for Mac OS X since it otherwise does not find swig and I cannot get + // the Exec task to respect the PATH environment :( + if (File("/usr/local/bin/swig").exists()) + swigcmd = "/usr/local/bin/swig" + + doFirst { + mkdir(openvpn3SwigFiles) + } + commandLine(listOf(swigcmd, "-outdir", openvpn3SwigFiles, "-outcurrentdir", "-c++", "-java", "-package", "net.openvpn.ovpn3", + "-Isrc/main/cpp/openvpn3/client", "-Isrc/main/cpp/openvpn3/", + "-o", "${openvpn3SwigFiles}/ovpncli_wrap.cxx", "-oh", "${openvpn3SwigFiles}/ovpncli_wrap.h", + "src/main/cpp/openvpn3/javacli/ovpncli.i")) +} + +android { + compileSdkVersion(28) + + defaultConfig { + minSdkVersion(14) + targetSdkVersion(28) + versionCode = 160 + versionName = "0.7.7" + + externalNativeBuild { + cmake { + //arguments = listOf("-DANDROID_TOOLCHAIN=clang", + // "-DANDROID_STL=c++_static") + //abiFilters "arm64-v8a" + } + } + } + + externalNativeBuild { + cmake { + setPath(File("${projectDir}/src/main/cpp/CMakeLists.txt")) + } + } + + sourceSets { + getByName("main") { + assets.srcDirs("src/main/assets", "build/ovpnassets") + } + + create("normal") { +// java.srcDir(listOf(File("src/ovpn3/java/"), openvpn3SwigFiles)) + } + + create("noovpn3") { + } + + getByName("debug") { + + } + + getByName("release") { + + } + } + + signingConfigs { + create("release") {} + } + + lintOptions { + enable("BackButton", "EasterEgg", "StopShip", "IconExpectedSize", "GradleDynamicVersion", "NewerVersionAvailable") + warning("ImpliedQuantity", "MissingQuantity") + disable("MissingTranslation", "UnsafeNativeCodeLocation") + } + + buildTypes { + getByName("release") { + signingConfig = signingConfigs.getByName("release") + } + } + + flavorDimensions("implementation") + + productFlavors { + create("noovpn3") { + setDimension("implementation") + buildConfigField ("boolean", "openvpn3", "false") + } + create("normal") { + setDimension("implementation") + buildConfigField ("boolean", "openvpn3", "true") + } + + } + + + compileOptions { + targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_1_8 + } +} + +// ~/.gradle/gradle.properties +if (project.hasProperty("keystoreFile") && + project.hasProperty("keystorePassword") && + project.hasProperty("keystoreAliasPassword")) { + android.signingConfigs.getByName("release") { + storeFile = file(project.properties["keystoreFile"] as String) + storePassword = project.properties["keystorePassword"] as String + keyPassword = project.properties["keystoreAliasPassword"] as String + keyAlias = project.properties["keystoreAlias"] as String + } +} else { + android.buildTypes.getByName("release").signingConfig = null +} + + +/* Hack-o-rama but it works good enough and documentation is surprisingly sparse */ + +val swigTask = tasks.named("generateOpenVPN3Swig") +val assembleTask = tasks.getByName("assemble") + +assembleTask.dependsOn(swigTask) + +// Ensure native build is run before assets, so assets are ready to be merged into the apk +/*android.applicationVariants.all { variant -> + variant.mergeAssets.dependsOn(variant.externalNativeBuildTasks) +}*/ + + +//for (t in android.variant(true)) +// println(t) + + +//tasks.getByName("processResources").dependsOn(tasks.getByName("externalNativeBuildTasks")) + + +//tasks.getByName("compileJava").dependsOn(tasks.getByName("generateOpenVPN3Swig")) + +/* +android.applicationVariants.all { variant -> + variant.productFlavors.each { + if (it.dimension == "implementation" && it.name != "noovpn3") + variant.getJavaCompiler().dependsOn(generateOpenVPN3Swig) + + } + +}*/
\ No newline at end of file diff --git a/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java b/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java index bb511c6d..fab090b7 100644 --- a/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java +++ b/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java @@ -66,7 +66,7 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable if(status.getError()) { VpnStatus.logError(String.format("connect() error: %s: %s",status.getStatus(),status.getMessage())); } else { - VpnStatus.logDebug("OpenVPN3 thread finished"); + VpnStatus.updateStateString("NOPROCESS", "OpenVPN3 thread finished", R.string.state_noprocess, ConnectionStatus.LEVEL_NOTCONNECTED); } statuspoller.stop(); } diff --git a/settings.gradle b/settings.gradle.kts index 0c651b1c..e1e8d4fd 100644 --- a/settings.gradle +++ b/settings.gradle.kts @@ -3,6 +3,6 @@ * Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt */ -include ':main' -include ':tlsexternalcertprovider' -include ':remoteExample' +include(":main") +include(":tlsexternalcertprovider") +include(":remoteExample") |