|
|
|
import org.apache.tools.ant.filters.ReplaceTokens
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
id 'org.cadixdev.licenser' version '0.6.1' apply false
|
|
|
|
id 'fabric-loom' version '1.7-SNAPSHOT' apply false
|
|
|
|
id 'io.github.goooler.shadow' version '8.1.8'
|
|
|
|
id 'org.ajoberstar.grgit' version '5.2.2'
|
|
|
|
id 'maven-publish'
|
|
|
|
id 'java'
|
|
|
|
}
|
|
|
|
|
|
|
|
group 'org.inksnow.husk'
|
|
|
|
version "$ext.library_version${versionMetadata()}"
|
|
|
|
description "$ext.library_description"
|
|
|
|
defaultTasks 'licenseFormat', 'build'
|
|
|
|
|
|
|
|
ext {
|
|
|
|
set 'version', version.toString()
|
|
|
|
set 'description', description.toString()
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
name = 'husk-release'
|
|
|
|
url = findProperty("repository.huskrelease.url")
|
|
|
|
credentials {
|
|
|
|
username = findProperty("repository.huskrelease.username")
|
|
|
|
password = findProperty("repository.huskrelease.password")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
allprojects {
|
|
|
|
apply plugin: 'io.github.goooler.shadow'
|
|
|
|
apply plugin: 'org.cadixdev.licenser'
|
|
|
|
apply plugin: 'java'
|
|
|
|
|
|
|
|
compileJava.options.encoding = 'UTF-8'
|
|
|
|
compileJava.options.release.set 8
|
|
|
|
javadoc.options.encoding = 'UTF-8'
|
|
|
|
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
|
|
|
|
|
|
|
|
java {
|
|
|
|
disableAutoTargetJvm()
|
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenLocal()
|
|
|
|
mavenCentral()
|
|
|
|
maven { url 'https://repo.papermc.io/repository/maven-public/' }
|
|
|
|
maven { url 'https://libraries.minecraft.net/' }
|
|
|
|
maven { url 'https://maven.fabricmc.net/' }
|
|
|
|
maven { url 'https://mvn-repo.arim.space/lesser-gpl3/' }
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3'
|
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.3'
|
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.3'
|
|
|
|
}
|
|
|
|
|
|
|
|
test {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
|
|
|
|
|
|
|
license {
|
|
|
|
header = rootProject.file('HEADER')
|
|
|
|
include '**/*.java'
|
|
|
|
newLine = true
|
|
|
|
}
|
|
|
|
|
|
|
|
processResources {
|
|
|
|
filesMatching(['**/*.json', '**/*.yml']) {
|
|
|
|
filter ReplaceTokens as Class, beginToken: '${', endToken: '}',
|
|
|
|
tokens: rootProject.ext.properties
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
subprojects {
|
|
|
|
if (['fabric-1.20.1', 'fabric-1.21'].contains(project.name)) {
|
|
|
|
apply plugin: 'fabric-loom'
|
|
|
|
}
|
|
|
|
|
|
|
|
version rootProject.version
|
|
|
|
archivesBaseName = "${rootProject.name}-${project.name.capitalize()}"
|
|
|
|
|
|
|
|
jar {
|
|
|
|
from '../LICENSE'
|
|
|
|
}
|
|
|
|
|
|
|
|
shadowJar {
|
|
|
|
destinationDirectory.set(file("$rootDir/target"))
|
|
|
|
archiveClassifier.set('')
|
|
|
|
}
|
|
|
|
|
|
|
|
// Don't include example plugin in publishing
|
|
|
|
if (['example-plugin'].contains(project.name)) return;
|
|
|
|
|
|
|
|
// API publishing
|
|
|
|
java {
|
|
|
|
withSourcesJar()
|
|
|
|
withJavadocJar()
|
|
|
|
}
|
|
|
|
sourcesJar {
|
|
|
|
destinationDirectory.set(file("$rootDir/target"))
|
|
|
|
}
|
|
|
|
javadocJar {
|
|
|
|
destinationDirectory.set(file("$rootDir/target"))
|
|
|
|
}
|
|
|
|
shadowJar.dependsOn(sourcesJar, javadocJar)
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
if (['common'].contains(project.name)) {
|
|
|
|
publications {
|
|
|
|
mavenJavaCommon(MavenPublication) {
|
|
|
|
groupId = 'org.inksnow.husk.uniform'
|
|
|
|
artifactId = 'uniform-common'
|
|
|
|
version = "$rootProject.version"
|
|
|
|
artifact shadowJar
|
|
|
|
artifact sourcesJar
|
|
|
|
artifact javadocJar
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (['paper'].contains(project.name)) {
|
|
|
|
publications {
|
|
|
|
mavenJavaPaper(MavenPublication) {
|
|
|
|
groupId = 'org.inksnow.husk.uniform'
|
|
|
|
artifactId = 'uniform-paper'
|
|
|
|
version = "$rootProject.version"
|
|
|
|
artifact shadowJar
|
|
|
|
artifact sourcesJar
|
|
|
|
artifact javadocJar
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (['bukkit'].contains(project.name)) {
|
|
|
|
publications {
|
|
|
|
mavenJavaBukkit(MavenPublication) {
|
|
|
|
groupId = 'org.inksnow.husk.uniform'
|
|
|
|
artifactId = 'uniform-bukkit'
|
|
|
|
version = "$rootProject.version"
|
|
|
|
artifact shadowJar
|
|
|
|
artifact sourcesJar
|
|
|
|
artifact javadocJar
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (['velocity'].contains(project.name)) {
|
|
|
|
publications {
|
|
|
|
mavenJavaVelocity(MavenPublication) {
|
|
|
|
groupId = 'org.inksnow.husk.uniform'
|
|
|
|
artifactId = 'uniform-velocity'
|
|
|
|
version = "$rootProject.version"
|
|
|
|
artifact shadowJar
|
|
|
|
artifact sourcesJar
|
|
|
|
artifact javadocJar
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (['fabric-1.20.1'].contains(project.name)) {
|
|
|
|
publications {
|
|
|
|
mavenJavaFabric1_20_1(MavenPublication) {
|
|
|
|
groupId = 'org.inksnow.husk.uniform'
|
|
|
|
artifactId = 'uniform-fabric'
|
|
|
|
version = "${rootProject.version}+1.20.1"
|
|
|
|
artifact remapJar
|
|
|
|
artifact sourcesJar
|
|
|
|
artifact javadocJar
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (['fabric-1.21'].contains(project.name)) {
|
|
|
|
publications {
|
|
|
|
mavenJavaFabric1_21(MavenPublication) {
|
|
|
|
groupId = 'org.inksnow.husk.uniform'
|
|
|
|
artifactId = 'uniform-fabric'
|
|
|
|
version = "${rootProject.version}+1.21"
|
|
|
|
artifact remapJar
|
|
|
|
artifact sourcesJar
|
|
|
|
artifact javadocJar
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (['sponge-11'].contains(project.name)) {
|
|
|
|
publications {
|
|
|
|
mavenSponge11(MavenPublication) {
|
|
|
|
groupId = 'org.inksnow.husk.uniform'
|
|
|
|
artifactId = 'uniform-sponge'
|
|
|
|
version = "${rootProject.version}+11"
|
|
|
|
artifact shadowJar
|
|
|
|
artifact sourcesJar
|
|
|
|
artifact javadocJar
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
jar.dependsOn shadowJar
|
|
|
|
clean.delete "$rootDir/target"
|
|
|
|
}
|
|
|
|
|
|
|
|
logger.lifecycle("Building Uniform ${version} by William278")
|
|
|
|
|
|
|
|
@SuppressWarnings('GrMethodMayBeStatic')
|
|
|
|
def versionMetadata() {
|
|
|
|
// Require grgit
|
|
|
|
if (grgit == null) {
|
|
|
|
return '-unknown'
|
|
|
|
}
|
|
|
|
|
|
|
|
// If unclean, return the last commit hash with -indev
|
|
|
|
if (!grgit.status().clean) {
|
|
|
|
return '-' + grgit.head().abbreviatedId + '-indev'
|
|
|
|
}
|
|
|
|
|
|
|
|
// Otherwise if this matches a tag, return nothing
|
|
|
|
def tag = grgit.tag.list().find { it.commit.id == grgit.head().id }
|
|
|
|
if (tag != null) {
|
|
|
|
return ''
|
|
|
|
}
|
|
|
|
return '-' + grgit.head().abbreviatedId
|
|
|
|
}
|