2018-11-05 09:54:00 -05:00
|
|
|
plugins {
|
|
|
|
id 'java'
|
|
|
|
id 'eclipse'
|
|
|
|
id 'idea'
|
2019-04-22 11:12:05 -04:00
|
|
|
id 'maven-publish'
|
2020-06-04 16:20:20 -04:00
|
|
|
id 'fabric-loom' version '0.4-SNAPSHOT' apply false
|
2019-11-28 03:03:04 -05:00
|
|
|
id 'net.minecrell.licenser' version '0.4.1'
|
2019-05-11 02:55:17 -04:00
|
|
|
id "org.ajoberstar.grgit" version "3.1.1"
|
2020-04-19 19:56:39 -04:00
|
|
|
id 'com.matthewprenger.cursegradle' version "1.4.0"
|
2018-11-05 09:54:00 -05:00
|
|
|
}
|
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
def ENV = System.getenv()
|
2018-11-05 09:54:00 -05:00
|
|
|
|
2019-07-14 12:42:09 -04:00
|
|
|
class Globals {
|
2020-06-05 15:09:24 -04:00
|
|
|
static def baseVersion = "0.11.7"
|
2020-06-05 07:42:58 -04:00
|
|
|
static def mcVersion = "1.16-pre2"
|
2020-05-29 10:56:10 -04:00
|
|
|
static def yarnVersion = "+build.1"
|
2019-07-14 12:42:09 -04:00
|
|
|
}
|
|
|
|
|
2020-04-05 10:51:59 -04:00
|
|
|
version = Globals.baseVersion + "+" + (ENV.BUILD_NUMBER ? ("build." + ENV.BUILD_NUMBER) : "local") + "-" + getBranch()
|
|
|
|
logger.lifecycle("Building Fabric: " + version)
|
|
|
|
|
2019-07-14 12:42:09 -04:00
|
|
|
import org.apache.commons.codec.digest.DigestUtils
|
2019-05-11 02:55:17 -04:00
|
|
|
|
|
|
|
def getSubprojectVersion(project, version) {
|
2019-05-13 05:20:47 -04:00
|
|
|
if (grgit == null) {
|
|
|
|
return version + "+nogit"
|
|
|
|
}
|
2019-05-11 17:48:33 -04:00
|
|
|
def latestCommits = grgit.log(paths: [project.name], maxCommits: 1)
|
|
|
|
if (latestCommits.isEmpty()) {
|
|
|
|
return version + "+uncommited"
|
|
|
|
} else {
|
2019-07-14 12:42:09 -04:00
|
|
|
return version + "+" + latestCommits.get(0).id.substring(0, 8) + DigestUtils.sha256Hex(Globals.mcVersion).substring(0, 2)
|
2019-05-11 17:48:33 -04:00
|
|
|
}
|
2019-05-11 02:55:17 -04:00
|
|
|
}
|
2018-11-05 09:54:00 -05:00
|
|
|
|
2020-04-05 10:07:27 -04:00
|
|
|
def getBranch() {
|
|
|
|
if (System.getenv().GIT_BRANCH) {
|
2019-08-27 15:40:07 -04:00
|
|
|
def branch = System.getenv().GIT_BRANCH
|
|
|
|
return branch.substring(branch.lastIndexOf("/") + 1)
|
2019-08-27 15:26:27 -04:00
|
|
|
}
|
2019-08-27 15:11:55 -04:00
|
|
|
if (grgit == null) {
|
|
|
|
return "unknown"
|
|
|
|
}
|
2019-12-27 18:32:40 -05:00
|
|
|
def branch = grgit.branch.current().name
|
|
|
|
return branch.substring(branch.lastIndexOf("/") + 1)
|
2019-08-27 15:11:55 -04:00
|
|
|
}
|
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
allprojects {
|
2019-10-26 22:39:47 -04:00
|
|
|
apply plugin: 'checkstyle'
|
2019-04-23 18:46:23 -04:00
|
|
|
apply plugin: 'maven-publish'
|
|
|
|
apply plugin: 'fabric-loom'
|
2019-04-26 14:18:20 -04:00
|
|
|
apply plugin: 'net.minecrell.licenser'
|
2018-12-14 13:48:37 -05:00
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
sourceCompatibility = 1.8
|
|
|
|
targetCompatibility = 1.8
|
2018-11-05 09:54:00 -05:00
|
|
|
|
2019-04-24 13:15:08 -04:00
|
|
|
group = "net.fabricmc.fabric-api"
|
|
|
|
|
2020-05-03 12:56:50 -04:00
|
|
|
sourceSets {
|
|
|
|
testmod {
|
|
|
|
compileClasspath += main.compileClasspath
|
|
|
|
runtimeClasspath += main.runtimeClasspath
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
dependencies {
|
2019-07-14 12:42:09 -04:00
|
|
|
minecraft "com.mojang:minecraft:$Globals.mcVersion"
|
2019-12-10 02:43:00 -05:00
|
|
|
mappings "net.fabricmc:yarn:${Globals.mcVersion}${Globals.yarnVersion}:v2"
|
2020-06-04 16:20:20 -04:00
|
|
|
modCompile "net.fabricmc:fabric-loader:0.8.7+build.201"
|
2019-04-23 18:46:23 -04:00
|
|
|
}
|
2018-12-09 11:47:35 -05:00
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
configurations {
|
|
|
|
dev
|
|
|
|
}
|
2018-11-05 09:54:00 -05:00
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
repositories {
|
|
|
|
mavenLocal()
|
|
|
|
}
|
|
|
|
|
2019-07-24 17:07:45 -04:00
|
|
|
jar {
|
|
|
|
classifier = "dev"
|
|
|
|
}
|
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
afterEvaluate {
|
2019-07-24 17:07:45 -04:00
|
|
|
remapJar {
|
|
|
|
input = file("${project.buildDir}/libs/$archivesBaseName-${version}-dev.jar")
|
|
|
|
archiveName = "${archivesBaseName}-${version}.jar"
|
|
|
|
}
|
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
artifacts {
|
2019-05-10 19:02:20 -04:00
|
|
|
dev file: file("${project.buildDir}/libs/$archivesBaseName-${version}-dev.jar"), type: "jar", builtBy: jar
|
2019-04-23 18:46:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
processResources {
|
|
|
|
inputs.property "version", project.version
|
|
|
|
|
|
|
|
from(sourceSets.main.resources.srcDirs) {
|
|
|
|
include "fabric.mod.json"
|
|
|
|
expand "version": project.version
|
|
|
|
}
|
|
|
|
|
|
|
|
from(sourceSets.main.resources.srcDirs) {
|
|
|
|
exclude "fabric.mod.json"
|
|
|
|
}
|
|
|
|
}
|
2019-04-26 14:18:20 -04:00
|
|
|
|
|
|
|
license {
|
|
|
|
header rootProject.file('HEADER')
|
|
|
|
include '**/*.java'
|
|
|
|
}
|
2019-04-23 18:46:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
|
|
classifier = 'sources'
|
|
|
|
from sourceSets.main.allSource
|
|
|
|
}
|
2019-10-26 22:39:47 -04:00
|
|
|
|
|
|
|
checkstyle {
|
|
|
|
configFile = rootProject.file("checkstyle.xml")
|
2020-04-11 14:21:53 -04:00
|
|
|
toolVersion = '8.31'
|
2019-10-26 22:39:47 -04:00
|
|
|
}
|
2019-06-27 12:22:48 -04:00
|
|
|
}
|
2019-10-26 22:39:47 -04:00
|
|
|
|
|
|
|
javadoc {
|
2020-04-05 10:07:27 -04:00
|
|
|
options {
|
|
|
|
source = "8"
|
|
|
|
encoding = 'UTF-8'
|
|
|
|
charSet = 'UTF-8'
|
|
|
|
memberLevel = JavadocMemberLevel.PACKAGE
|
|
|
|
links(
|
|
|
|
'https://guava.dev/releases/21.0/api/docs/',
|
|
|
|
'https://asm.ow2.io/javadoc/',
|
|
|
|
'https://docs.oracle.com/javase/8/docs/api/',
|
|
|
|
'http://jenkins.liteloader.com/job/Mixin/javadoc/',
|
|
|
|
'https://logging.apache.org/log4j/2.x/log4j-api/apidocs/'
|
|
|
|
// Need to add minecraft jd publication etc once there is one available
|
|
|
|
)
|
|
|
|
// Disable the crazy super-strict doclint tool in Java 8
|
|
|
|
addStringOption('Xdoclint:none', '-quiet')
|
|
|
|
}
|
|
|
|
allprojects.each {
|
|
|
|
source(it.sourceSets.main.allJava.srcDirs)
|
|
|
|
}
|
2019-06-27 12:22:48 -04:00
|
|
|
classpath = sourceSets.main.compileClasspath
|
2020-04-05 10:07:27 -04:00
|
|
|
include("**/api/**")
|
2020-02-10 12:05:41 -05:00
|
|
|
failOnError false
|
2018-12-22 10:21:31 -05:00
|
|
|
}
|
|
|
|
|
2020-02-10 12:05:41 -05:00
|
|
|
task javadocJar(type: Jar) {
|
2020-04-05 10:07:27 -04:00
|
|
|
dependsOn javadoc
|
|
|
|
from javadoc.destinationDir
|
2020-02-10 12:05:41 -05:00
|
|
|
//Set as `fatjavadoc` to prevent an ide form trying to use this javadoc, over using the modules javadoc
|
|
|
|
classifier = 'fatjavadoc'
|
|
|
|
}
|
|
|
|
build.dependsOn javadocJar
|
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
subprojects {
|
2020-05-03 12:56:50 -04:00
|
|
|
|
|
|
|
dependencies {
|
|
|
|
testmodCompile sourceSets.main.output
|
|
|
|
}
|
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
task remapMavenJar(type: Copy, dependsOn: remapJar) {
|
|
|
|
afterEvaluate {
|
|
|
|
from("${project.buildDir}/libs/$archivesBaseName-${version}.jar")
|
|
|
|
into("${project.buildDir}/libs/")
|
|
|
|
rename { String fn -> "$archivesBaseName-${version}-maven.jar" }
|
|
|
|
}
|
|
|
|
}
|
2019-04-23 19:14:43 -04:00
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
2020-04-05 10:51:59 -04:00
|
|
|
afterEvaluate {
|
|
|
|
artifact(file("${project.buildDir}/libs/$archivesBaseName-${version}-maven.jar")) {
|
|
|
|
builtBy remapMavenJar
|
|
|
|
}
|
|
|
|
artifact(sourcesJar) {
|
|
|
|
builtBy remapSourcesJar
|
|
|
|
}
|
2019-04-23 19:14:43 -04:00
|
|
|
}
|
|
|
|
}
|
2019-07-24 17:07:45 -04:00
|
|
|
}
|
2019-04-23 19:14:43 -04:00
|
|
|
|
2020-04-05 10:07:27 -04:00
|
|
|
setupRepositories(repositories)
|
2019-04-23 19:14:43 -04:00
|
|
|
}
|
|
|
|
|
2019-06-27 12:22:48 -04:00
|
|
|
javadoc.enabled = false
|
2019-04-23 18:46:23 -04:00
|
|
|
}
|
2019-04-03 15:34:09 -04:00
|
|
|
|
2019-05-10 19:02:20 -04:00
|
|
|
task remapMavenJar(type: net.fabricmc.loom.task.RemapJarTask, dependsOn: jar) {
|
2019-04-23 18:46:23 -04:00
|
|
|
afterEvaluate {
|
2019-05-10 19:02:20 -04:00
|
|
|
input = file("${project.buildDir}/libs/${archivesBaseName}-${version}-dev.jar")
|
2019-07-24 17:07:45 -04:00
|
|
|
archiveName = "${archivesBaseName}-${version}-maven.jar"
|
2019-05-10 19:02:20 -04:00
|
|
|
addNestedDependencies = false
|
2019-04-03 15:34:09 -04:00
|
|
|
}
|
2019-04-23 18:46:23 -04:00
|
|
|
}
|
2019-04-03 15:34:09 -04:00
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
2019-04-23 19:14:43 -04:00
|
|
|
artifact(file("${project.buildDir}/libs/$archivesBaseName-${version}-maven.jar")) {
|
|
|
|
builtBy remapMavenJar
|
|
|
|
}
|
|
|
|
artifact(sourcesJar) {
|
|
|
|
builtBy remapSourcesJar
|
|
|
|
}
|
2020-04-05 10:07:27 -04:00
|
|
|
artifact javadocJar
|
2019-04-23 18:46:23 -04:00
|
|
|
pom.withXml {
|
|
|
|
def depsNode = asNode().appendNode("dependencies")
|
|
|
|
subprojects.each {
|
|
|
|
def depNode = depsNode.appendNode("dependency")
|
|
|
|
depNode.appendNode("groupId", it.group)
|
|
|
|
depNode.appendNode("artifactId", it.name)
|
2019-05-17 10:20:37 -04:00
|
|
|
depNode.appendNode("version", it.version)
|
2019-04-23 18:46:23 -04:00
|
|
|
depNode.appendNode("scope", "compile")
|
|
|
|
}
|
|
|
|
}
|
2019-11-28 03:03:04 -05:00
|
|
|
}
|
2019-04-03 15:34:09 -04:00
|
|
|
}
|
2019-04-23 19:14:43 -04:00
|
|
|
|
2020-04-05 10:07:27 -04:00
|
|
|
setupRepositories(repositories)
|
|
|
|
}
|
|
|
|
|
|
|
|
void setupRepositories(RepositoryHandler repositories) {
|
|
|
|
//repositories.mavenLocal() // uncomment for testing
|
|
|
|
if (project.hasProperty('mavenPass')) {
|
|
|
|
repositories.maven {
|
2019-04-23 19:14:43 -04:00
|
|
|
url "http://mavenupload.modmuss50.me/"
|
2020-04-05 10:07:27 -04:00
|
|
|
credentials {
|
|
|
|
username 'buildslave'
|
|
|
|
password project.getProperty('mavenPass')
|
2019-04-23 19:14:43 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-03 15:34:09 -04:00
|
|
|
}
|
|
|
|
|
2019-04-26 14:18:20 -04:00
|
|
|
task licenseFormatAll
|
|
|
|
subprojects { p -> licenseFormatAll.dependsOn("${p.path}:licenseFormat") }
|
2019-05-11 17:48:33 -04:00
|
|
|
subprojects.each { remapJar.dependsOn("${it.path}:remapJar") }
|
2019-04-26 14:18:20 -04:00
|
|
|
|
2020-05-03 12:56:50 -04:00
|
|
|
sourceSets {
|
|
|
|
testmod
|
|
|
|
}
|
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
dependencies {
|
|
|
|
afterEvaluate {
|
|
|
|
subprojects.each {
|
|
|
|
compile project(path: ":${it.name}", configuration: "dev")
|
|
|
|
include project("${it.name}:")
|
2020-05-03 12:56:50 -04:00
|
|
|
|
|
|
|
testmodCompile project("${it.name}:").sourceSets.testmod.output
|
2019-04-23 18:46:23 -04:00
|
|
|
}
|
|
|
|
}
|
2018-11-05 09:54:00 -05:00
|
|
|
}
|
|
|
|
|
2019-05-11 18:00:57 -04:00
|
|
|
curseforge {
|
2020-04-05 10:07:27 -04:00
|
|
|
if (project.hasProperty('curse_api_key')) {
|
2019-05-11 18:00:57 -04:00
|
|
|
apiKey = project.getProperty('curse_api_key')
|
|
|
|
}
|
|
|
|
project {
|
|
|
|
id = '306612'
|
2020-02-05 13:05:59 -05:00
|
|
|
changelog = 'A changelog can be found at https://github.com/FabricMC/fabric/commits'
|
2020-04-08 11:03:19 -04:00
|
|
|
releaseType = 'beta'
|
2020-02-10 12:16:06 -05:00
|
|
|
addGameVersion '1.16-Snapshot'
|
2020-04-19 19:56:39 -04:00
|
|
|
addGameVersion 'Fabric'
|
2019-05-11 18:00:57 -04:00
|
|
|
mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar")) {
|
2019-07-14 12:42:09 -04:00
|
|
|
displayName = "[$Globals.mcVersion] Fabric API $Globals.baseVersion build $ENV.BUILD_NUMBER"
|
2019-05-11 18:00:57 -04:00
|
|
|
}
|
|
|
|
afterEvaluate {
|
|
|
|
uploadTask.dependsOn("remapJar")
|
|
|
|
}
|
|
|
|
}
|
2020-04-05 10:07:27 -04:00
|
|
|
options {
|
2019-05-11 18:00:57 -04:00
|
|
|
forgeGradleIntegration = false
|
|
|
|
}
|
|
|
|
}
|
2018-12-14 13:48:37 -05:00
|
|
|
|
2018-11-05 09:54:00 -05:00
|
|
|
apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/ideconfig.gradle'
|