Skip to content

Commit a855127

Browse files
committed
Signing, change maven group, bump version.
1 parent ca4f444 commit a855127

File tree

1 file changed

+54
-3
lines changed

1 file changed

+54
-3
lines changed

build.gradle

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
plugins {
22
id 'java-library'
33
id 'maven-publish'
4+
id 'signing'
45
}
56

67
java {
78
toolchain {
89
languageVersion = JavaLanguageVersion.of(8)
910
}
1011
withSourcesJar()
12+
withJavadocJar()
1113
}
1214

13-
group "codechicken"
14-
version = '3.2.0'
15+
group "io.codechicken"
16+
version = '4.0.0'
1517
archivesBaseName = 'ChickenASM'
1618

1719
version = "$version." + (System.getenv("BUILD_NUMBER") ?: "1")
@@ -38,6 +40,7 @@ dependencies {
3840

3941
jar {
4042
manifest {
43+
attributes 'FMLModType': 'GAMELIBRARY'
4144
attributes 'Specification-Title': archivesBaseName
4245
attributes 'Specification-Vendor': 'covers1624'
4346
attributes 'Specification-Version': "1"
@@ -48,6 +51,38 @@ jar {
4851
}
4952
}
5053

54+
tasks.register('signJar') {
55+
dependsOn('jar')
56+
57+
doFirst {
58+
def args = [:]
59+
args['jar'] = jar.archiveFile.get().asFile
60+
if (System.getenv("KEY_STORE")) {
61+
args['keyStore'] = System.getenv("KEY_STORE")
62+
file(System.getenv("KEY_STORE_PROPS")).withReader {
63+
def props = new Properties()
64+
props.load(it)
65+
args.putAll(props)
66+
}
67+
} else if (project.hasProperty('keyStore')) {
68+
args['keyStore'] = project.getProperty('keyStore')
69+
args['alias'] = project.getProperty('keyStoreAlias')
70+
args['storePass'] = project.getProperty('keyStorePass')
71+
args['keyPass'] = project.getProperty('keyStoreKeyPass')
72+
} else {
73+
println "No signing properties."
74+
state.setOutcome(org.gradle.api.internal.tasks.TaskExecutionOutcome.UP_TO_DATE)
75+
didWork = false
76+
return
77+
}
78+
project.ant.invokeMethod('signjar', args)
79+
}
80+
}
81+
82+
javadoc {
83+
options.addBooleanOption("Xdoclint:none", true)
84+
}
85+
5186
publishing {
5287
repositories {
5388
if (System.getenv('MAVEN_PASS')) {
@@ -61,7 +96,7 @@ publishing {
6196
}
6297
}
6398
publications {
64-
publication(MavenPublication) {
99+
ChickenASM(MavenPublication) {
65100
group = rootProject.group
66101
version = rootProject.version
67102
artifactId archivesBaseName
@@ -105,3 +140,19 @@ publishing {
105140
}
106141
}
107142

143+
signing {
144+
if (System.getenv('GPG_PRIVATE_KEY')) {
145+
useInMemoryPgpKeys(
146+
new File(System.getenv('GPG_PRIVATE_KEY')).text,
147+
System.getenv('GPG_PRIVATE_KEY_PASS')
148+
)
149+
} else if (project.hasProperty('gpgPrivateKey')) {
150+
useInMemoryPgpKeys(
151+
new File(project.getProperty('gpgPrivateKey')).text,
152+
project.getProperty('gpgPrivateKeyPass')
153+
)
154+
} else {
155+
return
156+
}
157+
sign publishing.publications.ChickenASM
158+
}

0 commit comments

Comments
 (0)