-
Notifications
You must be signed in to change notification settings - Fork 403
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
155 lines (138 loc) · 4.94 KB
/
build.gradle.kts
File metadata and controls
155 lines (138 loc) · 4.94 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
import mega.privacy.android.build.isServerBuild
plugins {
alias(plugin.plugins.kotlin.compose) apply false
alias(plugin.plugins.ksp) apply false
alias(plugin.plugins.mega.android.cicd)
alias(plugin.plugins.mega.android.release)
alias(plugin.plugins.jfrog.artifactory) apply false
alias(plugin.plugins.mega.artifactory.publish.convention) apply false
alias(plugin.plugins.de.mannodermaus.android.junit5) apply false
alias(plugin.plugins.jetbrains.kotlin.android) apply false
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
maven { url = uri("https://plugins.gradle.org/m2/") }
mavenCentral()
}
dependencies {
classpath(plugin.build.tools)
classpath(plugin.kotlin.gradle)
classpath(plugin.navigation.safeargs)
classpath(plugin.google.services)
classpath(plugin.hilt.android)
classpath(plugin.firebase.crashlytics)
classpath(plugin.firebase.performance)
classpath(plugin.firebase.app.distribution)
classpath(plugin.jacoco)
classpath(plugin.paparazzi)
classpath(plugin.jfrog)
classpath(plugin.junit5)
classpath(plugin.kotlin.gradle)
classpath(lib.kotlin.serialisation)
classpath(plugin.benchmark.baseline.profile)
classpath(lib.okhttp3)
classpath(lib.okio)
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:${plugin.versions.jfrog.artifactory.get()}")
}
}
allprojects {
repositories {
google()
mavenCentral()
maven {
url = uri("https://jitpack.io")
}
maven {
url =
uri("${System.getenv("ARTIFACTORY_BASE_URL")}/artifactory/mega-gradle/mega-sdk-android")
}
maven {
url =
uri("${System.getenv("ARTIFACTORY_BASE_URL")}/artifactory/mega-gradle/mobile-analytics")
}
maven {
url =
uri("${System.getenv("ARTIFACTORY_BASE_URL")}/artifactory/mega-gradle/core-ui")
}
maven {
url =
uri("${System.getenv("ARTIFACTORY_BASE_URL")}/artifactory/mega-gradle/dev-tools")
}
maven {
url =
uri("${System.getenv("ARTIFACTORY_BASE_URL")}/artifactory/mega-gradle/karma")
}
maven {
url =
uri("${System.getenv("ARTIFACTORY_BASE_URL")}/artifactory/mega-gradle/mega-telephoto")
}
maven {
url =
uri("${System.getenv("ARTIFACTORY_BASE_URL")}/artifactory/mega-gradle/mega-ucrop-n-edit")
}
}
configurations.all {
resolutionStrategy.cacheDynamicVersionsFor(5, "minutes")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-android-extensions-runtime")
}
}
tasks.register("clean", Delete::class) {
delete(rootProject.layout.buildDirectory.get())
}
// Define versions in a single place
// App
extra["appVersion"] = "16.3"
// Sdk and tools
extra["compileSdkVersion"] = 36
extra["minSdkVersion"] = 28
extra["targetSdkVersion"] = 36
extra["buildTools"] = "36.0.0"
// Prebuilt MEGA SDK version
extra["megaSdkVersion"] = "20260401.134858-rel"
//JDK and Java Version
extra["jdk"] = "21"
extra["javaVersion"] = JavaVersion.VERSION_21
/**
* Checks whether to Suppress Warnings
*/
val shouldSuppressWarnings by extra(
fun(): Boolean = isServerBuild() && System.getenv("DO_NOT_SUPPRESS_WARNINGS") != "true"
)
tasks.register("printSubprojectPaths") {
doLast {
rootProject.subprojects.forEach {
println("SUBPROJECT_PATH: " + it.path.removePrefix(":").replace(":", "/"))
}
}
}
tasks.register("runAllUnitTestsWithCoverage") {
group = "Verification"
description = "Runs all unit tests same as CI/CD pipeline"
val testTasks = rootProject.subprojects.flatMap { sub ->
listOfNotNull(
// We only add one test task for each module, which is the most fitted one.
sub.tasks.findByName("testDebugUnitTestCoverage")?.path // for Android library
?: sub.tasks.findByName("createUnitTestCoverageReport")?.path // for Android app
?: sub.tasks.findByName("jacocoTestReport")?.path // for JVM module
)
}.distinct()
println("Running Test Tasks: $testTasks")
dependsOn(testTasks)
}
tasks.register("printModulesWithUnitTest") {
doLast {
val unitTestTaskNames = listOf(
"testDebugUnitTestCoverage", // Android library
"createUnitTestCoverageReport", // Android app
"jacocoTestReport" // JVM module
)
rootProject.subprojects.forEach { sub ->
val hasUnitTestTask = unitTestTaskNames.any { sub.tasks.findByName(it) != null }
if (hasUnitTestTask) {
println("UNIT-TEST-MODULE: ${sub.path.removePrefix(":").replace(":", "/")}")
}
}
}
}