From d3c6e3606393dcd68c879341eb0f9dc89f824a63 Mon Sep 17 00:00:00 2001 From: chiteroman Date: Wed, 4 Sep 2024 01:17:31 +0200 Subject: [PATCH] Drop emulator support Integrity won't pass so it's useless to compile these libs --- app/build.gradle.kts | 269 ++++++++++++++++++++++--------------------- 1 file changed, 138 insertions(+), 131 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index df952357..d820bce1 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,131 +1,138 @@ -plugins { - alias(libs.plugins.android.application) -} - -android { - namespace = "es.chiteroman.playintegrityfix" - compileSdk = 35 - buildToolsVersion = "35.0.0" - ndkVersion = "27.0.12077973" - - buildFeatures { - prefab = true - } - - packaging { - resources { - excludes += "**" - } - jniLibs { - excludes += "**/libdobby.so" - } - } - - defaultConfig { - applicationId = "es.chiteroman.playintegrityfix" - minSdk = 26 - targetSdk = 35 - versionCode = 17300 - versionName = "v17.3" - multiDexEnabled = false - - externalNativeBuild { - cmake { - arguments( - "-DCMAKE_BUILD_TYPE=MinSizeRel", - "-DANDROID_STL=none", - "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON" - ) - - cFlags( - "-std=c23", "-fvisibility=hidden", "-fvisibility-inlines-hidden" - ) - - cppFlags( - "-std=c++23", - "-fno-exceptions", - "-fno-rtti", - "-fvisibility=hidden", - "-fvisibility-inlines-hidden" - ) - } - } - } - - buildTypes { - release { - isMinifyEnabled = true - isShrinkResources = true - multiDexEnabled = false - proguardFiles( - getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" - ) - } - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - externalNativeBuild { - cmake { - path = file("src/main/cpp/CMakeLists.txt") - version = "3.22.1" - } - } -} - -dependencies { - implementation(libs.cxx) - implementation(libs.hiddenapibypass) -} - -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) - } -} - -tasks.register("copyFiles") { - dependsOn("updateModuleProp") - - doLast { - val moduleFolder = project.rootDir.resolve("module") - 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") - - dexFile.copyTo(moduleFolder.resolve("classes.dex"), overwrite = true) - - 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) - } - } -} - -tasks.register("zip") { - dependsOn("copyFiles") - - archiveFileName.set("PlayIntegrityFix_${project.android.defaultConfig.versionName}.zip") - destinationDirectory.set(project.rootDir.resolve("out")) - - from(project.rootDir.resolve("module")) -} - -afterEvaluate { - tasks["assembleRelease"].finalizedBy("updateModuleProp", "copyFiles", "zip") -} +plugins { + alias(libs.plugins.android.application) +} + +android { + namespace = "es.chiteroman.playintegrityfix" + compileSdk = 35 + buildToolsVersion = "35.0.0" + ndkVersion = "27.0.12077973" + + buildFeatures { + prefab = true + } + + packaging { + resources { + excludes += "**" + } + jniLibs { + excludes += "**/libdobby.so" + } + } + + defaultConfig { + applicationId = "es.chiteroman.playintegrityfix" + minSdk = 26 + targetSdk = 35 + versionCode = 17300 + versionName = "v17.3" + multiDexEnabled = false + + externalNativeBuild { + cmake { + abiFilters( + "arm64-v8a", + "armeabi-v7a" + ) + + arguments( + "-DCMAKE_BUILD_TYPE=MinSizeRel", + "-DANDROID_STL=none", + "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON" + ) + + cFlags( + "-std=c23", + "-fvisibility=hidden", + "-fvisibility-inlines-hidden" + ) + + cppFlags( + "-std=c++23", + "-fno-exceptions", + "-fno-rtti", + "-fvisibility=hidden", + "-fvisibility-inlines-hidden" + ) + } + } + } + + buildTypes { + release { + isMinifyEnabled = true + isShrinkResources = true + multiDexEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" + ) + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + externalNativeBuild { + cmake { + path = file("src/main/cpp/CMakeLists.txt") + version = "3.22.1" + } + } +} + +dependencies { + implementation(libs.cxx) + implementation(libs.hiddenapibypass) +} + +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) + } +} + +tasks.register("copyFiles") { + dependsOn("updateModuleProp") + + doLast { + val moduleFolder = project.rootDir.resolve("module") + 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") + + dexFile.copyTo(moduleFolder.resolve("classes.dex"), overwrite = true) + + 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) + } + } +} + +tasks.register("zip") { + dependsOn("copyFiles") + + archiveFileName.set("PlayIntegrityFix_${project.android.defaultConfig.versionName}.zip") + destinationDirectory.set(project.rootDir.resolve("out")) + + from(project.rootDir.resolve("module")) +} + +afterEvaluate { + tasks["assembleRelease"].finalizedBy("updateModuleProp", "copyFiles", "zip") +}