Fix build bug

This commit is contained in:
LoveSy 2020-11-17 17:58:13 +08:00 committed by 双草酸酯
parent 0ece9b141d
commit 14b85366a1
14 changed files with 77 additions and 241 deletions

View File

@ -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()

View File

@ -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()
}
}

View File

@ -0,0 +1 @@
<manifest package="com.elderdrivers.riru.edxp.eddalvikdx" />

View File

@ -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()
}
}
}

View File

@ -0,0 +1 @@
<manifest package="com.elderdrivers.riru.edxp.dexmaker" />

View File

@ -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}")
}

View File

@ -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 }
}
}
}

View File

@ -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 }
}
}

View File

@ -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 }
}
}
}

View File

@ -1,2 +1,2 @@
androidCompileSdkVersion=30
androidCompileNdkVersion=22.0.6917172 rc1
androidCompileNdkVersion=22.0.6917172

View File

@ -1 +1,2 @@
/build
/libs

View File

@ -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)
}

View File

@ -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 {