Added stuff to enable CI

This commit is contained in:
Tschipp 2020-05-04 10:44:37 +02:00
parent 92ebde173f
commit 2b687ed23b
5 changed files with 110 additions and 33 deletions

2
.gitignore vendored
View File

@ -1,5 +1,6 @@
# eclipse
bin
oldBuilds
*.launch
.settings
.metadata
@ -22,4 +23,3 @@ build
eclipse
run
gradle\.properties

25
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env groovy
pipeline {
agent any
stages {
stage('Clean') {
steps {
echo 'Cleaning Project'
sh 'chmod +x gradlew'
sh './gradlew clean'
}
}
stage('Build and Deploy') {
steps {
echo 'Building and Deploying to Maven'
sh './gradlew build publish'
}
}
}
post {
always {
archive 'build/libs/**.jar'
}
}
}

View File

@ -13,8 +13,9 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'maven-publish'
version = "1.0"
version = "${minecraft_version}-${version}"
group = "tschipp.carryon"
archivesBaseName = "carryon"
@ -23,6 +24,10 @@ compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
if (System.getenv('BUILD_NUMBER') != null) {
version += "." + System.getenv('BUILD_NUMBER')
}
minecraft {
version = "1.12.2-14.23.5.2847"
runDir = "run"
@ -53,6 +58,76 @@ dependencies {
}
task sourcesJar(type: Jar, dependsOn: classes) {
description = 'Creates a JAR containing the source code.'
from sourceSets.main.allSource
classifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
description = 'Creates a JAR containing the JavaDocs.'
from javadoc.destinationDir
classifier = 'javadoc'
}
task deobfJar(type: Jar) {
description = 'Creates a JAR containing the non-obfuscated compiled code.'
from sourceSets.main.output
classifier = "deobf"
}
artifacts {
archives sourcesJar
archives javadocJar
archives deobfJar
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId project.group
artifactId project.archivesBaseName
version project.version
from components.java
// Allows the maven pom file to be modified.
pom.withXml {
// Go through all the dependencies.
asNode().dependencies.dependency.each { dep ->
println 'Surpressing artifact ' + dep.artifactId.last().value().last() + ' from maven dependencies.'
assert dep.parent().remove(dep)
}
}
artifact sourcesJar {
classifier 'sources'
}
artifact javadocJar {
classifier 'javadoc'
}
artifact deobfJar {
classifier 'deobf'
}
}
}
repositories {
maven {
url "file://" + System.getenv("local_maven")
}
}
}
processResources {
inputs.property "version", project.version

5
gradle.properties Normal file
View File

@ -0,0 +1,5 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
version=1.12.3
minecraft_version=1.12.2

View File

@ -16,19 +16,7 @@ import net.minecraftforge.fml.relauncher.ReflectionHelper;
*/
public class ReflectionUtil
{
/**
* Get a {@link MethodHandle} for a method.
*
* @param clazz
* The class
* @param methodNames
* The possible names of the method
* @param methodTypes
* The argument types of the method
* @param <T>
* The class
* @return The MethodHandle
*/
public static MethodHandle findMethod(final Class<?> clazz, final String methodName, @Nullable final String methodObfName, final Class<?>... parameterTypes)
{
final Method method = ReflectionHelper.findMethod(clazz, methodName, methodObfName, parameterTypes);
@ -42,15 +30,7 @@ public class ReflectionUtil
}
}
/**
* Get a {@link MethodHandle} for a field's getter.
*
* @param clazz
* The class
* @param fieldNames
* The possible names of the field
* @return The MethodHandle
*/
public static MethodHandle findFieldGetter(Class<?> clazz, String... fieldNames)
{
final Field field = ReflectionHelper.findField(clazz, fieldNames);
@ -65,15 +45,7 @@ public class ReflectionUtil
}
}
/**
* Get a {@link MethodHandle} for a field's setter.
*
* @param clazz
* The class
* @param fieldNames
* The possible names of the field
* @return The MethodHandle
*/
public static MethodHandle findFieldSetter(Class<?> clazz, String... fieldNames)
{
final Field field = ReflectionHelper.findField(clazz, fieldNames);