forked from WiIIiam278/HuskTowns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
98 lines (82 loc) · 2.88 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'org.ajoberstar.grgit' version '5.0.0'
id 'java'
id 'maven-publish'
}
group 'net.william278'
version "$ext.plugin_version-${versionMetadata()}"
ext {
set 'version', version.toString()
}
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'
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
compileJava.options.release.set 16
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
maven { url 'https://papermc.io/repo/repository/maven-public/' }
maven { url 'https://repo.minebench.de/' }
maven { url 'https://repo.codemc.org/repository/maven-public' }
maven { url 'https://jitpack.io' }
maven { url 'https://repo.mikeprimm.com/' }
maven { url 'https://repo.jpenilla.xyz/snapshots/' }
maven { url 'https://repo.lucko.me/' }
}
processResources {
filter ReplaceTokens as Class, beginToken: '${', endToken: '}',
tokens: rootProject.ext.properties
}
}
subprojects {
version rootProject.version
archivesBaseName = "${rootProject.name}-${project.name.capitalize()}"
if (['bukkit', 'plugin'].contains(project.name)) {
shadowJar {
destinationDirectory.set(file("$rootDir/target"))
archiveClassifier.set('')
}
// API publishing
if ('bukkit'.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 = 'husktowns'
version = "$rootProject.version"
artifact shadowJar
artifact javadocJar
artifact sourcesJar
}
}
}
}
jar.dependsOn shadowJar
clean.delete "$rootDir/target"
}
}
logger.lifecycle("Building HuskTowns ${version} by William278")
@SuppressWarnings('GrMethodMayBeStatic')
def versionMetadata() {
if (grgit == null) {
return System.getenv("GITHUB_RUN_NUMBER") ? 'build.' + System.getenv("GITHUB_RUN_NUMBER") : 'unknown'
}
return grgit.head().abbreviatedId + (grgit.status().clean ? '' : '-indev')
}