2020-04-13 08:58:57 +02:00
|
|
|
plugins {
|
2023-11-23 05:56:29 +01:00
|
|
|
id 'eclipse'
|
|
|
|
id 'idea'
|
|
|
|
id 'maven-publish'
|
|
|
|
id 'net.minecraftforge.gradle' version "${forgegradle_version}"
|
|
|
|
id 'org.parchmentmc.librarian.forgegradle' version "${librarian_version}"
|
2023-11-24 01:14:46 +01:00
|
|
|
id 'org.spongepowered.mixin' version "${mixingradle_version}"
|
2020-04-13 08:58:57 +02:00
|
|
|
}
|
2020-06-08 02:18:34 +02:00
|
|
|
|
2022-08-05 19:51:07 +02:00
|
|
|
jarJar.enable()
|
|
|
|
|
2021-06-21 01:20:18 +02:00
|
|
|
boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false');
|
2021-06-19 08:52:13 +02:00
|
|
|
|
2022-02-09 04:26:36 +01:00
|
|
|
ext.buildNumber = System.getenv('BUILD_NUMBER')
|
2021-06-21 01:20:18 +02:00
|
|
|
|
2021-06-21 22:56:27 +02:00
|
|
|
group = 'com.jozufozu.flywheel'
|
2022-07-15 09:00:54 +02:00
|
|
|
archivesBaseName = "flywheel-forge-${artifact_minecraft_version}"
|
|
|
|
version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '')
|
2019-07-11 09:03:08 +02:00
|
|
|
|
2021-12-07 06:29:21 +01:00
|
|
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
2019-07-11 09:03:08 +02:00
|
|
|
|
2023-11-23 05:56:29 +01:00
|
|
|
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
|
2019-07-11 09:03:08 +02:00
|
|
|
minecraft {
|
2021-12-24 08:09:51 +01:00
|
|
|
mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}"
|
2021-06-16 20:19:33 +02:00
|
|
|
|
2023-11-23 05:56:29 +01:00
|
|
|
copyIdeResources = true
|
|
|
|
|
2021-04-10 01:23:49 +02:00
|
|
|
runs {
|
2023-11-23 05:56:29 +01:00
|
|
|
configureEach {
|
2019-07-11 09:03:08 +02:00
|
|
|
workingDirectory project.file('run')
|
2021-06-16 20:19:33 +02:00
|
|
|
|
|
|
|
property 'forge.logging.markers', ''
|
|
|
|
property 'forge.logging.console.level', 'debug'
|
2023-11-23 05:56:29 +01:00
|
|
|
|
2022-07-11 00:08:59 +02:00
|
|
|
property 'mixin.env.remapRefMap', 'true'
|
|
|
|
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
2021-06-16 20:19:33 +02:00
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
mods {
|
2021-06-16 20:19:33 +02:00
|
|
|
flywheel {
|
2019-07-11 09:03:08 +02:00
|
|
|
source sourceSets.main
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-23 05:56:29 +01:00
|
|
|
client {
|
|
|
|
property 'flw.dumpShaderSource', 'true'
|
|
|
|
property 'flw.debugMemorySafety', 'true'
|
2019-08-06 19:00:51 +02:00
|
|
|
}
|
2019-07-11 09:03:08 +02:00
|
|
|
|
2023-11-23 05:56:29 +01:00
|
|
|
server {
|
|
|
|
args '--nogui'
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-16 12:27:28 +02:00
|
|
|
repositories {
|
2021-12-27 00:41:20 +01:00
|
|
|
maven {
|
|
|
|
url 'https://www.cursemaven.com'
|
|
|
|
content {
|
|
|
|
includeGroup "curse.maven"
|
|
|
|
}
|
|
|
|
}
|
2020-03-23 04:09:28 +01:00
|
|
|
maven {
|
2021-11-18 23:59:39 +01:00
|
|
|
name 'tterrag maven'
|
|
|
|
url 'https://maven.tterrag.com/'
|
2020-03-23 04:09:28 +01:00
|
|
|
}
|
2022-07-11 00:08:59 +02:00
|
|
|
maven {
|
|
|
|
name = "Modrinth"
|
|
|
|
url = "https://api.modrinth.com/maven"
|
|
|
|
content {
|
|
|
|
includeGroup "maven.modrinth"
|
|
|
|
}
|
|
|
|
}
|
2022-08-05 19:51:07 +02:00
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
2023-11-23 05:56:29 +01:00
|
|
|
// Fix for loading non-mod libraries in dev-env, used for Miniball.
|
2022-08-05 19:51:07 +02:00
|
|
|
// https://gist.github.com/SizableShrimp/66b22f1b24c255e1491c8d98d3f11f83
|
|
|
|
// v--------------------------------------------------------------------v
|
|
|
|
configurations {
|
|
|
|
library
|
|
|
|
implementation.extendsFrom library
|
2020-04-13 08:58:57 +02:00
|
|
|
}
|
|
|
|
|
2023-11-23 05:56:29 +01:00
|
|
|
minecraft.runs.configureEach {
|
2022-08-05 19:51:07 +02:00
|
|
|
lazyToken('minecraft_classpath') {
|
|
|
|
configurations.library.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator)
|
|
|
|
}
|
2020-04-13 08:58:57 +02:00
|
|
|
}
|
2022-08-05 19:51:07 +02:00
|
|
|
// ^--------------------------------------------------------------------^
|
2020-04-13 08:58:57 +02:00
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
dependencies {
|
2023-04-09 23:15:29 +02:00
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
|
2020-06-08 02:18:34 +02:00
|
|
|
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
2021-04-10 01:23:49 +02:00
|
|
|
|
2023-11-25 23:09:30 +01:00
|
|
|
compileOnly fg.deobf("maven.modrinth:embeddium:0.2.10+mc1.20.1")
|
|
|
|
compileOnly fg.deobf("maven.modrinth:oculus:1.20.1-1.6.9")
|
2023-03-30 07:03:28 +02:00
|
|
|
|
2023-11-23 05:56:29 +01:00
|
|
|
jarJar(group: 'com.dreizak', name: 'miniball', version: '[1.0.3,2.0.0)')
|
2023-03-30 07:03:28 +02:00
|
|
|
library 'com.dreizak:miniball:1.0.3'
|
2022-07-30 01:06:25 +02:00
|
|
|
|
2021-12-02 23:03:14 +01:00
|
|
|
// https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497
|
|
|
|
// Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings
|
|
|
|
// This allows 'Settings > Build, Execution, and Deployment > Build Tools > Gradle > Build and run using' set to IntelliJ to work correctly
|
2023-11-24 01:14:46 +01:00
|
|
|
// if (System.getProperty('idea.sync.active') != 'true') {
|
2023-11-25 23:09:30 +01:00
|
|
|
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
|
2023-11-24 01:14:46 +01:00
|
|
|
// }
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|
|
|
|
|
2023-04-09 23:15:29 +02:00
|
|
|
test {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
|
|
|
|
2022-07-15 09:00:54 +02:00
|
|
|
mixin {
|
|
|
|
add sourceSets.main, 'flywheel.refmap.json'
|
2023-11-23 05:56:29 +01:00
|
|
|
|
|
|
|
config 'flywheel.mixins.json'
|
|
|
|
config 'flywheel.sodium.mixins.json'
|
|
|
|
|
|
|
|
debug.verbose = true
|
|
|
|
debug.export = true
|
2022-07-15 09:00:54 +02:00
|
|
|
}
|
|
|
|
|
2024-01-15 23:09:19 +01:00
|
|
|
idea {
|
|
|
|
// Tell IDEA to always download sources/javadoc artifacts from maven.
|
|
|
|
module {
|
|
|
|
downloadJavadoc = true
|
|
|
|
downloadSources = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-16 04:29:42 +02:00
|
|
|
// Workaround for SpongePowered/MixinGradle#38
|
2022-07-15 18:42:14 +02:00
|
|
|
afterEvaluate {
|
|
|
|
tasks.configureReobfTaskForReobfJar.mustRunAfter(tasks.compileJava)
|
2022-08-05 19:51:07 +02:00
|
|
|
tasks.configureReobfTaskForReobfJarJar.mustRunAfter(tasks.compileJava)
|
2022-07-15 18:42:14 +02:00
|
|
|
}
|
|
|
|
|
2022-07-15 09:00:54 +02:00
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
|
|
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
|
|
|
}
|
|
|
|
|
2022-07-15 18:42:14 +02:00
|
|
|
javadoc {
|
|
|
|
source = [sourceSets.main.allJava]
|
|
|
|
// prevent java 8's strict doclint for javadocs from failing builds
|
|
|
|
options.addStringOption('Xdoclint:none', '-quiet')
|
|
|
|
}
|
|
|
|
|
2022-08-05 19:51:07 +02:00
|
|
|
compileJava {
|
|
|
|
options.compilerArgs = ['-Xdiags:verbose']
|
|
|
|
}
|
|
|
|
|
2024-01-16 02:41:17 +01:00
|
|
|
tasks.named('processResources', ProcessResources).configure {
|
|
|
|
var replaceProperties = [
|
|
|
|
minecraft_version : minecraft_version,
|
|
|
|
minecraft_version_range: minecraft_version_range,
|
|
|
|
forge_version : forge_version,
|
|
|
|
forge_version_range : forge_version_range,
|
|
|
|
loader_version_range : loader_version_range,
|
2024-01-17 19:37:39 +01:00
|
|
|
mod_version : mod_version
|
2024-01-16 02:41:17 +01:00
|
|
|
]
|
|
|
|
inputs.properties replaceProperties
|
|
|
|
|
|
|
|
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
|
|
|
|
expand replaceProperties + [project: project]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-22 20:12:48 +01:00
|
|
|
apply from: rootProject.file('gradle/package-infos.gradle')
|
|
|
|
|
2023-11-23 05:56:29 +01:00
|
|
|
void addLicense(jarTask) {
|
|
|
|
jarTask.from('LICENSE.md') {
|
|
|
|
rename '(.*)\\.(.*)', '$1_' + archivesBaseName + '.$2'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-16 02:41:17 +01:00
|
|
|
void addManifest(jarTask) {
|
|
|
|
jarTask.manifest {
|
2019-07-11 09:03:08 +02:00
|
|
|
attributes([
|
2024-01-16 02:41:17 +01:00
|
|
|
'Specification-Title' : 'flywheel',
|
2023-11-25 23:09:30 +01:00
|
|
|
// 'Specification-Vendor': 'flywheel authors',
|
2024-01-16 02:41:17 +01:00
|
|
|
'Specification-Version' : '1', // We are version 1 of ourselves
|
|
|
|
'Implementation-Title' : project.jar.archiveBaseName,
|
|
|
|
'Implementation-Version' : project.jar.archiveVersion,
|
2023-11-25 23:09:30 +01:00
|
|
|
// 'Implementation-Vendor': 'flywheel authors',
|
2022-07-15 09:00:54 +02:00
|
|
|
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
2019-07-11 09:03:08 +02:00
|
|
|
])
|
|
|
|
}
|
2024-01-16 02:41:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.named('jar', Jar).configure {
|
|
|
|
archiveClassifier = 'slim'
|
2023-11-23 05:56:29 +01:00
|
|
|
|
|
|
|
finalizedBy 'reobfJar'
|
2024-01-16 02:41:17 +01:00
|
|
|
addManifest(it)
|
|
|
|
addLicense(it)
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.named('jarJar', Jar).configure {
|
|
|
|
archiveClassifier = ''
|
|
|
|
|
|
|
|
finalizedBy 'reobfJarJar'
|
|
|
|
addManifest(it)
|
2023-11-23 05:56:29 +01:00
|
|
|
addLicense(it)
|
|
|
|
}
|
|
|
|
|
2022-07-15 09:00:54 +02:00
|
|
|
java {
|
|
|
|
withSourcesJar()
|
|
|
|
withJavadocJar()
|
2021-06-20 01:52:23 +02:00
|
|
|
}
|
|
|
|
|
2021-06-21 22:56:27 +02:00
|
|
|
publishing {
|
|
|
|
publications {
|
2023-11-23 05:56:29 +01:00
|
|
|
register('mavenJava', MavenPublication) {
|
|
|
|
artifact jar
|
2023-12-28 22:05:25 +01:00
|
|
|
artifact sourcesJar
|
|
|
|
artifact javadocJar
|
2022-07-15 09:00:54 +02:00
|
|
|
|
2023-12-27 21:44:16 +01:00
|
|
|
artifactId = archivesBaseName
|
|
|
|
|
2022-07-15 09:00:54 +02:00
|
|
|
fg.component(it)
|
2022-07-30 01:06:25 +02:00
|
|
|
jarJar.component(it)
|
2021-06-21 22:56:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
repositories {
|
2023-11-23 05:56:29 +01:00
|
|
|
maven {
|
|
|
|
url "file://${project.projectDir}/mcmodsrepo"
|
|
|
|
}
|
|
|
|
|
2021-06-21 22:56:27 +02:00
|
|
|
if (project.hasProperty('mavendir')) {
|
|
|
|
maven { url mavendir }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|