aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
diff options
context:
space:
mode:
Diffstat (limited to 'build.gradle')
-rw-r--r--build.gradle128
1 files changed, 73 insertions, 55 deletions
diff --git a/build.gradle b/build.gradle
index e5e456c8..219c5c42 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,29 +7,43 @@ plugins {
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 = 'net.fabricmc'
+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 build = 'local'
-def ENV = System.getenv()
-if (ENV.BUILD_NUMBER) {
- build = "release #${ENV.BUILD_NUMBER}"
- version = baseVersion + '.' + ENV.BUILD_NUMBER
+def isSnapshot = System.getenv("PR_NUM") != null
+
+def build = "release #$runNumber"
+
+if (!isSnapshot) {
+ version = baseVersion + "." + runNumber
} else {
- version = baseVersion + '.local'
+ 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 {
- name = 'Fabric'
- url = 'https://maven.fabricmc.net/'
- }
+ maven { url "https://maven.fabricmc.net/" }
+ maven { url "https://files.minecraftforge.net/maven/" }
+ maven { url "https://maven.shedaniel.me/" }
mavenCentral()
}
@@ -46,9 +60,11 @@ dependencies {
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'
}
@@ -68,11 +84,27 @@ dependencies {
implementation ('org.benf:cfr:0.150')
// source code remapping
- implementation ('org.cadixdev:mercury:0.1.0-rc1')
+ 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') {
@@ -83,7 +115,21 @@ dependencies {
}
+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': project.version + ' Build(' + build + ')'
}
@@ -103,6 +149,8 @@ license {
header rootProject.file("HEADER")
include "**/*.java"
exclude '**/loom/util/DownloadUtil.java'
+ exclude '**/loom/util/FileSystemUtil.java'
+ exclude '**/loom/inject/mixin/MixinIntermediaryDevRemapper.java'
}
checkstyle {
@@ -113,69 +161,39 @@ checkstyle {
gradlePlugin {
plugins {
fabricLoom {
- id = 'fabric-loom'
+ id = 'forgified-fabric-loom'
implementationClass = 'net.fabricmc.loom.LoomGradlePlugin'
}
}
}
-import org.w3c.dom.Document
-import org.w3c.dom.Element
-import org.w3c.dom.Node
-
publishing {
publications {
- plugin(MavenPublication) { publication ->
- groupId project.group
- artifactId project.archivesBaseName
- version project.version
-
- from components['java']
+ plugin(MavenPublication) {
+ groupId 'forgified-fabric-loom'
+ artifactId 'forgified-fabric-loom.gradle.plugin'
+ from components.java
artifact sourcesJar
- artifact javadocJar
}
- // Also publish a snapshot so people can use the latest version if they wish
- snapshot(MavenPublication) { publication ->
+ maven(MavenPublication) { publication ->
groupId project.group
artifactId project.archivesBaseName
- version baseVersion + '-SNAPSHOT'
-
- from components['java']
+ from components.java
artifact sourcesJar
artifact javadocJar
}
-
- // Manually crate the plugin marker for snapshot versions
- snapshotPlugin(MavenPublication) { publication ->
- groupId 'fabric-loom'
- artifactId '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('net.fabricmc')
- Node artifactId = dependency.appendChild(document.createElement('artifactId'))
- artifactId.setTextContent('fabric-loom')
- Node version = dependency.appendChild(document.createElement('version'))
- version.setTextContent(baseVersion + '-SNAPSHOT')
- })
- }
}
+
repositories {
- maven {
- if (ENV.MAVEN_URL) {
- url ENV.MAVEN_URL
+ if (System.getenv("MAVEN_PASS") != null) {
+ maven {
+ url = "https://deploy.shedaniel.me/"
credentials {
- username ENV.MAVEN_USERNAME
- password ENV.MAVEN_PASSWORD
+ username = "shedaniel"
+ password = System.getenv("MAVEN_PASS")
}
}
}