Chore: migrate gradle build system to GTNewHorizons/

ExampleMod1.7.10
This commit is contained in:
Discreater committed 2022-12-18 13:53:50 +08:00
1 parent 90f805884d
commit 09a8245153
26 files changed
+1448 -99

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
* text eol=lf
*.[jJ][aA][rR] binary
*.[pP][nN][gG] binary
*.[jJ][pP][gG] binary
*.[jJ][pP][eE][gG] binary
*.[gG][iI][fF] binary
*.[tT][iI][fF] binary
*.[tT][iI][fF][fF] binary
*.[iI][cC][oO] binary
*.[sS][vV][gG] text
*.[eE][pP][sS] binary
*.[xX][cC][fF] binary
*.[kK][aA][rR] binary
*.[mM]4[aA] binary
*.[mM][iI][dD] binary
*.[mM][iI][dD][iI] binary
*.[mM][pP]3 binary
*.[oO][gG][gG] binary
*.[rR][aA] binary
*.7[zZ] binary
*.[gG][zZ] binary
*.[tT][aA][rR] binary
*.[tT][gG][zZ] binary
*.[zZ][iI][pP] binary
*.[tT][cC][nN] binary
*.[sS][oO] binary
*.[dD][lL][lL] binary
*.[dD][yY][lL][iI][bB] binary
*.[pP][sS][dD] binary
*.[tT][tT][fF] binary
*.[oO][tT][fF] binary
*.[pP][aA][tT][cC][hH] -text
*.[bB][aA][tT] text eol=crlf
*.[cC][mM][dD] text eol=crlf
*.[pP][sS]1 text eol=crlf
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
if ! git diff --name-only HEAD HEAD~1 | grep -qF 'build.gradle'; then
new_version="$(date +%s)"
sed --in-place "s!^//version:.*!//version: $new_version!g" build.gradle
git add build.gradle
git commit -m "[ci skip] update build script version to $new_version"
git push
printf 'Updated buildscript version to %s\n' "$new_version"
else
printf 'Ignored buildscript version update: no changes detected\n'
fi
+13
View File
@@ -0,0 +1,13 @@
name: Build and test
on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]
jobs:
build-and-test:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
secrets: inherit
@@ -0,0 +1,53 @@
# This workflow only meant for the source mod you shouldn't bring it into your own project
name: Buildscript maintenance
on:
push:
branches: [ master, main ]
paths:
- build.gradle
workflow_dispatch: { }
jobs:
buildscript-maintenance:
runs-on: ubuntu-latest
# Avoid running this workflow on forks
if: github.repository == 'GTNewHorizons/ExampleMod1.7.10'
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Ensure build script version is up to date
id: update-buildscript
run: |
new_version="$(date +%s)"
sed --in-place "1s!^//version:.*!//version: $new_version!g" build.gradle
echo "::set-output name=new_version::$new_version"
- name: Create Pull Request
id: create-pull-request
uses: peter-evans/create-pull-request@v4
with:
add-paths: build.gradle
commit-message: '[ci skip] update build script version to ${{ steps.update-buildscript.outputs.new_version }}'
branch: buildscript-maintenance
title: Update build script version to ${{ steps.update-buildscript.outputs.new_version }}
body: This pull request is created by the buildscript-maintenance workflow
- name: Enable Pull Request Auto Merge
if: steps.create-pull-request.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
pull-request-number: ${{ steps.create-pull-request.outputs.pull-request-number }}
merge-method: squash
- name: Auto approve
if: steps.create-pull-request.outputs.pull-request-operation == 'created'
uses: juliangruber/approve-pull-request-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.create-pull-request.outputs.pull-request-number }}
+53
View File
@@ -0,0 +1,53 @@
# This workflow only meant for the source mod you shouldn't bring it into your own project
name: Buildscript maintenance
on:
push:
branches: [ master, main ]
paths:
- build.gradle
workflow_dispatch: { }
jobs:
buildscript-maintenance:
runs-on: ubuntu-latest
# Avoid running this workflow on forks
if: github.repository == 'GTNewHorizons/ExampleMod1.7.10'
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Ensure build script version is up to date
id: update-buildscript
run: |
new_version="$(date +%s)"
sed --in-place "1s!^//version:.*!//version: $new_version!g" build.gradle
echo "::set-output name=new_version::$new_version"
- name: Create Pull Request
id: create-pull-request
uses: peter-evans/create-pull-request@v4
with:
add-paths: build.gradle
commit-message: '[ci skip] update build script version to ${{ steps.update-buildscript.outputs.new_version }}'
branch: buildscript-maintenance
title: Update build script version to ${{ steps.update-buildscript.outputs.new_version }}
body: This pull request is created by the buildscript-maintenance workflow
- name: Enable Pull Request Auto Merge
if: steps.create-pull-request.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
pull-request-number: ${{ steps.create-pull-request.outputs.pull-request-number }}
merge-method: squash
- name: Auto approve
if: steps.create-pull-request.outputs.pull-request-operation == 'created'
uses: juliangruber/approve-pull-request-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.create-pull-request.outputs.pull-request-number }}
+14
View File
@@ -0,0 +1,14 @@
name: Release tagged build
on:
push:
tags: [ '*' ]
permissions:
contents: write
jobs:
release-tags:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
secrets: inherit
+1051 -52
View File
File diff suppressed because it is too large. Load diff
+25
View File
@@ -0,0 +1,25 @@
// Add your dependencies here
dependencies {
// compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-122-GTNH:dev")
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.5:dev")
compile("com.github.GTNewHorizons:CodeChickenCore:1.1.6:dev")
compile("com.github.GTNewHorizons:NotEnoughItems:2.3.2-GTNH:dev")
// compile("com.github.GTNewHorizons:Baubles:1.0.1.14:dev")
// compile("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.9.1:dev")
// compileOnly("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.0.15-gtnh:dev") { transitive = false }
// compileOnly("com.github.GTNewHorizons:Avaritiaddons:1.5.4-GTNH:dev") { transitive = false }
// compileOnly("com.github.GTNewHorizons:BuildCraftCompat:7.1.12:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:EnderIO:2.3.1.47:dev') {transitive=false}
compileOnly("com.github.GTNewHorizons:ForestryMC:4.4.14:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.41.37:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:GTplusplus:1.7.90:dev") { transitive = false }
// compileOnly("com.github.GTNewHorizons:ThaumicEnergistics:1.3.19-GTNH:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:Botania:1.9.11-GTNH:dev") { transitive = false }
compileOnly("com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev") { transitive = false }
compileOnly("curse.maven:thaumcraft-nei-plugin-225095:2241913") { transitive = false }
// compileOnly("curse.maven:thermal-expansion-69163:2388759") { transitive = false }
// runtime("curse.maven:cofh-core-69162:2388751")
}
+79 -7
View File
@@ -1,7 +1,79 @@
# 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
# suppress inspection "UnusedProperty" for whole file
mc_version=1.7.10
nei_version=2.1.5-GTNH
proj_version=3.8.4
modName = Just Enough Calculation
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = jecalculation
modGroup = me.towdium.jecalculation
# WHY is there no version field?
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
# Will update your build.gradle automatically whenever an update is available
autoUpdateBuildScript = false
minecraftVersion = 1.7.10
forgeVersion = 10.13.4.1614
# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task.
channel = stable
mappingsVersion = 12
# Define other MCP mappings for dependency deobfuscation
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
# restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = Developer
# Define a source file of your project with:
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = Tags.java
gradleTokenModId = GRADLETOKEN_MODID
gradleTokenModName = GRADLETOKEN_MODNAME
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName = GRADLETOKEN_GROUPNAME
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage =
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
accessTransformersFile = jeca_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Adds some debug arguments like verbose output and export
usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatibility only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies = false
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# projects. New projects should not use this parameter.
#customArchiveBaseName =
# Optional parameter to prevent the source code from being published
# noPublishedSources =
+1 -2
View File
@@ -1,6 +1,5 @@
#Wed Jul 02 15:54:47 CDT 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
+2
View File
@@ -0,0 +1,2 @@
before_install:
- ./gradlew setupCIWorkspace
Binary file not shown.
Binary file not shown.
+18
View File
@@ -0,0 +1,18 @@
// Add any additional repositories for your dependencies here
repositories {
maven {
name 'GTNH Maven'
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
allowInsecureProtocol
}
maven {
url 'https://cursemaven.com'
content {
includeGroup 'curse.maven'
}
}
maven {
url 'https://jitpack.io'
}
}
+10
View File
@@ -0,0 +1,10 @@
plugins {
id 'com.diffplug.blowdryerSetup' version '1.6.0'
}
apply plugin: 'com.diffplug.blowdryerSetup'
blowdryerSetup {
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.5')
//devLocal '.' // Use this when testing config updates locally
}
@@ -134,7 +134,7 @@ public class JecaConfig {
public static Object empty;
public static void preInit(FMLPreInitializationEvent event) {
config = new Configuration(configFile, JustEnoughCalculation.Reference.VERSION);
config = new Configuration(configFile, Tags.VERSION);
config.load();
handleInit();
config.save();
@@ -20,17 +20,17 @@ import javax.annotation.ParametersAreNonnullByDefault;
@ParametersAreNonnullByDefault
@SuppressWarnings("unused")
@SideOnly(Side.CLIENT)
@Mod(modid = JustEnoughCalculation.Reference.MODID,
name = JustEnoughCalculation.Reference.MODNAME,
version = JustEnoughCalculation.Reference.VERSION,
@Mod(modid = Tags.MODID,
name = Tags.MODNAME,
version = Tags.VERSION,
dependencies = "required-after:NotEnoughItems")
public class JustEnoughCalculation {
@Mod.Instance(Reference.MODID)
@Mod.Instance(Tags.MODID)
public static JustEnoughCalculation INSTANCE;
public static ClientHandler handler = new ClientHandler();
public static Logger logger = LogManager.getLogger(Reference.MODID);
public static Logger logger = LogManager.getLogger(Tags.MODID);
@Mod.EventHandler
public static void initPre(FMLPreInitializationEvent event) {
@@ -49,9 +49,4 @@ public class JustEnoughCalculation {
NEIPlugin.init();
}
public static class Reference {
public static final String MODID = "jecalculation";
public static final String MODNAME = "Just Enough Calculation";
public static final String VERSION = "@VERSION@";
}
}
@@ -0,0 +1,10 @@
package me.towdium.jecalculation;
public class Tags {
public static final String MODID = "GRADLETOKEN_MODID";
public static final String MODNAME = "GRADLETOKEN_MODNAME";
public static final String VERSION = "GRADLETOKEN_VERSION";
public static final String GROUPNAME = "GRADLETOKEN_GROUPNAME";
}
@@ -2,7 +2,7 @@ package me.towdium.jecalculation.data.label.labels;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import me.towdium.jecalculation.JustEnoughCalculation;
import me.towdium.jecalculation.Tags;
import me.towdium.jecalculation.data.label.ILabel;
import me.towdium.jecalculation.gui.JecaGui;
import me.towdium.jecalculation.polyfill.mc.util.NonNullList;
@@ -205,7 +205,7 @@ public class LOreDict extends ILabel.Impl {
@SideOnly(Side.CLIENT)
public void getToolTip(List<String> existing, boolean detailed) {
super.getToolTip(existing, detailed);
existing.add(FORMAT_BLUE + FORMAT_ITALIC + JustEnoughCalculation.Reference.MODNAME);
existing.add(FORMAT_BLUE + FORMAT_ITALIC + Tags.MODNAME);
}
@Override
@@ -2,7 +2,7 @@ package me.towdium.jecalculation.data.label.labels;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import me.towdium.jecalculation.JustEnoughCalculation;
import me.towdium.jecalculation.Tags;
import me.towdium.jecalculation.data.label.ILabel;
import me.towdium.jecalculation.gui.JecaGui;
import me.towdium.jecalculation.gui.Resource;
@@ -119,7 +119,7 @@ public class LPlaceholder extends ILabel.Impl {
@SideOnly(Side.CLIENT)
public void getToolTip(List<String> existing, boolean detailed) {
super.getToolTip(existing, detailed);
existing.add(FORMAT_BLUE + FORMAT_ITALIC + JustEnoughCalculation.Reference.MODNAME);
existing.add(FORMAT_BLUE + FORMAT_ITALIC + Tags.MODNAME);
}
public static boolean merge(ILabel a, ILabel b) {
@@ -2,7 +2,7 @@ package me.towdium.jecalculation.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import me.towdium.jecalculation.JustEnoughCalculation;
import me.towdium.jecalculation.Tags;
import net.minecraft.util.ResourceLocation;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -15,7 +15,7 @@ import javax.annotation.ParametersAreNonnullByDefault;
@SideOnly(Side.CLIENT)
public class Resource {
public static final ResourceLocation location = new ResourceLocation(
JustEnoughCalculation.Reference.MODID, "textures/gui/resources.png");
Tags.MODID, "textures/gui/resources.png");
// letters abbr for button & icon: N - normal, F - focused, D - disabled
// letters abbr for fuzzy related: N - normal, F - fuzzy
// letters abbr for state related: N - normal, A - active
@@ -2,7 +2,7 @@ package me.towdium.jecalculation.nei;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import me.towdium.jecalculation.JustEnoughCalculation;
import me.towdium.jecalculation.Tags;
import me.towdium.jecalculation.gui.JecaGui;
import me.towdium.jecalculation.nei.adapter.IAdapter;
@@ -34,11 +34,11 @@ public class NEICalculatorConfig implements IConfigureNEI {
@Override
public String getName() {
return JustEnoughCalculation.Reference.MODNAME;
return Tags.MODNAME;
}
@Override
public String getVersion() {
return JustEnoughCalculation.Reference.VERSION;
return Tags.VERSION;
}
}
@@ -9,15 +9,14 @@ import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import me.towdium.jecalculation.JustEnoughCalculation;
import me.towdium.jecalculation.Tags;
import me.towdium.jecalculation.polyfill.NBTHelper;
import me.towdium.jecalculation.utils.wrappers.Pair;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.Fluid;
@@ -147,7 +146,7 @@ public class Utilities {
}
public static NBTTagCompound getTag(ItemStack is) {
return NBTHelper.getOrCreateSubCompound(is, JustEnoughCalculation.Reference.MODID);
return NBTHelper.getOrCreateSubCompound(is, Tags.MODID);
}
public static EntityClientPlayerMP getPlayer() {
File renamed without changes.
+16 -15
View File
@@ -1,16 +1,17 @@
[
{
"modid": "jecalculation",
"name": "Just Enough Calculation",
"description": "A simple mod to help you with recipe calculation.",
"version": "${version}",
"mcversion": "${mcversion}",
"url": "https://github.com/Towdium/JustEnoughCalculation",
"updateUrl": "http://minecratft.curseforge.com/projects/just-enough-calculation",
"authorList": ["Towdium", "Discreater"],
"logoFile": "",
"screenshots": [],
"dependencies": ["NotEnoughItems"],
"credits": "Thanks to the MCP, Forge and FML guys; along with sesess, Pahimar, MrCrayfish and BedrockMiner for their tutorial."
}
]
"modListVersion": 2,
"modList": [{
"modid": "${modId}",
"name": "${modName}",
"description": "A simple mod to help you with recipe calculation.",
"version": "${modVersion}",
"mcversion": "${minecraftVersion}",
"url": "https://github.com/Towdium/JustEnoughCalculation",
"updateUrl": "http://minecratft.curseforge.com/projects/just-enough-calculation",
"authorList": ["Towdium", "Discreater"],
"logoFile": "",
"screenshots": [],
"dependencies": ["NotEnoughItems"],
"credits": "Thanks to the MCP, Forge and FML guys; along with sesess, Pahimar, MrCrayfish and BedrockMiner for their tutorial."
}]
}
+30
View File
@@ -0,0 +1,30 @@
printf("Configuring spotless\n")
// Spotless autoformatter
// See https://github.com/diffplug/spotless/tree/main/plugin-gradle
// Can be locally toggled via spotless:off/spotless:on comments
spotless {
encoding 'UTF-8'
format 'misc', {
target '.gitignore'
trimTrailingWhitespace()
indentWithSpaces(4)
endWithNewline()
}
java {
toggleOffOn()
importOrder()
removeUnusedImports()
palantirJavaFormat('1.1.0') // last version supporting jvm 8
}
kotlin {
toggleOffOn()
ktfmt('0.39')
trimTrailingWhitespace()
indentWithSpaces(4)
endWithNewline()
}
}