Create/build.gradle
IThundxr d5ef7e5147
Eclipsed
- Modify property expansion to use a method that's compatible with eclipse and running with Intellij instead of Gradle in the build and run with setting
2025-01-09 17:52:55 -05:00

230 lines
8.2 KiB
Groovy

plugins {
id 'java-library'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.moddev' version '2.0.9-beta'
}
boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equals('false');
String buildNumber = System.getenv('BUILD_NUMBER')
version = project.mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '')
group = project.maven_group
repositories {
mavenLocal()
}
base {
archivesName = "$mod_id-$minecraft_version"
}
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
neoForge {
version = project.neo_version
parchment {
minecraftVersion = project.parchment_minecraft_version
mappingsVersion = project.parchment_version
}
accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
client()
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
server {
server()
gameDirectory = project.file('run/server')
programArgument '--nogui'
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
type = "gameTestServer"
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
data {
data()
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
configureEach {
systemProperty 'forge.logging.markers', 'REGISTRIES'
systemProperty 'mixin.debug.verbose', 'true'
systemProperty 'mixin.debug.export', 'true'
// IThundxr ~ I use JBR for enhanced hotswap, this adds the required arg while not affecting other people
jvmArguments = ["-XX:+AllowEnhancedClassRedefinition", "-XX:+IgnoreUnrecognizedVMOptions"]
logLevel = org.slf4j.event.Level.DEBUG
}
}
mods {
"${mod_id}" {
sourceSet(sourceSets.main)
}
}
}
configurations {
runtimeClasspath.extendsFrom localRuntime
}
repositories {
maven { url = "https://maven.createmod.net" } // Ponder, Catnip
maven { url = "https://maven.tterrag.com" } // Flywheel
maven { url = "https://maven.ithundxr.dev/snapshots" } // Registrate
maven { url = "https://maven.blamejared.com" } // JEI, Vazkii's Mods
maven { url = "https://harleyoconnor.com/maven" } // Dynamic Trees
maven { url = "https://maven.squiddev.cc" } // CC: Tweaked
maven { url = "https://www.cursemaven.com" }
maven { url = "https://api.modrinth.com/maven" }
maven { url = "https://maven.saps.dev/releases" } // FTB Mods
maven { url = "https://maven.architectury.dev" } // Arch API
maven { url = "https://jm.gserv.me/repository/maven-public" // JourneyMap
content {
includeGroup "info.journeymap"
includeGroup "mysticdrew"
}
}
maven { url = "https://maven.octo-studios.com/releases" } // Curios API Continuation
// Mirror of maven.createmod.net
if (System.getProperty("os.name").contains("Mac") && System.getenv("USER") == "ithundxr") {
maven { url = "https://maven.ithundxr.dev/mirror" }
}
// todo - temp
maven { url = "https://maven.ithundxr.dev/hidden" } // Flywheel 1.21 PR
}
dependencies {
jarJar(implementation("com.tterrag.registrate:Registrate:${registrate_version}"))
compileOnly("dev.engine_room.flywheel:flywheel-neoforge-api-${flywheel_minecraft_version}:${flywheel_version}")
jarJar(runtimeOnly("dev.engine_room.flywheel:flywheel-neoforge-${flywheel_minecraft_version}:${flywheel_version}"))
jarJar(implementation("net.createmod.catnip:Catnip-NeoForge-${catnip_and_ponder_mc_ver}:${catnip_version}"))
jarJar(implementation("net.createmod.ponder:Ponder-NeoForge-${catnip_and_ponder_mc_ver}:${ponder_version}"))
//compileOnly("mezz.jei:jei-${jei_minecraft_version}-common-api:${jei_version}")
//compileOnly("mezz.jei:jei-${jei_minecraft_version}-neoforge-api:${jei_version}")
implementation("mezz.jei:jei-${jei_minecraft_version}-neoforge:${jei_version}")
implementation("top.theillusivec4.curios:curios-neoforge:${curios_version}+${curios_minecraft_version}")
if (cc_tweaked_enable.toBoolean()) {
compileOnly("cc.tweaked:cc-tweaked-${cc_tweaked_minecraft_version}-core-api:${cc_tweaked_version}")
compileOnly("cc.tweaked:cc-tweaked-${cc_tweaked_minecraft_version}-forge-api:${cc_tweaked_version}")
if (!cc_tweaked_disable_runtime.toBoolean())
runtimeOnly("cc.tweaked:cc-tweaked-${cc_tweaked_minecraft_version}-forge:${cc_tweaked_version}")
}
runtimeOnly("dev.architectury:architectury-neoforge:13.0.8")
implementation("dev.ftb.mods:ftb-chunks-neoforge:2101.1.1")
implementation("dev.ftb.mods:ftb-teams-neoforge:2101.1.0")
implementation("dev.ftb.mods:ftb-library-neoforge:2101.1.3")
implementation("maven.modrinth:journeymap:1.21.1-6.0.0-beta.32+neoforge")
implementation("info.journeymap:journeymap-api-neoforge:2.0.0-1.21.1-SNAPSHOT")
// implementation("curse.maven:druidcraft-340991:3101903")
// implementation("com.ferreusveritas.dynamictrees:DynamicTrees-1.16.5:0.10.0-Beta25")
// runtimeOnly("vazkii.arl:AutoRegLib:1.4-35.69")
// runtimeOnly("vazkii.quark:Quark:r2.0-212.984")
// runtimeOnly("slimeknights.mantle:Mantle:1.16.5-1.6.115")
// runtimeOnly("slimeknights.tconstruct:TConstruct:1.16.5-3.1.1.252")
// runtimeOnly("maven.modrinth:rubidium:0.5.3")
// implementation("com.railwayteam.railways:railways-1.18.2-1.1.1:all" { transitive = false })
// runtimeOnly("maven.modrinth:aether:1.19.2-1.0.0-beta.1.1-forge")
// runtimeOnly("maven.modrinth:spark:1.10.38-forge")
// runtimeOnly("curse.maven:xycraft-653786:4788862")
// runtimeOnly("curse.maven:xycraft-world-653789:4788863")
}
sourceSets.main.java {
if (!cc_tweaked_enable.toBoolean()) {
exclude "com/simibubi/create/compat/computercraft/implementation/**"
}
}
sourceSets.main.resources {
srcDir "src/generated/resources"
exclude ".cache/"
}
jar {
from('LICENSE') {
rename { "${it}_${project.archivesBaseName}" }
}
}
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
var replaceProperties = [
mod_version : mod_version,
mod_id : mod_id,
mod_name : mod_name,
mod_author : mod_author,
mod_description : mod_description,
mod_license : mod_license,
minecraft_version_range: minecraft_version_range,
neo_version_range : neo_version_range,
flywheel_version_range : flywheel_version_range,
]
inputs.properties replaceProperties
expand replaceProperties
from "src/main/templates"
into "build/generated/sources/modMetadata"
}
// Include the output of "generateModMetadata" as an input directory for the build
// this works with both building through Gradle and the IDE.
sourceSets.main.resources.srcDir(generateModMetadata)
// To avoid having to run "generateModMetadata" manually, make it run on every project reload
neoForge.ideSyncTask(generateModMetadata)
java {
withSourcesJar()
}
publishing {
publications {
register('mavenJava', MavenPublication) {
from components.java
}
}
repositories {
if (project.hasProperty('mavendir')) {
maven { url = mavendir }
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}