-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
101 lines (91 loc) · 3.52 KB
/
Copy pathbuild.gradle
File metadata and controls
101 lines (91 loc) · 3.52 KB
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
plugins {
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
id "maven-publish"
}
allprojects {
group = findProperty("GROUP")
version = findProperty("VERSION_NAME")
}
def loadSigningKey() {
def k = findProperty("signingKey") ?: System.getenv("GPG_SIGNING_KEY")
if (k) return k
def kb64 = findProperty("signingKeyB64") ?: System.getenv("GPG_SIGNING_KEY_B64")
if (kb64) return new String(Base64.decoder.decode(kb64 as String), "UTF-8")
def kfile = findProperty("signingKeyFile") ?: System.getenv("GPG_SIGNING_KEY_FILE")
if (kfile) return new File(kfile as String).getText("UTF-8")
return null
}
subprojects {
apply plugin: "java-library"
apply plugin: "maven-publish"
apply plugin: "signing"
tasks.withType(Jar).configureEach {
from("$rootDir/LICENSE") { into "META-INF" }
if (file("$rootDir/NOTICE").exists()) {
from("$rootDir/NOTICE") { into "META-INF" }
}
}
java {
toolchain { languageVersion = JavaLanguageVersion.of(21) }
withSourcesJar()
withJavadocJar()
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = project.name
description = "Java fixture generator modules: ${project.name}"
url = "https://github.com/romann-broque/java-fixture-generator"
licenses {
license {
name = "Apache-2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0"
}
}
developers {
developer {
id = "ffoissey"
name = "Frédéric Foissey"
email = "ffoissey@users.noreply.github.com"
}
developer {
id = "romann-broque"
name = "Romann Broque"
email = "romann-broque@users.noreply.github.com"
}
}
scm {
url = "https://github.com/romann-broque/java-fixture-generator"
connection = "scm:git:https://github.com/romann-broque/java-fixture-generator.git"
developerConnection = "scm:git:ssh://git@github.com:romann-broque/java-fixture-generator.git"
}
}
}
}
}
signing {
required {
gradle.taskGraph.hasTask(":publishToSonatype") ||
gradle.taskGraph.hasTask(":closeSonatypeStagingRepository")
}
def key = loadSigningKey()
def pass = (findProperty("signingPass") ?: System.getenv("GPG_SIGNING_PASSPHRASE"))
if (key && pass) {
useInMemoryPgpKeys(key, pass)
sign publishing.publications.mavenJava
}
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
packageGroup.set(findProperty("GROUP"))
username = findProperty("sonatypeUsername") ?: System.getenv("SONATYPE_USERNAME")
password = findProperty("sonatypePassword") ?: System.getenv("SONATYPE_PASSWORD")
}
}
}