-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
83 lines (74 loc) · 2.09 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
ext {
this["compileVersion"] = 31
this["minVersion"] = 21
this["targetVersion"] = 31
this["buildTools"] = "32.0.0"
}
val commonConfigure = project.file("common.gradle.kts")
subprojects {
repositories {
google()
mavenLocal()
maven {
setUrl("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
mavenCentral()
}
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
}
apply(from = commonConfigure)
if (name.startsWith("defensor")) {
pluginManager.withPlugin("maven-publish") {
val GROUP: String by project
val VERSION: String by project
val sonatypeUserName: String by project
val sonatypePassword: String by project
val publishExtension = extensions.getByType<PublishingExtension>()
publishExtension.repositories {
mavenLocal()
maven {
val url = if (VERSION.endsWith("-SNAPSHOT")) {
"https://s01.oss.sonatype.org/content/repositories/snapshots/"
} else {
"https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}
setUrl(url)
credentials {
username = sonatypeUserName
password = sonatypePassword
}
}
}
publishExtension.publications.whenObjectAdded {
check(this is MavenPublication) {
"unexpected publication $this"
}
groupId = GROUP
version = VERSION
pom {
url.set("https://github.com/porum/Defensor")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("porum")
name.set("guobao.sun")
email.set("[email protected]")
}
}
scm {
url.set("https://github.com/porum/Defensor.git")
}
}
}
}
}
}
tasks.register<Delete>("clean") {
delete(rootProject.buildDir)
}