Fix some stuff
This commit is contained in:
+44
-18
@@ -17,6 +17,7 @@ def writeBuildGradlePredefine() {
|
||||
new File(projectDir, "build.properties").text = "MC_VERSION_${excapedMCVersion}=\n"
|
||||
}
|
||||
|
||||
// Sets up the variables for Manifold in the code
|
||||
def loadProperties() {
|
||||
def defaultMcVersion = '1.18.2'
|
||||
if (!project.hasProperty("mcVer")) {
|
||||
@@ -34,7 +35,6 @@ def loadProperties() {
|
||||
// println "Added prop [key:" + prop.key + ", value:" + prop.value + "]"
|
||||
}
|
||||
writeBuildGradlePredefine()
|
||||
|
||||
}
|
||||
loadProperties()
|
||||
|
||||
@@ -93,11 +93,12 @@ subprojects { p ->
|
||||
}
|
||||
}
|
||||
|
||||
// Allows the jar to run standalone
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Implementation-Title': rootProject.archives_base_name,
|
||||
'Implementation-Version': rootProject.mod_version,
|
||||
'Main-Class': 'com.seibel.lod.core.JarMain'
|
||||
'Main-Class': 'com.seibel.lod.core.JarMain' // When changing the main of the jar change this line
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,8 +118,8 @@ allprojects { p ->
|
||||
// used to download and compile dependencies from git repos
|
||||
maven { url 'https://jitpack.io' }
|
||||
|
||||
// For Manifold Preprocessor
|
||||
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
||||
// For Manifold Preprocessor
|
||||
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
||||
|
||||
// Required for importing Modrinth mods
|
||||
maven {
|
||||
@@ -158,17 +159,18 @@ allprojects { p ->
|
||||
def resourceTargets = ["fabric.mod.json", "META-INF/mods.toml"] // Location of where to put
|
||||
def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder
|
||||
def replaceProperties = [
|
||||
version: mod_version,
|
||||
mod_name: mod_name,
|
||||
authors: mod_authors,
|
||||
description: mod_description,
|
||||
homepage: mod_homepage,
|
||||
source: mod_source,
|
||||
issues: mod_issues,
|
||||
minecraft_version: minecraft_version,
|
||||
version : mod_version,
|
||||
mod_name : mod_name,
|
||||
authors : mod_authors,
|
||||
description : mod_description,
|
||||
homepage : mod_homepage,
|
||||
source : mod_source,
|
||||
issues : mod_issues,
|
||||
minecraft_version : minecraft_version,
|
||||
compatible_minecraft_versions: compatible_minecraft_versions,
|
||||
java_version: java_version
|
||||
] // The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties
|
||||
java_version : java_version
|
||||
]
|
||||
// The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties
|
||||
//TODO: Make Forge loader version also be relaced with non hardcoded value instead of "[36,41)"
|
||||
|
||||
inputs.properties replaceProperties
|
||||
@@ -191,16 +193,37 @@ allprojects { p ->
|
||||
}
|
||||
|
||||
|
||||
// This method copies the access wideners from the common project to the fabric project. And it was generated by Github Copilot
|
||||
// Copies the correct accesswidener and renames it
|
||||
task copyAccessWidener(type: Copy) {
|
||||
from project(":common").file("src/main/resources/${acsessWidenerVersion}.lod.accesswidener")
|
||||
into(file(p.file("build/resources/main")))
|
||||
rename "${acsessWidenerVersion}.lod.accesswidener", "lod.accesswidener"
|
||||
}
|
||||
|
||||
task copyCoreResources(type: Copy) {
|
||||
from fileTree(project(":core").file("src/main/resources"))
|
||||
into p.file("build/resources/main")
|
||||
}
|
||||
|
||||
task copyCommonResources(type: Copy) {
|
||||
from fileTree(project(":common").file("src/main/resources"))
|
||||
into p.file("build/resources/main")
|
||||
}
|
||||
|
||||
|
||||
// Is this necessary for running the fabric build
|
||||
if (p == project(":common")) {
|
||||
println "Copying [common/src/main/resources/${acsessWidenerVersion}.lod.accesswidner] to [fabric/build/resources/main]."
|
||||
|
||||
copy {
|
||||
from project(":common").file("src/main/resources/${acsessWidenerVersion}.lod.accesswidener")
|
||||
into project(":fabric").file("build/resources/main")
|
||||
rename "${acsessWidenerVersion}.lod.accesswidener", "lod.accesswidener"
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
// Add Manifold Preprocessor
|
||||
// Add Manifold Preprocessor
|
||||
// def excapedMCVersion = rootProject.minecraft_version.replace(".", "_")
|
||||
// options.compilerArgs += ['-Xplugin:Manifold', "-AMC_VERSION_${excapedMCVersion}"]
|
||||
//
|
||||
@@ -212,12 +235,14 @@ allprojects { p ->
|
||||
//options.compilerArgs += ['-XprintProcessorInfo']
|
||||
//options.compilerArgs += ['-XprintRounds']
|
||||
|
||||
// println options.compilerArgs
|
||||
// println options.compilerArgs
|
||||
|
||||
// Set the java version
|
||||
if (p != project(":core")) {
|
||||
options.compilerArgs += ['-Xplugin:Manifold']
|
||||
options.release = rootProject.java_version as Integer
|
||||
} else if (p == project(":core")) {
|
||||
options.release = 8;
|
||||
options.release = 8; // Core should use Java 8 no matter what
|
||||
}
|
||||
// TODO: make everything use java 8
|
||||
// options.release = 8 // Use Java 8 for everything so back porting is easier
|
||||
@@ -227,6 +252,7 @@ allprojects { p ->
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
// Disable running the core and common
|
||||
if (p == project(":core") || p == project(":common")) {
|
||||
runClient.enabled = false
|
||||
runServer.enabled = false
|
||||
|
||||
+5
-12
@@ -95,31 +95,24 @@ dependencies {
|
||||
shadowMe 'org.apache.commons:commons-compress:1.21'
|
||||
}
|
||||
|
||||
task copyCoreResources(type: Copy) {
|
||||
from fileTree(project(":core").file("src/main/resources"))
|
||||
into file("build/resources/main")
|
||||
}
|
||||
|
||||
task deleteResources(type: Delete) {
|
||||
delete file("build/resources/main")
|
||||
}
|
||||
|
||||
task copyCommonResources(type: Copy) {
|
||||
from fileTree(project(":common").file("src/main/resources"))
|
||||
into file("build/resources/main")
|
||||
processResources {
|
||||
dependsOn(copyCoreResources)
|
||||
dependsOn(copyCommonResources)
|
||||
dependsOn(copyAccessWidener)
|
||||
}
|
||||
|
||||
runClient {
|
||||
dependsOn(copyCoreResources)
|
||||
dependsOn(copyCommonResources)
|
||||
dependsOn(copyAccessWidener)
|
||||
jvmArgs "-XX:-OmitStackTraceInFastThrow"
|
||||
finalizedBy(deleteResources)
|
||||
}
|
||||
|
||||
processResources {
|
||||
dependsOn(copyAccessWidener)
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
configurations = [project.configurations.shadowMe]
|
||||
relocate 'org.tukaani', 'shaded.tukaani'
|
||||
|
||||
@@ -54,16 +54,6 @@ dependencies {
|
||||
shadowMe 'org.apache.commons:commons-compress:1.21'
|
||||
}
|
||||
|
||||
task copyCoreResources(type: Copy) {
|
||||
from fileTree(project(":core").file("src/main/resources"))
|
||||
into file("build/resources/main")
|
||||
}
|
||||
|
||||
task copyCommonResources(type: Copy) {
|
||||
from fileTree(project(":common").file("src/main/resources"))
|
||||
into file("build/resources/main")
|
||||
}
|
||||
|
||||
processResources {
|
||||
dependsOn(copyAccessWidener)
|
||||
dependsOn(copyCoreResources)
|
||||
|
||||
Reference in New Issue
Block a user