-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
build.gradle
117 lines (100 loc) · 3.69 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
apply from: 'secrets.gradle'
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:8.7.2'
classpath 'com.google.gms:google-services:4.4.2'
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.21"
classpath "org.jlleitschuh.gradle:ktlint-gradle:12.1.1"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.8.4"
classpath "com.google.android.gms:oss-licenses-plugin:0.10.6"
}
}
allprojects {
repositories {
maven {
url "${rootDir}/.local-m2/"
metadataSources {
mavenPom()
artifact() // Supports artifact only dependencies like those from medicmobile repo
}
}
// Needs to go first to get specialty libraries https://stackoverflow.com/a/48438866/137744
google()
mavenLocal() // Only used for javarosa_local dependency
mavenCentral()
maven { url 'https://oss.sonatype.org/content/groups/public' }
maven { url 'https://jitpack.io' }
maven {
url 'https://staging.dev.medicmobile.org/_couch/maven-repo'
metadataSources { artifact() }
}
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
username = "mapbox"
password = getSecrets().getProperty('MAPBOX_DOWNLOADS_TOKEN', '')
}
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs = ['-Xjvm-default=all']
jvmTarget = '17'
}
}
}
configurations.all {
transitive = true
}
task checkCode(type: GradleBuild) {
tasks = ['pmd', 'ktlintCheck', 'checkstyle', 'lintDebug']
}
// Create local Maven repo from cached Gradle dependencies
task cacheToMavenLocal(type: Sync) {
from new File(gradle.gradleUserHomeDir, 'caches/modules-2/files-2.1')
into "${rootDir}/.local-m2"
duplicatesStrategy = 'include'
// Convert from Gradle cache to Maven format
eachFile {
List<String> parts = it.path.split('/')
it.path = parts[0].replace('.','/') +
'/' + parts[1] +
'/' + parts[2] +
'/' + parts[4]
}
includeEmptyDirs false
}
tasks.register('testLab') {
dependsOn "collect_app:assembleDebug", "collect_app:assembleDebugAndroidTest"
doLast {
exec {
executable 'gcloud'
args('beta', 'firebase', 'test', 'android', 'run',
'--type', 'instrumentation',
'--num-uniform-shards=25',
'--app', 'collect_app/build/outputs/apk/debug/ODK-Collect-debug.apk',
'--test', 'collect_app/build/outputs/apk/androidTest/debug/ODK-Collect-debug-androidTest.apk',
'--device', 'model=MediumPhone.arm,version=34,locale=en,orientation=portrait',
'--timeout', '10m',
'--directories-to-pull', '/sdcard',
'--test-targets', "notPackage org.odk.collect.android.regression",
'--test-targets', "notPackage org.odk.collect.android.benchmark"
)
}
}
}
tasks.register('releaseCheck') {
dependsOn "testLab", "collect_app:assembleOdkCollectRelease"
}