-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
154 lines (129 loc) · 4.08 KB
/
build.gradle
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import net.neoforged.gradleutils.PomUtilsExtension
plugins {
id 'java'
id 'signing'
id 'maven-publish'
alias libs.plugins.managedversioning
alias libs.plugins.nexuspublish
id 'net.neoforged.gradleutils' version '3.0.0-alpha.11' apply false
}
group = 'org.groovymc'
managedVersioning {
versionFile = rootProject.file('version.properties')
gitHubActions {
register('release') {
prettyName = 'Release'
workflowDispatch = true
gradleJob {
name = 'build'
step {
setupGitUser()
}
readOnly = false
gradlew 'Tag Release', 'tagRelease'
gradlew 'Build', 'build'
step {
run = 'git push && git push --tags'
}
recordVersion 'Record Version', 'version'
}
gradleJob {
name.set 'publish'
needs.add('build')
gradlew 'Publish', 'release', 'closeAndReleaseSonatypeStagingRepository'
tag.set('${{needs.build.outputs.version}}')
secrets 'GPG_SIGNING_KEY', 'GPG_KEY_PASSWORD', 'CENTRAL_MAVEN_USER', 'CENTRAL_MAVEN_PASSWORD'
}
gradleJob {
name.set 'publishPlugins'
needs.add('build')
gradlew 'Publish Plugins', 'publishPlugins'
tag.set('${{needs.build.outputs.version}}')
secrets 'GPG_SIGNING_KEY', 'GPG_KEY_PASSWORD', 'GPP_KEY', 'GPP_SECRET'
}
}
}
apply()
}
println "Building: $version"
nexusPublishing {
repositories {
sonatype {
nexusUrl = uri('https://s01.oss.sonatype.org/service/local/')
username = System.getenv('CENTRAL_MAVEN_USER') ?: ''
password = System.getenv('CENTRAL_MAVEN_PASSWORD') ?: ''
}
}
}
tasks.register('release') {
dependsOn tasks.publish
group 'publishing'
}
final String signingKey = System.getenv('GPG_SIGNING_KEY') ?: ''
final String signingPassword = System.getenv('GPG_KEY_PASSWORD') ?: ''
final boolean hasSigningDetails = !signingKey.isEmpty() && !signingPassword.isEmpty()
sourceSets {
transform {}
}
repositories {
mavenCentral()
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
withSourcesJar()
withJavadocJar()
registerFeature("transform") {
usingSourceSet sourceSets.transform
withSourcesJar()
withJavadocJar()
}
}
dependencies {
transformApi project(':')
transformImplementation libs.asm
testImplementation(project(':')) {
capabilities {
requireCapability("${group}:${name}-transform")
}
}
testImplementation libs.junit.api
testRuntimeOnly libs.junit.engine
}
test {
useJUnitPlatform()
options {
systemProperty('org.groovymc.rootpackagetransformer.testclasses', sourceSets.test.java.classesDirectory.get().asFile.absolutePath)
}
}
final pomUtils = extensions.create('pomUtils', PomUtilsExtension)
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pomUtils.githubRepo(pom, 'GroovyMC', 'RootPackageTransformer')
pomUtils.license(pom, PomUtilsExtension.License.MIT)
pom {
name = 'RootPackageTransformer'
description = 'Transforms bytecode and sources to move marked classes to the root package'
url = 'https://github.com/GroovyMC/RootPackageTransformer'
developers {
developer {
id = 'groovymc'
name = 'GroovyMC'
email = '[email protected]'
url = 'https://github.com/GroovyMC/'
}
}
}
}
}
}
signing {
if (hasSigningDetails) useInMemoryPgpKeys(signingKey, signingPassword)
}
tasks.withType(Sign).configureEach {
onlyIf { hasSigningDetails }
}
signing {
sign publishing.publications.mavenJava
}