feat: improved build tool setup

This commit is contained in:
Michael Hillcox 2024-03-07 00:24:42 +00:00
parent 3ce53350bf
commit 4ef880aa15
6 changed files with 31 additions and 49 deletions

View file

@ -6,23 +6,19 @@ plugins {
id 'net.neoforged.gradle.userdev' version '7.0.96' id 'net.neoforged.gradle.userdev' version '7.0.96'
} }
version = "$mod_version" def buildSuffix = System.getenv('BUILD_NUMBER') ? "-b${System.getenv('BUILD_NUMBER')}" : ""
version = "$mod_version+mc${game_version}${buildSuffix}"
group = "de.ellpeck.actuallyadditions" group = "de.ellpeck.actuallyadditions"
base { base {
archivesName = "ActuallyAdditions-$game_version" archivesName = "ActuallyAdditions"
} }
if (System.getenv('BUILD_NUMBER') != null) {
version += "." + System.getenv('BUILD_NUMBER')
}
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17) java.toolchain.languageVersion = JavaLanguageVersion.of(17)
if (rootProject.file('src/main/resources/META-INF/accesstransformer.cfg').exists()) { if (rootProject.file('src/main/resources/META-INF/accesstransformer.cfg').exists()) {
minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg') minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
} }
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
runs { runs {
// applies to all the run configs below // applies to all the run configs below
@ -93,20 +89,6 @@ dependencies {
runtimeOnly "curse.maven:mekanism-268560:5155329" runtimeOnly "curse.maven:mekanism-268560:5155329"
} }
// not sure if this is still needed
//processResources {
// inputs.property('version', project.version)
//
// from(sourceSets.main.resources.srcDirs) {
// include 'META-INF/mods.toml'
// expand 'version': project.version
// }
//
// from(sourceSets.main.resources.srcDirs) {
// exclude 'META-INF/mods.toml'
// }
//}
jar { jar {
group = 'artifact' group = 'artifact'
manifest { manifest {
@ -114,12 +96,27 @@ jar {
"Specification-Version" : "1", "Specification-Version" : "1",
"Implementation-Title" : project.archivesBaseName, "Implementation-Title" : project.archivesBaseName,
"Implementation-Version" : project.version, "Implementation-Version" : project.version,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],) "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"Modloader": "Neoforge",
"Modloader-Version": project.neo_version,
])
} }
from sourceSets.main.output from sourceSets.main.output
} }
processResources {
inputs.property('version', project.version)
inputs.property('neo_version_range', project.neo_version_range)
inputs.property('loader', project.loader)
inputs.property('minecraft_version_range', project.minecraft_version_range)
filesMatching(['META-INF/mods.toml']) {
expand 'version': project.version, 'neo_version_range': project.neo_version_range, 'loader': project.loader, 'minecraft_version_range': project.minecraft_version_range
}
}
task apiJar(type: Jar) { task apiJar(type: Jar) {
from sourceSets.main.output from sourceSets.main.output
from sourceSets.main.java from sourceSets.main.java

View file

@ -2,13 +2,17 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false org.gradle.daemon=false
# Actually Additions # Actually Additions
# TODO: check this version change is okay.
mod_version=1.1.52 mod_version=1.1.52
# Forge # Forge
game_version=1.20.4 game_version=1.20.4
neo_version=20.4.190 neo_version=20.4.190
# mods.toml
loader=2
neo_version_range=[20.4.190,)
minecraft_version_range=[1.20.4,1.21)
# Parchment (Mappings) # Parchment (Mappings)
neogradle.subsystems.parchment.minecraftVersion=1.20.4 neogradle.subsystems.parchment.minecraftVersion=1.20.4
neogradle.subsystems.parchment.mappingsVersion=2024.02.25 neogradle.subsystems.parchment.mappingsVersion=2024.02.25

View file

@ -1,13 +1,13 @@
modLoader="javafml" modLoader="javafml"
loaderVersion="[2,)" loaderVersion="[${loader},)"
license="MIT" license="MIT"
[[mods]] [[mods]]
modId="actuallyadditions" modId="actuallyadditions"
version="${file.jarVersion}" version="${version}"
displayName="Actually Additions" displayName="Actually Additions"
#logoFile="logo.png" #logoFile="logo.png"
credits="Author: Ellpeck; Textures and Models: BootyToast, GlenthorLP, canitzp" credits="Author: Ellpeck; Textures and Models: BootyToast, GlenthorLP, canitzp; Porters: Flanks, MrBysco, ErrorMikey; 1.20+ Textures: Ridanisaurus"
authors="Ellpeck" authors="Ellpeck"
description=''' description='''
Do you want Automation? Wireless Transport? Better Machines? A cup o' Coffee? Chests? Better Hoppers? Leaf Blowers? Faster Growth? Plants? Well, Actually Additions has all that and a lot more! Do you want Automation? Wireless Transport? Better Machines? A cup o' Coffee? Chests? Better Hoppers? Leaf Blowers? Faster Growth? Plants? Well, Actually Additions has all that and a lot more!
@ -16,13 +16,13 @@ Do you want Automation? Wireless Transport? Better Machines? A cup o' Coffee? Ch
[[dependencies.actuallyadditions]] [[dependencies.actuallyadditions]]
modId="neoforge" modId="neoforge"
type="required" type="required"
versionRange="[20.4.167,)" versionRange="${neo_version_range}"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"
[[dependencies.actuallyadditions]] [[dependencies.actuallyadditions]]
modId="minecraft" modId="minecraft"
type="required" type="required"
versionRange="[1.20.4,1.21)" versionRange="${minecraft_version_range}"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"

View file

@ -1,19 +0,0 @@
[
{
"modid": "actuallyadditions",
"name": "Actually Additions",
"description": "Do you want Automation? Wireless Transport? Better Machines? A cup o' Coffee? Chests? Better Hoppers? Leaf Blowers? Faster Growth? Plants? Well, Actually Additions has all that and a lot more!",
"version": "${version}",
"mcversion": "${mcversion}",
"url": "http://github.com/Ellpeck/ActuallyAdditions",
"updateUrl": "",
"authorList": [ "Ellpeck" ],
"credits": "Author: Ellpeck; Textures and Models: BootyToast, GlenthorLP, canitzp",
"logoFile": "assets/actuallyadditions/textures/logo.png",
"screenshots": [
],
"parent":"",
"dependencies": [
]
}
]

View file

@ -3,6 +3,6 @@
"description": { "description": {
"text": "actuallyadditions resources" "text": "actuallyadditions resources"
}, },
"pack_format": 22 "pack_format": 26
} }
} }