forked from RikkaApps/Riru
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
133 lines (112 loc) · 3.51 KB
/
build.gradle
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import org.apache.tools.ant.filters.FixCrLfFilter
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 {
minSdkVersion = 23
targetSdkVersion = 33
buildToolsVersion = "33.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()
versionNameMinor = 1
versionNamePatch = 7
outDir = file("$rootDir/out")
}
task clean(type: Delete) {
delete rootProject.buildDir, outDir
}
def aarVersion = "${riruApiVersion}.0.0"
def aarDir = "out/aar/dev/rikka/ndk/riru/${aarVersion}"
task generateLibraryAar(type: Zip) {
copy {
from 'riru/src/main/cpp/include_riru/riru.h'
into 'template/aar/riru.aar/prefab/modules/riru/include'
}
from 'template/aar/riru.aar'
archiveName "riru-${aarVersion}.aar"
destinationDir file(aarDir)
}
task signLibraryAar(type: Exec) {
commandLine "gpg",
"--armor",
"--detach-sign",
"--passphrase=${findProperty("signing.password")}",
"--batch",
"--yes",
"riru-${aarVersion}.aar"
workingDir aarDir
}
task generateLibraryPom(type: Copy) {
from 'template/aar/riru.pom'
into file(aarDir)
filter { line -> line.replaceAll('%%%VERSION%%%', "$aarVersion") }
filter(FixCrLfFilter.class,
eol: FixCrLfFilter.CrLf.newInstance("lf"))
rename { "riru-${aarVersion}.pom" }
}
task signLibraryPom(type: Exec) {
commandLine "gpg",
"--armor",
"--detach-sign",
"--passphrase=${findProperty("signing.password")}",
"--batch",
"--yes",
"riru-${aarVersion}.pom"
workingDir aarDir
}
task generateLibrarySourceJar(type: Zip) {
from 'template/aar/riru-sources.jar'
archiveName "riru-${aarVersion}-sources.jar"
destinationDir file(aarDir)
}
task signLibrarySourceJar(type: Exec) {
commandLine "gpg",
"--armor",
"--detach-sign",
"--passphrase=${findProperty("signing.password")}",
"--batch",
"--yes",
"riru-${aarVersion}-sources.jar"
workingDir aarDir
}
task generateLibraryJavaDocJar(type: Zip) {
from 'template/aar/riru-javadoc.jar'
archiveName "riru-${aarVersion}-javadoc.jar"
destinationDir file(aarDir)
}
task signLibraryJavaDocJar(type: Exec) {
commandLine "gpg",
"--armor",
"--detach-sign",
"--passphrase=${findProperty("signing.password")}",
"--batch",
"--yes",
"riru-${aarVersion}-javadoc.jar"
workingDir aarDir
}
task generateLibrary(type: GradleBuild) {
tasks = [':generateLibraryAar', ':generateLibraryPom', ':generateLibrarySourceJar', ':generateLibraryJavaDocJar',
':signLibraryAar', ':signLibraryPom', ':signLibrarySourceJar', ':signLibraryJavaDocJar']
}