Skip to content

Commit

Permalink
Gradle 8.4, GH Actions publishing, add readme (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaintNinja authored Oct 19, 2023
1 parent 7b72389 commit 892ead3
Show file tree
Hide file tree
Showing 12 changed files with 115 additions and 141 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish

on:
push:
branches: [ "master" ]

permissions:
contents: read

jobs:
build:
uses: MinecraftForge/SharedActions/.github/workflows/gradle.yml@main
with:
java: 8
gradle_tasks: "publish"
artifact_name: "jarsplitter"
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
PROMOTE_ARTIFACT_WEBHOOK: ${{ secrets.PROMOTE_ARTIFACT_WEBHOOK }}
PROMOTE_ARTIFACT_USERNAME: ${{ secrets.PROMOTE_ARTIFACT_USERNAME }}
PROMOTE_ARTIFACT_PASSWORD: ${{ secrets.PROMOTE_ARTIFACT_PASSWORD }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
69 changes: 0 additions & 69 deletions Jenkinsfile

This file was deleted.

File renamed without changes.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# JarSplitter

Splits a jar file into data, slim and classes jars.
112 changes: 55 additions & 57 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,42 +1,59 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.minecraftforge.gradleutils.PomUtils

plugins {
id 'java'
id 'eclipse'
id 'maven-publish'
id 'org.cadixdev.licenser' version '0.6.1'
id 'net.minecraftforge.gradleutils' version '2.+'
id 'com.github.johnrengelman.shadow' version '2.0.4'
id 'java'
id 'eclipse'
id 'maven-publish'
id 'org.cadixdev.licenser' version '0.6.1'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'net.minecraftforge.gradleutils' version '2.+'
}


group = 'net.minecraftforge'
version = gradleutils.getTagOffsetVersion()
println('Version: ' + version)
println "Version: $version"

java {
toolchain.languageVersion = JavaLanguageVersion.of(8)
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
withSourcesJar()
}

repositories {
maven { url = 'https://maven.minecraftforge.net/' }
mavenCentral()
maven gradleutils.forgeMaven
}

dependencies {
implementation 'net.sf.jopt-simple:jopt-simple:5.0.4'
implementation 'net.minecraftforge:srgutils:0.4.3'
}

license {
header project.file('LICENSE-header.txt')
include 'net/minecraftforge/jarsplitter/**/*.java'
newLine false
header = file('LICENSE-header.txt')
newLine = false
exclude '**/*.properties'
}

jar {
manifest.attributes('Main-Class': 'net.minecraftforge.jarsplitter.ConsoleTool')
manifest.attributes('Implementation-Version': project.version)
tasks.named('jar', Jar).configure {
manifest {
attributes([
'Main-Class': 'net.minecraftforge.jarsplitter.ConsoleTool',
'Implementation-Version': project.version
])
}
}

shadowJar {
classifier 'fatjar'
manifest.attributes('Main-Class': 'net.minecraftforge.jarsplitter.ConsoleTool')
manifest.attributes('Implementation-Version': project.version)
tasks.named('shadowJar', ShadowJar).configure {
archiveClassifier = 'fatjar'
manifest {
attributes([
'Main-Class': 'net.minecraftforge.jarsplitter.ConsoleTool',
'Implementation-Version': project.version
])
}
}

artifacts {
Expand All @@ -45,47 +62,28 @@ artifacts {
archives sourcesJar
}

dependencies {
implementation 'net.sf.jopt-simple:jopt-simple:5.0.4'
implementation 'net.minecraftforge:srgutils:0.4.3'
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact shadowJar

pom {
name = 'Jar Splitter'
description = 'Splits a jar file into classes and data, used in the Forge installer'
url = 'https://github.com/MinecraftForge/JarSplitter'
scm {
url = 'https://github.com/MinecraftForge/JarSplitter'
connection = 'scm:git:git://github.com/MinecraftForge/JarSplitter.git'
developerConnection = 'scm:git:[email protected]:MinecraftForge/JarSplitter.git'
}
issueManagement {
system = 'github'
url = 'https://github.com/MinecraftForge/JarSplitter/issues'
}

licenses {
license {
name = 'LGPLv2.1'
url = 'https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt'
}
}

developers {
developer {
id = 'LexManos'
name = 'Lex Manos'
}
}
publications.register('mavenJava', MavenPublication) {
from components.java
artifact shadowJar

artifactId = 'jarsplitter'

pom {
name = 'Jar Splitter'
description = 'Splits a jar file into classes and data, used in the Forge installer'
url = 'https://github.com/MinecraftForge/JarSplitter'

PomUtils.setGitHubDetails(pom, 'JarSplitter')

license PomUtils.Licenses.LGPLv2_1

developers {
developer PomUtils.Developers.LexManos
}
}
}

repositories {
maven gradleutils.getPublishingForgeMaven()
}
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
org.gradle.configureondemand=true
org.gradle.caching=true
org.gradle.parallel=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
25 changes: 17 additions & 8 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,11 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +198,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
11 changes: 9 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@ pluginManagement {
repositories {
gradlePluginPortal()
mavenLocal()
maven { url = 'https://maven.minecraftforge.net/' }
maven {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
}
}

rootProject.name = 'jarsplitter'
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
}

rootProject.name = 'JarSplitter'
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@
import java.io.OutputStream;
import java.math.BigInteger;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TimeZone;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
Expand All @@ -32,7 +29,7 @@
import net.minecraftforge.srgutils.IMappingFile;

public class ConsoleTool {
private static OutputStream NULL_OUTPUT = new OutputStream() {
private static final OutputStream NULL_OUTPUT = new OutputStream() {
@Override public void write(int b) throws IOException {}
};

Expand Down

0 comments on commit 892ead3

Please sign in to comment.