-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.gradle.kts
95 lines (85 loc) · 2.75 KB
/
settings.gradle.kts
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
@file:Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage")
fun readConfig(name: String): String {
return settings.extensions.extraProperties.properties[name] as String?
?: System.getenv(name) ?: ""
}
pluginManagement {
fun createBuildLogicPath(): String {
//If it is build by Jenkins, use the project directory to keep BuildLogic
return if (System.getenv("BUILD_ID").isNullOrEmpty()) {
"../BuildLogic"
} else {
"BuildLogic"
}
}
fun initBuildLogic(buildLogicPath: String) {
fun execCmd(workPath: String, cmd: String): String {
val stdout = java.io.ByteArrayOutputStream()
exec {
workingDir = file(workPath)
commandLine(cmd.split(" "))
standardOutput = stdout
}
return stdout.toString().trim()
}
if (!file(buildLogicPath).exists()) {
println("Init build logic...")
//clone build logic to BuildLogic dir
val result = execCmd(
".",
"git clone -b main https://github.com/TW-Smart-CoE/BuildLogic.git $buildLogicPath"
)
if (result.isNotEmpty()) {
println(result)
}
println("Build logic init success")
} else {
println("Update build logic...")
val result = execCmd(buildLogicPath, "git pull")
if (result.isNotEmpty()) {
println(result)
}
println("Update build logic success")
}
}
val buildLogicPath = createBuildLogicPath()
initBuildLogic(buildLogicPath)
includeBuild(buildLogicPath)
repositories {
gradlePluginPortal()
google()
mavenCentral()
maven("https://jitpack.io")
mavenLocal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
mavenLocal()
if (readConfig("MAVEN_REPO").isNotEmpty()) {
maven {
url = uri(readConfig("MAVEN_REPO"))
isAllowInsecureProtocol = true
credentials {
username = readConfig("MAVEN_USER")
password = readConfig(("MAVEN_PWD"))
}
}
} else {
System.err.println("Please config your private Maven repo!")
}
}
versionCatalogs {
create("libs") {
from("io.github.ssseasonnn:VersionCatalog:0.0.3")
}
}
}
rootProject.name = "ARK-Android-Feature-Notifications"
include(":app")
include(":feature-notifications")
include(":feature-notifications-api")