mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
* Fix displayed forge version when using prefix-ranges in dev environments * Fix the forge repo url
264 lines
7.0 KiB
Groovy
264 lines
7.0 KiB
Groovy
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
|
|
plugins {
|
|
id 'java'
|
|
id 'maven-publish'
|
|
id 'java-gradle-plugin'
|
|
id 'idea'
|
|
id 'eclipse'
|
|
id 'groovy'
|
|
id 'checkstyle'
|
|
id "org.cadixdev.licenser" version "0.5.0"
|
|
id 'com.github.johnrengelman.shadow' version '4.0.4'
|
|
}
|
|
|
|
sourceCompatibility = 1.8
|
|
targetCompatibility = 1.8
|
|
|
|
group = 'me.shedaniel'
|
|
archivesBaseName = project.name
|
|
def baseVersion = '0.6'
|
|
def runNumber = System.getenv("GITHUB_RUN_NUMBER") ?: "9999"
|
|
|
|
def isSnapshot = System.getenv("PR_NUM") != null
|
|
|
|
def buildNum = "release #$runNumber"
|
|
|
|
if (!isSnapshot) {
|
|
version = baseVersion + "." + runNumber
|
|
} else {
|
|
version = baseVersion + "-PR." + System.getenv("PR_NUM") + "." + runNumber
|
|
}
|
|
|
|
logger.lifecycle(":building plugin v${version}")
|
|
|
|
configurations {
|
|
shadowArchitectury
|
|
forgeInjectShadow
|
|
forgeInjectCompileClasspath.extendsFrom(forgeInjectShadow)
|
|
forgeInjectRuntimeClasspath.extendsFrom(forgeInjectShadow)
|
|
}
|
|
|
|
sourceSets {
|
|
forgeInject
|
|
}
|
|
|
|
repositories {
|
|
maven { url "https://maven.fabricmc.net/" }
|
|
maven { url "https://maven.minecraftforge.net/" }
|
|
maven { url "https://maven.shedaniel.me/" }
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
implementation gradleApi()
|
|
|
|
// libraries
|
|
implementation ('commons-io:commons-io:2.8.0')
|
|
implementation ('org.zeroturnaround:zt-zip:1.14')
|
|
implementation ('com.google.code.gson:gson:2.8.6')
|
|
implementation ('com.google.guava:guava:30.1-jre')
|
|
implementation ('org.ow2.asm:asm:9.1')
|
|
implementation ('org.ow2.asm:asm-analysis:9.1')
|
|
implementation ('org.ow2.asm:asm-commons:9.1')
|
|
implementation ('org.ow2.asm:asm-tree:9.1')
|
|
implementation ('org.ow2.asm:asm-util:9.1')
|
|
implementation ('me.tongfei:progressbar:0.9.0')
|
|
|
|
// game handling utils
|
|
implementation ('net.fabricmc:stitch:0.5.1+build.77') {
|
|
exclude module: 'mercury'
|
|
exclude module: 'enigma'
|
|
}
|
|
|
|
// tinyfile management
|
|
compileOnly ('net.fabricmc:tiny-remapper:0.3.2-architectury.7')
|
|
shadowArchitectury ('net.fabricmc:tiny-remapper:0.3.2-architectury.7') {
|
|
transitive = false
|
|
}
|
|
implementation ('net.fabricmc:tiny-mappings-parser:0.3.0+build.17')
|
|
|
|
implementation 'net.fabricmc:access-widener:1.0.0'
|
|
|
|
implementation ('net.fabricmc:lorenz-tiny:3.0.0') {
|
|
transitive = false
|
|
}
|
|
implementation ('org.cadixdev:lorenz-io-proguard:0.5.6')
|
|
compileOnly "me.shedaniel.architectury:refmap-remapper:1.0.4"
|
|
shadowArchitectury ("me.shedaniel.architectury:refmap-remapper:1.0.4") {
|
|
transitive = false
|
|
}
|
|
|
|
// decompilers
|
|
implementation ('net.fabricmc:fabric-fernflower:1.3.0')
|
|
implementation ('org.benf:cfr:0.150')
|
|
|
|
// source code remapping
|
|
implementation ('org.cadixdev:mercury:0.2.8')
|
|
|
|
// Kapt integration
|
|
compileOnly('org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21')
|
|
|
|
// Forge patches
|
|
implementation ('net.minecraftforge:binarypatcher:1.1.1')
|
|
implementation ('org.cadixdev:lorenz:0.5.3')
|
|
implementation ('org.cadixdev:lorenz-asm:0.5.3')
|
|
implementation ('net.minecraftforge:accesstransformers:2.2.0')
|
|
implementation ('de.oceanlabs.mcp:mcinjector:3.8.0')
|
|
implementation ('net.md-5:SpecialSource:1.8.3')
|
|
|
|
// Forge injection
|
|
forgeInjectShadow ('net.fabricmc:tiny-mappings-parser:0.2.2.14')
|
|
forgeInjectImplementation ('cpw.mods:modlauncher:6.1.3')
|
|
forgeInjectImplementation ('org.spongepowered:mixin:0.8.2')
|
|
forgeInjectImplementation ('com.google.code.gson:gson:2.8.6')
|
|
forgeInjectImplementation ('com.google.guava:guava:21.0')
|
|
forgeInjectImplementation ('org.apache.logging.log4j:log4j-api:2.11.2')
|
|
|
|
// Testing
|
|
testImplementation(gradleTestKit())
|
|
testImplementation('org.spockframework:spock-core:1.3-groovy-2.4') {
|
|
exclude module: 'groovy-all'
|
|
}
|
|
|
|
compileOnly 'org.jetbrains:annotations:20.1.0'
|
|
|
|
}
|
|
|
|
task forgeInjectJar(type: ShadowJar, dependsOn: [compileForgeInjectJava, processForgeInjectResources]) {
|
|
configurations = [project.configurations.forgeInjectShadow]
|
|
classifier = 'forgeinject'
|
|
from compileForgeInjectJava.outputs
|
|
from processForgeInjectResources.outputs
|
|
}
|
|
|
|
jar {
|
|
classifier 'jar'
|
|
}
|
|
|
|
shadowJar {
|
|
relocate "net.fabricmc.tinyremapper", "me.shedaniel.architectury.loom.shadowed.impl.net.fabricmc.tinyremapper"
|
|
relocate "me.shedaniel.architectury.refmapremapper", "me.shedaniel.architectury.loom.shadowed.impl.me.shedaniel.architectury.refmapremapper"
|
|
configurations = [project.configurations.shadowArchitectury]
|
|
classifier "shadow"
|
|
}
|
|
|
|
task mainJar(type: Jar, dependsOn: shadowJar) {
|
|
dependsOn forgeInjectJar
|
|
|
|
from zipTree(shadowJar.archivePath)
|
|
from(forgeInjectJar.outputs) {
|
|
into "inject"
|
|
rename { "injection.jar" }
|
|
}
|
|
|
|
manifest {
|
|
attributes 'Implementation-Version': project.version + ' Build(' + buildNum + ')'
|
|
}
|
|
}
|
|
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
classifier = 'sources'
|
|
from sourceSets.main.allSource
|
|
}
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
classifier = 'javadoc'
|
|
from javadoc.destinationDir
|
|
}
|
|
|
|
license {
|
|
header rootProject.file("HEADER")
|
|
include "**/*.java"
|
|
exclude '**/loom/util/DownloadUtil.java'
|
|
exclude '**/loom/util/FileSystemUtil.java'
|
|
exclude '**/loom/inject/mixin/MixinIntermediaryDevRemapper.java'
|
|
}
|
|
|
|
checkstyle {
|
|
configFile = file('checkstyle.xml')
|
|
toolVersion = '8.39'
|
|
}
|
|
|
|
gradlePlugin {
|
|
plugins {
|
|
fabricLoom {
|
|
id = 'forgified-fabric-loom'
|
|
implementationClass = 'net.fabricmc.loom.LoomGradlePlugin'
|
|
}
|
|
}
|
|
}
|
|
|
|
build.dependsOn mainJar
|
|
|
|
import org.w3c.dom.Document
|
|
import org.w3c.dom.Element
|
|
import org.w3c.dom.Node
|
|
|
|
publishing {
|
|
publications {
|
|
plugin(MavenPublication) {
|
|
groupId 'forgified-fabric-loom'
|
|
artifactId 'forgified-fabric-loom.gradle.plugin'
|
|
|
|
from components.java
|
|
artifact mainJar
|
|
artifact sourcesJar
|
|
}
|
|
|
|
maven(MavenPublication) { publication ->
|
|
groupId project.group
|
|
artifactId project.archivesBaseName
|
|
|
|
from components.java
|
|
artifact mainJar
|
|
artifact sourcesJar
|
|
artifact javadocJar
|
|
}
|
|
|
|
if (isSnapshot) return
|
|
|
|
mavenSnapshot(MavenPublication) { publication ->
|
|
groupId project.group
|
|
artifactId project.archivesBaseName
|
|
version baseVersion + '-SNAPSHOT'
|
|
|
|
from components.java
|
|
artifact mainJar
|
|
artifact sourcesJar
|
|
artifact javadocJar
|
|
}
|
|
|
|
pluginSnapshot(MavenPublication) {
|
|
groupId 'forgified-fabric-loom'
|
|
artifactId 'forgified-fabric-loom.gradle.plugin'
|
|
version baseVersion + '-SNAPSHOT'
|
|
|
|
pom.withXml {
|
|
// Based off org.gradle.plugin.devel.plugins.MavenPluginPublishPlugin
|
|
Element root = asElement()
|
|
Document document = root.getOwnerDocument()
|
|
Node dependencies = root.appendChild(document.createElement('dependencies'))
|
|
Node dependency = dependencies.appendChild(document.createElement('dependency'))
|
|
Node groupId = dependency.appendChild(document.createElement('groupId'))
|
|
groupId.setTextContent(project.group)
|
|
Node artifactId = dependency.appendChild(document.createElement('artifactId'))
|
|
artifactId.setTextContent(project.archivesBaseName)
|
|
Node version = dependency.appendChild(document.createElement('version'))
|
|
version.setTextContent(baseVersion + '-SNAPSHOT')
|
|
}
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
if (System.getenv("MAVEN_PASS") != null) {
|
|
maven {
|
|
url = "https://deploy.shedaniel.me/"
|
|
credentials {
|
|
username = "shedaniel"
|
|
password = System.getenv("MAVEN_PASS")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |