-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
133 lines (118 loc) · 3.93 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
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
import java.nio.file.Path
import java.nio.file.StandardOpenOption
import java.text.SimpleDateFormat
import java.time.Instant
import java.util.*
import kotlin.io.path.Path
import kotlin.io.path.inputStream
plugins {
eclipse
idea
java
`maven-publish`
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
idea {
module {
isDownloadSources = true
isDownloadJavadoc = true
}
}
eclipse {
classpath {
isDownloadSources = true
isDownloadJavadoc = true
}
}
val projectPath: Path = project.projectDir.toPath()
val buildConfig: Properties = Properties().apply {
Path("build.properties").inputStream(StandardOpenOption.READ).use(::load)
}
val license: String = buildConfig["license"] as String
val buildNumber: Int = System.getenv("CI_PIPELINE_IID")?.toIntOrNull() ?: 0
val buildTime: Instant = Instant.now()
version = "${libs.versions.materialColorUtils.get()}.$buildNumber"
group = buildConfig["group"] as String
base.archivesName = "material-color-utils"
repositories {
mavenCentral()
google()
}
dependencies {
implementation(libs.annotations)
}
tasks {
jar {
manifest.attributes.apply {
this["Specification-Title"] = "Material Color Utils"
this["Specification-Vendor"] = "Google LLC"
this["Specification-Version"] = "1"
this["Implementation-Title"] = "material-color-utils"
this["Implementation-Vendor"] = "Karma Krafts"
this["Implementation-Version"] = project.version
this["Implementation-Timestamp"] = SimpleDateFormat.getDateTimeInstance().format(Date.from(buildTime))
}
}
val classes by getting
val sourcesJar = create<Jar>("sourcesJar") {
from(sourceSets.main.get().allSource)
dependsOn(classes)
archiveClassifier = "sources"
}
System.getenv("CI_API_V4_URL")?.let { apiUrl ->
publishing {
repositories {
maven {
url = uri("${apiUrl.replace("http://", "https://")}/projects/267/packages/maven")
name = "GitLab"
credentials(HttpHeaderCredentials::class) {
name = "Job-Token"
value = System.getenv("CI_JOB_TOKEN")
}
authentication {
create("header", HttpHeaderAuthentication::class)
}
}
}
publications {
create<MavenPublication>("materialColorUtils") {
groupId = project.group as String
artifactId = project.base.archivesName.get()
version = project.version as String
artifact(jar)
artifact(sourcesJar)
pom {
name = artifactId
url = "https://git.karmakrafts.dev/kk/${project.name}"
scm {
url = [email protected]
}
issueManagement {
system = "gitlab"
url = "https://git.karmakrafts.dev/kk/${project.name}/issues"
}
licenses {
license {
name = license
distribution = "repo"
}
}
developers {
developer {
id = "kitsunealex"
name = "KitsuneAlex"
url = "https://git.karmakrafts.dev/KitsuneAlex"
}
}
}
}
}
}
}
}