forked from RikkaApps/Riru
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle
More file actions
114 lines (97 loc) · 3.25 KB
/
build.gradle
File metadata and controls
114 lines (97 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import org.apache.tools.ant.filters.FixCrLfFilter
import org.apache.tools.ant.filters.ReplaceTokens
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.internal.storage.file.FileRepository
import java.util.stream.StreamSupport
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r'
}
}
plugins {
id 'idea'
}
idea.module {
excludeDirs += file('out')
resourceDirs += file('template')
excludeDirs += file('template/aar')
resourceDirs += file('scripts')
resourceDirs += file('docs')
}
ext {
riruMinSdkVersion = 23
riruTargetSdkVersion = 32
riruBuildToolsVersion = "32.0.0"
riruApiVersion = 26
riruMinApiVersion = 24
repo = new FileRepository(rootProject.file(".git"))
gitObjectId = repo.refDatabase.exactRef("refs/remotes/origin/master").objectId
gitCommitId = gitObjectId.abbreviate(10).name()
gitCommitCount = StreamSupport.stream(new Git(repo).log().add(gitObjectId).call().spliterator(), false).count()
def versionNameMinor = 1
def versionNamePatch = 6
riruVersionNameShort = "v${riruApiVersion}.${versionNameMinor}.${versionNamePatch}"
riruVersionName = "${riruVersionNameShort}.r${gitCommitCount}.${gitCommitId}"
riruVersionCode = gitCommitCount
outDir = file("out")
riruPath = "/data/riru"
}
def getProject(String name) {
return project(name)
}
task clean(type: Delete) {
delete buildDir, outDir
}
["Release", "Debug"].forEach { variant ->
def flashDir = file("$outDir/riru-${riruVersionName}-${variant}")
task("prepareUpdateFiles${variant}") {
dependsOn("clean")
dependsOn("rirud:assemble$variant")
dependsOn("riru:assemble$variant")
doLast {
def templatePath = "template/update_package"
copy {
into flashDir
from(templatePath) {
exclude 'zip/update.sh', 'zip/files/rirud_launcher.rc'
}
from(templatePath) {
include 'zip/update.sh', 'zip/files/rirud_launcher.rc'
filter(ReplaceTokens.class, tokens: [
"RIRU_PATH": riruPath.toString()
])
filter(FixCrLfFilter.class,
eol: FixCrLfFilter.CrLf.newInstance("lf"))
}
from(project("riru").buildDir.absolutePath + "/intermediates/stripped_native_libs/${variant.toLowerCase()}/out/lib") {
into 'zip/files/lib'
}
from(project("rirud").buildDir.absolutePath + "/outputs/apk/${variant.toLowerCase()}/rirud.apk") {
include 'rirud.apk'
into 'zip/files/'
}
}
}
}
task("zip${variant}") {
dependsOn("prepareUpdateFiles${variant}")
doLast {
exec {
workingDir flashDir
commandLine "./flashable.sh"
}
}
}
task("flash${variant}") {
dependsOn("prepareUpdateFiles${variant}")
doLast {
exec {
workingDir flashDir
commandLine "./flashable.sh", "-s"
}
}
}
}