Formatting + some extra documentation
This commit is contained in:
parent
ddc78efa0e
commit
5276e52f45
2 changed files with 96 additions and 89 deletions
171
build.gradle
171
build.gradle
|
@ -1,14 +1,13 @@
|
||||||
import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar
|
|
||||||
import org.jetbrains.gradle.ext.Gradle
|
import org.jetbrains.gradle.ext.Gradle
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("java")
|
id 'java'
|
||||||
id("java-library")
|
id 'java-library'
|
||||||
id("maven-publish")
|
id 'maven-publish'
|
||||||
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.7"
|
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7'
|
||||||
id("eclipse")
|
id 'eclipse'
|
||||||
id("com.gtnewhorizons.retrofuturagradle") version "1.3.9"
|
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.16'
|
||||||
id("com.matthewprenger.cursegradle") version "1.4.0"
|
id 'com.matthewprenger.cursegradle' version '1.4.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
version = project.mod_version
|
version = project.mod_version
|
||||||
|
@ -24,11 +23,11 @@ java {
|
||||||
}
|
}
|
||||||
// Generate sources and javadocs jars when building and publishing
|
// Generate sources and javadocs jars when building and publishing
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
withJavadocJar()
|
// withJavadocJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
tasks.withType(JavaCompile).configureEach {
|
||||||
options.encoding = "UTF-8"
|
options.encoding = 'UTF-8'
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
|
@ -38,6 +37,18 @@ configurations {
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
mcVersion = '1.12.2'
|
mcVersion = '1.12.2'
|
||||||
|
|
||||||
|
// MCP Mappings
|
||||||
|
mcpMappingChannel = 'stable'
|
||||||
|
mcpMappingVersion = '39'
|
||||||
|
|
||||||
|
// Set username here, the UUID will be looked up automatically
|
||||||
|
username = 'Developer'
|
||||||
|
|
||||||
|
// Add any additional tweaker classes here
|
||||||
|
// extraTweakClasses.add('org.spongepowered.asm.launch.MixinTweaker')
|
||||||
|
|
||||||
|
// Add various JVM arguments here for runtime
|
||||||
def args = ["-ea:${project.group}"]
|
def args = ["-ea:${project.group}"]
|
||||||
if (project.use_coremod.toBoolean()) {
|
if (project.use_coremod.toBoolean()) {
|
||||||
args << '-Dfml.coreMods.load=' + coremod_plugin_class_name
|
args << '-Dfml.coreMods.load=' + coremod_plugin_class_name
|
||||||
|
@ -49,26 +60,36 @@ minecraft {
|
||||||
}
|
}
|
||||||
extraRunJvmArguments.addAll(args)
|
extraRunJvmArguments.addAll(args)
|
||||||
|
|
||||||
|
// Include and use dependencies' Access Transformer files
|
||||||
useDependencyAccessTransformers = true
|
useDependencyAccessTransformers = true
|
||||||
|
|
||||||
injectedTags.put("VERSION", project.version)
|
// Add any properties you want to swap out for a dynamic value at build time here
|
||||||
|
// Any properties here will be added to a class at build time, the name can be configured below
|
||||||
|
// Example:
|
||||||
|
// injectedTags.put('VERSION', project.version)
|
||||||
|
// injectedTags.put('MOD_ID', project.archives_base_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate a my.project.Tags class with the version number as a field
|
// Generate a group.archives_base_name.Tags class
|
||||||
tasks.injectTags.configure {
|
tasks.injectTags.configure {
|
||||||
outputClassName.set("${project.group}.Tags")
|
// Change Tags class' name here:
|
||||||
|
outputClassName.set("${project.group}.${project.archives_base_name}.Tags")
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url = 'https://maven.cleanroommc.com'
|
name 'CleanroomMC Maven'
|
||||||
|
url 'https://maven.cleanroommc.com'
|
||||||
}
|
}
|
||||||
maven { url = "https://repo.spongepowered.org/maven" }
|
|
||||||
//maven { url "https://maven.mcmoddev.com/" }
|
|
||||||
maven {
|
maven {
|
||||||
url "https://cursemaven.com"
|
name 'SpongePowered Maven'
|
||||||
|
url 'https://repo.spongepowered.org/maven'
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name 'CurseMaven'
|
||||||
|
url 'https://cursemaven.com'
|
||||||
content {
|
content {
|
||||||
includeGroup "curse.maven"
|
includeGroup 'curse.maven'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mavenLocal() // Must be last for caching to work
|
mavenLocal() // Must be last for caching to work
|
||||||
|
@ -76,47 +97,32 @@ repositories {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
if (project.use_assetmover.toBoolean()) {
|
if (project.use_assetmover.toBoolean()) {
|
||||||
implementation 'com.cleanroommc:assetmover:2.0'
|
implementation 'com.cleanroommc:assetmover:2.5'
|
||||||
}
|
}
|
||||||
if (project.use_mixins.toBoolean()) {
|
if (project.use_mixins.toBoolean()) {
|
||||||
implementation 'zone.rong:mixinbooter:7.0'
|
implementation 'zone.rong:mixinbooter:7.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Example deobf dependency
|
// Example of deobfuscating a dependency
|
||||||
// compileOnly rfg.deobf("curse.maven:endercore-231868:2972849:")
|
// implementation rfg.deobf('curse.maven:had-enough-items-557549:4543375')
|
||||||
|
|
||||||
if (project.use_mixins.toBoolean()) {
|
if (project.use_mixins.toBoolean()) {
|
||||||
api ("org.spongepowered:mixin:0.8.3") {transitive = false}
|
// Change your mixin refmap name here:
|
||||||
annotationProcessor('org.ow2.asm:asm-debug-all:5.2')
|
String mixin = modUtils.enableMixins('org.spongepowered:mixin:0.8.3', "mixins.${project.archives_base_name}.refmap.json")
|
||||||
annotationProcessor('com.google.guava:guava:24.1.1-jre')
|
api (mixin) {
|
||||||
annotationProcessor('com.google.code.gson:gson:2.8.6')
|
transitive = false
|
||||||
annotationProcessor ("org.spongepowered:mixin:0.8.3") {transitive = false}
|
}
|
||||||
}
|
annotationProcessor 'org.ow2.asm:asm-debug-all:5.2'
|
||||||
|
annotationProcessor 'com.google.guava:guava:24.1.1-jre'
|
||||||
}
|
annotationProcessor 'com.google.code.gson:gson:2.8.6'
|
||||||
|
annotationProcessor (mixin) {
|
||||||
def mixinConfigRefMap = 'mixins.' + project.archives_base_name + '.refmap.json'
|
transitive = false
|
||||||
def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins'
|
|
||||||
def refMap = "${mixinTmpDir}" + File.separator + mixinConfigRefMap
|
|
||||||
def mixinSrg = "${mixinTmpDir}" + File.separator + "mixins.srg"
|
|
||||||
|
|
||||||
if (project.use_mixins.toBoolean()) {
|
|
||||||
tasks.named("reobfJar", ReobfuscatedJar).configure {
|
|
||||||
extraSrgFiles.from(mixinSrg)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named("compileJava", JavaCompile).configure {
|
|
||||||
doFirst {
|
|
||||||
new File(mixinTmpDir).mkdirs()
|
|
||||||
}
|
}
|
||||||
options.compilerArgs += [
|
|
||||||
"-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}",
|
|
||||||
"-AoutSrgFile=${mixinSrg}",
|
|
||||||
"-AoutRefMapFile=${refMap}",
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adds Access Transformer files to tasks
|
||||||
if (project.use_access_transformer.toBoolean()) {
|
if (project.use_access_transformer.toBoolean()) {
|
||||||
for (File at : sourceSets.getByName("main").resources.files) {
|
for (File at : sourceSets.getByName("main").resources.files) {
|
||||||
if (at.name.toLowerCase().endsWith("_at.cfg")) {
|
if (at.name.toLowerCase().endsWith("_at.cfg")) {
|
||||||
|
@ -127,12 +133,13 @@ if (project.use_access_transformer.toBoolean()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
// this will ensure that this task is redone when the versions change.
|
// This will ensure that this task is redone when the versions change
|
||||||
inputs.property 'version', project.version
|
inputs.property 'version', project.version
|
||||||
inputs.property 'mcversion', project.minecraft.version
|
inputs.property 'mcversion', project.minecraft.version
|
||||||
// replace stuff in mcmod.info, nothing else
|
|
||||||
|
// Replace various properties in mcmod.info and pack.mcmeta if applicable
|
||||||
filesMatching(['mcmod.info', 'pack.mcmeta']) { fcd ->
|
filesMatching(['mcmod.info', 'pack.mcmeta']) { fcd ->
|
||||||
// replace version and mcversion
|
// Replace version and mcversion
|
||||||
fcd.expand (
|
fcd.expand (
|
||||||
'version': project.version,
|
'version': project.version,
|
||||||
'mcversion': project.minecraft.version
|
'mcversion': project.minecraft.version
|
||||||
|
@ -140,13 +147,7 @@ processResources {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.use_access_transformer.toBoolean()) {
|
if (project.use_access_transformer.toBoolean()) {
|
||||||
rename '(.+_at.cfg)', 'META-INF/$1' // Access Transformers
|
rename '(.+_at.cfg)', 'META-INF/$1' // Make sure Access Transformer files are in META-INF folder
|
||||||
}
|
|
||||||
|
|
||||||
if (project.use_mixins.toBoolean()) {
|
|
||||||
// Embed mixin refmap
|
|
||||||
from refMap
|
|
||||||
dependsOn("compileJava")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +161,7 @@ jar {
|
||||||
attribute_map['ForceLoadAsMod'] = project.gradle.startParameter.taskNames[0] == "build"
|
attribute_map['ForceLoadAsMod'] = project.gradle.startParameter.taskNames[0] == "build"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (project.use_access_transformer.toBoolean()) {
|
if (project.use_access_transformer.toBoolean()) {
|
||||||
attribute_map['FMLAT'] = project.archives_base_name + '_at.cfg'
|
attribute_map['FMLAT'] = project.archives_base_name + '_at.cfg'
|
||||||
}
|
}
|
||||||
attributes(attribute_map)
|
attributes(attribute_map)
|
||||||
|
@ -170,31 +171,35 @@ jar {
|
||||||
}
|
}
|
||||||
|
|
||||||
idea {
|
idea {
|
||||||
module { inheritOutputDirs = true }
|
module {
|
||||||
project { settings {
|
inheritOutputDirs = true
|
||||||
runConfigurations {
|
}
|
||||||
"1. Run Client"(Gradle) {
|
project {
|
||||||
taskNames = ["runClient"]
|
settings {
|
||||||
|
runConfigurations {
|
||||||
|
"1. Run Client"(Gradle) {
|
||||||
|
taskNames = ["runClient"]
|
||||||
|
}
|
||||||
|
"2. Run Server"(Gradle) {
|
||||||
|
taskNames = ["runServer"]
|
||||||
|
}
|
||||||
|
"3. Run Obfuscated Client"(Gradle) {
|
||||||
|
taskNames = ["runObfClient"]
|
||||||
|
}
|
||||||
|
"4. Run Obfuscated Server"(Gradle) {
|
||||||
|
taskNames = ["runObfServer"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"2. Run Server"(Gradle) {
|
compiler.javac {
|
||||||
taskNames = ["runServer"]
|
afterEvaluate {
|
||||||
}
|
javacAdditionalOptions = "-encoding utf8"
|
||||||
"3. Run Obfuscated Client"(Gradle) {
|
moduleJavacAdditionalOptions = [
|
||||||
taskNames = ["runObfClient"]
|
(project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ')
|
||||||
}
|
]
|
||||||
"4. Run Obfuscated Server"(Gradle) {
|
}
|
||||||
taskNames = ["runObfServer"]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compiler.javac {
|
}
|
||||||
afterEvaluate {
|
|
||||||
javacAdditionalOptions = "-encoding utf8"
|
|
||||||
moduleJavacAdditionalOptions = [
|
|
||||||
(project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ')
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named("processIdeaSettings").configure {
|
tasks.named("processIdeaSettings").configure {
|
||||||
|
|
|
@ -2,12 +2,12 @@ pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
// RetroFuturaGradle
|
// RetroFuturaGradle
|
||||||
name = "GTNH Maven"
|
name 'GTNH Maven'
|
||||||
url = uri("http://jenkins.usrv.eu:8081/nexus/content/groups/public/")
|
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
|
||||||
allowInsecureProtocol = true
|
allowInsecureProtocol = true
|
||||||
mavenContent {
|
mavenContent {
|
||||||
includeGroup("com.gtnewhorizons")
|
includeGroup 'com.gtnewhorizons'
|
||||||
includeGroup("com.gtnewhorizons.retrofuturagradle")
|
includeGroup 'com.gtnewhorizons.retrofuturagradle'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
@ -18,7 +18,9 @@ pluginManagement {
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
// Automatic toolchain provisioning
|
// Automatic toolchain provisioning
|
||||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.4.0"
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.name = archives_base_name
|
// Due to an IntelliJ bug, this has to be done
|
||||||
|
// rootProject.name = archives_base_name
|
||||||
|
rootProject.name = rootProject.projectDir.getName()
|
||||||
|
|
Loading…
Reference in a new issue