Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
219 lines (184 loc) · 6.67 KB
/
Copy pathbuild.gradle
File metadata and controls
219 lines (184 loc) · 6.67 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
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
apply plugin: 'com.android.application'
apply plugin: 'com.google.devtools.ksp'
apply plugin: 'kotlin-parcelize'
def commitSHA1 = 'COMMIT_SHA1'
def gitRemote = 'GIT_REMOTE'
dependencies {
// Data and domain modules
implementation project(':owncloudDomain')
implementation project(':owncloudData')
// Kotlin
implementation libs.kotlin.stdlib
implementation libs.kotlinx.coroutines.core
// Android X
implementation libs.androidx.annotation
implementation libs.androidx.appcompat
implementation libs.androidx.biometric
implementation libs.androidx.constraintlayout
implementation libs.androidx.core.ktx
implementation libs.androidx.fragment.ktx
implementation libs.androidx.legacy.support
implementation libs.androidx.lifecycle.common.java8
implementation libs.androidx.lifecycle.extensions
implementation libs.androidx.lifecycle.livedata.ktx
implementation libs.androidx.lifecycle.runtime.ktx
implementation libs.androidx.lifecycle.viewmodel.ktx
implementation libs.androidx.preference.ktx
implementation libs.androidx.room.runtime
implementation libs.androidx.sqlite.ktx
implementation libs.androidx.work.runtime.ktx
implementation(libs.androidx.browser) { because "CustomTabs required for OAuth2 and OIDC" }
implementation(libs.androidx.enterprise.feedback) { because "MDM feedback" }
implementation libs.androidx.emoji2.emojipicker
// Image loading
implementation libs.coil
implementation libs.glide
implementation libs.glide.vector
// Zooming Android ImageView.
implementation libs.photoview
// Koin dependency injector
implementation libs.koin.androidx.workmanager
implementation libs.koin.core
// Miscellaneous
implementation libs.disklrucache
implementation libs.media3.exoplayer
implementation libs.media3.ui
implementation libs.floatingactionbutton
implementation libs.material
implementation libs.patternlockview
// Markdown Preview
implementation libs.bundles.markwon
// Timber
implementation libs.timber
// Tests
testImplementation project(":owncloudTestUtil")
testImplementation libs.androidx.arch.core.testing
testImplementation libs.junit4
testImplementation libs.kotlinx.coroutines.test
testImplementation libs.mockk
// Instrumented tests
androidTestImplementation project(":owncloudTestUtil")
androidTestImplementation libs.androidx.annotation
androidTestImplementation libs.androidx.arch.core.testing
androidTestImplementation libs.androidx.test.core
androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.androidx.test.rules
androidTestImplementation libs.androidx.test.runner
androidTestImplementation libs.androidx.test.uiautomator
androidTestImplementation libs.bundles.espresso
androidTestImplementation libs.dexopener
androidTestImplementation(libs.mockk.android) { exclude module: "objenesis" }
// Debug
debugImplementation libs.androidx.fragment.testing
debugImplementation libs.androidx.test.monitor
debugImplementation libs.stetho
// Detekt
detektPlugins libs.detekt.formatting
detektPlugins libs.detekt.libraries
}
android {
compileSdk sdkCompileVersion
defaultConfig {
minSdk sdkMinVersion
targetSdk sdkTargetVersion
testInstrumentationRunner "com.owncloud.android.utils.OCTestAndroidJUnitRunner"
versionCode = 48000300
versionName = "4.8.3"
buildConfigField "String", gitRemote, "\"" + getGitOriginRemote() + "\""
buildConfigField "String", commitSHA1, "\"" + getLatestGitHash() + "\""
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
sourceSets {
androidTest.java.srcDirs += "src/test-common/java"
test.java.srcDirs += "src/test-common/java"
}
lint {
abortOnError true
htmlOutput file('../lint-app-report.html')
ignoreWarnings false
xmlReport false
}
signingConfigs {
release {
if (System.env.OC_RELEASE_KEYSTORE) {
storeFile file(System.env.OC_RELEASE_KEYSTORE) // use an absolute path
storePassword System.env.OC_RELEASE_KEYSTORE_PASSWORD
keyAlias System.env.OC_RELEASE_KEY_ALIAS
keyPassword System.env.OC_RELEASE_KEY_PASSWORD
}
}
}
buildTypes {
release {
if (System.env.OC_RELEASE_KEYSTORE) {
signingConfig signingConfigs.release
}
}
debug {
applicationIdSuffix ".debug"
}
}
flavorDimensions "management"
productFlavors {
original {
dimension "management"
}
mdm {
dimension "management"
}
qa {
dimension "management"
}
}
testOptions {
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
unitTests.returnDefaultValues = true
animationsDisabled = true
}
buildFeatures {
viewBinding true
buildConfig true
}
packaging {
resources.excludes.add("META-INF/*")
}
namespace "com.owncloud.android"
testNamespace "com.owncloud.android.test"
}
// Updates output file names of a given variant to format
// [appName].[variant.versionName].[OC_BUILD_NUMBER]-[variant.name].apk using the new AGP Variant API (androidComponents)
androidComponents {
onVariants(selector().all()) { variant ->
def appName = System.env.OC_APP_NAME ?: "owncloud"
def buildNumber = System.env.OC_BUILD_NUMBER
variant.outputs.each { output ->
if (output.outputType == com.android.build.api.variant.VariantOutputConfiguration.OutputType.SINGLE) {
output.outputFileName.set(output.versionName.map { versionName ->
def newName = appName + "_" + versionName
if (buildNumber) {
newName += "_" + buildNumber
}
newName += "-" + variant.name + ".apk"
newName
})
}
}
}
}
static def getLatestGitHash() {
def process = "git rev-parse --short HEAD".execute()
return process.text.toString().trim()
}
static def getGitOriginRemote() {
def process = "git remote -v".execute()
def values = process.text.toString().trim().split("\\r\\n|\\n|\\r")
def found = values.find { it.startsWith("origin") && it.endsWith("(push)") }
return found.replace("origin", "").replace("(push)", "").replace(".git", "").trim()
}