forked from unbroken-dome/gradle-xjc-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.gradle.kts
49 lines (39 loc) · 1.62 KB
/
publish.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
import org.gradle.api.publish.PublishingExtension
allprojects {
apply(plugin = "maven-publish")
tasks.withType<Javadoc>().configureEach {
options {
this as StandardJavadocDocletOptions
if(JavaVersion.current().isJava8Compatible()) {
addStringOption("Xdoclint:none", "-quiet")
}
if(JavaVersion.current().isJava9Compatible()) {
addBooleanOption("html5", true)
}
}
}
configure<PublishingExtension> {
repositories {
maven {
// Default is Maven buildDirectory publish only
url = uri(layout.buildDirectory.dir("repo"))
}
if(findProperty("doGitHubPackagesPublish") == "true") {
val GITHUB_ACTOR = System.getenv("GITHUB_USERNAME") ?: System.getenv("GITHUB_ACTOR") ?: throw IllegalArgumentException()
val GITHUB_TOKEN = System.getenv("GITHUB_TOKEN") ?: System.getenv("GH_TOKEN") ?: throw IllegalArgumentException()
val GITHUB_REPOSITORY = System.getenv("GITHUB_REPOSITORY")
assert(GITHUB_ACTOR.isNotEmpty() == true)
assert(GITHUB_TOKEN.isNotEmpty() == true)
assert(GITHUB_REPOSITORY.isNotEmpty() == true)
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/${GITHUB_REPOSITORY}")
credentials {
username = GITHUB_ACTOR
password = GITHUB_TOKEN
}
}
}
}
}
}