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.6' def runNumber = (System.getenv("GITHUB_RUN_NUMBER") == null ? (((short) new Random().nextInt()).abs() + 1000).toString() : System.getenv("GITHUB_RUN_NUMBER")) def isSnapshot = System.getenv("PR_NUM") != null def build = "release #$runNumber" if (!isSnapshot) { version = baseVersion + "." + runNumber } else { version = baseVersion + "-PR." + System.getenv("PR_NUM") + "." + runNumber } 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.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.0') implementation ('org.ow2.asm:asm-analysis:9.0') implementation ('org.ow2.asm:asm-commons:9.0') implementation ('org.ow2.asm:asm-tree:9.0') implementation ('org.ow2.asm:asm-util:9.0') // game handling utils implementation ('net.fabricmc:stitch:0.5.1+build.77') { exclude module: 'mercury' exclude module: 'enigma' } // tinyfile management implementation ('net.fabricmc:tiny-remapper:0.3.2') 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') // 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: 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' exclude '**/loom/util/FileSystemUtil.java' exclude '**/loom/inject/mixin/MixinIntermediaryDevRemapper.java' } checkstyle { configFile = file('checkstyle.xml') toolVersion = '8.39' } 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 } } }