forked from vvb2060/KeyAttestation
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathbuild.gradle
More file actions
171 lines (150 loc) · 5.33 KB
/
Copy pathbuild.gradle
File metadata and controls
171 lines (150 loc) · 5.33 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import com.android.build.api.instrumentation.*
import com.android.build.gradle.internal.tasks.CompileArtProfileTask
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.objectweb.asm.ClassVisitor
import org.objectweb.asm.commons.ClassRemapper
import org.objectweb.asm.commons.Remapper
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
def gitCommitCount
try {
gitCommitCount = providers.exec {
commandLine("git", "rev-list", "--count", "HEAD")
}.standardOutput.asText.get().toInteger()
} catch (ignored) {
gitCommitCount = 1
}
def properties = new Properties()
def local = project.rootProject.file("local.properties")
if (local.exists()) {
properties.load(local.newDataInputStream())
}
def localesFile = file("locales.txt")
def supportedLocales = localesFile.readLines().findAll { it && !it.startsWith("#") }
android {
compileSdk = 35
buildToolsVersion = '35.0.1'
namespace = 'io.github.vvb2060.keyattestation'
defaultConfig {
minSdk = 24
targetSdk = 35
versionCode = gitCommitCount
versionName = '2.0.3'
resourceConfigurations += supportedLocales
optimization {
keepRules {
ignoreFromAllExternalDependencies true
}
}
}
signingConfigs {
debug {
if (properties.getProperty("storeFile") != null) {
storeFile file(properties.getProperty("storeFile"))
storePassword properties.getProperty("storePassword")
keyAlias properties.getProperty("keyAlias")
keyPassword properties.getProperty("keyPassword")
}
}
release {
def sFile = System.getenv("STORE_FILE") ?: properties.getProperty("storeFile") ?: "Vision.jks"
storeFile file(sFile)
storePassword System.getenv("STORE_PASSWORD") ?: properties.getProperty("storePassword")
keyAlias System.getenv("KEY_ALIAS") ?: properties.getProperty("keyAlias")
keyPassword System.getenv("KEY_PASSWORD") ?: properties.getProperty("keyPassword")
}
}
buildTypes {
debug {
versionNameSuffix '-debug'
}
release {
minifyEnabled true
shrinkResources true
vcsInfo.include false
signingConfig signingConfigs.release
proguardFiles 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
kotlinOptions {
jvmTarget = "21"
options.languageVersion = KotlinVersion.KOTLIN_2_1
options.progressiveMode = true
}
buildFeatures {
viewBinding = true
buildConfig = true
aidl = true
}
packagingOptions {
resources {
excludes += '**'
}
}
androidResources {
generateLocaleConfig true
}
installation {
installOptions += ["--user 0"]
}
lint.checkReleaseBuilds false
dependenciesInfo.includeInApk false
}
tasks.withType(CompileArtProfileTask.class).configureEach {
enabled = false
}
configurations.configureEach {
exclude group: 'dev.rikka.rikkax.appcompat', module: 'appcompat'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk7'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
}
dependencies {
compileOnly project(':stub')
implementation 'org.bouncycastle:bcprov-jdk18on:1.80'
implementation 'com.google.guava:guava:33.4.0-android'
implementation 'co.nstant.in:cbor:0.9'
//noinspection GradleDependency
implementation 'dev.rikka.rikkax.material:material:1.6.6'
implementation 'dev.rikka.rikkax.html:html-ktx:1.1.2'
implementation 'dev.rikka.rikkax.recyclerview:recyclerview-adapter:1.3.0'
implementation 'dev.rikka.rikkax.widget:borderview:1.1.0'
implementation 'dev.rikka.shizuku:api:13.1.5'
implementation 'androidx.core:core-ktx:1.15.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.activity:activity-ktx:1.10.0'
implementation 'androidx.fragment:fragment-ktx:1.8.5'
implementation 'androidx.recyclerview:recyclerview:1.4.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.8.7'
implementation 'com.google.android.material:material:1.12.0'
}
androidComponents {
onVariants(selector().all(), {
instrumentation.transformClassesWith(ClassVisitorFactory.class,
InstrumentationScope.PROJECT) {}
})
}
abstract class ClassVisitorFactory implements AsmClassVisitorFactory<InstrumentationParameters.None> {
ClassVisitor createClassVisitor(ClassContext classContext, ClassVisitor classVisitor) {
return new ClassRemapper(classVisitor, new Remapper() {
String map(String name) {
var index = name.indexOf('$')
if (index != -1) {
return map(name.substring(0, index)) + name.substring(index)
}
if (name.endsWith("_rename")) {
return name.substring(0, name.length() - 7)
}
return name
}
})
}
boolean isInstrumentable(ClassData classData) {
return classData.className.startsWith("io.github.vvb2060.keyattestation.keystore.")
}
}