Skip to content

Commit 7f597f0

Browse files
authored
Gradle 8.4, GH Action, minor cleanup and optimisations (#29)
1 parent cb83c6a commit 7f597f0

38 files changed

+164
-259
lines changed

.github/workflows/gradle_publish_on_push.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
uses: MinecraftForge/SharedActions/.github/workflows/gradle.yml@main
13+
with:
14+
java: 8
15+
gradle_tasks: "publish"
16+
artifact_name: "ForgeAutoRenamingTool"
17+
secrets:
18+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
19+
PROMOTE_ARTIFACT_WEBHOOK: ${{ secrets.PROMOTE_ARTIFACT_WEBHOOK }}
20+
PROMOTE_ARTIFACT_USERNAME: ${{ secrets.PROMOTE_ARTIFACT_USERNAME }}
21+
PROMOTE_ARTIFACT_PASSWORD: ${{ secrets.PROMOTE_ARTIFACT_PASSWORD }}
22+
MAVEN_USER: ${{ secrets.MAVEN_USER }}
23+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

Jenkinsfile

Lines changed: 0 additions & 85 deletions
This file was deleted.
File renamed without changes.

build.gradle

Lines changed: 78 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,29 @@
1-
buildscript {
2-
repositories {
3-
mavenCentral()
4-
maven { url = 'https://maven.minecraftforge.net/' }
5-
}
6-
dependencies {
7-
classpath group: 'net.minecraftforge.gradleutils', name: 'GradleUtils', version: '2.+', changing: true
8-
}
9-
}
1+
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
import net.minecraftforge.gradleutils.PomUtils
103

114
plugins {
125
id 'java-library'
136
id 'eclipse'
147
id 'maven-publish'
158
id 'org.cadixdev.licenser' version '0.6.1'
16-
id 'com.github.johnrengelman.shadow' version '7.0.0'
9+
id 'com.github.johnrengelman.shadow' version '8.1.1'
10+
id 'net.minecraftforge.gradleutils' version '2.+'
1711
}
18-
apply plugin: 'net.minecraftforge.gradleutils'
1912

20-
group 'net.minecraftforge'
13+
group = 'net.minecraftforge'
2114
version = gradleutils.getTagOffsetBranchVersion(null, 'master', 'HEAD')
22-
println('Version: ' + version)
23-
24-
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
25-
compileJava.options.encoding = 'UTF-8'
15+
println "Version: $version"
2616

27-
ext {
28-
CHANGELOG = rootProject.file('build/changelog.txt')
29-
REPO = 'ForgeAutoRenamingTool'
30-
TITLE = 'Forge Auto Renaming Tool'
31-
MANIFEST = manifest{
32-
attributes('Main-Class': 'net.minecraftforge.fart.Main')
33-
attributes([
34-
'Specification-Title': 'ForgeAutoRenamingTool',
35-
'Specification-Vendor': 'Forge Development LLC',
36-
'Specification-Version': gradleutils.gitInfo.tag,
37-
'Implementation-Title': 'SimpleInstaller',
38-
'Implementation-Version': project.version,
39-
'Implementation-Vendor': 'Forge Development LLC'
40-
] as LinkedHashMap, 'net/minecraftforge/fart/')
17+
java {
18+
toolchain {
19+
languageVersion = JavaLanguageVersion.of(8)
4120
}
42-
INITIAL_CHANGELOG_TAG = '0.1'
21+
withSourcesJar()
4322
}
4423

4524
repositories {
4625
mavenCentral()
47-
maven { url = 'https://maven.minecraftforge.net/' }
48-
}
49-
50-
test {
51-
useJUnitPlatform()
52-
}
53-
54-
license {
55-
header = file('LICENSE-header.txt')
56-
ext.project = TITLE
26+
maven gradleutils.forgeMaven
5727
}
5828

5929
dependencies {
@@ -63,79 +33,98 @@ dependencies {
6333
implementation 'org.ow2.asm:asm-commons:9.5'
6434
implementation 'org.ow2.asm:asm-tree:9.5'
6535

66-
testImplementation(platform('org.junit:junit-bom:5.8.1'))
67-
testImplementation('org.junit.jupiter:junit-jupiter')
68-
testImplementation('org.powermock:powermock-core:2.0.9')
36+
testImplementation platform('org.junit:junit-bom:5.8.1')
37+
testImplementation 'org.junit.jupiter:junit-jupiter'
38+
testImplementation 'org.powermock:powermock-core:2.0.9'
6939

7040
compileOnly 'org.jetbrains:annotations:24.0.1'
7141
}
7242

43+
tasks.named('test', Test).configure {
44+
useJUnitPlatform()
45+
testLogging {
46+
events 'passed', 'skipped', 'failed'
47+
}
48+
}
7349

74-
test {
75-
useJUnitPlatform()
76-
testLogging {
77-
events 'passed', 'skipped', 'failed'
78-
}
50+
tasks.named('jar', Jar).configure {
51+
manifest {
52+
attributes('Main-Class': 'net.minecraftforge.fart.Main')
53+
attributes([
54+
'Specification-Title': 'ForgeAutoRenamingTool',
55+
'Specification-Vendor': 'Forge Development LLC',
56+
'Specification-Version': gradleutils.gitInfo.tag,
57+
'Implementation-Title': 'ForgeAutoRenamingTool',
58+
'Implementation-Version': project.version,
59+
'Implementation-Vendor': 'Forge Development LLC'
60+
], 'net/minecraftforge/fart/')
61+
}
7962
}
8063

81-
java.withSourcesJar()
64+
tasks.named('shadowJar', ShadowJar).configure {
65+
manifest {
66+
attributes('Main-Class': 'net.minecraftforge.fart.Main')
67+
attributes([
68+
'Specification-Title': 'ForgeAutoRenamingTool',
69+
'Specification-Vendor': 'Forge Development LLC',
70+
'Specification-Version': gradleutils.gitInfo.tag,
71+
'Implementation-Title': 'ForgeAutoRenamingTool',
72+
'Implementation-Version': project.version,
73+
'Implementation-Vendor': 'Forge Development LLC'
74+
], 'net/minecraftforge/fart/')
75+
}
8276

83-
shadowJar {
84-
manifest.from(MANIFEST)
8577
minimize()
8678

87-
def relocations = [
79+
final List<String> relocations = [
8880
'org.objectweb.asm',
8981
'net.minecraftforge.srgutils',
9082
'joptsimple'
9183
]
9284

93-
relocations.forEach {
85+
relocations.each {
9486
relocate it, "net.minecraftforge.fart.relocated.$it"
9587
}
9688
}
9789

98-
assemble.dependsOn shadowJar
90+
tasks.named('assemble').configure {
91+
dependsOn 'shadowJar'
92+
}
93+
94+
tasks.named('compileJava', JavaCompile).configure {
95+
options.encoding = 'UTF-8'
96+
}
97+
98+
changelog {
99+
fromTag '0.1'
100+
}
101+
102+
license {
103+
header = file('LICENSE-header.txt')
104+
newLine = false
105+
exclude '**/*.properties'
106+
}
99107

100108
publishing {
101-
publications {
102-
mavenJava(MavenPublication) {
103-
from components.java
104-
pom {
105-
name = TITLE
106-
description = 'A tool that renames java bytecode elements.'
107-
url = "https://github.com/MinecraftForge/${REPO}"
108-
scm {
109-
url = "https://github.com/MinecraftForge/${REPO}"
110-
connection = "scm:git:git://github.com/MinecraftForge/${REPO}.git"
111-
developerConnection = "scm:git:[email protected]:MinecraftForge/${REPO}.git"
112-
}
113-
issueManagement {
114-
system = 'github'
115-
url = "https://github.com/MinecraftForge/${REPO}/issues"
116-
}
117-
118-
licenses {
119-
license {
120-
name = 'LGPLv2.1'
121-
url = 'https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt'
122-
}
123-
}
124-
125-
developers {
126-
developer {
127-
id = 'LexManos'
128-
name = 'LexManos'
129-
}
130-
}
109+
publications.register('mavenJava', MavenPublication) {
110+
from components.java
111+
112+
pom {
113+
name = 'Forge Auto Renaming Tool'
114+
description = 'A tool that renames java bytecode elements.'
115+
url = 'https://github.com/MinecraftForge/ForgeAutoRenamingTool'
116+
117+
PomUtils.setGitHubDetails(pom, 'ForgeAutoRenamingTool')
118+
119+
license PomUtils.Licenses.LGPLv2_1
120+
121+
developers {
122+
developer PomUtils.Developers.LexManos
131123
}
132124
}
133125
}
126+
134127
repositories {
135128
maven gradleutils.getPublishingForgeMaven()
136129
}
137130
}
138-
139-
changelog {
140-
fromTag INITIAL_CHANGELOG_TAG
141-
}

gradle/wrapper/gradle-wrapper.jar

3.81 KB
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)