mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-08 19:04:46 +00:00
326 lines
10 KiB
Groovy
326 lines
10 KiB
Groovy
import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar
|
|
|
|
plugins {
|
|
id 'java-library'
|
|
id 'idea'
|
|
id 'maven-publish'
|
|
id 'com.gtnewhorizons.retrofuturagradle' version '2.0.4'
|
|
}
|
|
|
|
defaultTasks 'fullBuild'
|
|
|
|
def baseModVersion = mod_version
|
|
def buildVersion = System.getenv('BUILD_VER')
|
|
if (buildVersion) {
|
|
mod_version = "${baseModVersion}-${buildVersion}"
|
|
}
|
|
|
|
group = 'mekanism'
|
|
version = "${minecraft_version}-${mod_version}"
|
|
|
|
base {
|
|
archivesName = 'Mekanism-Community-Edition'
|
|
}
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(8)
|
|
}
|
|
}
|
|
|
|
idea {
|
|
module {
|
|
// Required for IDEA to make resources available to Minecraft run tasks.
|
|
inheritOutputDirs = true
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
|
|
maven {
|
|
name = 'GTNH Maven'
|
|
url = uri('https://nexus.gtnewhorizons.com/repository/public/')
|
|
content {
|
|
includeGroup 'com.gtnewhorizons'
|
|
includeGroupByRegex 'com\\.gtnewhorizons\\..+'
|
|
}
|
|
}
|
|
|
|
maven {
|
|
name = 'CodeChicken Maven'
|
|
url = uri('https://maven.covers1624.net/')
|
|
content { includeGroup 'codechicken' }
|
|
}
|
|
maven {
|
|
name = 'CIL Maven'
|
|
url = uri('https://maven.cil.li/')
|
|
content { includeGroup 'mcp.mobius.waila' }
|
|
metadataSources {
|
|
mavenPom()
|
|
artifact()
|
|
}
|
|
}
|
|
maven {
|
|
name = 'IC2 Maven'
|
|
url = uri('https://maven.ic2.player.to/')
|
|
content { includeGroup 'net.industrial-craft' }
|
|
metadataSources {
|
|
mavenPom()
|
|
artifact()
|
|
}
|
|
}
|
|
// These repositories replace the old Thorfusion proxy named "central".
|
|
// Keep them last so normal dependencies are resolved from their upstream homes.
|
|
maven {
|
|
name = 'Thorfusion Releases'
|
|
url = uri('https://maven.thorfusion.com/artifactory/thorfusion/')
|
|
content { includeGroup 'inventorytweaks' }
|
|
}
|
|
maven {
|
|
name = 'Thorfusion Development'
|
|
url = uri('https://maven.thorfusion.com/artifactory/dev/')
|
|
content { includeGroup 'inventorytweaks' }
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation "codechicken:CodeChickenLib:${minecraft_version}-${CCLIB_version}:dev"
|
|
implementation "codechicken:ForgeMultipart:${minecraft_version}-${FMP_version}:dev"
|
|
implementation "codechicken:NotEnoughItems:${minecraft_version}-${NEI_version}:dev"
|
|
implementation "codechicken:CodeChickenCore:${minecraft_version}-${CCC_version}:dev"
|
|
implementation "inventorytweaks:inventory-tweaks:1.7.10-1.60.0:api"
|
|
implementation "net.industrial-craft:industrialcraft-2:2.2.828-experimental:api"
|
|
implementation "mcp.mobius.waila:Waila:1.5.10_1.7.10:dev"
|
|
|
|
// Optional integrations that are intentionally checked into libs/.
|
|
compileOnly fileTree(dir: 'libs', include: ['*.jar'])
|
|
}
|
|
|
|
minecraft {
|
|
mcVersion.set(minecraft_version)
|
|
mcpMappingChannel.set('stable')
|
|
mcpMappingVersion.set('12')
|
|
|
|
injectedTags.put('GRADLE_MODVERSION', mod_version)
|
|
injectedTags.put('GRADLE_VERSIONMOD', alt_version)
|
|
// RFG 2.0.4 serializes only one replacement-file pattern, so use one
|
|
// brace glob for every module entry point.
|
|
tagReplacementFiles.add('{Mekanism.java,MekanismGenerators.java,MekanismTools.java,DefenseTech.java,MekanismUltimate.java}')
|
|
}
|
|
|
|
tasks.named('processResources') {
|
|
exclude 'mcmod.info'
|
|
exclude '**/*.blend*'
|
|
}
|
|
|
|
tasks.named('jar') {
|
|
manifest {
|
|
attributes(
|
|
'FMLCorePlugin': 'mekanism.common.asm.LoadingHook',
|
|
'FMLCorePluginContainsFMLMod': 'true')
|
|
}
|
|
}
|
|
|
|
def artifactOutputDir = layout.projectDirectory.dir('output')
|
|
def reobfuscatedJar = tasks.named('reobfJar', ReobfuscatedJar)
|
|
def reobfuscatedContents = {
|
|
zipTree(reobfuscatedJar.get().archiveFile.get().asFile)
|
|
}
|
|
|
|
tasks.register('coreJar', Jar) {
|
|
dependsOn reobfuscatedJar
|
|
archiveClassifier.set('Core')
|
|
destinationDirectory.set(artifactOutputDir)
|
|
manifest {
|
|
attributes(
|
|
'FMLCorePlugin': 'mekanism.common.asm.LoadingHook',
|
|
'FMLCorePluginContainsFMLMod': 'true')
|
|
}
|
|
from('etc/core') {
|
|
include '*.info'
|
|
expand 'version': mod_version, 'mc_version': minecraft_version, 'fmp_version': FMP_version
|
|
}
|
|
from(reobfuscatedContents) {
|
|
exclude 'mekanism/tools/**', 'mekanism/generators/**', 'mekanism/defense/**',
|
|
'defense/**', 'assets/defense/**', 'mcmod.info', 'mekanism/ultimate/**'
|
|
}
|
|
}
|
|
|
|
tasks.register('alltJar', Jar) {
|
|
dependsOn reobfuscatedJar
|
|
archiveClassifier.set('ALL')
|
|
destinationDirectory.set(artifactOutputDir)
|
|
manifest {
|
|
attributes(
|
|
'FMLCorePlugin': 'mekanism.common.asm.LoadingHook',
|
|
'FMLCorePluginContainsFMLMod': 'true')
|
|
}
|
|
from('etc/all') {
|
|
include '*.info'
|
|
expand 'version': mod_version, 'mc_version': minecraft_version, 'fmp_version': FMP_version
|
|
}
|
|
from(reobfuscatedContents) {
|
|
exclude 'mcmod.info'
|
|
}
|
|
}
|
|
|
|
tasks.register('toolsJar', Jar) {
|
|
dependsOn reobfuscatedJar
|
|
archiveClassifier.set('Tools')
|
|
destinationDirectory.set(artifactOutputDir)
|
|
from('etc/tools') {
|
|
include '*.info'
|
|
expand 'version': mod_version, 'mc_version': minecraft_version, 'fmp_version': FMP_version
|
|
}
|
|
from(reobfuscatedContents) {
|
|
include 'mekanism/tools/**'
|
|
exclude 'mcmod.info'
|
|
}
|
|
}
|
|
|
|
tasks.register('generatorsJar', Jar) {
|
|
dependsOn reobfuscatedJar
|
|
archiveClassifier.set('Generators')
|
|
destinationDirectory.set(artifactOutputDir)
|
|
from('etc/generators') {
|
|
include '*.info'
|
|
expand 'version': mod_version, 'mc_version': minecraft_version, 'fmp_version': FMP_version
|
|
}
|
|
from(reobfuscatedContents) {
|
|
include 'mekanism/generators/**'
|
|
exclude 'mcmod.info'
|
|
}
|
|
}
|
|
|
|
tasks.register('defensetechJar', Jar) {
|
|
dependsOn reobfuscatedJar
|
|
archiveClassifier.set('DefenseTech')
|
|
destinationDirectory.set(artifactOutputDir)
|
|
from('etc/defense') {
|
|
include '*.info'
|
|
expand 'version': mod_version, 'mc_version': minecraft_version, 'fmp_version': FMP_version
|
|
}
|
|
from(reobfuscatedContents) {
|
|
include 'mekanism/defense/**', 'defense/**', 'assets/defense/**'
|
|
exclude 'mcmod.info'
|
|
}
|
|
}
|
|
|
|
tasks.register('ultimateJar', Jar) {
|
|
dependsOn reobfuscatedJar
|
|
archiveClassifier.set('Ultimate')
|
|
destinationDirectory.set(artifactOutputDir)
|
|
from('etc/ultimate') {
|
|
include '*.info'
|
|
expand 'version': mod_version, 'mc_version': minecraft_version, 'fmp_version': FMP_version
|
|
}
|
|
from('etc/ultimate') {
|
|
include 'logo.png'
|
|
}
|
|
from(reobfuscatedContents) {
|
|
include 'mekanism/ultimate/**'
|
|
exclude 'mcmod.info'
|
|
}
|
|
}
|
|
|
|
tasks.register('MDKZip', Zip) {
|
|
archiveClassifier.set('MDK')
|
|
destinationDirectory.set(artifactOutputDir)
|
|
from sourceSets.main.java.srcDirs
|
|
include 'mekanism/api/**'
|
|
}
|
|
|
|
tasks.register('devJar', Jar) {
|
|
dependsOn reobfuscatedJar
|
|
archiveClassifier.set('DEV')
|
|
destinationDirectory.set(artifactOutputDir)
|
|
from sourceSets.main.java.srcDirs
|
|
manifest {
|
|
attributes(
|
|
'FMLCorePlugin': 'mekanism.common.asm.LoadingHook',
|
|
'FMLCorePluginContainsFMLMod': 'true')
|
|
}
|
|
from('etc/all') {
|
|
include '*.info'
|
|
expand 'version': mod_version, 'mc_version': minecraft_version, 'fmp_version': FMP_version
|
|
}
|
|
from(reobfuscatedContents) {
|
|
exclude 'mcmod.info'
|
|
}
|
|
}
|
|
|
|
tasks.register('apiJar', Jar) {
|
|
dependsOn tasks.named('classes')
|
|
archiveClassifier.set('API')
|
|
destinationDirectory.set(artifactOutputDir)
|
|
from sourceSets.main.java.srcDirs
|
|
from sourceSets.main.output
|
|
include 'mekanism/api/**', 'defense/api/**'
|
|
}
|
|
|
|
def distributionArtifacts = [
|
|
tasks.named('toolsJar'),
|
|
tasks.named('coreJar'),
|
|
tasks.named('generatorsJar'),
|
|
tasks.named('MDKZip'),
|
|
tasks.named('alltJar'),
|
|
tasks.named('apiJar'),
|
|
tasks.named('devJar'),
|
|
tasks.named('defensetechJar'),
|
|
tasks.named('ultimateJar')
|
|
]
|
|
|
|
tasks.register('fullBuild') {
|
|
group = 'build'
|
|
description = 'Builds every distribution artifact.'
|
|
dependsOn distributionArtifacts
|
|
}
|
|
|
|
def publishBaseUrl = providers.environmentVariable('MAVEN_URL')
|
|
.orElse('https://maven.thorfusion.com/artifactory')
|
|
def publishRepository = providers.environmentVariable('MAVEN_REPO').orElse('dev')
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
artifactId = 'Mekanism-Community-Edition'
|
|
groupId = project.group
|
|
version = project.version
|
|
distributionArtifacts.each { artifact it }
|
|
pom {
|
|
name.set('Mekanism Community Edition')
|
|
description.set('Mekanism is a Minecraft add-on featuring high-tech machinery that can be used to create powerful tools, armor, and weapons.')
|
|
url.set('https://github.com/Thorfusion/Mekanism-Community-Edition')
|
|
issueManagement {
|
|
system.set('github')
|
|
url.set('https://github.com/Thorfusion/Mekanism-Community-Edition/issues')
|
|
}
|
|
licenses {
|
|
license {
|
|
name.set('EUPL-1.2')
|
|
distribution.set('repo')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
name = 'thorfusion'
|
|
url = uri("${publishBaseUrl.get().replaceAll('/+$', '')}/${publishRepository.get()}")
|
|
credentials {
|
|
username = providers.environmentVariable('MAVEN_USERNAME').orElse('').get()
|
|
password = providers.environmentVariable('MAVEN_PASSWORD').orElse('').get()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Keep the workflow-facing task name while publishing through Gradle's maintained Maven Publish plugin.
|
|
tasks.register('artifactoryPublish') {
|
|
group = 'publishing'
|
|
description = 'Publishes the complete artifact set to the configured Maven repository.'
|
|
dependsOn tasks.named('publishMavenJavaPublicationToThorfusionRepository')
|
|
}
|