-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle.kts
95 lines (83 loc) · 3.43 KB
/
build.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
import java.util.Properties
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.7.2" apply false
id("com.android.library") version "8.7.2" apply false
id("org.jetbrains.kotlin.android") version "2.0.21" apply false
id("org.jetbrains.kotlin.plugin.serialization") version "2.0.21" apply false
id("com.google.devtools.ksp") version "2.0.21-1.0.25" apply false
}
/**
* Note: To configure GitHub credentials, you have to generate an access token with at least
* `read:packages` scope at https://github.com/settings/tokens/new and then
* add it to any of the following:
* <ul>
* <li>Add `githubUsername` and `githubAccessToken` to Global Gradle Properties</li>
* <li>Set `GITHUB_USERNAME` and `GITHUB_ACCESS_TOKEN` in your environment variables</li>
* <li>Create a `github.properties` file in your project folder with the following content:</li>
* </ul>
*
* <pre>
* githubUsername=<YOUR_GITHUB_USERNAME>
* githubAccessToken=<YOUR_GITHUB_ACCESS_TOKEN>
* </pre>
*/
val githubProperties = Properties().apply {
rootProject.file("github.properties").takeIf { it.exists() }?.inputStream()?.use { load(it) }
}
val githubUsername: String = rootProject.findProperty("githubUsername") as String? // Global Gradle Properties
?: githubProperties.getProperty("githubUsername") // github.properties file
?: System.getenv("GITHUB_USERNAME") // Environment Variables
?: error("GitHub username not found")
val githubAccessToken: String = rootProject.findProperty("githubAccessToken") as String? // Global Gradle Properties
?: githubProperties.getProperty("githubAccessToken") // github.properties file
?: System.getenv("GITHUB_ACCESS_TOKEN") // Environment Variables
?: error("GitHub Access Token not found")
allprojects {
repositories {
google()
mavenLocal()
mavenCentral()
maven { url = uri("https://jitpack.io") }
maven {
url = uri("https://maven.pkg.github.com/tribalfs/sesl-androidx")
credentials {
username = githubUsername
password = githubAccessToken
}
}
maven {
url = uri("https://maven.pkg.github.com/tribalfs/sesl-material-components-android")
credentials {
username = githubUsername
password = githubAccessToken
}
}
maven {
url = uri("https://maven.pkg.github.com/tribalfs/oneui-design")
credentials {
username = githubUsername
password = githubAccessToken
}
}
}
}
subprojects {
afterEvaluate {
if (plugins.hasPlugin("com.android.application")) {
val oneUiDesignVersion = project.configurations.getByName("implementation").dependencies.find {
it.group == "io.github.tribalfs" && it.name == "oneui-design" }?.version
extensions.configure<com.android.build.gradle.BaseExtension> {
defaultConfig {
buildConfigField("String", "ONEUI_DESIGN_VERSION", "\"$oneUiDesignVersion\"")
}
buildTypes.all{
buildConfigField("String", "ONEUI_DESIGN_VERSION", "\"$oneUiDesignVersion\"")
}
}
}
}
}
tasks.register<Delete>("clean") {
delete(layout.buildDirectory)
}