Skip to content

Commit 0014553

Browse files
committed
Migrate to github actions
Update gradle Add --keep-data to merge options
1 parent e68e1b0 commit 0014553

10 files changed

Lines changed: 111 additions & 222 deletions

File tree

.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: [ "0.2.3" ]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
uses: MinecraftForge/SharedActions/.github/workflows/gradle.yml@v0
13+
with:
14+
java: 17
15+
gradle_tasks: "publish"
16+
artifact_name: "mergetool"
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 & 56 deletions
This file was deleted.

LICENSE-header.txt

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,2 @@
1-
MergeTool
2-
Copyright (c) 2016-2018.
3-
4-
This library is free software; you can redistribute it and/or
5-
modify it under the terms of the GNU Lesser General Public
6-
License as published by the Free Software Foundation version 2.1
7-
of the License.
8-
9-
This library is distributed in the hope that it will be useful,
10-
but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12-
Lesser General Public License for more details.
13-
14-
You should have received a copy of the GNU Lesser General Public
15-
License along with this library; if not, write to the Free Software
16-
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1+
Copyright (c) Forge Development LLC
2+
SPDX-License-Identifier: LGPL-2.1-only

build.gradle

Lines changed: 52 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,26 @@
11
plugins {
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.'
1313
group = 'net.minecraftforge'
14-
version = gitVersion()
15-
targetCompatibility = sourceCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
14+
version = gitversion.tagOffset
15+
println "Version: $version"
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

3326
license {
@@ -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+
/*
5252
task 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

7972
dependencies {
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-
8877
publishing {
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
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

settings.gradle

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1+
plugins {
2+
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
3+
}
4+
15
rootProject.name = 'mergetool'
6+
7+
dependencyResolutionManagement.versionCatalogs.register('libs') {
8+
plugin 'licenser', 'net.minecraftforge.licenser' version '1.2.0'
9+
plugin 'gradleutils', 'net.minecraftforge.gradleutils' version '3.3.21'
10+
plugin 'gitversion', 'net.minecraftforge.gitversion' version '3.1.7'
11+
plugin 'changelog', 'net.minecraftforge.changelog' version '3.1.3'
12+
plugin 'shadow', 'com.gradleup.shadow' version '9.2.2'
13+
14+
15+
library 'jopt', 'net.sf.jopt-simple', 'jopt-simple' version '5.0.4'
16+
17+
library 'asm', 'org.ow2.asm', 'asm' version '6.0'
18+
library 'asm-tree', 'org.ow2.asm', 'asm-tree' version '6.0'
19+
library 'asm-util', 'org.ow2.asm', 'asm-util' version '6.0'
20+
bundle 'asm', ['asm', 'asm-tree', 'asm-util']
21+
}
22+

src/main/java/net/minecraftforge/mergetool/AnnotationVersion.java

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
/*
2-
* MergeTool
3-
* Copyright (c) 2016-2018.
4-
*
5-
* This library is free software; you can redistribute it and/or
6-
* modify it under the terms of the GNU Lesser General Public
7-
* License as published by the Free Software Foundation version 2.1
8-
* of the License.
9-
*
10-
* This library is distributed in the hope that it will be useful,
11-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13-
* Lesser General Public License for more details.
14-
*
15-
* You should have received a copy of the GNU Lesser General Public
16-
* License along with this library; if not, write to the Free Software
17-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2+
* Copyright (c) Forge Development LLC
3+
* SPDX-License-Identifier: LGPL-2.1-only
184
*/
195
package net.minecraftforge.mergetool;
206

src/main/java/net/minecraftforge/mergetool/ConsoleMerger.java

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
/*
2-
* MergeTool
3-
* Copyright (c) 2016-2018.
4-
*
5-
* This library is free software; you can redistribute it and/or
6-
* modify it under the terms of the GNU Lesser General Public
7-
* License as published by the Free Software Foundation version 2.1
8-
* of the License.
9-
*
10-
* This library is distributed in the hope that it will be useful,
11-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13-
* Lesser General Public License for more details.
14-
*
15-
* You should have received a copy of the GNU Lesser General Public
16-
* License along with this library; if not, write to the Free Software
17-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2+
* Copyright (c) Forge Development LLC
3+
* SPDX-License-Identifier: LGPL-2.1-only
184
*/
195
package net.minecraftforge.mergetool;
206

@@ -97,6 +83,7 @@ private static void merge(String[] args)
9783
OptionSpec<File> merged = parser.accepts("output").withRequiredArg().ofType(File.class).required();
9884
OptionSpec<Boolean> inject = parser.accepts("inject").withOptionalArg().ofType(Boolean.class).defaultsTo(true);
9985
OptionSpec<AnnotationVersion> anno = parser.accepts("ann").withOptionalArg().ofType(AnnotationVersion.class).withValuesConvertedBy(AnnotationReader).defaultsTo(AnnotationVersion.API);
86+
OptionSpec<Void> data = parser.accepts("keep-data");
10087

10188
try
10289
{
@@ -114,6 +101,9 @@ private static void merge(String[] args)
114101
if (options.has(anno))
115102
merge.annotate(options.valueOf(anno), !options.has(inject) || options.valueOf(inject));
116103

104+
if (options.has(data))
105+
merge.keepData();
106+
117107
try
118108
{
119109
merge.process();

0 commit comments

Comments
 (0)