123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- import net.neoforged.moddevgradle.internal.RunGameTask
- plugins {
- id 'java-library'
- id 'eclipse'
- id 'idea'
- id 'maven-publish'
- // Version List: https://projects.neoforged.net/neoforged/ModDevGradle
- id 'net.neoforged.moddev' version "${mdg_version}"
- id "com.dorongold.task-tree" version "4.0.0"
- }
- def secrets = new Properties()
- def secretsFile = file('secrets.properties')
- if (secretsFile.exists()) {
- secretsFile.withInputStream {
- stream -> secrets.load(stream)
- }
- fileTree("secrets").matching {
- include "**/*.properties"
- }.each {
- File file ->
- file.withInputStream {
- stream -> secrets.load(stream)
- }
- }
- }
- idea {
- module {
- downloadJavadoc = true
- downloadSources = true
- }
- }
- version = (hasProperty("CIRevision") ? CIRevision : project.mod_version)
- group = group_name
- java {
- toolchain {
- languageVersion.set(JavaLanguageVersion.of(21))
- }
- }
- compileJava.options.compilerArgs << "-Xlint:all,-classfile,-processing,-deprecation,-this-escape" << "-Werror"
- base {
- archivesName = "${project.mod_id}-${project.minecraft_version}"
- }
- subprojects {
- version = project(":").version
- }
- neoForge {
- evaluationDependsOnChildren() // we need the subprojects to evaluate first so that the sourceSets are properly constructed
- version = project.neo_version
- validateAccessTransformers = true
- mods {
- twilightforest {
- sourceSet this.sourceSets.main
- }
- 'tf-asm' {
- sourceSet project(":tf-asm").sourceSets.main
- }
- }
- unitTest {
- enable()
- testedMod = mods.twilightforest
- }
- runs {
- configureEach {
- gameDirectory = project.file('run')
- systemProperty 'forge.logging.console.level', 'debug'
- logLevel = org.slf4j.event.Level.DEBUG
- }
- client {
- client()
- systemProperty 'forge.enabledGameTestNamespaces', mod_id
- programArguments.addAll '--username', secrets.getProperty("username") ?: 'Dev', secrets.getProperty("uuid") ? '--uuid' : '', secrets.getProperty("uuid") ?: ''
- }
- server {
- server()
- systemProperty 'forge.enabledGameTestNamespaces', mod_id
- programArgument '--nogui'
- }
- data {
- data()
- gameDirectory = project.file('run-data')
- programArguments.addAll '--mod', mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
- }
- }
- }
- afterEvaluate { // DO NOT ASK... it fixes the runClient and family tasks :harold:
- tasks.withType(RunGameTask).configureEach {
- classpathProvider.setFrom(classpathProvider.files.stream().filter(f -> !f.toString().contains('tf-asm')).toList())
- }
- }
- jar {
- exclude 'data/twilightforest/function/**'
- if (hasProperty("CIRevision"))
- exclude 'data/twilightforest/structure/lich_tower'
- }
- sourceSets.main.resources { srcDir 'src/generated/resources' }
- repositories {
- mavenLocal()
- maven {
- name 'Jared\'s Maven' // JEI
- url 'https://maven.blamejared.com/'
- }
- maven {
- name = "OctoStudios" //Curios
- url = uri("https://maven.octo-studios.com/releases")
- }
- maven {
- name 'Shedaniel\'s Maven' //REI
- url "https://maven.shedaniel.me"
- }
- maven {
- name = "TerraformersMC" //EMI
- url = "https://maven.terraformersmc.com/"
- }
- maven { // TOP
- url "https://maven.k-4u.nl"
- }
- maven { //CS
- url "https://nexus.resourcefulbees.com/repository/maven-public/"
- }
- maven {
- name 'Curseforge Maven' // Jade
- url "https://www.cursemaven.com"
- content {
- includeGroup "curse.maven"
- }
- }
- }
- dependencies {
- // Purely so we can see MDG sources for debugging purposes
- compileOnly "net.neoforged.moddev:net.neoforged.moddev.gradle.plugin:${project.mdg_version}"
- jarJar implementation(project(":tf-asm"))
- //make sure to only pick one of these when testing (switch others to compileOnly)
- implementation "mezz.jei:jei-${project.base_minecraft_version}-neoforge:${project.jei_version}"
- compileOnly "me.shedaniel:RoughlyEnoughItems-neoforge:${project.rei_version}"
- compileOnly "dev.emi:emi-neoforge:${project.emi_version}+${project.base_minecraft_version}"
- // theillusivec4
- implementation "top.theillusivec4.curios:curios-neoforge:${project.curios_version}+${project.base_minecraft_version}"
- //curse maven
- implementation "curse.maven:jade-324717:5529595"
- implementation "curse.maven:cosmetic-armor-reworked-237307:5427303"
- // implementation "curse.maven:world-edit-225608:5613180"
- // runtimeOnly "curse.maven:jeed-532286:5483315"
- // runtimeOnly "curse.maven:museum-curator-859070:4629894"
- compileOnly "mcjty.theoneprobe:theoneprobe:${project.top_version}"
- //mods we dont have compat with but are nice to have
- runtimeOnly "com.telepathicgrunt:CommandStructures-Neoforge:4.3.2+1.20.6"
- testImplementation group: 'net.neoforged', name: 'testframework', version: project.neo_version
- testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.10.3'
- testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.10.3'
- testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.12.0'
- }
- configurations.testImplementation {
- exclude module: 'tf-asm'
- }
- test {
- useJUnitPlatform()
- testLogging {
- events "failed"
- showExceptions true
- exceptionFormat "full"
- showCauses true
- showStackTraces true
- showStandardStreams = false
- }
- }
- jar {
- manifest {
- archiveClassifier = 'universal'
- attributes([
- 'Specification-Title' : mod_id,
- 'Specification-Vendor' : "TeamTwilight",
- 'Specification-Version' : "1",
- 'Implementation-Title' : this.project.name,
- 'Implementation-Version' : this.project.jar.archiveVersion,
- 'Implementation-Vendor' : "TeamTwilight",
- 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
- ])
- }
- }
- publishing {
- publications {
- create('mavenJava', MavenPublication) {
- afterEvaluate {
- artifact this.project.jar
- artifact this.project.sourceJar
- }
- groupId 'team-twilight'
- artifactId this.project.mod_id
- }
- }
- repositories {
- maven {
- //url "file:///${project.projectDir}/mcmodsrepo"
- url "https://maven.tamaized.com/releases"
- credentials {
- username System.getenv('ARTIFACTORY_USER')
- password System.getenv('ARTIFACTORY_PASS')
- }
- }
- }
- }
- tasks.register('sourceJar', Jar) {
- dependsOn 'classes'
- from sourceSets.main.allSource
- archiveClassifier = 'sources'
- }
- tasks.withType(JavaCompile).configureEach {
- options.encoding = 'UTF-8'
- }
|