Update to Gradle 6.x, add GitHub Actions CI

This commit is contained in:
Adrian Siekierka 2022-06-17 11:10:55 +02:00
parent bc01c8b4d0
commit 3b8340afd6
4 changed files with 76 additions and 49 deletions

41
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,41 @@
name: Java CI with Gradle
on: [push, pull_request, workflow_dispatch]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Build with Gradle
run: ./gradlew build
env:
GPR_USER: ${{ secrets.GPR_USER }}
GPR_KEY: ${{ secrets.GPR_KEY }}
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: BuildCraft
path: build/libs/*.jar
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: BuildCraft (modular)
path: modules/*.jar

View file

@ -17,7 +17,7 @@ buildscript {
} }
} }
dependencies { dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7'
} }
} }
@ -32,6 +32,13 @@ archivesBaseName = "buildcraft" // the name that all artifacts will use as a bas
ext.mcModInfo = new groovy.json.JsonSlurper().parse(file("buildcraft_resources/mcmod.info")) ext.mcModInfo = new groovy.json.JsonSlurper().parse(file("buildcraft_resources/mcmod.info"))
ext.priv = parseConfig(file('private.properties')) ext.priv = parseConfig(file('private.properties'))
repositories {
maven {
name 'Overmind Forge repo mirror'
url 'https://gregtech.overminddl1.com/'
}
}
minecraft { minecraft {
version = "1.7.10-10.13.4.1614-1.7.10" // McVersion-ForgeVersion this variable is later changed to contain only the MC version, while the apiVersion variable is used for the forge version. Yeah its stupid, and will be changed eentually. version = "1.7.10-10.13.4.1614-1.7.10" // McVersion-ForgeVersion this variable is later changed to contain only the MC version, while the apiVersion variable is used for the forge version. Yeah its stupid, and will be changed eentually.
@ -149,94 +156,73 @@ task apiJar(type: Jar) {
} }
task coreJar(type: Jar, dependsOn: reobf) { task coreJar(type: Jar, dependsOn: reobf) {
destinationDir = file("modules") destinationDir = file("modules")
classifier = 'core' classifier = 'core'
doFirst {
from(createMCModInfo(0, name).parentFile) from(createMCModInfo(0, name).parentFile)
from(project.ext.jarFile) { from(project.ext.jarFile) {
includes.addAll(["assets/buildcraft/**", "assets/buildcraftcore/**", "buildcraft/BuildCraftCore**", "buildcraft/BuildCraftMod**", "buildcraft/core/**", "buildcraft/api/**", "cofh/**", "changelog/**", "LICENSE**", "versions.txt"]) includes.addAll(["assets/buildcraft/**", "assets/buildcraftcore/**", "buildcraft/BuildCraftCore**", "buildcraft/BuildCraftMod**", "buildcraft/core/**", "buildcraft/api/**", "cofh/**", "changelog/**", "LICENSE**", "versions.txt"])
} }
}
} }
task buildersJar(type: Jar, dependsOn: reobf) { task buildersJar(type: Jar, dependsOn: reobf) {
destinationDir = file("modules") destinationDir = file("modules")
classifier = 'builders' classifier = 'builders'
doFirst {
from(createMCModInfo(1, name).parentFile) from(createMCModInfo(1, name).parentFile)
from(project.ext.jarFile) { from(project.ext.jarFile) {
includes.addAll(["assets/buildcraftbuilders/**", "buildcraft/builders/**", "buildcraft/BuildCraftBuilders**", "LICENSE"]) includes.addAll(["assets/buildcraftbuilders/**", "buildcraft/builders/**", "buildcraft/BuildCraftBuilders**", "LICENSE"])
} }
}
} }
task energyJar(type: Jar, dependsOn: reobf) { task energyJar(type: Jar, dependsOn: reobf) {
destinationDir = file("modules") destinationDir = file("modules")
classifier = 'energy' classifier = 'energy'
doFirst {
from(createMCModInfo(2, name).parentFile) from(createMCModInfo(2, name).parentFile)
from(project.ext.jarFile) { from(project.ext.jarFile) {
includes.addAll(["assets/buildcraftenergy/**", "buildcraft/energy/**", "buildcraft/BuildCraftEnergy**", "LICENSE"]) includes.addAll(["assets/buildcraftenergy/**", "buildcraft/energy/**", "buildcraft/BuildCraftEnergy**", "LICENSE"])
} }
}
} }
task factoryJar(type: Jar, dependsOn: reobf) { task factoryJar(type: Jar, dependsOn: reobf) {
destinationDir = file("modules") destinationDir = file("modules")
classifier = 'factory' classifier = 'factory'
doFirst {
from(createMCModInfo(3, name).parentFile) from(createMCModInfo(3, name).parentFile)
from(project.ext.jarFile) { from(project.ext.jarFile) {
includes.addAll(["assets/buildcraftfactory/**", "buildcraft/factory/**", "buildcraft/BuildCraftFactory**", "LICENSE"]) includes.addAll(["assets/buildcraftfactory/**", "buildcraft/factory/**", "buildcraft/BuildCraftFactory**", "LICENSE"])
} }
}
} }
task siliconJar(type: Jar, dependsOn: reobf) { task siliconJar(type: Jar, dependsOn: reobf) {
destinationDir = file("modules") destinationDir = file("modules")
classifier = 'silicon' classifier = 'silicon'
doFirst {
from(createMCModInfo(4, name).parentFile) from(createMCModInfo(4, name).parentFile)
from(project.ext.jarFile) { from(project.ext.jarFile) {
includes.addAll(["assets/buildcraftsilicon/**", "buildcraft/silicon/**", "buildcraft/BuildCraftSilicon**", "LICENSE"]) includes.addAll(["assets/buildcraftsilicon/**", "buildcraft/silicon/**", "buildcraft/BuildCraftSilicon**", "LICENSE"])
} }
}
} }
task transportJar(type: Jar, dependsOn: reobf) { task transportJar(type: Jar, dependsOn: reobf) {
destinationDir = file("modules") destinationDir = file("modules")
classifier = 'transport' classifier = 'transport'
doFirst {
from(createMCModInfo(5, name).parentFile) from(createMCModInfo(5, name).parentFile)
from(project.ext.jarFile) { from(project.ext.jarFile) {
includes.addAll(["assets/buildcrafttransport/**", "buildcraft/transport/**", "buildcraft/BuildCraftTransport**", "LICENSE"]) includes.addAll(["assets/buildcrafttransport/**", "buildcraft/transport/**", "buildcraft/BuildCraftTransport**", "LICENSE"])
} }
}
} }
task roboticsJar(type: Jar, dependsOn: reobf) { task roboticsJar(type: Jar, dependsOn: reobf) {
destinationDir = file("modules") destinationDir = file("modules")
classifier = 'robotics' classifier = 'robotics'
doFirst {
from(createMCModInfo(6, name).parentFile) from(createMCModInfo(6, name).parentFile)
from(project.ext.jarFile) { from(project.ext.jarFile) {
includes.addAll(["assets/buildcraftrobotics/**", "buildcraft/robotics/**", "buildcraft/BuildCraftRobotics**", "LICENSE"]) includes.addAll(["assets/buildcraftrobotics/**", "buildcraft/robotics/**", "buildcraft/BuildCraftRobotics**", "LICENSE"])
} }
}
} }

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip

View file

@ -10,12 +10,12 @@
--> -->
<module name="Checker"> <module name="Checker">
<property name="severity" value="warning"/> <property name="severity" value="warning"/>
<module name="TreeWalker">
<module name="SuppressionCommentFilter"> <module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/> <property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/> <property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
<property name="checkFormat" value="$1"/> <property name="checkFormat" value="$1"/>
</module> </module>
<module name="TreeWalker">
<module name="MissingOverride"/> <module name="MissingOverride"/>
<module name="RedundantImport"/> <module name="RedundantImport"/>
<module name="UnusedImports"/> <module name="UnusedImports"/>