Now uses Architectury and added Forge support

This commit is contained in:
coolGi2007
2021-12-09 06:14:30 +00:00
parent 29d152b312
commit 5c47170ef4
158 changed files with 1128 additions and 16269 deletions
+48 -121
View File
@@ -1,138 +1,65 @@
plugins {
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'maven-publish'
id "com.github.johnrengelman.shadow" version "7.1.0"
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "0.10.0-SNAPSHOT" apply false
}
version = '1.0'
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
loom {
accessWidenerPath = file("src/main/resources/lod.accesswidener")
architectury {
minecraft = rootProject.minecraft_version
}
// this is required so that we can use
// jitpack in the dependencies section below
repositories {
mavenCentral()
// used to download and compile dependencies from git repos
maven { url 'https://jitpack.io' }
subprojects { p ->
apply plugin: "dev.architectury.loom"
// Required for ModMenu
maven { url "https://maven.terraformersmc.com/" }
}
configurations {
shadowMe
compileOnly.extendsFrom(embed)
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
// Fabric API
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
// Mod Menu
modImplementation("com.terraformersmc:modmenu:${project.modmenu_version}") {
exclude(group: "net.fabricmc.fabric-api")
loom {
silentMojangMappingsLicense()
}
implementation 'org.tukaani:xz:1.9'
shadowMe 'org.tukaani:xz:1.9'
implementation 'org.apache.commons:commons-compress:1.21'
shadowMe 'org.apache.commons:commons-compress:1.21'
}
shadowJar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
configurations = [project.configurations.getByName("shadowMe")]
relocate 'org.tukaani', 'shaded.tukaani'
relocate 'org.apache.commons.compress', 'shaded.apache.commons.compress'
archiveClassifier = 'unmapped'
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
configurations {
common
shadowMe
implementation.extendsFrom shadowMe
}
}
jar {
archiveClassifier = 'unmapped'
}
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings
mappings loom.officialMojangMappings()
remapJar {
dependsOn(shadowJar)
mustRunAfter(shadowJar)
input = shadowJar.archiveFile
if (p != project(":forge")) {
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
// Do NOT use other classes from fabric loader unless working with fabric
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
}
archiveBaseName = "${project.name}"
archiveVersion = "${project.version}"
archiveClassifier = ''
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
if (p != project(":core")) {
common(project(":core")) { transitive false }
shadowMe(project(":core")) { transitive false }
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
//// add Distant Horizon's Core source folders
//sourceSets {
// main {
// java {
// srcDirs("core/src/main/java");
// srcDirs("core/src/main/resources")
// }
// }
//}
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
archivesBaseName = rootProject.archives_base_name
version = rootProject.mod_version
group = rootProject.maven_group
repositories {
mavenCentral()
// used to download and compile dependencies from git repos
maven { url 'https://jitpack.io' }
}
tasks.withType(JavaCompile) {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
options.release = 17
}
java {
withSourcesJar()
}
}