Created
January 21, 2022 09:50
-
-
Save desht/1e15c887ff46c77cffc96e2d3fb30be7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
maven { url = 'https://files.minecraftforge.net/maven' } | |
maven { url = 'https://maven.parchmentmc.org' } | |
mavenCentral() | |
} | |
dependencies { | |
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true | |
classpath 'org.parchmentmc:librarian:1.+' | |
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+" | |
} | |
} | |
plugins { | |
id 'java' | |
id 'eclipse' | |
id 'idea' | |
// id 'com.matthewprenger.cursegradle' version '1.4.0' | |
id 'se.bjurr.gitchangelog.git-changelog-gradle-plugin' version '1.71.4' | |
id 'maven-publish' | |
} | |
apply plugin: 'net.minecraftforge.gradle' | |
apply plugin: 'org.parchmentmc.librarian.forgegradle' | |
apply plugin: "com.jfrog.artifactory" | |
apply from: 'https://raw.githubusercontent.com/SizableShrimp/Forge-Class-Remapper/main/classremapper.gradle' | |
//adds the build number to the end of the version string if on a build server | |
String build_number = System.getenv().BUILD_NUMBER | |
if (build_number == null) { | |
build_number = 'CUSTOM' | |
} | |
String semver = "${mod_version_massive}.${mod_version_major}.${mod_version_minor}" | |
// these two are required for the java plugin to generate jar files with a version | |
version = "${project.mc_version}-${semver}-${build_number}" | |
group = 'me.desht.pneumaticcraft' // http://maven.apache.org/guides/mini/guide-naming-conventions.html | |
archivesBaseName = "pneumaticcraft-repressurized" | |
// All jar files from this folder will be added automatically as runtime mod dependencies | |
String extraModsDir = "extra-mods-${project.mc_version}" | |
sourceSets { | |
api | |
main { | |
compileClasspath += sourceSets.api.output | |
runtimeClasspath += sourceSets.api.output | |
resources { | |
srcDir 'src/generated/resources' | |
} | |
} | |
test { | |
compileClasspath += sourceSets.api.output | |
runtimeClasspath += sourceSets.api.output | |
} | |
} | |
configurations { | |
apiImplementation.extendsFrom(implementation) | |
apiRuntimeOnly.extendsFrom(runtimeOnly) | |
} | |
java.toolchain.languageVersion = JavaLanguageVersion.of(17) | |
repositories { | |
mavenCentral() | |
flatDir { | |
name "extra-mods" | |
dir file(extraModsDir) | |
} | |
maven { | |
name "JEI" | |
url "https://dvs1.progwml6.com/files/maven" | |
} | |
maven { | |
name 'CC: Tweaked' | |
url 'https://squiddev.cc/maven/' | |
} | |
//maven { | |
//name "The One Probe" | |
//url "https://maven.tterrag.com/" | |
//} | |
maven { | |
name 'Crafttweaker/Patchouli/Botania/Immersive Engineering/Gamestages' | |
url 'https://maven.blamejared.com/' | |
} | |
maven { | |
name 'Curios' | |
url "https://maven.theillusivec4.top/" | |
} | |
//maven { | |
//name 'Gigaherz mappings' | |
//url 'https://dogforce-games.com/maven/' | |
//} | |
maven { | |
name "K-4u Mod maven" | |
url "https://modmaven.dev/" | |
} | |
maven { | |
url "https://www.cursemaven.com" | |
content { | |
includeGroup "curse.maven" | |
} | |
} | |
} | |
dependencies { | |
minecraft([ | |
group : "net.minecraftforge", | |
name : 'forge', | |
version: "${project.mc_version}-${project.forge_version}" | |
]) | |
testImplementation "org.junit.jupiter:junit-jupiter-api:5.7.2" | |
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.7.2" | |
//compileOnly fg.deobf ("mcjty.theoneprobe:TheOneProbe-1.16:${top_version}:api") | |
//runtimeOnly fg.deobf ("mcjty.theoneprobe:TheOneProbe-1.16:${top_version}") | |
// temporary till TOP for 1.18 is on maven.tterrag.com... | |
compileOnly fg.deobf("curse.maven:theoneprobe-245211:${top_curse_id}") | |
runtimeOnly fg.deobf("curse.maven:theoneprobe-245211:${top_curse_id}") | |
compileOnly fg.deobf("mezz.jei:jei-${project.mc_version}:${jei_version}:api") | |
runtimeOnly fg.deobf("mezz.jei:jei-${project.mc_version}:${jei_version}") | |
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api") | |
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}") | |
//compileOnly fg.deobf("vazkii.botania:Botania:${botania_version}:api") | |
//runtimeOnly fg.deobf("vazkii.botania:Botania:${botania_version}") | |
compileOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}:api") | |
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}") | |
compileOnly fg.deobf("org.squiddev:cc-tweaked-${project.mc_version}:${cc_tweaked_version}") | |
runtimeOnly fg.deobf("org.squiddev:cc-tweaked-${project.mc_version}:${cc_tweaked_version}") | |
compileOnly fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:${immersive_engineering_version}") | |
runtimeOnly fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:${immersive_engineering_version}") | |
//compileOnly fg.deobf("curse.maven:mekanism-268560:${mekanism_curse_id}") | |
//runtimeOnly fg.deobf("curse.maven:mekanism-268560:${mekanism_curse_id}") | |
compileOnly fg.deobf("curse.maven:create-328085:${create_curse_id}") | |
runtimeOnly fg.deobf("curse.maven:create-328085:${create_curse_id}") | |
compileOnly fg.deobf("curse.maven:flywheel-486392:${flywheel_curse_id}") | |
runtimeOnly fg.deobf("curse.maven:flywheel-486392:${flywheel_curse_id}") | |
compileOnly fg.deobf("curse.maven:jade-324717:${jade_curse_id}") | |
runtimeOnly fg.deobf("curse.maven:jade-324717:${jade_curse_id}") | |
//compileOnly fg.deobf("curse.maven:cofh_core-69162:${cofh_core_curse_id}") | |
//runtimeOnly fg.deobf("curse.maven:cofh_core-69162:${cofh_core_curse_id}") | |
compileOnly fg.deobf("appeng:appliedenergistics2:${ae2_version}:api") | |
runtimeOnly fg.deobf("appeng:appliedenergistics2:${ae2_version}") | |
compileOnly fg.deobf("com.blamejared.crafttweaker:CraftTweaker-forge-${project.mc_version}:${crafttweaker_version}") | |
runtimeOnly fg.deobf("com.blamejared.crafttweaker:CraftTweaker-forge-${project.mc_version}:${crafttweaker_version}") | |
//compileOnly fg.deobf("net.darkhax.gamestages:GameStages-${project.mc_version}:${gamestages_version}") | |
//runtimeOnly fg.deobf("net.darkhax.gamestages:GameStages-${project.mc_version}:${gamestages_version}") | |
//compileOnly fg.deobf("net.darkhax.bookshelf:Bookshelf-Forge-${project.mc_version}:10.3.29") | |
//runtimeOnly fg.deobf("net.darkhax.bookshelf:Bookshelf-Forge-${project.mc_version}:10.3.29") | |
//compileOnly fg.deobf("team.chisel.ctm:CTM:MC1.16.1-${ctm_version}") | |
//runtimeOnly fg.deobf("team.chisel.ctm:CTM:MC1.16.1-${ctm_version}") | |
// Locally sourced extra mods for runtime (i.e. testing) - thanks AE2 for this idea | |
for (extraModJar in fileTree(dir: extraModsDir, include: '*.jar')) { | |
def basename = extraModJar.name.substring(0, extraModJar.name.length() - ".jar".length()) | |
def versionSep = basename.lastIndexOf('-') | |
assert versionSep != -1 | |
def artifactId = basename.substring(0, versionSep) | |
def version = basename.substring(versionSep + 1) | |
runtimeOnly fg.deobf("extra-mods:$artifactId:$version") | |
} | |
// compileOnly "li.cil.oc:OpenComputers:MC1.12.2-${oc_version}:api" | |
// compileOnly "net.industrial-craft:industrialcraft-2:2.8.27-ex112:api" | |
// compileOnly "thaumcraft:Thaumcraft:${thaumcraft_version}" | |
// compileOnly "team.chisel.ctm:CTM:${ctm_version}:api" | |
// compileOnly "com.github.glitchfiend.biomesoplenty:ToughAsNails:${tan_version}:universal" | |
} | |
minecraft { | |
mappings channel: 'parchment', version: "${project.mappings_version}-${project.mc_version}" | |
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') | |
runs { | |
client { | |
property 'forge.logging.console.level', 'debug' | |
workingDirectory file('run') | |
property 'mixin.env.remapRefMap', 'true' | |
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" | |
ideaModule "${project.name}.main" | |
mods { | |
pneumaticcraft.sources((SourceSet[]) [sourceSets.main, sourceSets.api]) | |
} | |
} | |
server { | |
property 'forge.logging.console.level', 'debug' | |
workingDirectory file('run') | |
property 'mixin.env.remapRefMap', 'true' | |
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" | |
ideaModule "${project.name}.main" | |
mods { | |
pneumaticcraft.sources((SourceSet[]) [sourceSets.main, sourceSets.api]) | |
} | |
} | |
data { | |
property 'forge.logging.console.level', 'debug' | |
property 'fml.earlyprogresswindow', 'false' | |
property 'mixin.env.remapRefMap', 'true' | |
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" | |
workingDirectory file('run') | |
ideaModule "${project.name}.main" | |
forceExit false | |
args '--mod', 'pneumaticcraft', '--all', '--output', file('src/generated/resources/'), '--existing', sourceSets.main.resources.srcDirs[0] | |
mods { | |
pneumaticcraft.sources((SourceSet[]) [sourceSets.main, sourceSets.api]) | |
} | |
} | |
} | |
} | |
def replaceResources = tasks.register("replaceResources", Copy) { | |
it.outputs.upToDateWhen { false } | |
//Copy it into the build dir | |
it.from(sourceSets.main.resources) { | |
include "META-INF/mods.toml" | |
expand 'version': version, 'mc_version': minecraft_version_range, 'forge_version': forge_version_range | |
} | |
it.into "$buildDir/resources/main/" | |
} | |
processResources { | |
duplicatesStrategy(DuplicatesStrategy.FAIL) | |
exclude('META-INF/mods.toml') | |
configure { finalizedBy(replaceResources) } | |
} | |
classes.configure { | |
dependsOn(replaceResources) | |
} | |
javadoc { | |
source = [sourceSets.main.allJava, sourceSets.api.allJava] | |
// prevent java 8's strict doclint for javadocs from failing builds | |
options.addStringOption('Xdoclint:none', '-quiet') | |
(options as StandardJavadocDocletOptions) | |
.tags("apiNote:a:API Note:", "implSpec:a:Implementation Requirements:", "implNote:a:Implementation Note:") | |
} | |
//task makeChangelog(type: GitChangelogTask) { | |
// file = file('changelog.html') | |
// untaggedName = "Current release ${project.version}" | |
// fromCommit = '2fe051cf727adce1be210a46f778aa8fe031331e' | |
// toRef = 'HEAD' | |
// templateContent = file('changelog.mustache').getText('UTF-8') | |
//} | |
//curseforge { | |
// apiKey = project.findProperty('curseforge_apikey') ?: '0' | |
// project { | |
// id = curse_project_id | |
// changelog = file('changelog.html') | |
// changelogType = 'html' | |
// releaseType = 'beta' | |
// } | |
//} | |
//afterEvaluate { | |
// tasks.curseforge281849.dependsOn makeChangelog | |
//} | |
jar { | |
from sourceSets.main.output | |
from sourceSets.api.output | |
manifest.attributes([ | |
'FMLAT': 'accesstransformer.cfg', | |
"Specification-Title": "PneumaticCraft: Repressurized", | |
"Specification-Vendor": "desht", | |
"Specification-Version": "${semver}", | |
"Implementation-Title": project.name, | |
"Implementation-Version": "${project.version}", | |
"Implementation-Vendor" :"desht", | |
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") | |
]) | |
finalizedBy 'reobfJar' | |
} | |
task javadocJar(type: Jar, dependsOn: javadoc) { | |
duplicatesStrategy(DuplicatesStrategy.FAIL) | |
archiveClassifier.set('javadoc') | |
from javadoc.destinationDir | |
} | |
task sourcesJar(type: Jar) { | |
duplicatesStrategy(DuplicatesStrategy.FAIL) | |
archiveClassifier.set('sources') | |
from sourceSets.main.allJava | |
from sourceSets.api.allJava | |
} | |
task apiJar(type: Jar) { | |
duplicatesStrategy(DuplicatesStrategy.FAIL) | |
archiveClassifier.set('api') | |
from sourceSets.api.output | |
afterEvaluate { finalizedBy reobfApiJar } | |
} | |
task deobfJar(type: Jar) { | |
duplicatesStrategy(DuplicatesStrategy.FAIL) | |
archiveClassifier.set('deobf') | |
from sourceSets.main.output | |
from sourceSets.api.output | |
} | |
artifacts { | |
archives javadocJar | |
archives sourcesJar | |
archives apiJar | |
archives deobfJar | |
} | |
reobf { | |
apiJar { classpath.from(sourceSets.api.compileClasspath) } | |
jar { classpath.from(sourceSets.main.compileClasspath) } | |
} | |
task reobf { | |
dependsOn reobfJar | |
dependsOn reobfApiJar | |
} | |
tasks.withType(GenerateModuleMetadata) { | |
enabled = false | |
} | |
// with thanks to AE2 | |
publishing { | |
if (System.getenv("artifactory_user") != null) { | |
publications { | |
maven(MavenPublication) { | |
groupId = project.group | |
artifactId = project.archivesBaseName | |
version = project.version | |
// ForgeGradle will generate wild dependency definitions, see https://github.com/MinecraftForge/ForgeGradle/issues/584 | |
// Since we don't actually depend on anything, just remove the entire node. | |
pom.withXml { | |
asNode().remove(asNode().dependencies) | |
} | |
from components.java | |
artifact sourcesJar | |
artifact javadocJar | |
artifact apiJar | |
} | |
} | |
repositories { | |
maven { | |
name = "modmaven" | |
credentials { | |
username System.getenv("artifactory_user") | |
password System.getenv("artifactory_password") | |
} | |
url = "https://modmaven.dev/artifactory/local-releases/" | |
} | |
} | |
} | |
} | |
idea { | |
module { | |
for (String exclude in ['run', 'out', 'logs']) { | |
excludeDirs += file(exclude) | |
} | |
} | |
} | |
//test { | |
// useJUnitPlatform() | |
// include 'mezz/jei/**' | |
// exclude 'mezz/jei/lib/**' | |
//} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment