import org.gradle.internal.os.OperatingSystem apply plugin: 'com.android.library' version "v0.4.1.2_beta" ext { versionCode = "4120" module_name = "EdXposed" jar_dest_dir = "${projectDir}/template_override/system/framework/" is_windows = OperatingSystem.current().isWindows() backends = ["YAHFA", "SandHook", "Whale"] yahfa_authors = "solohsu, rk700 & MlgmXyysd" sandhook_authors = "solohsu, ganyao114 & MlgmXyysd" whale_authors = "solohsu, asLody & MlgmXyysd" } android { compileSdkVersion 28 defaultConfig { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion externalNativeBuild { ndkBuild { abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64' arguments "NDK_PROJECT_PATH=jni/" } } } externalNativeBuild { ndkBuild { path 'jni/Android.mk' } } } task copyDalvikdxJar { def jarTask = tasks.getByPath(':dalvikdx:dexInJar') dependsOn jarTask doLast { copy { from jarTask into jar_dest_dir } } onlyIf { !jarTask.state.upToDate || !file(jar_dest_dir + jarTask.archiveName).exists() } } task copyDexmakerJar { def jarTask = tasks.getByPath(':dexmaker:dexInJar') dependsOn jarTask doLast { copy { from jarTask into jar_dest_dir } } onlyIf { !jarTask.state.upToDate || !file(jar_dest_dir + jarTask.archiveName).exists() } } task cleanTemplate(type: Delete) { delete file(templateSystemPath), file(templateSystemx86Path) } afterEvaluate { android.libraryVariants.all { variant -> def variantCapped = variant.name.capitalize() def variantLowered = variant.name.toLowerCase() backends.each { backend -> def backendLowered = backend.toLowerCase() def backendCapped = backendLowered.capitalize() def authorList = property("${backendLowered}" + "_authors") def zipTask = task("zip${backendCapped}${variantCapped}", type: Exec) { dependsOn cleanTemplate, copyDalvikdxJar, copyDexmakerJar dependsOn tasks.getByPath(":edxp-${backendLowered}:makeAndCopy${variantCapped}") workingDir '..' commandLine 'sh', 'build.sh', project.name, "${backend}-${project.version}-${variantLowered}", "${module_name}" doFirst { copy { from "${projectDir}/tpl/edconfig.tpl" into templateFrameworkPath rename "edconfig.tpl", "edconfig.jar" expand(version: "$version", backend: "$backend") } copy { from "${projectDir}/tpl/module.prop.tpl" into templateRootPath rename "module.prop.tpl", "module.prop" expand(backend: "$backendCapped", versionName: "$version" + "($backend)", versionCode: "$versionCode", authorList: "$authorList") } copy { from "${templateRootPath}/module.prop" into templateRootPath rename "module.prop", "riru_module.prop" } } } task("push${backendCapped}${variantCapped}", type: Exec) { dependsOn zipTask workingDir "${projectDir}/release" def commands = ["adb", "push", "magisk-${module_name}-${backend}-${project.version}-${variantLowered}.zip", "/sdcard/"] if (is_windows) { commandLine 'cmd', '/c', commands.join(" ") } else { commandLine commands } } } // backward compatible task("zip${variantCapped}") { dependsOn "zipYahfa${variantCapped}" } task("push${variantCapped}") { dependsOn "pushYahfa${variantCapped}" } } }