@file:Suppress("UNUSED_VARIABLE") import com.android.build.gradle.BaseExtension import java.net.URL import java.util.* buildscript { repositories { mavenCentral() maven("https://raw.githubusercontent.com/MetaCubeX/maven-backup/main/releases") maven("https://maven.aliyun.com/repository/public/") maven("https://maven.aliyun.com/repository/google/") maven("https://maven.aliyun.com/repository/jcenter/") maven("https://maven.aliyun.com/repository/central/") // JitPack 远程仓库 maven("https://jitpack.io") maven("https://developer.huawei.com/repo") maven("https://developer.hihonor.com/repo") } dependencies { classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0") classpath(libs.build.android) classpath(libs.build.kotlin.common) classpath(libs.build.kotlin.serialization) classpath(libs.build.ksp) classpath(libs.build.golang) } } subprojects { repositories { mavenCentral() google() maven("https://raw.githubusercontent.com/MetaCubeX/maven-backup/main/releases") maven("https://maven.aliyun.com/repository/public/") maven("https://maven.aliyun.com/repository/google/") maven("https://maven.aliyun.com/repository/jcenter/") maven("https://maven.aliyun.com/repository/central/") // JitPack 远程仓库 maven("https://jitpack.io") maven("https://developer.huawei.com/repo") maven("https://developer.hihonor.com/repo") } val isApp = name == "app" apply(plugin = if (isApp) "com.android.application" else "com.android.library") extensions.configure { defaultConfig { if (isApp) { applicationId = "com.jsq.wufu" namespace = "com.yingmao.clash" } minSdk = 23 targetSdk = 34 versionName = "1.0.5.5" versionCode = 1055 resValue("string", "release_name", "v$versionName") resValue("integer", "release_code", "$versionCode") externalNativeBuild { cmake { abiFilters("arm64-v8a", "armeabi-v7a") } } if (!isApp) { consumerProguardFiles("consumer-rules.pro") } else { setProperty("archivesBaseName", "$versionName") } } ndkVersion = "23.0.7599858" compileSdkVersion(defaultConfig.targetSdk!!) if (isApp) { packagingOptions { resources { excludes.add("DebugProbesKt.bin") } } } productFlavors { flavorDimensions("feature") create("8888") { isDefault = true dimension = flavorDimensionList[0] buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"false\")") buildConfigField("boolean", "is_free", "false") buildConfigField("boolean", "is_back_cn", "false") buildConfigField("String", "applicationId", "\"com.jsq.wufu\"") buildConfigField("String", "service_url", "\"https://api.yijianlianjsq.com/\"") buildConfigField("String", "productId", "\"8888\"") manifestPlaceholders( mapOf( "APP_NAME" to "@string/wf", "APP_ICON" to "@mipmap/oneclickconnection" ) ) } } sourceSets { getByName("8888") { java.srcDirs("src/foss/java") } } signingConfigs { val keystore = rootProject.file("signing.properties") if (keystore.exists()) { print("keystore exists! ") create("release") { val prop = Properties().apply { keystore.inputStream().use(this::load) } storeFile = rootProject.file("orange_cat.jks") storePassword = prop.getProperty("keystore.password")!! keyAlias = prop.getProperty("key.alias")!! keyPassword = prop.getProperty("key.password")!! } } else { print("keystore not exists") } } buildTypes { named("release") { versionNameSuffix = ".release" isMinifyEnabled = isApp isShrinkResources = isApp signingConfig = signingConfigs.findByName("release") proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) } named("debug") { signingConfig = signingConfigs.findByName("release") versionNameSuffix = ".debug" } } } } 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") } }