diff options
Diffstat (limited to 'main/build.gradle.kts')
-rw-r--r-- | main/build.gradle.kts | 102 |
1 files changed, 48 insertions, 54 deletions
diff --git a/main/build.gradle.kts b/main/build.gradle.kts index 3550493d..741323d9 100644 --- a/main/build.gradle.kts +++ b/main/build.gradle.kts @@ -2,10 +2,11 @@ * 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 java.util.Properties plugins { - id ("com.android.application") - id ("checkstyle") + id("com.android.application") + id("checkstyle") } apply { @@ -13,32 +14,22 @@ apply { plugin("kotlin-android-extensions") } -/* -checkstyle { - showViolations(true) +var properties = Properties() + +var skeletonBuild: Boolean +properties.load(project.rootProject.file("local.properties").inputStream()) +if (properties.containsKey("skeleton")) { + skeletonBuild = true +} else { + skeletonBuild = false } -*/ repositories { jcenter() - maven (url ="https://jitpack.io") + 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") @@ -60,11 +51,11 @@ tasks.register<Exec>("generateOpenVPN3Swig") } android { - compileSdkVersion(29) + compileSdkVersion(28) defaultConfig { minSdkVersion(14) - targetSdkVersion(29) //'Q'.toInt() + targetSdkVersion(28) //'Q'.toInt() versionCode = 161 versionName = "0.7.8" @@ -72,7 +63,6 @@ android { cmake { //arguments = listOf("-DANDROID_TOOLCHAIN=clang", // "-DANDROID_STL=c++_static") - //abiFilters "arm64-v8a" } } } @@ -88,8 +78,10 @@ android { assets.srcDirs("src/main/assets", "build/ovpnassets") } - create("normal") { - java.srcDirs("src/ovpn3/java/", openvpn3SwigFiles) + create("ui") { + java.srcDirs("src/ovpn3/java/", openvpn3SwigFiles) + } + create("skeleton") { } getByName("debug") { @@ -120,15 +112,14 @@ android { flavorDimensions("implementation") productFlavors { - /*create("noovpn3") { + create("ui") { setDimension("implementation") - buildConfigField ("boolean", "openvpn3", "false") - }*/ - create("normal") { + buildConfigField("boolean", "openvpn3", "true") + } + create("skeleton") { setDimension("implementation") - buildConfigField ("boolean", "openvpn3", "true") + buildConfigField("boolean", "openvpn3", "false") } - } @@ -136,6 +127,16 @@ android { targetCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8 } + + splits { + abi { + setEnable(true) + reset() + include("x86", "x86_64", "armeabi-v7a", "arm64-v8a") + setUniversalApk(true) + + } + } } // ~/.gradle/gradle.properties @@ -159,32 +160,25 @@ val swigTask = tasks.named("generateOpenVPN3Swig") val preBuildTask = tasks.getByName("preBuild") val assembleTask = tasks.getByName("assemble") -println(tasks.names) - assembleTask.dependsOn(swigTask) preBuildTask.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")) - +/* Normally you would put these on top but then it errors out on unknown configurations */ +dependencies { + implementation("com.android.support:support-annotations:28.0.0") + implementation("com.android.support:support-core-utils:28.0.0") -//tasks.getByName("compileJava").dependsOn(tasks.getByName("generateOpenVPN3Swig")) + // Is there a nicer way to do this? + dependencies.add("uiImplementation", "com.android.support.constraint:constraint-layout:1.1.3") + dependencies.add("uiImplementation", "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.40") + dependencies.add("uiImplementation","com.android.support.constraint:constraint-layout:1.1.3") + dependencies.add("uiImplementation","com.android.support:cardview-v7:28.0.0") + dependencies.add("uiImplementation","com.android.support:recyclerview-v7:28.0.0") + dependencies.add("uiImplementation","com.github.PhilJay:MPAndroidChart:v3.0.2") -/* -android.applicationVariants.all { variant -> - variant.productFlavors.each { - if (it.dimension == "implementation" && it.name != "noovpn3") - variant.getJavaCompiler().dependsOn(generateOpenVPN3Swig) - } + testImplementation("junit:junit:4.12") + testImplementation("org.mockito:mockito-core:3.0.0") + testImplementation("org.robolectric:robolectric:4.3") +} -}*/
\ No newline at end of file |