-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
75 lines (66 loc) · 2.89 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
import java.time.Instant
import java.util.Properties
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.ksp) apply false
}
val localProperties = Properties()
localProperties.load(rootProject.projectDir.resolve("local.properties").inputStream())
subprojects {
apply(plugin = "maven-publish")
project.ext["publish.enable"] = (localProperties["publish.enable"] as String?)?.toBoolean()
?: false
project.ext["publish.version"] = localProperties["publish.version"]
?: "0.0.1"
project.ext["build.number"] = System.getenv("GITHUB_RUN_NUMBER")?.toInt()
?: Instant.now().epochSecond.toInt()
project.ext["publish.user"] = localProperties["publish.user"]
?: System.getenv("GITHUB_ACTOR")
project.ext["publish.token"] = localProperties["publish.token"]
?: System.getenv("GITHUB_TOKEN")
afterEvaluate {
if (
this.plugins.hasPlugin(libs.plugins.android.application.get().pluginId) ||
this.plugins.hasPlugin(libs.plugins.android.library.get().pluginId)
) {
// 하위 모듈의 단위 테스트 보고서를 프로젝트 루트의 보고서 디렉토리로 출력.
extensions.getByType<com.android.build.gradle.BaseExtension>()
.testOptions.unitTests.all {
it.useJUnitPlatform()
it.reports.html.outputLocation =
file("${rootProject.projectDir}/build/reports/${project.name}")
}
}
if (this.plugins.hasPlugin(libs.plugins.android.library.get().pluginId)) {
extensions.getByType<PublishingExtension>().run {
publications {
create<MavenPublication>("GitHubPackages") {
groupId = "com.github.hemoptysisheart.android"
artifactId = project.name
version = project.ext["publish.version"] as String
afterEvaluate {
from(components["release"])
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/hemoptysisheart/packages")
credentials {
username = project.ext["publish.user"] as String?
password = project.ext["publish.token"] as String?
}
}
}
}
}
}
}
tasks.register<Delete>("clean") {
delete("${rootProject.projectDir}/build")
}