modularization, part 1

This commit is contained in:
Draylar
2021-03-12 14:10:21 -06:00
parent 5ab6b91dce
commit e6b551a0aa
29 changed files with 160 additions and 89 deletions
+68 -52
View File
@@ -25,63 +25,79 @@ archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
sourceSets {
testmod {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
}
subprojects {
apply plugin: 'fabric-loom'
apply plugin: 'maven-publish'
archivesBaseName = project.name
}
repositories {
maven { url = "https://maven.terraformersmc.com/releases/"}
allprojects {
apply plugin: 'fabric-loom'
repositories {
maven { url = "https://maven.terraformersmc.com/releases/"}
}
dependencies {
//to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "com.terraformersmc:modmenu:1.16.8"
afterEvaluate {
testmodImplementation sourceSets.main.output
}
}
processResources {
inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
expand "version": project.version
}
from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
doLast {
def jsonMinifyStart = System.currentTimeMillis()
def jsonMinified = 0
def jsonBytesSaved = 0
fileTree(dir: outputs.files.asPath, include: '**/*.json').each {
File file = it
jsonMinified++
def oldLength = file.length()
file.text = JsonOutput.toJson(new JsonSlurper().parse(file))
jsonBytesSaved += oldLength - file.length()
println(it)
}
println('Minified ' + jsonMinified + ' json files. Saved ' + jsonBytesSaved + ' bytes. Took ' + (System.currentTimeMillis() - jsonMinifyStart) + 'ms.')
}
}
sourceSets {
testmod {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
}
}
}
dependencies {
//to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "com.terraformersmc:modmenu:1.16.8"
afterEvaluate {
testmodImplementation sourceSets.main.output
}
}
processResources {
inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
expand "version": project.version
}
from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
doLast {
def jsonMinifyStart = System.currentTimeMillis()
def jsonMinified = 0
def jsonBytesSaved = 0
fileTree(dir: outputs.files.asPath, include: '**/*.json').each {
File file = it
jsonMinified++
def oldLength = file.length()
file.text = JsonOutput.toJson(new JsonSlurper().parse(file))
jsonBytesSaved += oldLength - file.length()
println(it)
}
println('Minified ' + jsonMinified + ' json files. Saved ' + jsonBytesSaved + ' bytes. Took ' + (System.currentTimeMillis() - jsonMinifyStart) + 'ms.')
}
compile project(":omega-config-base")
compile project(":omega-config-gui")
}
// ensure that the encoding is set to UTF-8, no matter what the system default is