@@ -4,42 +4,46 @@ plugins {
44 id ' java-library'
55 id ' idea'
66 id ' maven-publish'
7- id ' net.minecraftforge.licenser' version ' 1.0.1'
8- id ' net.minecraftforge.gradleutils' version ' 2.3.6'
9- id ' com.github.johnrengelman.shadow' version ' 8.1.1'
10- }
11-
12- repositories {
13- mavenCentral()
7+ alias libs. plugins. licenser
8+ alias libs. plugins. gradleutils
9+ alias libs. plugins. shadow
1410}
1511
12+ final projectDisplayName = ' Java Version'
13+ final projectVendor = ' Forge Development LLC'
14+ description = ' Java Version management using Disco'
1615group = ' net.minecraftforge'
16+ version = gitversion. tagOffset
1717
18- version = gradleutils. tagOffsetVersion
19- println (' Version: ' + version)
18+ println " Version: $version "
19+
20+ java {
21+ // Currently JOpt is the limiting, requiring java 8
22+ // But also toolchains don't support building for anything lower then 8
23+ toolchain. languageVersion = JavaLanguageVersion . of 8
24+ withSourcesJar()
25+ }
2026
21- tasks. register(' createJavaProbeClass' , buildsrc.ClassGeneratorTask ) { }
27+ tasks. register(' createJavaProbeClass' , buildsrc.ClassGeneratorTask )
2228
2329tasks. register(' javaProbeJar' , Jar ) {
2430 destinationDirectory = layout. buildDirectory. dir(' libs' )
2531 archiveBaseName = project. name
2632 archiveClassifier = ' probe'
33+
2734 manifest {
2835 attributes([
29- ' Main-Class' : ' JavaProbe'
30- ] as LinkedHashMap )
31- attributes([
32- ' Main-Class' : ' JavaProbe' ,
33- ' Specification-Title' : ' Java Probe' ,
34- ' Specification-Vendor' : ' Forge Development LLC' ,
35- ' Specification-Version' : gradleutils. gitInfo. tag,
36- ' Implementation-Title' : ' javaprobe' ,
37- ' Implementation-Vendor' : ' Forge Development LLC' ,
36+ ' Main-Class' : ' JavaProbe' ,
37+ ' Specification-Title' : ' Java Probe' ,
38+ ' Specification-Vendor' : projectVendor,
39+ ' Specification-Version' : gitversion. info. tag,
40+ ' Implementation-Title' : ' javaprobe' ,
41+ ' Implementation-Vendor' : projectVendor,
3842 ' Implementation-Version' : project. version
39- ] as LinkedHashMap )
43+ ])
4044 }
4145
42- from( createJavaProbeClass. outputFile)
46+ from createJavaProbeClass. outputs . files
4347}
4448
4549dependencies {
@@ -50,85 +54,69 @@ dependencies {
5054}
5155
5256license {
53- header project . file(' LICENSE-header.txt' )
57+ header rootProject . file(' LICENSE-header.txt' )
5458 newLine false
5559}
5660
57- java {
58- // Currently JOpt is the limiting, requiring java 8
59- // But also toolchains don't support building for anything lower then 8
60- toolchain. languageVersion = JavaLanguageVersion . of(8 )
61- withSourcesJar()
62- }
63-
64- tasks. named(' shadowJar' , ShadowJar ) {
65- final String reloc = ' net.minecraftforge.java_version.reloc.'
66- relocate ' joptsimple' , reloc + ' jopt'
67- relocate ' com.google.gson' , reloc + ' gson'
68- relocate ' org.kamranzafar.jtar' , reloc + ' jtar'
69- }
70-
7161tasks. named(' jar' , Jar ) {
7262 manifest {
7363 attributes([
74- ' Main-Class' : ' net.minecraftforge.java_version.Main' ,
64+ ' Main-Class' : ' net.minecraftforge.java_version.Main' ,
7565 ' Automatic-Module-Name' : ' net.minecraftforge.java_version' ,
76- ' Sealed' : true
77- ] as LinkedHashMap )
66+ ' Sealed' : true
67+ ])
7868 attributes([
79- ' Specification-Title' : ' Java Version ' ,
80- ' Specification-Vendor' : ' Forge Development LLC ' ,
81- ' Specification-Version' : gradleutils . gitInfo . tag,
82- ' Implementation-Title' : ' Java Version ' ,
83- ' Implementation-Vendor' : ' Forge Development LLC ' ,
69+ ' Specification-Title' : projectDisplayName ,
70+ ' Specification-Vendor' : projectVendor ,
71+ ' Specification-Version' : gitversion . info . tag,
72+ ' Implementation-Title' : projectDisplayName ,
73+ ' Implementation-Vendor' : projectVendor ,
8474 ' Implementation-Version' : project. version
85- ] as LinkedHashMap , ' net/minecraftforge/java_version/' )
75+ ], ' net/minecraftforge/java_version/' )
8676 }
87- from(createJavaProbeClass. outputFile)
77+
78+ from createJavaProbeClass. outputs. files
8879}
8980
90- tasks. named(' compileJava' , JavaCompile ) {
91- dependsOn javaProbeJar
81+ tasks. named(' shadowJar' , ShadowJar ) {
82+ enableRelocation = true
83+ relocationPrefix = ' net.minecraftforge.java_version.shadow'
84+ }
85+
86+ tasks. withType(JavaCompile ). configureEach {
9287 options. encoding = ' UTF-8'
9388}
9489
9590changelog {
9691 from ' 1.0'
9792}
9893
99- artifacts {
100- // archives javaProbeJar
101- }
102-
10394publishing {
104- publications. register(' mavenJava' , MavenPublication ). configure {
105- artifactId = project. name
95+ publications. register(' mavenJava' , MavenPublication ) {
10696 from components. java
107- artifact(javaProbeJar)
10897
109- pom {
110- name = project. name
111- description = ' Minecraft Maven Repo Generator'
112- url = ' https://github.com/MinecraftForge/java-version'
98+ artifactId = project. name
99+ artifact javaProbeJar
100+
101+ pom { pom ->
102+ name = projectDisplayName
103+ description = project. description
113104
114- gradleutils. pom. setGitHubDetails(pom, ' java-version ' )
105+ gradleutils. pom. setGitHubDetails pom
115106
116- license gradleutils.pom.licenses.LGPLv2_1
107+ licenses {
108+ license gradleutils.pom.licenses.LGPLv2_1
109+ }
117110
118111 developers {
119- developer gradleutils.pom.Developers .LexManos
112+ developer gradleutils.pom.developers .LexManos
120113 }
121114 }
122115 }
116+
123117 repositories {
124118 maven gradleutils. publishingForgeMaven
125119 }
126120}
127121
128- idea {
129- module {
130- // IntelliJ IDEA does not do this by itself anymore...
131- downloadJavadoc = true
132- downloadSources = true
133- }
134- }
122+ idea. module { downloadJavadoc = downloadSources = true }
0 commit comments