PlayIntegrityFix/app/build.gradle.kts

99 lines
2.7 KiB
Plaintext
Raw Normal View History

2023-11-20 07:42:21 +08:00
plugins {
id("com.android.application")
}
android {
namespace = "es.chiteroman.playintegrityfix"
compileSdk = 34
ndkVersion = "26.1.10909125"
buildToolsVersion = "34.0.0"
2023-12-01 01:28:01 +08:00
packaging {
jniLibs {
2024-01-05 05:01:38 +08:00
excludes += "**/liblog.so"
2023-12-01 01:28:01 +08:00
excludes += "**/libdobby.so"
}
}
2023-11-20 07:42:21 +08:00
defaultConfig {
applicationId = "es.chiteroman.playintegrityfix"
minSdk = 26
targetSdk = 34
2024-01-05 05:01:38 +08:00
versionCode = 15200
versionName = "v15.2"
2023-11-20 07:42:21 +08:00
externalNativeBuild {
2024-01-12 20:32:32 +08:00
ndk {
jobs = Runtime.getRuntime().availableProcessors()
2023-11-20 07:42:21 +08:00
}
}
}
buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
2023-12-28 19:57:03 +08:00
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
2023-11-20 07:42:21 +08:00
}
}
compileOptions {
2023-12-06 01:43:17 +08:00
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
2023-11-20 07:42:21 +08:00
}
externalNativeBuild {
2024-01-12 20:32:32 +08:00
ndkBuild {
path = file("src/main/cpp/Android.mk")
2023-11-20 07:42:21 +08:00
}
}
2023-11-27 19:37:26 +08:00
}
2024-01-05 05:01:38 +08:00
tasks.register("updateModuleProp") {
doLast {
val versionName = project.android.defaultConfig.versionName
val versionCode = project.android.defaultConfig.versionCode
val modulePropFile = project.rootDir.resolve("module/module.prop")
var content = modulePropFile.readText()
content = content.replace(Regex("version=.*"), "version=$versionName")
content = content.replace(Regex("versionCode=.*"), "versionCode=$versionCode")
modulePropFile.writeText(content)
}
}
2023-11-27 21:18:58 +08:00
tasks.register("copyFiles") {
2024-01-05 05:01:38 +08:00
dependsOn("updateModuleProp")
2023-11-28 00:25:34 +08:00
doLast {
val moduleFolder = project.rootDir.resolve("module")
2023-12-28 19:57:03 +08:00
val dexFile = project.layout.buildDirectory.get().asFile.resolve("intermediates/dex/release/minifyReleaseWithR8/classes.dex")
val soDir = project.layout.buildDirectory.get().asFile.resolve("intermediates/stripped_native_libs/release/out/lib")
2023-11-27 19:37:26 +08:00
2023-11-28 00:25:34 +08:00
dexFile.copyTo(moduleFolder.resolve("classes.dex"), overwrite = true)
2023-11-27 19:37:26 +08:00
2023-11-28 00:25:34 +08:00
soDir.walk().filter { it.isFile && it.extension == "so" }.forEach { soFile ->
val abiFolder = soFile.parentFile.name
val destination = moduleFolder.resolve("zygisk/$abiFolder.so")
soFile.copyTo(destination, overwrite = true)
}
2023-11-27 19:37:26 +08:00
}
}
2023-11-27 21:18:58 +08:00
tasks.register<Zip>("zip") {
2023-11-28 00:25:34 +08:00
dependsOn("copyFiles")
2024-01-05 05:01:38 +08:00
archiveFileName.set("PlayIntegrityFix_${project.android.defaultConfig.versionName}.zip")
2023-11-27 19:37:26 +08:00
destinationDirectory.set(project.rootDir.resolve("out"))
from(project.rootDir.resolve("module"))
2023-11-27 21:18:58 +08:00
}
afterEvaluate {
2024-01-05 05:01:38 +08:00
tasks["assembleRelease"].finalizedBy("updateModuleProp", "copyFiles", "zip")
2023-12-06 01:43:17 +08:00
}