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.
HuskSync/build.gradle

103 lines
2.9 KiB
Groovy

plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'org.ajoberstar.grgit' version '5.0.0'
id 'java'
id 'maven-publish'
}
3 years ago
group 'net.william278'
version "$ext.plugin_version+${versionMetadata()}"
3 years ago
ext {
set 'version', version.toString()
}
3 years ago
import org.apache.tools.ant.filters.ReplaceTokens
allprojects {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
compileJava.options.encoding = 'UTF-8'
javadoc.options.encoding = 'UTF-8'
2 years ago
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
compileJava.options.release.set 16
3 years ago
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
maven { url 'https://repo.minebench.de/' }
maven { url 'https://repo.alessiodp.com/releases/' }
maven { url 'https://jitpack.io' }
maven { url 'https://libraries.minecraft.net/' }
3 years ago
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
}
test {
useJUnitPlatform()
}
processResources {
filter ReplaceTokens as Class, beginToken: '${', endToken: '}',
tokens: rootProject.ext.properties
}
}
subprojects {
version rootProject.version
archivesBaseName = "${rootProject.name}-${project.name.capitalize()}"
if (['bukkit', 'api', 'plugin'].contains(project.name)) {
shadowJar {
destinationDirectory.set(file("$rootDir/target"))
archiveClassifier.set('')
}
// API publishing
if ('api'.contains(project.name)) {
java {
withSourcesJar()
withJavadocJar()
}
sourcesJar {
destinationDirectory.set(file("$rootDir/target"))
}
javadocJar {
destinationDirectory.set(file("$rootDir/target"))
}
shadowJar.dependsOn(sourcesJar, javadocJar)
publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'net.william278'
artifactId = 'husksync'
version = "$rootProject.version"
artifact shadowJar
artifact javadocJar
artifact sourcesJar
}
}
}
}
jar.dependsOn(shadowJar)
clean.delete "$rootDir/target"
}
}
logger.lifecycle("Building HuskSync ${version} by William278")
@SuppressWarnings('GrMethodMayBeStatic')
def versionMetadata() {
if (grgit == null) {
return System.getenv("GITHUB_RUN_NUMBER") ? 'build.' + System.getenv("GITHUB_RUN_NUMBER") : 'unknown'
}
return 'rev.' + grgit.head().abbreviatedId + (grgit.status().clean ? '' : '-indev')
3 years ago
}