summaryrefslogtreecommitdiff
path: root/main/build.gradle
diff options
context:
space:
mode:
Diffstat (limited to 'main/build.gradle')
-rw-r--r--main/build.gradle109
1 files changed, 73 insertions, 36 deletions
diff --git a/main/build.gradle b/main/build.gradle
index afe19468..680bba69 100644
--- a/main/build.gradle
+++ b/main/build.gradle
@@ -8,9 +8,9 @@ import com.android.builder.model.ProductFlavor
apply plugin: 'com.android.application'
apply plugin: 'checkstyle'
- checkstyle {
+checkstyle {
showViolations true
- }
+}
repositories {
jcenter()
@@ -19,35 +19,66 @@ repositories {
}
dependencies {
- compile 'com.android.support:support-annotations:26.0.0'
- compile 'com.android.support:cardview-v7:26.0.0'
- compile 'com.android.support:recyclerview-v7:26.0.0'
+ implementation 'com.android.support.constraint:constraint-layout:1.0.2'
+ implementation 'com.android.support:support-annotations:27.0.2'
+ implementation 'com.android.support:cardview-v7:27.0.2'
+ implementation 'com.android.support:recyclerview-v7:27.0.2'
// compile 'ch.acra:acra:4.5.0'
- compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'
+
+ testImplementation 'junit:junit:4.12'
+}
+
+
+
+def openvpn3SwigFiles = new File(buildDir, "generated/source/ovpn3swig/ovpn3")
+
+task ("generateOpenVPN3Swig" ,type:Exec) {
+ doFirst {
+ mkdir openvpn3SwigFiles
+ }
+ commandLine "swig", "-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"
- testCompile 'junit:junit:4.12'
}
android {
- compileSdkVersion 26
- buildToolsVersion '26.0.0'
+ compileSdkVersion 27
+ buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 14
- targetSdkVersion 26
- versionCode = 153
- versionName = "0.6.73"
+ targetSdkVersion 27
+ versionCode = 156
+ versionName = "0.7.3"
+
+ 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', 'ovpnlibs/assets']
- jniLibs.srcDirs = ['ovpnlibs/jniLibs']
- jni.srcDirs = [] //disable automatic ndk-build
+ assets.srcDirs = ['src/main/assets', 'build/ovpnassets']
}
-
- ovpn3 {
-
+
+ normal {
+ java.srcDirs =["src/ovpn3/java/", openvpn3SwigFiles]
+ }
+
+ noovpn3 {
}
debug {
@@ -59,12 +90,6 @@ android {
}
}
- /*
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_7
- targetCompatibility JavaVersion.VERSION_1_7
- }*/
-
signingConfigs {
release
}
@@ -84,22 +109,26 @@ android {
flavorDimensions "implementation"
productFlavors {
- /*ovpn3 {
- dimension "implementation"
+ noovpn3 {
+ dimension "implementation"
+ buildConfigField 'boolean', 'openvpn3', 'false'
+ }
- } */
+ normal {
+ dimension "implementation"
+ buildConfigField 'boolean', 'openvpn3', 'true'
- normal {
- dimension "implementation"
- }
+ }
}
+ compileOptions {
+ targetCompatibility 1.8
+ sourceCompatibility 1.8
+ }
}
-
-
// ~/.gradle/gradle.properties
if (project.hasProperty('keystoreFile') &&
project.hasProperty('keystorePassword') &&
@@ -112,9 +141,17 @@ if (project.hasProperty('keystoreFile') &&
android.buildTypes.release.signingConfig = null
}
-/*tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
- pkgTask.jniFolders = new HashSet<File>()
- pkgTask.jniFolders.add(new File(buildDir, 'native-libs'))
+// 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