1+ import org.gradle.api.plugins.jvm.JvmTestSuite
12import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
23import com.github.jengelman.gradle.plugins.shadow.transformers.PropertiesFileTransformer
34
45plugins {
56 id ' java-library'
7+ id ' jvm-test-suite'
8+ id ' idea'
69 id ' eclipse'
710 id ' maven-publish'
8- id ' com.github.johnrengelman.shadow' version ' 8.1.1'
9- id ' net.minecraftforge.licenser' version ' 1.0.1'
10- id ' net.minecraftforge.gradleutils' version ' [2.3,2.4)'
11+ alias libs. plugins. gradleutils
12+ alias libs. plugins. gitversion
13+ alias libs. plugins. changelog
14+ alias libs. plugins. licenser
15+ alias libs. plugins. shadow
1116}
1217
18+ gradleutils. displayName = ' Renamer'
19+ description = ' A command line tool to rename java class files'
1320group = ' net.minecraftforge'
14- version = gradleutils. getTagOffsetBranchVersion(null , ' master' , ' HEAD' )
21+ version = gitversion. tagOffset
22+
1523println " Version: $version "
1624
1725java {
18- toolchain {
19- languageVersion = JavaLanguageVersion . of(8 )
20- }
26+ toolchain. languageVersion = JavaLanguageVersion . of(8 )
2127 withSourcesJar()
2228}
2329
24- repositories {
25- mavenCentral()
26- maven gradleutils. forgeMaven
27- }
28-
29- dependencies {
30- implementation(libs. jopt. simple)
31- api(libs. srgutils)
32- implementation(libs. bundles. asm)
30+ testing {
31+ suites. named(' test' , JvmTestSuite ) {
32+ useJUnitJupiter(libs. versions. junit)
3333
34- testImplementation(libs. junit. api)
35- testRuntimeOnly(libs. bundles. junit. runtime)
36- testImplementation(libs. powermock)
34+ dependencies {
35+ implementation libs. junit. api
36+ runtimeOnly. bundle libs. bundles. junit. runtime
37+ implementation libs. powermock
38+ }
3739
38- compileOnly(libs. nulls)
40+ targets. configureEach {
41+ testTask. configure {
42+ testLogging {
43+ events ' passed' , ' skipped' , ' failed'
44+ }
45+ }
46+ }
47+ }
3948}
4049
41- tasks. named(' test' , Test ). configure {
42- useJUnitPlatform()
43- testLogging {
44- events ' passed' , ' skipped' , ' failed'
45- }
50+ dependencies {
51+ compileOnly libs. annotations. jetbrains
52+
53+ implementation libs. jopt
54+ api libs. srgutils
55+ implementation libs. bundles. asm
4656}
4757
48- tasks. named(' jar' , Jar ). configure {
58+ tasks. named(' jar' , Jar ) {
4959 manifest {
50- attributes(' Main-Class' : ' net.minecraftforge.fart .Main' )
60+ attributes(' Main-Class' : ' net.minecraftforge.renamer .Main' )
5161 attributes([
52- ' Specification-Title' : ' ForgeAutoRenamingTool ' ,
53- ' Specification-Vendor' : ' Forge Development LLC ' ,
54- ' Specification-Version' : gradleutils . gitInfo . tag,
55- ' Implementation-Title' : ' ForgeAutoRenamingTool ' ,
56- ' Implementation-Version' : project. version,
57- ' Implementation-Vendor' : ' Forge Development LLC '
62+ ' Specification-Title' : ' Renamer ' ,
63+ ' Specification-Vendor' : gradleutils . vendor . get() ,
64+ ' Specification-Version' : gitversion . info . tag,
65+ ' Implementation-Title' : ' Renamer ' ,
66+ ' Implementation-Version' : project. version,
67+ ' Implementation-Vendor' : gradleutils . vendor . get()
5868 ], ' net/minecraftforge/fart/' )
5969 }
6070}
6171
62- tasks. named(' shadowJar' , ShadowJar ). configure {
63- manifest {
64- attributes(' Main-Class' : ' net.minecraftforge.fart.Main' )
65- attributes([
66- ' Specification-Title' : ' ForgeAutoRenamingTool' ,
67- ' Specification-Vendor' : ' Forge Development LLC' ,
68- ' Specification-Version' : gradleutils. gitInfo. tag,
69- ' Implementation-Title' : ' ForgeAutoRenamingTool' ,
70- ' Implementation-Version' : project. version,
71- ' Implementation-Vendor' : ' Forge Development LLC'
72- ], ' net/minecraftforge/fart/' )
73- }
72+ tasks. named(' shadowJar' , ShadowJar ) {
73+ enableAutoRelocation = true
74+ relocationPrefix = ' net.minecraftforge.renamer.relocated'
7475
7576 minimize()
7677
77- final List<String > relocations = [
78- ' org.objectweb.asm' ,
79- ' net.minecraftforge.srgutils' ,
80- ' joptsimple'
81- ]
82-
83- relocations. each {
84- relocate it, " net.minecraftforge.fart.relocated.$it "
85- }
86-
8778 // Rewrite JOpt's message files, so that help text is displayed nicely.
8879 transform(PropertiesFileTransformer ) {
89- paths = [ ' Messages.properties$' ]
90- keyTransformer = { key -> " net.minecraftforge.fart .relocated.$key " . toString() }
80+ paths = [' Messages.properties$' ]
81+ keyTransformer = { key -> " net.minecraftforge.renamer .relocated.$key " . toString() }
9182 }
9283}
9384
94- tasks. named(' assemble' ). configure {
95- dependsOn ' shadowJar'
96- }
97-
98- tasks. named(' compileJava' , JavaCompile ). configure {
99- options. encoding = ' UTF-8'
100- }
101-
10285changelog {
10386 from ' 0.1'
10487}
@@ -110,25 +93,26 @@ license {
11093}
11194
11295publishing {
96+ repositories {
97+ maven gradleutils. publishingForgeMaven
98+ }
99+
113100 publications. register(' mavenJava' , MavenPublication ) {
101+ suppressAllPomMetadataWarnings()
114102 from components. java
115103
116104 pom {
117- name = ' Forge Auto Renaming Tool '
105+ name = ' Renamer '
118106 description = ' A tool that renames java bytecode elements.'
119- url = ' https://github.com/MinecraftForge/ForgeAutoRenamingTool '
107+ url = ' https://github.com/MinecraftForge/renamer '
120108
121- gradleutils. pom. setGitHubDetails (pom, ' ForgeAutoRenamingTool ' )
109+ gradleutils. pom. addRemoteDetails (pom)
122110
123- license gradleutils.pom.Licenses .LGPLv2_1
111+ license gradleutils.pom.licenses .LGPLv2_1
124112
125113 developers {
126- developer gradleutils.pom.Developers .LexManos
114+ developer gradleutils.pom.developers .LexManos
127115 }
128116 }
129117 }
130-
131- repositories {
132- maven gradleutils. publishingForgeMaven
133- }
134118}
0 commit comments