ClashMetaForAndroid/build.gradle.kts

176 lines
4.6 KiB
Plaintext
Raw Normal View History

2021-05-14 19:51:08 +03:00
@file:Suppress("UNUSED_VARIABLE")
2021-09-17 06:19:03 +03:00
import com.android.build.gradle.AppExtension
import com.android.build.gradle.BaseExtension
import java.net.URL
2021-09-11 20:33:52 +03:00
import java.util.*
buildscript {
repositories {
mavenCentral()
google()
maven("https://maven.kr328.app/releases")
}
dependencies {
2022-03-22 08:48:02 +03:00
classpath(libs.build.android)
classpath(libs.build.kotlin.common)
classpath(libs.build.kotlin.serialization)
classpath(libs.build.ksp)
classpath(libs.build.golang)
}
}
2022-03-22 08:48:02 +03:00
subprojects {
2021-05-14 19:51:08 +03:00
repositories {
mavenCentral()
2021-09-12 06:04:26 +03:00
google()
maven("https://maven.kr328.app/releases")
}
val isApp = name == "app"
apply(plugin = if (isApp) "com.android.application" else "com.android.library")
extensions.configure<BaseExtension> {
defaultConfig {
if (isApp) {
2022-06-28 12:23:53 +03:00
applicationId = "com.github.metacubex.clash"
}
2022-01-14 18:20:01 +03:00
minSdk = 21
targetSdk = 31
Update Meta Core to v1.16.0 and add actions to help maintain the project (#147) * add: Create dependabot.yml * chore: Create update-dependencies.yml * chore: Update update-dependencies.yml * fix: switch meta core upstream * chore: Update update-dependencies.yml * chore: Update update-dependencies.yml * chore: Update update-dependencies.yml * chore: Update build-unsigned.yaml * chore: Delete .github/dependabot.yml * chore: Run build-unsigned for each PR * chore: Better PR info and add repo dispatch listener * chore: Better actions name * chore: rename ci file and try to fix failure * chore: add manual auto project version bump * chore: Fix wrong command usage * chore: fix path * chore: Fix * chore: Fix bump project version * chore: can this pass compile? * chore: update core to newest alpha * Update update-dependencies.yaml * chore: try to change core upstream * chore: remove all go get update to pass compile * Revert "chore: remove all go get update to pass compile" This reverts commit aad0ec3b83b51062c877f0487cb55f4ae7c3e617. * Revert "chore: can this pass compile?" This reverts commit 635289639b199d28d3d865849e5e7b7595f51522. * chore: force update submodule * chore: change upstream to alpha * chore: remove rubbish * chore: change upstream and update core * chore: add version fixed packages * chore: small fix * chore: update go dependencies * chore: revert some depends to old versions to fix compile * fix: fix compile error caused by core's deprecation * chore: fix actions and update core * chore: update clash core * fix: fix block calling * chore: update app version * chore: small fix to actions * feat: add Hysteria2 for UI * chore: revert version update for actions test * chore: try recover main go mod upgrade * chore: fix tag logic in release actions * Bump version to 2.8.10 (208010) * chore: remove test code in actions --------- Co-authored-by: GitHub Action <action@github.com>
2023-10-22 10:57:35 +03:00
versionName = "2.8.10"
versionCode = 208010
2022-01-14 18:20:01 +03:00
resValue("string", "release_name", "v$versionName")
resValue("integer", "release_code", "$versionCode")
externalNativeBuild {
cmake {
abiFilters("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
}
}
2021-09-12 08:01:08 +03:00
if (!isApp) {
consumerProguardFiles("consumer-rules.pro")
2021-09-17 06:19:03 +03:00
} else {
2022-06-16 10:24:43 +03:00
setProperty("archivesBaseName", "cmfa-$versionName")
2021-09-12 08:01:08 +03:00
}
}
2022-01-14 18:20:01 +03:00
ndkVersion = "23.0.7599858"
compileSdkVersion(defaultConfig.targetSdk!!)
if (isApp) {
packagingOptions {
resources {
excludes.add("DebugProbesKt.bin")
}
}
}
productFlavors {
2022-01-14 18:20:01 +03:00
flavorDimensions("feature")
2022-06-16 10:24:43 +03:00
create("meta-alpha") {
2021-11-14 14:45:33 +03:00
isDefault = true
2022-01-14 18:20:01 +03:00
dimension = flavorDimensionList[0]
2022-06-16 10:24:43 +03:00
versionNameSuffix = ".Meta-Alpha"
2022-06-22 14:37:13 +03:00
buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"false\")")
2021-09-12 08:01:08 +03:00
if (isApp) {
2022-06-28 12:23:53 +03:00
applicationIdSuffix = ".meta"
}
}
2023-05-10 13:10:50 +03:00
create("meta") {
dimension = flavorDimensionList[0]
versionNameSuffix = ".Meta"
buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"false\")")
if (isApp) {
applicationIdSuffix = ".meta"
}
}
2022-06-07 10:19:53 +03:00
}
2021-09-11 20:33:52 +03:00
2022-06-07 10:19:53 +03:00
sourceSets {
2023-05-10 13:10:50 +03:00
getByName("meta") {
java.srcDirs("src/foss/java")
}
2022-06-16 10:24:43 +03:00
getByName("meta-alpha") {
2022-06-07 10:19:53 +03:00
java.srcDirs("src/foss/java")
}
}
2021-09-12 08:19:40 +03:00
signingConfigs {
val keystore = rootProject.file("signing.properties")
if (keystore.exists()) {
create("release") {
val prop = Properties().apply {
keystore.inputStream().use(this::load)
}
2022-06-18 05:49:00 +03:00
storeFile = rootProject.file("release.keystore")
2021-09-12 08:19:40 +03:00
storePassword = prop.getProperty("keystore.password")!!
keyAlias = prop.getProperty("key.alias")!!
keyPassword = prop.getProperty("key.password")!!
}
}
}
buildTypes {
named("release") {
isMinifyEnabled = isApp
isShrinkResources = isApp
signingConfig = signingConfigs.findByName("release")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
named("debug") {
versionNameSuffix = ".debug"
}
}
buildFeatures.apply {
dataBinding {
isEnabled = name != "hideapi"
}
}
if (isApp) {
2021-09-17 06:19:03 +03:00
this as AppExtension
splits {
abi {
isEnable = true
isUniversalApk = true
}
}
}
2021-05-14 19:51:08 +03:00
}
}
task("clean", type = Delete::class) {
delete(rootProject.buildDir)
}
tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
doLast {
val sha256 = URL("$distributionUrl.sha256").openStream()
.use { it.reader().readText().trim() }
file("gradle/wrapper/gradle-wrapper.properties")
.appendText("distributionSha256Sum=$sha256")
}
2022-06-16 10:24:43 +03:00
}