refactor build script dependencies define
This commit is contained in:
9 files changed
+106
-118
No files matched your search
+19
-22
@@ -1,5 +1,4 @@
|
||||
import java.util.*
|
||||
import java.security.*
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
@@ -7,26 +6,24 @@ plugins {
|
||||
id("kotlin-android-extensions")
|
||||
}
|
||||
|
||||
val rootExtra = rootProject.extra
|
||||
val gCompileSdkVersion: String by project
|
||||
val gBuildToolsVersion: String by project
|
||||
|
||||
val gCompileSdkVersion: Int by rootExtra
|
||||
val gBuildToolsVersion: String by rootExtra
|
||||
val gMinSdkVersion: String by project
|
||||
val gTargetSdkVersion: String by project
|
||||
|
||||
val gMinSdkVersion: Int by rootExtra
|
||||
val gTargetSdkVersion: Int by rootExtra
|
||||
val gVersionCode: String by project
|
||||
val gVersionName: String by project
|
||||
|
||||
val gVersionCode: Int by rootExtra
|
||||
val gVersionName: String by rootExtra
|
||||
|
||||
val gKotlinVersion: String by rootExtra
|
||||
val gKotlinCoroutineVersion: String by rootExtra
|
||||
val gAppCenterVersion: String by rootExtra
|
||||
val gAndroidKtxVersion: String by rootExtra
|
||||
val gRecyclerviewVersion: String by rootExtra
|
||||
val gAppCompatVersion: String by rootExtra
|
||||
val gMaterialDesignVersion: String by rootExtra
|
||||
val gShizukuPreferenceVersion: String by rootExtra
|
||||
val gMultiprocessPreferenceVersion: String by rootExtra
|
||||
val gKotlinVersion: String by project
|
||||
val gKotlinCoroutineVersion: String by project
|
||||
val gAppCenterVersion: String by project
|
||||
val gAndroidKtxVersion: String by project
|
||||
val gRecyclerviewVersion: String by project
|
||||
val gAppCompatVersion: String by project
|
||||
val gMaterialDesignVersion: String by project
|
||||
val gShizukuPreferenceVersion: String by project
|
||||
val gMultiprocessPreferenceVersion: String by project
|
||||
|
||||
android {
|
||||
compileSdkVersion(gCompileSdkVersion)
|
||||
@@ -38,12 +35,12 @@ android {
|
||||
minSdkVersion(gMinSdkVersion)
|
||||
targetSdkVersion(gTargetSdkVersion)
|
||||
|
||||
versionCode = gVersionCode
|
||||
versionCode = gVersionCode.toInt()
|
||||
versionName = gVersionName
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
maybeCreate("release").apply {
|
||||
named("release") {
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
@@ -74,7 +71,7 @@ android {
|
||||
}
|
||||
}
|
||||
signingConfigs {
|
||||
maybeCreate("release").apply {
|
||||
named("release") {
|
||||
storeFile = rootProject.file(Objects.requireNonNull(properties.getProperty("storeFile")))
|
||||
storePassword = Objects.requireNonNull(properties.getProperty("storePassword"))
|
||||
keyAlias = Objects.requireNonNull(properties.getProperty("keyAlias"))
|
||||
@@ -82,7 +79,7 @@ android {
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
maybeCreate("release").apply {
|
||||
named("release") {
|
||||
this.signingConfig = signingConfigs.findByName("release")
|
||||
}
|
||||
}
|
||||
|
||||
+3
-25
@@ -1,38 +1,16 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
val kotlinVersion = "1.3.72"
|
||||
val gKotlinVersion: String by project
|
||||
|
||||
rootProject.extra.apply {
|
||||
this["gBuildToolsVersion"] = "29.0.3"
|
||||
|
||||
this["gCompileSdkVersion"] = 29
|
||||
this["gMinSdkVersion"] = 24
|
||||
this["gTargetSdkVersion"] = 29
|
||||
|
||||
this["gVersionCode"] = 10301
|
||||
this["gVersionName"] = "1.3.1"
|
||||
|
||||
this["gKotlinVersion"] = kotlinVersion
|
||||
this["gKotlinCoroutineVersion"] = "1.3.7"
|
||||
this["gKotlinSerializationVersion"] = "0.20.0"
|
||||
this["gRoomVersion"] = "2.2.5"
|
||||
this["gAppCenterVersion"] = "2.5.1"
|
||||
this["gAndroidKtxVersion"] = "1.2.0"
|
||||
this["gRecyclerviewVersion"] = "1.1.0"
|
||||
this["gAppCompatVersion"] = "1.1.0"
|
||||
this["gMaterialDesignVersion"] = "1.1.0"
|
||||
this["gShizukuPreferenceVersion"] = "4.2.0"
|
||||
this["gMultiprocessPreferenceVersion"] = "1.0.0"
|
||||
}
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath("com.android.tools.build:gradle:4.0.0")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
||||
classpath("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$gKotlinVersion")
|
||||
classpath("org.jetbrains.kotlin:kotlin-serialization:$gKotlinVersion")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-14
@@ -4,21 +4,19 @@ plugins {
|
||||
id("kotlin-android-extensions")
|
||||
}
|
||||
|
||||
val rootExtra = rootProject.extra
|
||||
val gCompileSdkVersion: String by project
|
||||
val gBuildToolsVersion: String by project
|
||||
|
||||
val gCompileSdkVersion: Int by rootExtra
|
||||
val gBuildToolsVersion: String by rootExtra
|
||||
val gMinSdkVersion: String by project
|
||||
val gTargetSdkVersion: String by project
|
||||
|
||||
val gMinSdkVersion: Int by rootExtra
|
||||
val gTargetSdkVersion: Int by rootExtra
|
||||
val gVersionCode: String by project
|
||||
val gVersionName: String by project
|
||||
|
||||
val gVersionCode: Int by rootExtra
|
||||
val gVersionName: String by rootExtra
|
||||
|
||||
val gKotlinVersion: String by rootExtra
|
||||
val gKotlinCoroutineVersion: String by rootExtra
|
||||
val gAndroidKtxVersion: String by rootExtra
|
||||
val gKotlinSerializationVersion: String by rootExtra
|
||||
val gKotlinVersion: String by project
|
||||
val gKotlinCoroutineVersion: String by project
|
||||
val gAndroidKtxVersion: String by project
|
||||
val gKotlinSerializationVersion: String by project
|
||||
|
||||
android {
|
||||
compileSdkVersion(gCompileSdkVersion)
|
||||
@@ -28,14 +26,14 @@ android {
|
||||
minSdkVersion(gMinSdkVersion)
|
||||
targetSdkVersion(gTargetSdkVersion)
|
||||
|
||||
versionCode = gVersionCode
|
||||
versionCode = gVersionCode.toInt()
|
||||
versionName = gVersionName
|
||||
|
||||
consumerProguardFiles("consumer-rules.pro")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
maybeCreate("release").apply {
|
||||
named("release") {
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
}
|
||||
|
||||
+13
-15
@@ -9,21 +9,19 @@ plugins {
|
||||
|
||||
apply(from = "clash.gradle.kts")
|
||||
|
||||
val rootExtra = rootProject.extra
|
||||
val gCompileSdkVersion: String by project
|
||||
val gBuildToolsVersion: String by project
|
||||
|
||||
val gCompileSdkVersion: Int by rootExtra
|
||||
val gBuildToolsVersion: String by rootExtra
|
||||
val gMinSdkVersion: String by project
|
||||
val gTargetSdkVersion: String by project
|
||||
|
||||
val gMinSdkVersion: Int by rootExtra
|
||||
val gTargetSdkVersion: Int by rootExtra
|
||||
val gVersionCode: String by project
|
||||
val gVersionName: String by project
|
||||
|
||||
val gVersionCode: Int by rootExtra
|
||||
val gVersionName: String by rootExtra
|
||||
|
||||
val gKotlinVersion: String by rootExtra
|
||||
val gKotlinCoroutineVersion: String by rootExtra
|
||||
val gKotlinSerializationVersion: String by rootExtra
|
||||
val gAndroidKtxVersion: String by rootExtra
|
||||
val gKotlinVersion: String by project
|
||||
val gKotlinCoroutineVersion: String by project
|
||||
val gKotlinSerializationVersion: String by project
|
||||
val gAndroidKtxVersion: String by project
|
||||
|
||||
val geoipOutput = buildDir.resolve("outputs/geoip")
|
||||
val golangSource = file("src/main/golang")
|
||||
@@ -38,7 +36,7 @@ android {
|
||||
minSdkVersion(gMinSdkVersion)
|
||||
targetSdkVersion(gTargetSdkVersion)
|
||||
|
||||
versionCode = gVersionCode
|
||||
versionCode = gVersionCode.toInt()
|
||||
versionName = gVersionName
|
||||
|
||||
consumerProguardFiles("consumer-rules.pro")
|
||||
@@ -52,14 +50,14 @@ android {
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
maybeCreate("release").apply {
|
||||
named("release") {
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
maybeCreate("main").apply {
|
||||
named("main") {
|
||||
assets.srcDir(geoipOutput)
|
||||
jniLibs.srcDir(golangOutput)
|
||||
}
|
||||
|
||||
+11
-9
@@ -4,7 +4,7 @@ import java.util.*
|
||||
import java.net.*
|
||||
import java.time.*
|
||||
|
||||
val gMinSdkVersion: Int by rootProject.extra
|
||||
val gMinSdkVersion: String by project
|
||||
|
||||
val geoipDatabaseUrl = "https://github.com/Dreamacro/maxmind-geoip/releases/latest/download/Country.mmdb"
|
||||
val geoipInvalidate = Duration.ofDays(7)
|
||||
@@ -41,30 +41,32 @@ fun generateGolangBuildEnvironment(abi: String): Map<String, String> {
|
||||
throw GradleScriptException("Unsupported host", FileNotFoundException("Unsupported host"))
|
||||
}
|
||||
|
||||
val minSdkVersion = gMinSdkVersion.removePrefix("android-")
|
||||
|
||||
val compilerBase = rootProject.file(ndk).resolve("toolchains/llvm/prebuilt/$host-x86_64/bin")
|
||||
|
||||
val cCompiler = when(abi) {
|
||||
"armeabi-v7a" ->
|
||||
"armv7a-linux-androideabi$gMinSdkVersion-clang"
|
||||
"armv7a-linux-androideabi$minSdkVersion-clang"
|
||||
"arm64-v8a" ->
|
||||
"aarch64-linux-android$gMinSdkVersion-clang"
|
||||
"aarch64-linux-android$minSdkVersion-clang"
|
||||
"x86" ->
|
||||
"i686-linux-android$gMinSdkVersion-clang"
|
||||
"i686-linux-android$minSdkVersion-clang"
|
||||
"x86_64" ->
|
||||
"x86_64-linux-android$gMinSdkVersion-clang"
|
||||
"x86_64-linux-android$minSdkVersion-clang"
|
||||
else ->
|
||||
throw GradleScriptException("Unsupported abi $abi", FileNotFoundException("Unsupported abi $abi"))
|
||||
}
|
||||
|
||||
val cppCompiler = when(abi) {
|
||||
"armeabi-v7a" ->
|
||||
"armv7a-linux-androideabi$gMinSdkVersion-clang++"
|
||||
"armv7a-linux-androideabi$minSdkVersion-clang++"
|
||||
"arm64-v8a" ->
|
||||
"aarch64-linux-android$gMinSdkVersion-clang++"
|
||||
"aarch64-linux-android$minSdkVersion-clang++"
|
||||
"x86" ->
|
||||
"i686-linux-android$gMinSdkVersion-clang++"
|
||||
"i686-linux-android$minSdkVersion-clang++"
|
||||
"x86_64" ->
|
||||
"x86_64-linux-android$gMinSdkVersion-clang++"
|
||||
"x86_64-linux-android$minSdkVersion-clang++"
|
||||
else ->
|
||||
throw GradleScriptException("Unsupported abi $abi", FileNotFoundException("Unsupported abi $abi"))
|
||||
}
|
||||
|
||||
+12
-14
@@ -4,21 +4,19 @@ plugins {
|
||||
id("kotlin-android-extensions")
|
||||
}
|
||||
|
||||
val rootExtra = rootProject.extra
|
||||
val gCompileSdkVersion: String by project
|
||||
val gBuildToolsVersion: String by project
|
||||
|
||||
val gCompileSdkVersion: Int by rootExtra
|
||||
val gBuildToolsVersion: String by rootExtra
|
||||
val gMinSdkVersion: String by project
|
||||
val gTargetSdkVersion: String by project
|
||||
|
||||
val gMinSdkVersion: Int by rootExtra
|
||||
val gTargetSdkVersion: Int by rootExtra
|
||||
val gVersionCode: String by project
|
||||
val gVersionName: String by project
|
||||
|
||||
val gVersionCode: Int by rootExtra
|
||||
val gVersionName: String by rootExtra
|
||||
|
||||
val gKotlinVersion: String by rootExtra
|
||||
val gAndroidKtxVersion: String by rootExtra
|
||||
val gAppCompatVersion: String by rootExtra
|
||||
val gMaterialDesignVersion: String by rootExtra
|
||||
val gKotlinVersion: String by project
|
||||
val gAndroidKtxVersion: String by project
|
||||
val gAppCompatVersion: String by project
|
||||
val gMaterialDesignVersion: String by project
|
||||
|
||||
android {
|
||||
compileSdkVersion(gCompileSdkVersion)
|
||||
@@ -28,14 +26,14 @@ android {
|
||||
minSdkVersion(gMinSdkVersion)
|
||||
targetSdkVersion(gTargetSdkVersion)
|
||||
|
||||
versionCode = gVersionCode
|
||||
versionCode = gVersionCode.toInt()
|
||||
versionName = gVersionName
|
||||
|
||||
consumerProguardFiles("consumer-rules.pro")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
maybeCreate("release").apply {
|
||||
named("release") {
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
}
|
||||
|
||||
+21
-2
@@ -19,7 +19,26 @@ android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
kotlin.code.style=official
|
||||
|
||||
kapt.incremental.apt=false
|
||||
org.gradle.parallel=true
|
||||
|
||||
org.gradle.parallel=true
|
||||
# dependencies
|
||||
gBuildToolsVersion=29.0.3
|
||||
gCompileSdkVersion=android-29
|
||||
|
||||
gMinSdkVersion=24
|
||||
gTargetSdkVersion=29
|
||||
|
||||
gVersionCode=10301
|
||||
gVersionName=1.3.1
|
||||
gKotlinVersion=1.3.72
|
||||
gKotlinCoroutineVersion=1.3.7
|
||||
gKotlinSerializationVersion=0.20.0
|
||||
gRoomVersion=2.2.5
|
||||
gAppCenterVersion=2.5.1
|
||||
gAndroidKtxVersion=1.3.0
|
||||
gRecyclerviewVersion=1.1.0
|
||||
gAppCompatVersion=1.1.0
|
||||
gMaterialDesignVersion=1.1.0
|
||||
gShizukuPreferenceVersion=4.2.0
|
||||
gMultiprocessPreferenceVersion=1.0.0
|
||||
+1
-1
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
|
||||
+14
-16
@@ -6,23 +6,21 @@ plugins {
|
||||
id("kotlinx-serialization")
|
||||
}
|
||||
|
||||
val rootExtra = rootProject.extra
|
||||
val gCompileSdkVersion: String by project
|
||||
val gBuildToolsVersion: String by project
|
||||
|
||||
val gCompileSdkVersion: Int by rootExtra
|
||||
val gBuildToolsVersion: String by rootExtra
|
||||
val gMinSdkVersion: String by project
|
||||
val gTargetSdkVersion: String by project
|
||||
|
||||
val gMinSdkVersion: Int by rootExtra
|
||||
val gTargetSdkVersion: Int by rootExtra
|
||||
val gVersionCode: String by project
|
||||
val gVersionName: String by project
|
||||
|
||||
val gVersionCode: Int by rootExtra
|
||||
val gVersionName: String by rootExtra
|
||||
|
||||
val gKotlinVersion: String by rootExtra
|
||||
val gKotlinCoroutineVersion: String by rootExtra
|
||||
val gKotlinSerializationVersion: String by rootExtra
|
||||
val gRoomVersion: String by rootExtra
|
||||
val gAndroidKtxVersion: String by rootExtra
|
||||
val gMultiprocessPreferenceVersion: String by rootExtra
|
||||
val gKotlinVersion: String by project
|
||||
val gKotlinCoroutineVersion: String by project
|
||||
val gKotlinSerializationVersion: String by project
|
||||
val gRoomVersion: String by project
|
||||
val gAndroidKtxVersion: String by project
|
||||
val gMultiprocessPreferenceVersion: String by project
|
||||
|
||||
android {
|
||||
compileSdkVersion(gCompileSdkVersion)
|
||||
@@ -32,14 +30,14 @@ android {
|
||||
minSdkVersion(gMinSdkVersion)
|
||||
targetSdkVersion(gTargetSdkVersion)
|
||||
|
||||
versionCode = gVersionCode
|
||||
versionCode = gVersionCode.toInt()
|
||||
versionName = gVersionName
|
||||
|
||||
consumerProguardFiles("consumer-rules.pro")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
maybeCreate("release").apply {
|
||||
named("release") {
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
|
||||
Reference in new issue
Block a user