PlayIntegrityFix/app/build.gradle.kts

125 lines
3.5 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
2024-04-23 22:32:22 +08:00
ndkVersion = "26.3.11579264"
2023-11-20 07:42:21 +08:00
buildToolsVersion = "34.0.0"
2024-04-23 22:32:22 +08:00
buildFeatures {
prefab = true
}
2023-11-20 07:42:21 +08:00
defaultConfig {
applicationId = "es.chiteroman.playintegrityfix"
minSdk = 26
targetSdk = 34
2024-06-27 08:07:05 +08:00
versionCode = 16400
versionName = "v16.4"
multiDexEnabled = false
2024-01-23 11:12:52 +08:00
2024-01-23 07:18:30 +08:00
packaging {
2024-06-27 08:07:05 +08:00
resources {
excludes += "META-INF/**"
}
2024-01-23 07:18:30 +08:00
jniLibs {
2024-01-23 11:12:52 +08:00
excludes += "**/liblog.so"
2024-01-23 07:18:30 +08:00
excludes += "**/libdobby.so"
}
}
2023-11-20 07:42:21 +08:00
externalNativeBuild {
2024-02-08 01:03:56 +08:00
cmake {
2024-03-18 07:34:07 +08:00
arguments += "-DANDROID_STL=none"
arguments += "-DCMAKE_BUILD_TYPE=MinSizeRel"
2024-03-06 23:30:03 +08:00
arguments += "-DPlugin.Android.BionicLinkerUtil=ON"
2024-02-16 09:50:50 +08:00
2024-06-27 08:07:05 +08:00
cppFlags += "-std=c++2b"
2024-02-08 01:03:56 +08:00
cppFlags += "-fno-exceptions"
cppFlags += "-fno-rtti"
cppFlags += "-fvisibility=hidden"
cppFlags += "-fvisibility-inlines-hidden"
2023-11-20 07:42:21 +08:00
}
}
}
buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
multiDexEnabled = false
2024-06-27 08:07:05 +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-02-08 01:03:56 +08:00
cmake {
path = file("src/main/cpp/CMakeLists.txt")
version = "3.22.1"
2023-11-20 07:42:21 +08:00
}
}
2023-11-27 19:37:26 +08:00
}
2024-03-18 07:34:07 +08:00
dependencies {
implementation("dev.rikka.ndk.thirdparty:cxx:1.2.0")
2024-06-20 00:40:03 +08:00
implementation("com.madgag.spongycastle:bcpkix-jdk15on:1.58.0.0")
2024-03-18 07:34:07 +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")
2024-06-27 08:07:05 +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/stripReleaseDebugSymbols/out/lib")
2023-11-27 19:37:26 +08:00
2024-06-21 05:59:48 +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")
2024-02-03 22:24:43 +08:00
}