11plugins {
2- id ' net.minecrell.licenser' version ' 0.4'
3- id ' org.ajoberstar.grgit' version ' 3.0.0'
4- id ' com.github.johnrengelman.shadow' version ' 2.0.4'
5- id ' com.github.ben-manes.versions' version ' 0.22.0'
2+ id ' java'
3+ id ' maven-publish'
4+ alias libs. plugins. changelog
5+ alias libs. plugins. gitversion
6+ alias libs. plugins. gradleutils
7+ alias libs. plugins. licenser
8+ alias libs. plugins. shadow
69}
710
8- apply plugin : ' java'
9- apply plugin : ' eclipse'
10- apply plugin : ' maven'
11- apply plugin : ' maven-publish'
12-
11+ gradleutils. displayName = ' MergeTool'
12+ description = ' Merges two jar files together, useful for rebuilding Retroguard stripped jars.'
1313group = ' net.minecraftforge'
14- version = gitVersion()
15- targetCompatibility = sourceCompatibility = compileJava . sourceCompatibility = compileJava . targetCompatibility = ' 1.8 '
14+ version = gitversion . tagOffset
15+ println " Version: $v ersion "
1616
17- repositories {
18- mavenCentral()
17+ java {
18+ toolchain. languageVersion = JavaLanguageVersion . of(8 )
19+ withSourcesJar()
1920}
2021
21- def gitVersion () {
22- def raw = grgit. describe(longDescr : true , tags :true )
23- def desc = (raw == null ? ' 0.0-0-unknown' : grgit. describe(longDescr : true , tags :true )). split(' -' ) as List
24- def hash = desc. remove(desc. size() - 1 )
25- def offset = desc. remove(desc. size() - 1 )
26- def tag = desc. join(' -' )
27- def branch = grgit. branch. current(). name
28- if (tag. startsWith(branch))
29- branch = ' master'
30- return " ${ tag} .${ offset}${ t -> if (branch != 'master') t << '-' + branch} "
22+ repositories {
23+ mavenCentral()
3124}
3225
3326license {
@@ -36,19 +29,26 @@ license {
3629 newLine false
3730}
3831
39- jar {
40- manifest. attributes( ' Main-Class ' : ' net.minecraftforge.mergetool.ConsoleMerger ' )
41- manifest . attributes(' Implementation-Version ' : project . version)
42- }
43- shadowJar {
44- classifier ' fatjar '
45- manifest . attributes( ' Main-Class ' : ' net. minecraftforge. mergetool.ConsoleMerger ' )
46- manifest . attributes( ' Implementation-Version ' : project . version)
32+ tasks . named( ' jar' , Jar ) {
33+ manifest {
34+ attributes([
35+ ' Main-Class ' : ' net.minecraftforge.mergetool.ConsoleMerger ' ,
36+ ' Automatic-Module-Name ' : ' net.minecraftforge.mergetool '
37+ ])
38+ gradleutils . manifestDefaults(it, ' net/ minecraftforge/ mergetool/ ' )
39+ }
4740}
48- task sourcesJar (type : Jar ) {
49- classifier = ' sources'
50- from sourceSets. main. allSource
41+ tasks. named(' shadowJar' , com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar ) {
42+ archiveClassifier = ' fatjar'
43+ manifest {
44+ attributes([
45+ ' Main-Class' : ' net.minecraftforge.mergetool.ConsoleMerger' ,
46+ ' Automatic-Module-Name' : ' net.minecraftforge.mergetool'
47+ ])
48+ gradleutils. manifestDefaults(it, ' net/minecraftforge/mergetool/' )
49+ }
5150}
51+ /*
5252task cpwFML(type: Jar) {
5353 classifier 'cpw'
5454 from (sourceSets.main.output) {
@@ -67,74 +67,41 @@ task forgeAPI(type: Jar) {
6767 include 'net/minecraftforge/api/distmarker/**'
6868 }
6969}
70- artifacts {
71- archives jar
72- archives sourcesJar
73- archives shadowJar
74- archives cpwFML
75- archives forgeFML
76- archives forgeAPI
77- }
70+ */
7871
7972dependencies {
80- implementation ' org.ow2.asm:asm:6.0'
81- implementation ' org.ow2.asm:asm-tree:6.0'
82- implementation ' org.ow2.asm:asm-util:6.0'
83- implementation ' net.sf.jopt-simple:jopt-simple:5.0.4'
73+ implementation libs. bundles. asm
74+ implementation libs. jopt
8475}
8576
86- configurations { deployJars }
87-
8877publishing {
78+ repositories {
79+ maven gradleutils. publishingForgeMaven
80+ }
8981 publications {
9082 mavenJava(MavenPublication ) {
91- from components. java
92- artifact sourcesJar
93- artifact shadowJar
83+ from components. shadow
84+ changelog. publish(it)
85+ gradleutils. promote(it)
86+ /*
9487 artifact cpwFML
9588 artifact forgeFML
9689 artifact forgeAPI
90+ */
9791
98- pom {
99- name = ' MergeTool'
100- description = ' Merges two jar files together, useful for rebuilding Retroguard stripped jars.'
101- url = ' https://github.com/MinecraftForge/MergeTool'
102- scm {
103- url = ' https://github.com/MinecraftForge/MergeTool'
104- connection = ' scm:git:git://github.com/MinecraftForge/MergeTool.git'
105- developerConnection = ' scm:git:git@github.com:MinecraftForge/MergeTool.git'
106- }
107- issueManagement {
108- system = ' github'
109- url = ' https://github.com/MinecraftForge/MergeTool/issues'
110- }
92+ pom { pom ->
93+ name = gradleutils. displayName
94+ description = project. description
95+
96+ gradleutils. pom. addRemoteDetails(pom)
11197
11298 licenses {
113- license {
114- name = ' LGPLv2.1'
115- url = ' https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt'
116- }
99+ license gradleutils.pom.licenses.LGPLv2_1
117100 }
118101
119102 developers {
120- developer {
121- id = ' LexManos'
122- name = ' Lex Manos'
123- }
124- }
125- }
126- }
127- }
128- repositories {
129- maven {
130- if (project. hasProperty(' forgeMavenPassword' )) {
131- credentials {
132- username project. properties. forgeMavenUser
133- password project. properties. forgeMavenPassword
103+ developer gradleutils.pom.developers.LexManos
134104 }
135- url ' https://files.minecraftforge.net/maven/manage/upload'
136- } else {
137- url ' file://' + rootProject. file(' repo' ). getAbsolutePath()
138105 }
139106 }
140107 }
0 commit comments