Skip to content

Commit

Permalink
Update build script + release via github actions.
Browse files Browse the repository at this point in the history
Bump ASM to 9.0
  • Loading branch information
modmuss50 committed Dec 29, 2020
1 parent ff672cb commit a03a362
Show file tree
Hide file tree
Showing 11 changed files with 202 additions and 176 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Build
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
java: [8-jdk, 11-jdk, 15-jdk]
runs-on: ubuntu-20.04
container:
image: openjdk:${{ matrix.java }}
options: --user root
steps:
- uses: actions/checkout@v1
- uses: gradle/wrapper-validation-action@v1
- run: chmod +x ./gradlew
- run: ./gradlew build test --stacktrace
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Release
on: [workflow_dispatch] # Manual trigger
jobs:
build:
runs-on: ubuntu-20.04
container:
image: openjdk:15-jdk
options: --user root
steps:
- uses: actions/checkout@v1
- uses: gradle/wrapper-validation-action@v1
- run: chmod +x ./gradlew
- run: ./gradlew checkVersion build publish --stacktrace
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
15 changes: 0 additions & 15 deletions Jenkinsfile

This file was deleted.

99 changes: 60 additions & 39 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'

buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
jcenter()
}
plugins {
id 'java'
id 'maven-publish'
id 'org.cadixdev.licenser' version '0.5.0'
id 'com.github.johnrengelman.shadow' version '6.1.0'
}

sourceCompatibility = 1.8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

version = '0.3.2'

def ENV = System.getenv()
if (ENV.BUILD_NUMBER) {
version = version + "." + "${System.getenv().BUILD_NUMBER}"
}
version = version + (ENV.GITHUB_ACTIONS ? "" : "+local")

group = 'net.fabricmc'
archivesBaseName = 'tiny-remapper'
Expand All @@ -27,44 +21,71 @@ repositories {
}

dependencies {
compile 'org.ow2.asm:asm:8.0'
compile 'org.ow2.asm:asm-commons:8.0'
compile 'org.ow2.asm:asm-tree:8.0'
compile 'org.ow2.asm:asm-util:8.0'
implementation 'org.ow2.asm:asm:9.0'
implementation 'org.ow2.asm:asm-commons:9.0'
implementation 'org.ow2.asm:asm-tree:9.0'
implementation 'org.ow2.asm:asm-util:9.0'
}

java {
withSourcesJar()
}

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"

if (JavaVersion.current().isJava9Compatible()) {
it.options.release = 8
}
}

apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/maven.gradle'
apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/license.gradle'
license {
header file("HEADER")
include '**/*.java'
}

shadowJar {
archiveClassifier = 'fat'
}

jar {
manifest {
attributes 'Implementation-Title': 'TinyRemapper',
'Implementation-Version': version,
'Implementation-Version': archiveVersion,
'Main-Class': "net.fabricmc.tinyremapper.Main"
}
}

task fatJar(type: Jar) {
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
manifest {
attributes 'Implementation-Title': 'TinyRemapper',
'Implementation-Version': version,
'Main-Class': "net.fabricmc.tinyremapper.Main"

repositories {
if (ENV.MAVEN_URL) {
maven {
url ENV.MAVEN_URL
credentials {
username ENV.MAVEN_USERNAME
password ENV.MAVEN_PASSWORD
}
}
}
}
classifier = 'fat'
with jar
}

task sourceJar(type:Jar) {
classifier = "sources"
from sourceSets.main.allSource
// A task to ensure that the version being released has not already been released.
task checkVersion {
doFirst {
def xml = new URL("https://maven.fabricmc.net/net/fabricmc/tiny-remapper/maven-metadata.xml").text
def metadata = new XmlSlurper().parseText(xml)
def versions = metadata.versioning.versions.version*.text();
if (versions.contains(version)) {
throw new RuntimeException("${version} has already been released!")
}
}
}

artifacts {
archives fatJar
archives sourceJar
}
publish.mustRunAfter checkVersion
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
31 changes: 14 additions & 17 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand All @@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -175,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
Loading

0 comments on commit a03a362

Please sign in to comment.