PlayIntegrityFix/app/build.gradle.kts

126 lines
3.6 KiB
Plaintext
Raw Permalink Normal View History

2023-11-20 01:42:21 +02:00
plugins {
id("com.android.application")
}
android {
namespace = "es.chiteroman.playintegrityfix"
compileSdk = 34
ndkVersion = "26.1.10909125"
buildToolsVersion = "34.0.0"
defaultConfig {
applicationId = "es.chiteroman.playintegrityfix"
minSdk = 26
targetSdk = 34
2024-02-16 03:50:50 +02:00
versionCode = 15800
versionName = "v15.8"
multiDexEnabled = false
2024-01-23 05:12:52 +02:00
buildFeatures {
prefab = true
}
2024-01-23 01:18:30 +02:00
packaging {
jniLibs {
2024-01-23 05:12:52 +02:00
excludes += "**/liblog.so"
2024-01-23 01:18:30 +02:00
excludes += "**/libdobby.so"
}
}
2023-11-20 01:42:21 +02:00
externalNativeBuild {
2024-02-07 19:03:56 +02:00
cmake {
arguments += "-DANDROID_STL=none"
2024-02-16 03:50:50 +02:00
arguments += "-DCMAKE_BUILD_TYPE=Release"
2024-02-07 19:03:56 +02:00
arguments += "-DPlugin.Android.BionicLinkerUtil=ON"
2024-02-16 03:50:50 +02:00
cFlags += "-fvisibility=hidden"
cFlags += "-fvisibility-inlines-hidden"
cFlags += "-flto"
cFlags += "-O3"
cFlags += "-mllvm -polly"
2024-02-07 19:03:56 +02:00
cppFlags += "-std=c++20"
cppFlags += "-fno-exceptions"
cppFlags += "-fno-rtti"
cppFlags += "-fvisibility=hidden"
cppFlags += "-fvisibility-inlines-hidden"
2024-02-16 03:50:50 +02:00
cppFlags += "-flto"
cppFlags += "-O3"
cppFlags += "-mllvm -polly"
2023-11-20 01:42:21 +02:00
}
}
}
buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
multiDexEnabled = false
2024-02-03 16:24:43 +02:00
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
2023-11-20 01:42:21 +02:00
}
}
compileOptions {
2023-12-05 19:43:17 +02:00
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
2023-11-20 01:42:21 +02:00
}
externalNativeBuild {
2024-02-07 19:03:56 +02:00
cmake {
path = file("src/main/cpp/CMakeLists.txt")
version = "3.22.1"
2023-11-20 01:42:21 +02:00
}
}
2023-11-27 13:37:26 +02:00
}
2024-02-07 19:03:56 +02:00
dependencies {
implementation("dev.rikka.ndk.thirdparty:cxx:1.2.0")
}
2024-01-04 23:01:38 +02: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 15:18:58 +02:00
tasks.register("copyFiles") {
2024-01-04 23:01:38 +02:00
dependsOn("updateModuleProp")
2023-11-27 18:25:34 +02:00
doLast {
val moduleFolder = project.rootDir.resolve("module")
2024-02-03 16:24:43 +02: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 13:37:26 +02:00
2023-11-27 18:25:34 +02:00
dexFile.copyTo(moduleFolder.resolve("classes.dex"), overwrite = true)
2023-11-27 13:37:26 +02:00
2023-11-27 18:25:34 +02: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 13:37:26 +02:00
}
}
2023-11-27 15:18:58 +02:00
tasks.register<Zip>("zip") {
2023-11-27 18:25:34 +02:00
dependsOn("copyFiles")
2024-01-04 23:01:38 +02:00
archiveFileName.set("PlayIntegrityFix_${project.android.defaultConfig.versionName}.zip")
2023-11-27 13:37:26 +02:00
destinationDirectory.set(project.rootDir.resolve("out"))
from(project.rootDir.resolve("module"))
2023-11-27 15:18:58 +02:00
}
afterEvaluate {
2024-01-04 23:01:38 +02:00
tasks["assembleRelease"].finalizedBy("updateModuleProp", "copyFiles", "zip")
2024-02-03 16:24:43 +02:00
}