diff --git a/build.gradle b/build.gradle index 48da868c..ddd888e9 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ allprojects { templateLibPath = templateRootPath + "/system/lib/" templateLib64Path = templateRootPath + "/system/lib64/" templateEtcPath = templateRootPath + "/system/etc/" - hiddenApiStubJarFilePath = project(":hiddenapi-stubs").projectDir.absolutePath + "/libs/framework-stub.jar" + hiddenApiStubJarFilePath = project(":hiddenapi-stubs").buildDir.absolutePath + "/libs/framework-stub.jar" } repositories { google() diff --git a/dalvikdx/build.gradle b/dalvikdx/build.gradle index a8b47c1e..a1d358bc 100644 --- a/dalvikdx/build.gradle +++ b/dalvikdx/build.gradle @@ -1,57 +1,33 @@ -import org.gradle.internal.os.OperatingSystem -apply plugin: 'java-library' +apply plugin: 'com.android.application' -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) +repositories { + jcenter() } -sourceCompatibility = "7" -targetCompatibility = "7" +android { + compileSdkVersion androidCompileSdkVersion.toInteger() + ndkVersion androidCompileNdkVersion +} -task findDx { - if (OperatingSystem.current().isWindows()){ - return true - } - doLast { - new ByteArrayOutputStream().withStream { os -> - exec { - commandLine "which", "dx" - standardOutput os +afterEvaluate { + android.applicationVariants.all { variant -> + def variantNameCapped = variant.name.capitalize() + def variantNameLowered = variant.name.toLowerCase() + + task("copyDex${variantNameCapped}", type: Copy) { + dependsOn "assemble${variantNameCapped}" + def dexOutPath = "${buildDir}/intermediates/dex/${variantNameLowered}/mergeDex${variantNameCapped}" + from (dexOutPath){ + rename("classes.dex", "eddalvikdx.dex") } - rootProject.ext.dxPath = os.toString() + destinationDir file(templateRootPath + "system/framework/") + outputs.upToDateWhen { false } + } + task("makeJar${variantNameCapped}", type: Jar, dependsOn: "assemble${variantNameCapped}") { + dependsOn "assemble${variantNameCapped}" + from "${buildDir}/intermediates/javac/${variantNameLowered}/classes" + baseName "dalvikdx" + outputs.file(archivePath) } } } - -task makeDex(type: Exec) { - dependsOn jar - dependsOn findDx - def dexName = "classes.dex" - workingDir jar.destinationDir - if (OperatingSystem.current().isWindows()) { - executable "dx.bat" - args "--dex", "--output", dexName, "${jar.archiveName}" - } else { - executable "bash" - args rootProject.ext.dxPath.trim(), "--dex", "--output", dexName, "${jar.archiveName}" - } -} - -task dex(type: Copy) { - dependsOn makeDex - from (jar.destinationDir) { - include "classes.dex" - rename "classes.dex", "eddalvikdx.dex" - } - destinationDir new File(projectDir, "dex") -} - -task dexInJar(type: Jar) { - dependsOn makeDex - from "${jar.destinationDir}/classes.dex" - destinationDir jar.destinationDir - baseName "eddalvikdx" - onlyIf { - !jar.state.upToDate || !file(archiveName).exists() - } -} \ No newline at end of file diff --git a/dalvikdx/src/main/AndroidManifest.xml b/dalvikdx/src/main/AndroidManifest.xml new file mode 100644 index 00000000..7474421e --- /dev/null +++ b/dalvikdx/src/main/AndroidManifest.xml @@ -0,0 +1 @@ + diff --git a/dexmaker/build.gradle b/dexmaker/build.gradle index 7e615282..a3a6cc1b 100644 --- a/dexmaker/build.gradle +++ b/dexmaker/build.gradle @@ -1,47 +1,39 @@ -import org.gradle.internal.os.OperatingSystem -apply plugin: 'java' +apply plugin: 'com.android.application' description = "A utility for doing compile or runtime code generation targeting Android's Dalvik VM" -targetCompatibility = '1.7' -sourceCompatibility = '1.7' - repositories { jcenter() } +android { + compileSdkVersion androidCompileSdkVersion.toInteger() + ndkVersion androidCompileNdkVersion +} + dependencies { - compileOnly project(':dalvikdx') + compileOnly files(project(":dalvikdx").tasks.getByName("makeJarRelease").outputs) } -task makeDex(type: Exec) { - dependsOn jar - def dexName = "classes.dex" - workingDir jar.destinationDir - if (OperatingSystem.current().isWindows()) { - executable "dx.bat" - args "--dex", "--output", dexName, "${jar.archiveName}" - } else { - executable "bash" - args rootProject.ext.dxPath.trim(), "--dex", "--output", dexName, "${jar.archiveName}" - } -} +afterEvaluate { + android.applicationVariants.all { variant -> + def variantNameCapped = variant.name.capitalize() + def variantNameLowered = variant.name.toLowerCase() -task dex(type: Copy) { - dependsOn makeDex - from (jar.destinationDir) { - include "classes.dex" - rename "classes.dex", "eddexmaker.dex" + task("copyDex${variantNameCapped}", type: Copy) { + dependsOn "assemble${variantNameCapped}" + def dexOutPath = "${buildDir}/intermediates/dex/${variantNameLowered}/mergeDex${variantNameCapped}" + from (dexOutPath){ + rename("classes.dex", "eddexmaker.dex") + } + destinationDir file(templateRootPath + "system/framework/") + outputs.upToDateWhen { false } + } + task("makeJar${variantNameCapped}", type: Jar, dependsOn: "assemble${variantNameCapped}") { + dependsOn "assemble${variantNameCapped}" + from "${buildDir}/intermediates/javac/${variantNameLowered}/classes" + baseName "dexmaker" + outputs.file(archivePath) + } } - destinationDir new File(projectDir, "dex") -} - -task dexInJar(type: Jar) { - dependsOn makeDex - from "${jar.destinationDir}/classes.dex" - destinationDir jar.destinationDir - baseName "eddexmaker" - onlyIf { - !jar.state.upToDate || !file(archiveName).exists() - } -} +} \ No newline at end of file diff --git a/dexmaker/src/main/AndroidManifest.xml b/dexmaker/src/main/AndroidManifest.xml new file mode 100644 index 00000000..419831dd --- /dev/null +++ b/dexmaker/src/main/AndroidManifest.xml @@ -0,0 +1 @@ + diff --git a/edxp-core/build.gradle b/edxp-core/build.gradle index 4afa17d1..e80bd37d 100644 --- a/edxp-core/build.gradle +++ b/edxp-core/build.gradle @@ -4,7 +4,7 @@ import org.gradle.internal.os.OperatingSystem apply plugin: 'com.android.library' // Values set here will be overriden by AppVeyor, feel free to modify during development. -def buildVersionName = 'v0.5.0.6' +def buildVersionName = 'v0.5.0.8' def buildVersionCode = 233 if (System.env.APPVEYOR_BUILD_VERSION != null) { @@ -49,8 +49,8 @@ android { externalNativeBuild { cmake { abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64' - cppFlags "-std=c++17 -ffixed-x18 -Qunused-arguments -frtti" - cFlags "-std=gnu99 -ffixed-x18 -Qunused-arguments -frtti" + cppFlags "-std=c++17 -ffixed-x18 -Qunused-arguments -frtti -fomit-frame-pointer" + cFlags "-std=gnu99 -ffixed-x18 -Qunused-arguments -frtti -fomit-frame-pointer" arguments "-DRIRU_MODULE_API_VERSION=$moduleMaxRiruApiVersion", "-DRIRU_MODULE_VERSION=$buildVersionCode", "-DRIRU_MODULE_VERSION_NAME:STRING=\"$buildVersionName\"" @@ -86,62 +86,6 @@ android { ndkVersion androidCompileNdkVersion } -task copyDalvikdxDex { - def dexTask = tasks.getByPath(':dalvikdx:dex') - dependsOn dexTask - doLast { - copy { - from dexTask - into jar_dest_dir - } - } - onlyIf { - !dexTask.state.upToDate - } -} - -task copyDexmakerDex { - def dexTask = tasks.getByPath(':dexmaker:dex') - dependsOn dexTask - doLast { - copy { - from dexTask - into jar_dest_dir - } - } - onlyIf { - !dexTask.state.upToDate - } -} - -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(templateSystemx86Path) } @@ -161,7 +105,9 @@ afterEvaluate { def magiskModuleId = property("${backendLowered}" + "_module_id") def prepareJarsTask = task("prepareJars${backendCapped}${variantCapped}") { - dependsOn cleanTemplate, copyDalvikdxDex, copyDexmakerDex + dependsOn cleanTemplate + dependsOn tasks.getByPath(":dexmaker:copyDex${variantCapped}") + dependsOn tasks.getByPath(":dalvikdx:copyDex${variantCapped}") dependsOn tasks.getByPath(":edxp-${backendLowered}:copyDex${variantCapped}") } diff --git a/edxp-sandhook/build.gradle b/edxp-sandhook/build.gradle index 01a8fc9b..09a22a55 100644 --- a/edxp-sandhook/build.gradle +++ b/edxp-sandhook/build.gradle @@ -29,7 +29,7 @@ dependencies { compileOnly project(':hiddenapi-stubs') implementation project(':edxp-common') implementation 'com.swift.sandhook:hooklib:4.2.1' - compileOnly project(':dexmaker') + compileOnly files(project(":dexmaker").tasks.getByName("makeJarRelease").outputs) } @@ -58,8 +58,6 @@ afterEvaluate { def variantNameCapped = variant.name.capitalize() def variantNameLowered = variant.name.toLowerCase() - def myTemplatePath = "${projectDir}/template_override/" - task("copyDex${variantNameCapped}", type: Copy) { dependsOn "assemble${variantNameCapped}" dependsOn tasks.getByPath(":edxp-common:copyCommonProperties") @@ -68,32 +66,9 @@ afterEvaluate { rename("classes.dex", "edxp.dex") } from "${projectDir}/src/main/resources/" - destinationDir file(myTemplatePath + "system/framework/") - doLast { - copy { - from file(myTemplatePath) - into file(templateRootPath) - } - } - } - - task("makeAndCopy${variantNameCapped}", type: Jar, dependsOn: "assemble${variantNameCapped}") { - dependsOn tasks.getByPath(":edxp-common:copyCommonProperties") - def dexOutPath = "${buildDir}/intermediates/dex/${variantNameLowered}/mergeDex${variantNameCapped}" - from (dexOutPath){ - rename("classes.dex", "edxp.dex") - } - from "${projectDir}/src/main/resources/" - destinationDir file(myTemplatePath + "system/framework/") - baseName "edxp" - doLast { - copy { - from file(myTemplatePath) - into file(templateRootPath) - include "*.dex" - } - } + destinationDir file(templateRootPath + "system/framework/") outputs.upToDateWhen { false } } + } } \ No newline at end of file diff --git a/edxp-whale/build.gradle b/edxp-whale/build.gradle index ed706ecf..649fec74 100644 --- a/edxp-whale/build.gradle +++ b/edxp-whale/build.gradle @@ -28,7 +28,7 @@ android { dependencies { compileOnly project(':hiddenapi-stubs') implementation project(':edxp-common') - compileOnly project(':dexmaker') + compileOnly files(project(":dexmaker").tasks.getByName("makeJarRelease").outputs) } @@ -57,8 +57,6 @@ afterEvaluate { def variantNameCapped = variant.name.capitalize() def variantNameLowered = variant.name.toLowerCase() - def myTemplatePath = "${projectDir}/template_override/" - task("copyDex${variantNameCapped}", type: Copy) { dependsOn "assemble${variantNameCapped}" dependsOn tasks.getByPath(":edxp-common:copyCommonProperties") @@ -67,30 +65,7 @@ afterEvaluate { rename("classes.dex", "edxp.dex") } from "${projectDir}/src/main/resources/" - destinationDir file(myTemplatePath + "system/framework/") - doLast { - copy { - from file(myTemplatePath) - into file(templateRootPath) - include "*.dex" - } - } - } - - task("makeAndCopy${variantNameCapped}", type: Jar, dependsOn: "assemble${variantNameCapped}") { - dependsOn tasks.getByPath(":edxp-common:copyCommonProperties") - def dexOutPath = variant.name.contains("release") ? - "${buildDir}/intermediates/transforms/dexMerger/${variantNameLowered}/0/" : - "${buildDir}/intermediates/dex/${variantNameLowered}/mergeDex${variantNameCapped}/out/" - from dexOutPath, "${projectDir}/src/main/resources/" - destinationDir file(myTemplatePath + "system/framework/") - baseName "edxp" - doLast { - copy { - from file(myTemplatePath) - into file(templateRootPath) - } - } + destinationDir file(templateRootPath + "system/framework/") outputs.upToDateWhen { false } } } diff --git a/edxp-yahfa/build.gradle b/edxp-yahfa/build.gradle index 2c2a1ad3..b84ac58f 100644 --- a/edxp-yahfa/build.gradle +++ b/edxp-yahfa/build.gradle @@ -28,7 +28,7 @@ android { dependencies { compileOnly project(':hiddenapi-stubs') implementation project(':edxp-common') - compileOnly project(':dexmaker') + compileOnly files(project(":dexmaker").tasks.getByName("makeJarRelease").outputs) } @@ -57,8 +57,6 @@ afterEvaluate { def variantNameCapped = variant.name.capitalize() def variantNameLowered = variant.name.toLowerCase() - def myTemplatePath = "${projectDir}/template_override/" - task("copyDex${variantNameCapped}", type: Copy) { dependsOn "assemble${variantNameCapped}" dependsOn tasks.getByPath(":edxp-common:copyCommonProperties") @@ -67,31 +65,9 @@ afterEvaluate { rename("classes.dex", "edxp.dex") } from "${projectDir}/src/main/resources/" - destinationDir file(myTemplatePath + "system/framework/") - doLast { - copy { - from file(myTemplatePath) - into file(templateRootPath) - } - } - } - - task("makeAndCopy${variantNameCapped}", type: Jar, dependsOn: "assemble${variantNameCapped}") { - dependsOn tasks.getByPath(":edxp-common:copyCommonProperties") - def dexOutPath = variant.name.contains("release") ? - "${buildDir}/intermediates/transforms/dexMerger/${variantNameLowered}/0/" : - "${buildDir}/intermediates/dex/${variantNameLowered}/mergeDex${variantNameCapped}/out/" - from dexOutPath, "${projectDir}/src/main/resources/" - destinationDir file(myTemplatePath + "system/framework/") - baseName "edxp" - doLast { - copy { - from file(myTemplatePath) - into file(templateRootPath) - include "*.dex" - } - } + destinationDir file(templateRootPath + "system/framework/") outputs.upToDateWhen { false } } + } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index be668d74..6eeb58e9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ androidCompileSdkVersion=30 -androidCompileNdkVersion=22.0.6917172 rc1 \ No newline at end of file +androidCompileNdkVersion=22.0.6917172 \ No newline at end of file diff --git a/hiddenapi-stubs/.gitignore b/hiddenapi-stubs/.gitignore index 796b96d1..97873191 100644 --- a/hiddenapi-stubs/.gitignore +++ b/hiddenapi-stubs/.gitignore @@ -1 +1,2 @@ /build +/libs diff --git a/hiddenapi-stubs/build.gradle b/hiddenapi-stubs/build.gradle index 513c00e2..31adb017 100644 --- a/hiddenapi-stubs/build.gradle +++ b/hiddenapi-stubs/build.gradle @@ -1,23 +1,15 @@ -import com.android.builder.core.BuilderConstants - apply plugin: 'com.android.library' android { compileSdkVersion androidCompileSdkVersion.toInteger() + ndkVersion androidCompileNdkVersion } task makeStubJar(type: Jar){ dependsOn assemble baseName 'framework-stub' - from("${projectDir}/build/intermediates/javac/release/classes/") - into('') - destinationDir file("${projectDir}/libs") + from("${buildDir}/intermediates/javac/release/classes/") exclude('BuildConfig.class', 'R.class') exclude{ it.name.startsWith('R$')} -} - -afterEvaluate { - tasks.withType(JavaCompile) { - it.finalizedBy(makeStubJar) - } + outputs.file(archivePath) } diff --git a/hiddenapi-stubs/libs/framework-stub.jar b/hiddenapi-stubs/libs/framework-stub.jar deleted file mode 100644 index 2c94a740..00000000 Binary files a/hiddenapi-stubs/libs/framework-stub.jar and /dev/null differ diff --git a/xposed-bridge/build.gradle b/xposed-bridge/build.gradle index 1e9e58dc..831afc02 100644 --- a/xposed-bridge/build.gradle +++ b/xposed-bridge/build.gradle @@ -2,6 +2,7 @@ apply plugin: 'com.android.library' android { compileSdkVersion androidCompileSdkVersion.toInteger() + ndkVersion androidCompileNdkVersion defaultConfig { minSdkVersion 26 @@ -38,8 +39,8 @@ preBuild.doLast { } dependencies { - compileOnly project(':hiddenapi-stubs') - compileOnly project(':dexmaker') + compileOnly files(project(":dexmaker").tasks.getByName("makeJarRelease").outputs) + compileOnly files(project(":hiddenapi-stubs").tasks.getByName("makeStubJar").outputs) } afterEvaluate {