Skip to content

Commit 14b8536

Browse files
LoveSykotori2
LoveSy
authored andcommitted
Fix build bug
1 parent 0ece9b1 commit 14b8536

File tree

14 files changed

+76
-240
lines changed

14 files changed

+76
-240
lines changed

Diff for: build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ allprojects {
2323
templateLibPath = templateRootPath + "/system/lib/"
2424
templateLib64Path = templateRootPath + "/system/lib64/"
2525
templateEtcPath = templateRootPath + "/system/etc/"
26-
hiddenApiStubJarFilePath = project(":hiddenapi-stubs").projectDir.absolutePath + "/libs/framework-stub.jar"
26+
hiddenApiStubJarFilePath = project(":hiddenapi-stubs").buildDir.absolutePath + "/libs/framework-stub.jar"
2727
}
2828
repositories {
2929
google()

Diff for: dalvikdx/build.gradle

+25-49
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,33 @@
1-
import org.gradle.internal.os.OperatingSystem
2-
apply plugin: 'java-library'
1+
apply plugin: 'com.android.application'
32

4-
dependencies {
5-
implementation fileTree(dir: 'libs', include: ['*.jar'])
3+
repositories {
4+
jcenter()
65
}
76

8-
sourceCompatibility = "7"
9-
targetCompatibility = "7"
10-
11-
task findDx {
12-
if (OperatingSystem.current().isWindows()){
13-
return true
14-
}
15-
doLast {
16-
new ByteArrayOutputStream().withStream { os ->
17-
exec {
18-
commandLine "which", "dx"
19-
standardOutput os
20-
}
21-
rootProject.ext.dxPath = os.toString()
22-
}
23-
}
7+
android {
8+
compileSdkVersion androidCompileSdkVersion.toInteger()
9+
ndkVersion androidCompileNdkVersion
2410
}
2511

26-
task makeDex(type: Exec) {
27-
dependsOn jar
28-
dependsOn findDx
29-
def dexName = "classes.dex"
30-
workingDir jar.destinationDir
31-
if (OperatingSystem.current().isWindows()) {
32-
executable "dx.bat"
33-
args "--dex", "--output", dexName, "${jar.archiveName}"
34-
} else {
35-
executable "bash"
36-
args rootProject.ext.dxPath.trim(), "--dex", "--output", dexName, "${jar.archiveName}"
37-
}
38-
}
12+
afterEvaluate {
13+
android.applicationVariants.all { variant ->
14+
def variantNameCapped = variant.name.capitalize()
15+
def variantNameLowered = variant.name.toLowerCase()
3916

40-
task dex(type: Copy) {
41-
dependsOn makeDex
42-
from (jar.destinationDir) {
43-
include "classes.dex"
44-
rename "classes.dex", "eddalvikdx.dex"
17+
task("copyDex${variantNameCapped}", type: Copy) {
18+
dependsOn "assemble${variantNameCapped}"
19+
def dexOutPath = "${buildDir}/intermediates/dex/${variantNameLowered}/mergeDex${variantNameCapped}"
20+
from (dexOutPath){
21+
rename("classes.dex", "eddalvikdx.dex")
22+
}
23+
destinationDir file(templateRootPath + "system/framework/")
24+
outputs.upToDateWhen { false }
25+
}
26+
task("makeJar${variantNameCapped}", type: Jar, dependsOn: "assemble${variantNameCapped}") {
27+
dependsOn "assemble${variantNameCapped}"
28+
from "${buildDir}/intermediates/javac/${variantNameLowered}/classes"
29+
baseName "dalvikdx"
30+
outputs.file(archivePath)
31+
}
4532
}
46-
destinationDir new File(projectDir, "dex")
4733
}
48-
49-
task dexInJar(type: Jar) {
50-
dependsOn makeDex
51-
from "${jar.destinationDir}/classes.dex"
52-
destinationDir jar.destinationDir
53-
baseName "eddalvikdx"
54-
onlyIf {
55-
!jar.state.upToDate || !file(archiveName).exists()
56-
}
57-
}

Diff for: dalvikdx/src/main/AndroidManifest.xml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<manifest package="com.elderdrivers.riru.edxp.eddalvikdx" />

Diff for: dexmaker/build.gradle

+26-34
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,39 @@
1-
import org.gradle.internal.os.OperatingSystem
2-
apply plugin: 'java'
1+
apply plugin: 'com.android.application'
32

43
description = "A utility for doing compile or runtime code generation targeting Android's Dalvik VM"
54

6-
targetCompatibility = '1.7'
7-
sourceCompatibility = '1.7'
8-
95
repositories {
106
jcenter()
117
}
128

13-
dependencies {
14-
compileOnly project(':dalvikdx')
9+
android {
10+
compileSdkVersion androidCompileSdkVersion.toInteger()
11+
ndkVersion androidCompileNdkVersion
1512
}
1613

17-
task makeDex(type: Exec) {
18-
dependsOn jar
19-
def dexName = "classes.dex"
20-
workingDir jar.destinationDir
21-
if (OperatingSystem.current().isWindows()) {
22-
executable "dx.bat"
23-
args "--dex", "--output", dexName, "${jar.archiveName}"
24-
} else {
25-
executable "bash"
26-
args rootProject.ext.dxPath.trim(), "--dex", "--output", dexName, "${jar.archiveName}"
27-
}
14+
dependencies {
15+
compileOnly files(project(":dalvikdx").tasks.getByName("makeJarRelease").outputs)
2816
}
2917

30-
task dex(type: Copy) {
31-
dependsOn makeDex
32-
from (jar.destinationDir) {
33-
include "classes.dex"
34-
rename "classes.dex", "eddexmaker.dex"
35-
}
36-
destinationDir new File(projectDir, "dex")
37-
}
18+
afterEvaluate {
19+
android.applicationVariants.all { variant ->
20+
def variantNameCapped = variant.name.capitalize()
21+
def variantNameLowered = variant.name.toLowerCase()
3822

39-
task dexInJar(type: Jar) {
40-
dependsOn makeDex
41-
from "${jar.destinationDir}/classes.dex"
42-
destinationDir jar.destinationDir
43-
baseName "eddexmaker"
44-
onlyIf {
45-
!jar.state.upToDate || !file(archiveName).exists()
23+
task("copyDex${variantNameCapped}", type: Copy) {
24+
dependsOn "assemble${variantNameCapped}"
25+
def dexOutPath = "${buildDir}/intermediates/dex/${variantNameLowered}/mergeDex${variantNameCapped}"
26+
from (dexOutPath){
27+
rename("classes.dex", "eddexmaker.dex")
28+
}
29+
destinationDir file(templateRootPath + "system/framework/")
30+
outputs.upToDateWhen { false }
31+
}
32+
task("makeJar${variantNameCapped}", type: Jar, dependsOn: "assemble${variantNameCapped}") {
33+
dependsOn "assemble${variantNameCapped}"
34+
from "${buildDir}/intermediates/javac/${variantNameLowered}/classes"
35+
baseName "dexmaker"
36+
outputs.file(archivePath)
37+
}
4638
}
47-
}
39+
}

Diff for: dexmaker/src/main/AndroidManifest.xml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<manifest package="com.elderdrivers.riru.edxp.dexmaker" />

Diff for: edxp-core/build.gradle

+6-60
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import org.gradle.internal.os.OperatingSystem
44
apply plugin: 'com.android.library'
55

66
// Values set here will be overriden by AppVeyor, feel free to modify during development.
7-
def buildVersionName = 'v0.5.0.6'
7+
def buildVersionName = 'v0.5.0.8'
88
def buildVersionCode = 233
99

1010
if (System.env.APPVEYOR_BUILD_VERSION != null) {
@@ -49,8 +49,8 @@ android {
4949
externalNativeBuild {
5050
cmake {
5151
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
52-
cppFlags "-std=c++17 -ffixed-x18 -Qunused-arguments -frtti"
53-
cFlags "-std=gnu99 -ffixed-x18 -Qunused-arguments -frtti"
52+
cppFlags "-std=c++17 -ffixed-x18 -Qunused-arguments -frtti -fomit-frame-pointer"
53+
cFlags "-std=gnu99 -ffixed-x18 -Qunused-arguments -frtti -fomit-frame-pointer"
5454
arguments "-DRIRU_MODULE_API_VERSION=$moduleMaxRiruApiVersion",
5555
"-DRIRU_MODULE_VERSION=$buildVersionCode",
5656
"-DRIRU_MODULE_VERSION_NAME:STRING=\"$buildVersionName\""
@@ -86,62 +86,6 @@ android {
8686
ndkVersion androidCompileNdkVersion
8787
}
8888

89-
task copyDalvikdxDex {
90-
def dexTask = tasks.getByPath(':dalvikdx:dex')
91-
dependsOn dexTask
92-
doLast {
93-
copy {
94-
from dexTask
95-
into jar_dest_dir
96-
}
97-
}
98-
onlyIf {
99-
!dexTask.state.upToDate
100-
}
101-
}
102-
103-
task copyDexmakerDex {
104-
def dexTask = tasks.getByPath(':dexmaker:dex')
105-
dependsOn dexTask
106-
doLast {
107-
copy {
108-
from dexTask
109-
into jar_dest_dir
110-
}
111-
}
112-
onlyIf {
113-
!dexTask.state.upToDate
114-
}
115-
}
116-
117-
task copyDalvikdxJar {
118-
def jarTask = tasks.getByPath(':dalvikdx:dexInJar')
119-
dependsOn jarTask
120-
doLast {
121-
copy {
122-
from jarTask
123-
into jar_dest_dir
124-
}
125-
}
126-
onlyIf {
127-
!jarTask.state.upToDate || !file(jar_dest_dir + jarTask.archiveName).exists()
128-
}
129-
}
130-
131-
task copyDexmakerJar {
132-
def jarTask = tasks.getByPath(':dexmaker:dexInJar')
133-
dependsOn jarTask
134-
doLast {
135-
copy {
136-
from jarTask
137-
into jar_dest_dir
138-
}
139-
}
140-
onlyIf {
141-
!jarTask.state.upToDate || !file(jar_dest_dir + jarTask.archiveName).exists()
142-
}
143-
}
144-
14589
task cleanTemplate(type: Delete) {
14690
delete file(templateSystemx86Path)
14791
}
@@ -161,7 +105,9 @@ afterEvaluate {
161105
def magiskModuleId = property("${backendLowered}" + "_module_id")
162106

163107
def prepareJarsTask = task("prepareJars${backendCapped}${variantCapped}") {
164-
dependsOn cleanTemplate, copyDalvikdxDex, copyDexmakerDex
108+
dependsOn cleanTemplate
109+
dependsOn tasks.getByPath(":dexmaker:copyDex${variantCapped}")
110+
dependsOn tasks.getByPath(":dalvikdx:copyDex${variantCapped}")
165111
dependsOn tasks.getByPath(":edxp-${backendLowered}:copyDex${variantCapped}")
166112
}
167113

Diff for: edxp-sandhook/build.gradle

+3-28
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dependencies {
2929
compileOnly project(':hiddenapi-stubs')
3030
implementation project(':edxp-common')
3131
implementation 'com.swift.sandhook:hooklib:4.2.1'
32-
compileOnly project(':dexmaker')
32+
compileOnly files(project(":dexmaker").tasks.getByName("makeJarRelease").outputs)
3333
}
3434

3535

@@ -58,8 +58,6 @@ afterEvaluate {
5858
def variantNameCapped = variant.name.capitalize()
5959
def variantNameLowered = variant.name.toLowerCase()
6060

61-
def myTemplatePath = "${projectDir}/template_override/"
62-
6361
task("copyDex${variantNameCapped}", type: Copy) {
6462
dependsOn "assemble${variantNameCapped}"
6563
dependsOn tasks.getByPath(":edxp-common:copyCommonProperties")
@@ -68,32 +66,9 @@ afterEvaluate {
6866
rename("classes.dex", "edxp.dex")
6967
}
7068
from "${projectDir}/src/main/resources/"
71-
destinationDir file(myTemplatePath + "system/framework/")
72-
doLast {
73-
copy {
74-
from file(myTemplatePath)
75-
into file(templateRootPath)
76-
}
77-
}
78-
}
79-
80-
task("makeAndCopy${variantNameCapped}", type: Jar, dependsOn: "assemble${variantNameCapped}") {
81-
dependsOn tasks.getByPath(":edxp-common:copyCommonProperties")
82-
def dexOutPath = "${buildDir}/intermediates/dex/${variantNameLowered}/mergeDex${variantNameCapped}"
83-
from (dexOutPath){
84-
rename("classes.dex", "edxp.dex")
85-
}
86-
from "${projectDir}/src/main/resources/"
87-
destinationDir file(myTemplatePath + "system/framework/")
88-
baseName "edxp"
89-
doLast {
90-
copy {
91-
from file(myTemplatePath)
92-
into file(templateRootPath)
93-
include "*.dex"
94-
}
95-
}
69+
destinationDir file(templateRootPath + "system/framework/")
9670
outputs.upToDateWhen { false }
9771
}
72+
9873
}
9974
}

Diff for: edxp-whale/build.gradle

+2-27
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ android {
2828
dependencies {
2929
compileOnly project(':hiddenapi-stubs')
3030
implementation project(':edxp-common')
31-
compileOnly project(':dexmaker')
31+
compileOnly files(project(":dexmaker").tasks.getByName("makeJarRelease").outputs)
3232
}
3333

3434

@@ -57,8 +57,6 @@ afterEvaluate {
5757
def variantNameCapped = variant.name.capitalize()
5858
def variantNameLowered = variant.name.toLowerCase()
5959

60-
def myTemplatePath = "${projectDir}/template_override/"
61-
6260
task("copyDex${variantNameCapped}", type: Copy) {
6361
dependsOn "assemble${variantNameCapped}"
6462
dependsOn tasks.getByPath(":edxp-common:copyCommonProperties")
@@ -67,30 +65,7 @@ afterEvaluate {
6765
rename("classes.dex", "edxp.dex")
6866
}
6967
from "${projectDir}/src/main/resources/"
70-
destinationDir file(myTemplatePath + "system/framework/")
71-
doLast {
72-
copy {
73-
from file(myTemplatePath)
74-
into file(templateRootPath)
75-
include "*.dex"
76-
}
77-
}
78-
}
79-
80-
task("makeAndCopy${variantNameCapped}", type: Jar, dependsOn: "assemble${variantNameCapped}") {
81-
dependsOn tasks.getByPath(":edxp-common:copyCommonProperties")
82-
def dexOutPath = variant.name.contains("release") ?
83-
"${buildDir}/intermediates/transforms/dexMerger/${variantNameLowered}/0/" :
84-
"${buildDir}/intermediates/dex/${variantNameLowered}/mergeDex${variantNameCapped}/out/"
85-
from dexOutPath, "${projectDir}/src/main/resources/"
86-
destinationDir file(myTemplatePath + "system/framework/")
87-
baseName "edxp"
88-
doLast {
89-
copy {
90-
from file(myTemplatePath)
91-
into file(templateRootPath)
92-
}
93-
}
68+
destinationDir file(templateRootPath + "system/framework/")
9469
outputs.upToDateWhen { false }
9570
}
9671
}

0 commit comments

Comments
 (0)