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 {
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.priv = parseConfig(file('private.properties'))
repositories {
maven {
name 'Overmind Forge repo mirror'
url 'https://gregtech.overminddl1.com/'
}
}
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.
@ -149,95 +156,74 @@ task apiJar(type: Jar) {
}
task coreJar(type: Jar, dependsOn: reobf) {
destinationDir = file("modules")
classifier = 'core'
doFirst {
from(createMCModInfo(0, name).parentFile)
from(project.ext.jarFile) {
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) {
destinationDir = file("modules")
classifier = 'builders'
doFirst {
from(createMCModInfo(1, name).parentFile)
from(project.ext.jarFile) {
includes.addAll(["assets/buildcraftbuilders/**", "buildcraft/builders/**", "buildcraft/BuildCraftBuilders**", "LICENSE"])
}
}
}
task energyJar(type: Jar, dependsOn: reobf) {
destinationDir = file("modules")
classifier = 'energy'
doFirst {
from(createMCModInfo(2, name).parentFile)
from(project.ext.jarFile) {
includes.addAll(["assets/buildcraftenergy/**", "buildcraft/energy/**", "buildcraft/BuildCraftEnergy**", "LICENSE"])
}
}
}
task factoryJar(type: Jar, dependsOn: reobf) {
destinationDir = file("modules")
classifier = 'factory'
doFirst {
from(createMCModInfo(3, name).parentFile)
from(project.ext.jarFile) {
includes.addAll(["assets/buildcraftfactory/**", "buildcraft/factory/**", "buildcraft/BuildCraftFactory**", "LICENSE"])
}
}
}
task siliconJar(type: Jar, dependsOn: reobf) {
destinationDir = file("modules")
classifier = 'silicon'
doFirst {
from(createMCModInfo(4, name).parentFile)
from(project.ext.jarFile) {
includes.addAll(["assets/buildcraftsilicon/**", "buildcraft/silicon/**", "buildcraft/BuildCraftSilicon**", "LICENSE"])
}
}
}
task transportJar(type: Jar, dependsOn: reobf) {
destinationDir = file("modules")
classifier = 'transport'
doFirst {
from(createMCModInfo(5, name).parentFile)
from(project.ext.jarFile) {
includes.addAll(["assets/buildcrafttransport/**", "buildcraft/transport/**", "buildcraft/BuildCraftTransport**", "LICENSE"])
}
}
}
task roboticsJar(type: Jar, dependsOn: reobf) {
destinationDir = file("modules")
classifier = 'robotics'
doFirst {
from(createMCModInfo(6, name).parentFile)
from(project.ext.jarFile) {
includes.addAll(["assets/buildcraftrobotics/**", "buildcraft/robotics/**", "buildcraft/BuildCraftRobotics**", "LICENSE"])
}
}
}
// add api classes to main package

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
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">
<property name="severity" value="warning"/>
<module name="TreeWalker">
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
<property name="checkFormat" value="$1"/>
</module>
<module name="TreeWalker">
<module name="MissingOverride"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>