forked from public-mirrors/HuskSync
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
199 lines
6.0 KiB
Groovy
199 lines
6.0 KiB
Groovy
import org.apache.tools.ant.filters.ReplaceTokens
|
|
|
|
plugins {
|
|
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
|
id 'org.cadixdev.licenser' version '0.6.1' apply false
|
|
id 'fabric-loom' version '1.7-SNAPSHOT' apply false
|
|
id 'org.ajoberstar.grgit' version '5.2.2'
|
|
id 'maven-publish'
|
|
id 'java'
|
|
}
|
|
|
|
group 'org.inksnow.husk'
|
|
version "$ext.plugin_version${versionMetadata()}"
|
|
description "$ext.plugin_description"
|
|
defaultTasks 'licenseFormat', 'build'
|
|
|
|
ext {
|
|
set 'version', version.toString()
|
|
set 'description', description.toString()
|
|
|
|
set 'jedis_version', jedis_version.toString()
|
|
set 'mysql_driver_version', mysql_driver_version.toString()
|
|
set 'mariadb_driver_version', mariadb_driver_version.toString()
|
|
set 'postgres_driver_version', postgres_driver_version.toString()
|
|
set 'mongodb_driver_version', mongodb_driver_version.toString()
|
|
set 'snappy_version', snappy_version.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: 'com.github.johnrengelman.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')
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
mavenCentral()
|
|
maven {
|
|
url findProperty('repository.huskpublic.url')
|
|
credentials {
|
|
username = findProperty('repository.huskpublic.username')
|
|
password = findProperty('repository.huskpublic.password')
|
|
}
|
|
}
|
|
maven { url 'https://r.irepo.space/maven/' }
|
|
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
|
|
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
|
|
maven { url "https://repo.dmulloy2.net/repository/public/" }
|
|
maven { url 'https://repo.codemc.io/repository/maven-public/' }
|
|
}
|
|
|
|
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 {
|
|
def tokenMap = rootProject.ext.properties
|
|
tokenMap.merge("grgit",'',(s, s2) -> s)
|
|
filesMatching(['**/*.json', '**/*.yml']) {
|
|
filter ReplaceTokens as Class, beginToken: '${', endToken: '}',
|
|
tokens: tokenMap
|
|
}
|
|
}
|
|
}
|
|
|
|
subprojects {
|
|
if (['fabric'].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('')
|
|
}
|
|
|
|
// Append the Minecraft to the version for Fabric projects
|
|
if (project.name == 'fabric') {
|
|
version += "+mc.${fabric_minecraft_version}"
|
|
}
|
|
|
|
// API publishing
|
|
if (['common', 'bukkit', 'fabric'].contains(project.name)) {
|
|
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.husksync'
|
|
artifactId = 'husksync-common'
|
|
version = "$rootProject.version"
|
|
artifact shadowJar
|
|
artifact sourcesJar
|
|
artifact javadocJar
|
|
}
|
|
}
|
|
}
|
|
|
|
if (['bukkit'].contains(project.name)) {
|
|
publications {
|
|
mavenJavaBukkit(MavenPublication) {
|
|
groupId = 'org.inksnow.husk.husksync'
|
|
artifactId = 'husksync-bukkit'
|
|
version = "$rootProject.version"
|
|
artifact shadowJar
|
|
artifact sourcesJar
|
|
artifact javadocJar
|
|
}
|
|
}
|
|
}
|
|
|
|
if (['fabric'].contains(project.name)) {
|
|
publications {
|
|
mavenJavaFabric(MavenPublication) {
|
|
groupId = 'org.inksnow.husk.husksync'
|
|
artifactId = 'husksync-fabric'
|
|
version = "$rootProject.version+${fabric_minecraft_version}"
|
|
artifact remapJar
|
|
artifact sourcesJar
|
|
artifact javadocJar
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
jar.dependsOn(shadowJar)
|
|
clean.delete "$rootDir/target"
|
|
}
|
|
|
|
logger.lifecycle("Building HuskSync ${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
|
|
}
|