Files
architectury-loom/build.gradle

193 lines
5.0 KiB
Groovy

plugins {
id 'java'
id 'maven-publish'
id 'java-gradle-plugin'
id 'idea'
id 'eclipse'
id 'groovy'
id 'checkstyle'
id 'com.github.johnrengelman.shadow' version '4.0.4'
id "com.jfrog.bintray" version "1.8.5"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'me.shedaniel'
archivesBaseName = project.name
def baseVersion = '0.5'
def build = "release #${System.getenv("GITHUB_RUN_NUMBER") == null ? "custom" : System.getenv("GITHUB_RUN_NUMBER")}"
version = baseVersion + "." + (System.getenv("GITHUB_RUN_NUMBER") == null ? (((short) new Random().nextInt()).abs() + 1000).toString() : System.getenv("GITHUB_RUN_NUMBER"))
logger.lifecycle(":building plugin v${version}")
configurations {
forgeInjectShadow
forgeInjectCompileClasspath.extendsFrom(forgeInjectShadow)
forgeInjectRuntimeClasspath.extendsFrom(forgeInjectShadow)
}
sourceSets {
forgeInject
}
repositories {
maven { url "https://maven.fabricmc.net/" }
maven { url "https://files.minecraftforge.net/maven/" }
maven { url "https://dl.bintray.com/shedaniel/cloth" }
mavenCentral()
}
dependencies {
implementation gradleApi()
// libraries
implementation ('commons-io:commons-io:2.6')
implementation ('org.zeroturnaround:zt-zip:1.13')
implementation ('com.google.code.gson:gson:2.8.5')
implementation ('com.google.guava:guava:28.0-jre')
// game handling utils
implementation ('net.fabricmc:stitch:0.4.6+build.74') {
exclude module: 'mercury'
exclude module: 'enigma'
}
// tinyfile management
implementation ('net.fabricmc:tiny-remapper:0.3.0.70')
implementation ('net.fabricmc:tiny-mappings-parser:0.2.2.14')
implementation 'net.fabricmc:access-widener:1.0.0'
implementation ('net.fabricmc:lorenz-tiny:2.0.0+build.2') {
transitive = false
}
implementation ('org.cadixdev:lorenz-io-proguard:0.5.5')
// decompilers
implementation ('net.fabricmc:procyon-fabric-compilertools:0.5.35.13')
implementation ('org.jetbrains:intellij-fernflower:1.2.1.16')
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.3.72')
// 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')
// Testing
testImplementation(gradleTestKit())
testImplementation('org.spockframework:spock-core:1.3-groovy-2.4') {
exclude module: 'groovy-all'
}
}
task forgeInjectJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar, dependsOn: [compileForgeInjectJava, processForgeInjectResources]) {
configurations = [project.configurations.forgeInjectShadow]
classifier = 'forgeinject'
from compileForgeInjectJava.outputs
from processForgeInjectResources.outputs
}
jar {
dependsOn forgeInjectJar
from(forgeInjectJar.outputs) {
into "inject"
rename { "injection.jar" }
}
manifest {
attributes 'Implementation-Version': version + ' Build(' + build + ')'
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/license.gradle'
license {
exclude '**/loom/util/DownloadUtil.java'
}
checkstyle {
configFile = file('checkstyle.xml')
toolVersion = '8.25'
}
checkstyleMain {
logging.setLevel(LogLevel.LIFECYCLE)
}
gradlePlugin {
plugins {
fabricLoom {
id = 'forgified-fabric-loom'
implementationClass = 'net.fabricmc.loom.LoomGradlePlugin'
}
}
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_KEY')
publications = ["plugin", "maven"]
publish = true
pkg {
repo = "cloth"
name = "forgified-fabric-loom"
userOrg = "shedaniel"
licenses = ["MIT"]
version {
name = project.version
vcsTag = project.version
released = new Date()
vcsUrl = 'https://github.com/shedaniel/fabric-loom.git'
}
}
}
publishing {
publications {
plugin(MavenPublication) {
groupId 'forgified-fabric-loom'
artifactId 'forgified-fabric-loom.gradle.plugin'
from components.java
artifact sourcesJar
}
maven(MavenPublication) { publication ->
groupId project.group
artifactId project.archivesBaseName
from components.java
artifact sourcesJar
artifact javadocJar
}
}
}