Skip to content

Commit

Permalink
changed to mod dev gradle legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Dec 8, 2024
1 parent 4074abd commit 93492ed
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 137 deletions.
30 changes: 12 additions & 18 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id "fabric-loom"
id 'xyz.wagyourtail.unimined.expect-platform' version '1.0.5'
}
archivesBaseName = "${rootProject.antimatter_archive_base_name}-common"
archivesBaseName = "${project.antimatter_archive_base_name}-common"


def accessWidenerFile = file("src/main/resources/antimatter.accesswidener")
Expand All @@ -23,16 +23,16 @@ repositories {

//apply from: 'https://raw.githubusercontent.com/GregTech-Intergalactical/GradleSripts/main/common.gradle'
dependencies{
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.mappings_version}@zip")
parchment("org.parchmentmc.data:parchment-${project.minecraft_version}:${project.mappings_version}@zip")
}
implementation(expectPlatform.annotationsDep)
compileOnly("com.blamejared.crafttweaker:CraftTweaker-common-1.18.2:${rootProject.crafttweaker_version}")
modCompileOnly("dev.latvian.mods:kubejs-fabric:${rootProject.kubejs_version}")
compileOnly("com.blamejared.crafttweaker:CraftTweaker-common-1.18.2:${project.crafttweaker_version}")
modCompileOnly("dev.latvian.mods:kubejs-fabric:${project.kubejs_version}")
implementation(project(path: ":tesseract-common"))
modImplementation("io.github.fabricators_of_create:Porting-Lib:${rootProject.port_lib_version}-beta+1.18.2-stable"){
modImplementation("io.github.fabricators_of_create:Porting-Lib:${project.port_lib_version}-beta+1.18.2-stable"){
exclude(group: "net.fabricmc.fabric-api")
exclude(group: "com.github.LlamaLad7")
}
Expand All @@ -43,8 +43,8 @@ dependencies{
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:0.4.1"))
modImplementation("dev.trinsdar:ct-fabric-fluid-support:1.0.2")
//modCompileOnly "me.shedaniel:RoughlyEnoughItems-api:${rootProject.rei_version}"
modCompileOnly "me.shedaniel:RoughlyEnoughItems-fabric:${rootProject.rei_version}"
modCompileOnly("mezz.jei:jei-${rootProject.minecraft_version}-fabric:${rootProject.jei_version}")
modCompileOnly "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}"
modCompileOnly("mezz.jei:jei-${project.minecraft_version}-fabric:${project.jei_version}")
modCompileOnly("dev.trinsdar:arrp:0.6.7")
implementation("org.gt-reimagined:structurelib-common:${project.structurelib_version}-${project.minecraft_version}")
modImplementation "maven.modrinth:carbon-config:${project.carbon_config_fabric_version}"
Expand All @@ -65,19 +65,13 @@ publishing {
}

repositories {
def isCI = System.getenv("GITHUB_ACTION")
def isRELEASE = System.getenv("GITHUB_RELEASE")
if (isCI && isRELEASE) {
def isCI = System.getenv("CI")
if (isCI) {
maven {
name = "GTMaven"
url = "https://repo.repsy.io/mvn/trinsdar/gregtech-intergalactical/"
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
url System.getenv("local_maven_url")
}
} else {
maven { url "file:///${project.projectDir}/mcmodsrepo"}
mavenLocal()
}
}
}
44 changes: 19 additions & 25 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id "fabric-loom"
id 'xyz.wagyourtail.unimined.expect-platform' version '1.0.5'
}
archivesBaseName = "${rootProject.antimatter_archive_base_name}-fabric"
archivesBaseName = "${project.antimatter_archive_base_name}-fabric"

def generatedResources = file("src/generated/resources")
def accessWidenerFile = project(":antimatter-common").file("src/main/resources/antimatter.accesswidener")
Expand All @@ -22,21 +22,21 @@ loom {
}

dependencies{
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.mappings_version}@zip")
parchment("org.parchmentmc.data:parchment-${project.minecraft_version}:${project.mappings_version}@zip")
}
implementation(expectPlatform.annotationsDep)
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
modCompileOnly("dev.latvian.mods:kubejs-fabric:${rootProject.kubejs_version}")
modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
modCompileOnly("dev.latvian.mods:kubejs-fabric:${project.kubejs_version}")
implementation(project(path: ":tesseract-common")) { transitive false }
implementation(project(path: ":tesseract-fabric")) { transitive false }
afterEvaluate {
include(project(path: ":tesseract-fabric"))
}
modImplementation(include("io.github.fabricators_of_create:Porting-Lib:${rootProject.port_lib_version}-beta+1.18.2-stable")){
modImplementation(include("io.github.fabricators_of_create:Porting-Lib:${project.port_lib_version}-beta+1.18.2-stable")){
exclude(group: "net.fabricmc.fabric-api")
exclude(group: "com.github.LlamaLad7")
}
Expand All @@ -55,25 +55,25 @@ dependencies{
modImplementation(include("net.feltmc:felt-enchanting-api:1.1.0")) { transitive false }
modImplementation(include("org.gt-reimagined:structurelib-fabric:${project.structurelib_version}-${project.minecraft_version}"))
modImplementation(include("dev.trinsdar:arrp:0.6.7"))
modCompileOnly("com.blamejared.crafttweaker:CraftTweaker-fabric-1.18.2:${rootProject.crafttweaker_version}")
modCompileOnly("com.blamejared.crafttweaker:CraftTweaker-fabric-1.18.2:${project.crafttweaker_version}")
modCompileOnly(include("dev.trinsdar:ct-fabric-fluid-support:1.0.2"))
modImplementation "me.shedaniel:RoughlyEnoughItems-fabric:${rootProject.rei_version}"
modCompileOnly("mezz.jei:jei-${rootProject.minecraft_version}-fabric:${rootProject.jei_version}"){
modImplementation "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}"
modCompileOnly("mezz.jei:jei-${project.minecraft_version}-fabric:${project.jei_version}"){
exclude(group: "mezz.jei", module: "jei-1.18.2-fabric-api")
}
modImplementation("teamreborn:energy:${rootProject.energy_version}") {
modImplementation("teamreborn:energy:${project.energy_version}") {
transitive = false
}
implementation(annotationProcessor(include("io.github.llamalad7:mixinextras-fabric:0.2.0-beta.11")))
modImplementation("earth.terrarium:botarium-fabric-1.18.2:${project.botarium_version}"){
transitive = false
}
modImplementation("com.teamresourceful.resourcefullib:resourcefullib-fabric-1.18.2:${project.resourcefullib_version}")
modRuntimeOnly("com.terraformersmc:modmenu:${rootProject.mod_menu_version}") {
modRuntimeOnly("com.terraformersmc:modmenu:${project.mod_menu_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
implementation("com.electronwill.night-config:toml:${rootProject.nightconfig_version}")
implementation("com.electronwill.night-config:core:${rootProject.nightconfig_version}")
implementation("com.electronwill.night-config:toml:${project.nightconfig_version}")
implementation("com.electronwill.night-config:core:${project.nightconfig_version}")
modImplementation "maven.modrinth:carbon-config:${project.carbon_config_fabric_version}"
modCompileOnly("curse.maven:the-one-probe-fabric-581847:${project.top_fabric_file}")
modCompileOnly "lol.bai.megane:megane-reborn-energy:${project.megane_version}"
Expand All @@ -99,7 +99,7 @@ processResources {
expand toReplace
}
}
tasks.withType(JavaCompile) {
tasks.named('compileJava', JavaCompile) {
source(project(":antimatter-common").sourceSets.main.allSource)
}

Expand All @@ -116,19 +116,13 @@ publishing {
}

repositories {
def isCI = System.getenv("GITHUB_ACTION")
def isRELEASE = System.getenv("GITHUB_RELEASE")
if (isCI && isRELEASE) {
def isCI = System.getenv("CI")
if (isCI) {
maven {
name = "GTMaven"
url = "https://repo.repsy.io/mvn/trinsdar/gregtech-intergalactical/"
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
url System.getenv("local_maven_url")
}
} else {
maven { url "file:///${project.projectDir}/mcmodsrepo"}
mavenLocal()
}
}
}
145 changes: 51 additions & 94 deletions forge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,60 +1,34 @@
plugins {
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id 'org.spongepowered.mixin' version '0.7.+'
id "net.neoforged.moddev.legacyforge" version "2.0.58-beta"
id 'xyz.wagyourtail.unimined.expect-platform' version '1.0.5'
}

archivesBaseName = "${rootProject.antimatter_archive_base_name}-forge"

minecraft {
// Change to your preferred mappings
mappings channel: "parchment", version: "${rootProject.mappings_version}-${rootProject.minecraft_version}"
// Add your AccessTransformer
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
archivesBaseName = "${project.antimatter_archive_base_name}-forge"

neoForge {
version = "${project.minecraft_version}-${project.forge_version}"
def at = project(':antimatter-common').file('src/main/resources/META-INF/accesstransformer.cfg')
if (at.exists()) {
accessTransformers.add(at.absolutePath)
}
parchment {
minecraftVersion = project.minecraft_version
mappingsVersion = project.mappings_version
}
runs {
// applies to all the run configs below
configureEach {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"

// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', mod_id

mods {
"${mod_id}" {
source sourceSets.main
}
}
}

client {
property 'forge.enabledGameTestNamespaces', mod_id
client()
}

server {
workingDirectory project.file('run/server')
property 'forge.enabledGameTestNamespaces', mod_id
args '--nogui'
data {
data()
}

// 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 {
property 'forge.enabledGameTestNamespaces', mod_id
server {
server()
}

data {
// example of overriding the workingDirectory set in configureEach above
workingDirectory project.file('run-data')

// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
}
mods {
"${mod_id}" {
sourceSet sourceSets.main
}
}
}
Expand All @@ -64,62 +38,59 @@ mixin {
config "antimatter.mixins.json"
config "antimatter-forge.mixins.json"
config "antimatter.rei.mixins.json"
debug.verbose = true
debug.export = true
}

jarJar.enable()

dependencies {
implementation(expectPlatform.annotationsDep)
minecraft "net.minecraftforge:forge:${project.minecraft_version}-${project.forge_version}"
implementation(project(path: ":tesseract-forge"))
implementation(project(path: ":tesseract-common"))
afterEvaluate {
jarJar(project(path: ":tesseract-forge")){
jarJar.ranged(it, "[${project(":tesseract-forge").version},)")
transitive = false
}
}
compileOnly(project(":antimatter-common"))
jarJar(project(path: ":tesseract-forge"))

//MIXIN
annotationProcessor 'org.spongepowered:mixin:0.8.5-SNAPSHOT:processor'
implementation("org.jetbrains:annotations:26.0.1")
//modCompileOnly("mezz.jei:jei-${rootProject.minecraft_version}-forge:${rootProject.jei_version}")
//modRuntimeOnly("mezz.jei:jei-${rootProject.minecraft_version}-forge:${rootProject.jei_version}")
implementation fg.deobf("mezz.jei:jei-1.18.2:9.7.2.1001")
compileOnly fg.deobf("me.shedaniel:RoughlyEnoughItems-forge:${rootProject.rei_version}")
compileOnly fg.deobf("me.shedaniel.cloth:cloth-config-forge:6.5.133")
implementation fg.deobf("com.blamejared.crafttweaker:CraftTweaker-forge-1.18.2:${rootProject.crafttweaker_version}")
implementation fg.deobf(include("dev.trinsdar:arrp-forge:0.6.7"))
implementation fg.deobf(include("dev.trinsdar:terraform-utils-v1:3.1.5"))
implementation fg.deobf(include("earth.terrarium:botarium-forge-1.18.2:${project.botarium_version}"))
implementation fg.deobf(include("org.gt-reimagined:structurelib-forge:${project.structurelib_version}-${project.minecraft_version}"))
implementation fg.deobf(include("com.teamresourceful.resourcefullib:resourcefullib-forge-1.18.2:${project.resourcefullib_version}"))
implementation fg.deobf("maven.modrinth:carbon-config:${project.carbon_config_forge_version}")
modImplementation("mezz.jei:jei-1.18.2:9.7.2.1001")
modCompileOnly("me.shedaniel:RoughlyEnoughItems-forge:${project.rei_version}")
modCompileOnly("me.shedaniel.cloth:cloth-config-forge:6.5.133")
modImplementation("com.blamejared.crafttweaker:CraftTweaker-forge-1.18.2:${project.crafttweaker_version}")
modImplementation(include("dev.trinsdar:arrp-forge:0.6.7"))
modImplementation(include("dev.trinsdar:terraform-utils-v1:3.1.5"))
modImplementation(include("earth.terrarium:botarium-forge-1.18.2:${project.botarium_version}"))
modImplementation(include("org.gt-reimagined:structurelib-forge:${project.structurelib_version}-${project.minecraft_version}"))
modImplementation(include("com.teamresourceful.resourcefullib:resourcefullib-forge-1.18.2:${project.resourcefullib_version}"))
modImplementation("maven.modrinth:carbon-config:${project.carbon_config_forge_version}")
jarJar("maven.modrinth:carbon-config:${project.carbon_config_forge_version}"){
jarJar.ranged(it, "[1.18.2-1.2.6,)")
version {
strictly("[1.18.2-1.2.6,)")
prefer("[1.18.2-1.2.6,)")
}
}
implementation fg.deobf("dev.latvian.mods:kubejs-forge:${rootProject.kubejs_version}")
implementation fg.deobf("dev.latvian.mods:rhino-forge:${rootProject.rhino_version}")
implementation fg.deobf("dev.architectury:architectury-forge:${rootProject.architectury_version}")
implementation fg.deobf("curse.maven:the-one-probe-245211:${rootProject.top_forge_file}")
modImplementation("dev.latvian.mods:kubejs-forge:${project.kubejs_version}")
modImplementation("dev.latvian.mods:rhino-forge:${project.rhino_version}")
modImplementation("dev.architectury:architectury-forge:${project.architectury_version}")
modImplementation("curse.maven:the-one-probe-245211:${project.top_forge_file}")
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.4.1"))
implementation(include("io.github.llamalad7:mixinextras-forge:0.4.1"))
compileOnly fg.deobf("com.simibubi.create:create-${minecraft_version}:0.5.1.i-435:all"){
transitive = false
}
modCompileOnly("com.simibubi.create:create-${minecraft_version}:0.5.1.i-435:all")
//include("org.jetbrains.kotlin:kotlin-reflect:${kotlin.coreLibrariesVersion}")
//include("org.jetbrains.kotlin:kotlin-stdlib:${kotlin.coreLibrariesVersion}")
//include("org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin.coreLibrariesVersion}")
}

Dependency include(Object dep){
dependencies.jarJar(dep){
jarJar.ranged(it, "[${it.version},)")
version {
strictly("[${it.version},)")
prefer(it.version)
}
}
}

tasks.withType(JavaCompile).configureEach {
tasks.named('compileJava', JavaCompile) {
source(project(":antimatter-common").sourceSets.main.allSource)
/*expectPlatform.insertAgent(it, "forge", ["xyz/wagyourtail/unimined/expect/annotation/Environment": "net/minecraftforge/api/distmarker/OnlyIn",
"xyz/wagyourtail/unimined/expect/annotation/Environment\$EnvType": "net/minecraftforge/api/distmarker/Dist",
Expand All @@ -140,10 +111,6 @@ sourcesJar {
from(project(':antimatter-common').sourceSets.main.allSource)
}

tasks.named('jarJar', Jar).configure {
archiveClassifier.set("")
}

tasks.named('jar', Jar).configure {
manifest {
attributes([
Expand All @@ -156,30 +123,20 @@ tasks.named('jar', Jar).configure {
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}

// This is the preferred method to reobfuscate your jar file
finalizedBy 'reobfJar'
archiveClassifier.set "thin"
}

publishing {
publications {
mavenJava(org.gradle.api.publish.maven.MavenPublication) {
artifactId = project.name
from components.java
jarJar.component(it)
}
}
repositories {
def isCI = System.getenv("GITHUB_ACTION")
def isRELEASE = System.getenv("GITHUB_RELEASE")
if (isCI && isRELEASE) {
def isCI = System.getenv("CI")
if (isCI) {
maven {
url = "https://repo.repsy.io/mvn/trinsdar/gregtech-intergalactical/"
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
url System.getenv("local_maven_url")
}
} else {
mavenLocal()
Expand Down

0 comments on commit 93492ed

Please sign in to comment.