forked from Digitaler-Impfnachweis/covpass-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
219 lines (199 loc) · 7.67 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
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
/*
* (C) Copyright IBM Deutschland GmbH 2021
* (C) Copyright IBM Corp. 2021
*/
buildscript {
ext.kotlin_version = '1.5.31'
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.18.1"
classpath "pl.allegro.tech.build:axion-release-plugin:1.13.3"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "com.jaredsburrows:gradle-license-plugin:0.8.90"
}
}
plugins {
id "com.github.ben-manes.versions" version "0.38.0"
}
apply plugin: 'pl.allegro.tech.build.axion-release'
apply from: "$rootDir/gradle/common/repos.gradle"
setupRepos()
apply from: "$rootDir/gradle/common/dependency-updates.gradle"
apply from: "$rootDir/gradle/common/scm-version.gradle"
setupScmVersion()
// FIXME: Change this when we switch to Maven Central or GitHub Packages finally works without authentication
group = 'com.ibm.health.de.rki.covpass'
subprojects {
group = rootProject.group
version = rootProject.version
def isLibraryProject = project.name != 'app' && !project.name.startsWith('app-')
def isAndroidProject = project.file('src/main/AndroidManifest.xml').exists()
def isPlatformProject = project.name.endsWith('-bom')
def isTestProject = project.name.endsWith('-test') || project.name == 'test'
def shouldPublish = isLibraryProject && project.name.startsWith("covpass-")
def isThirdPartyProject = project.name == "covpass-dgc-certlogic"
def kotlinExplicitApiMode = !isThirdPartyProject
def compilerArgs = [
"-Xopt-in=de.rki.covpass.sdk.utils.ExperimentalHCertApi",
]
apply from: "$rootDir/dependencies.gradle"
repositories {
maven {
url 'https://maven.pkg.github.com/ehn-dcc-development/*'
credentials {
username repoConfig.githubUsername ?: System.getenv("GITHUB_PACKAGES_USERNAME")
password repoConfig.githubPassword ?: System.getenv("GITHUB_PACKAGES_PASSWORD")
}
}
}
if (!isPlatformProject) {
if (!isLibraryProject) {
apply from: "$rootDir/gradle/common/android-app.gradle"
androidApp(
kotlinCompilerArgs: compilerArgs,
kotlinExplicitApiMode: kotlinExplicitApiMode,
obfuscation: Obfuscation.Full,
disableAndroidLints: ["UnusedResources"],
)
apply plugin: 'com.jaredsburrows.license'
licenseReport {
generateCsvReport = false
generateHtmlReport = false
generateJsonReport = true
}
} else if (isAndroidProject) {
apply from: "$rootDir/gradle/common/android-library.gradle"
androidLibrary(
kotlinCompilerArgs: compilerArgs,
kotlinExplicitApiMode: kotlinExplicitApiMode,
)
} else {
apply from: "$rootDir/gradle/common/kotlin-library.gradle"
kotlinLibrary(
kotlinCompilerArgs: compilerArgs,
kotlinExplicitApiMode: kotlinExplicitApiMode,
)
}
if (!isThirdPartyProject) {
apply from: "$rootDir/gradle/common/ktlint.gradle"
apply from: "$rootDir/gradle/common/detekt.gradle"
}
if (isAndroidProject) {
android {
defaultConfig {
versionName = "1.13.0"
}
if (!isLibraryProject) {
def codeName = project.name.substring("app-".length()).replaceAll("-", "")
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "$codeName-${defaultConfig.versionName}-${version}-${variant.buildType.name}.apk"
}
}
}
buildFeatures {
viewBinding true
}
// Resolve build conflicts for test modules
if (isTestProject) {
packagingOptions {
pickFirst 'META-INF/AL2.0'
pickFirst 'META-INF/LGPL2.1'
}
}
if (isTestProject || isThirdPartyProject) {
lintOptions {
abortOnError false
}
}
// for local release builds and debugging proguard
def debugKeystore = file("$rootDir/debug.keystore")
if (debugKeystore.exists()) {
signingConfigs {
debug {
storeFile debugKeystore
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
signingConfig signingConfigs.debug
}
}
}
}
dependencies {
baseAndroid()
}
} else {
dependencies {
base()
}
}
task verifyAll(group: 'verification') {
if (!isThirdPartyProject) {
dependsOn 'ktlint'
dependsOn 'detekt'
}
if (isAndroidProject) {
dependsOn 'lintDebug'
dependsOn 'testDebugUnitTest'
} else {
dependsOn 'test'
}
}
if (isLibraryProject) {
apply from: "$rootDir/gradle/common/coverage.gradle"
trackCoverage(enableTestCoverage: isOnCI, trackUI: false)
}
if (!isLibraryProject && (System.getenv("PUBLISH_APPS") ?: "true") == "true") {
apply plugin: 'maven-publish'
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release_apk
}
}
repositories {
maven {
url "https://nexus.open-insurance-platform.com/repository/covpass-releases"
credentials {
username repoConfig.nexusUsername
password repoConfig.nexusPassword
}
}
}
}
}
}
}
if (shouldPublish) {
apply from: "$rootDir/gradle/common/publish.gradle"
publish(
url: System.getenv("PUBLICATION_URL") ?: nexus.egaPublic,
username: repoConfig.nexusUsername ?: System.getenv("PUBLICATION_USERNAME"),
password: repoConfig.nexusPassword ?: System.getenv("PUBLICATION_PASSWORD"),
repoUrl: "https://github.com/Digitaler-Impfnachweis/covpass-android",
pomAction: {
description = "The official CovPass(-Check) SDK"
url = "https://github.com/Digitaler-Impfnachweis/covpass-android"
licenses {
license(LICENSE.APACHE2)
}
},
isPlatformProject: isPlatformProject,
)
}
}