-
Notifications
You must be signed in to change notification settings - Fork 105
/
build.gradle
176 lines (147 loc) · 4.81 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
plugins {
id "io.github.goooler.shadow" version "8.1.8"
id "com.jfrog.artifactory" version "4.21.0"
}
println """
*******************************************
You are building CommandBook!
If you encounter trouble:
1) Read CONTRIBUTING.md if you haven't yet
2) Try running 'build' in a separate Gradle run
3) Use gradlew and not gradle
4) If you still need help, ask on Discord! https://discord.gg/enginehub
Output files will be in [subproject]/build/libs
*******************************************
"""
if (!project.hasProperty("artifactory_contextUrl")) ext.artifactory_contextUrl = ""
if (!project.hasProperty("artifactory_user")) ext.artifactory_user = ""
if (!project.hasProperty("artifactory_password")) ext.artifactory_password = ""
if (!project.hasProperty("gitCommitHash")) {
try {
def repo = org.ajoberstar.grgit.Grgit.open(project.file('.'))
ext.gitCommitHash = repo.head().abbreviatedId
} catch (Exception e) {
ext.gitCommitHash = "no_git_id"
}
}
apply plugin: 'java'
apply plugin: 'maven-publish'
group = pluginGroup
version = pluginVersion
ext.internalVersion = pluginVersion + ";" + gitCommitHash
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenLocal()
mavenCentral()
maven {
name = 'EngineHub Repo'
url = 'https://maven.enginehub.org/repo/'
}
maven {
name = 'Destroystokyo Repo'
url = 'https://repo.destroystokyo.com/repository/maven-public/'
}
maven {
name 'Packet Loss Gaming Repository'
url 'https://mvn.packetloss.gg/'
}
}
dependencies {
compileOnly 'io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT'
compileOnly 'com.sk89q.worldedit:worldedit-core:7.3.4'
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.3.4'
compileOnly 'org.enginehub.jinglenote:jinglenote-core:1.0.0-SNAPSHOT'
implementation('org.enginehub.jinglenote:jinglenote-bukkit:1.0.0-SNAPSHOT') {
exclude group: 'org.spigotmc', module: 'spigot-api'
}
implementation 'com.zachsthings.libcomponents:libcomponents-core:1.3.1'
implementation 'com.zachsthings.libcomponents:libcomponents-bukkit:1.3.1'
implementation 'net.sf.opencsv:opencsv:2.0'
compileOnly 'com.sk89q.worldedit.worldedit-libs:ap:7.3.4'
annotationProcessor 'com.sk89q.worldedit.worldedit-libs:ap:7.3.4'
annotationProcessor "com.google.guava:guava:21.0"
testImplementation group: 'junit', name: 'junit', version: '4.12'
}
tasks.withType(JavaCompile).configureEach {
it.options.compilerArgs.add("-Aarg.name.key.prefix=")
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
publishing {
publications {
maven(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
}
}
}
artifacts {
archives shadowJar
archives sourcesJar
archives javadocJar
}
build.dependsOn(sourcesJar)
build.dependsOn(javadocJar)
jar {
manifest {
attributes("Class-Path": "CommandBook/WorldEdit.jar lib/WorldEdit.jar ../lib/WorldEdit.jar ../WorldEdit.jar",
"CommandBook-Version": pluginVersion)
}
}
shadowJar {
archiveClassifier.set('dist')
dependencies {
include(dependency('com.zachsthings.libcomponents:libcomponents-core'))
include(dependency('com.zachsthings.libcomponents:libcomponents-bukkit'))
relocate ("au.com.bytecode.opencsv", "com.sk89q.commandbook.shaded.opencsv") {
include(dependency('net.sf.opencsv:opencsv'))
}
relocate ("org.enginehub.jinglenote", "com.sk89q.commandbook.shaded.jinglenote") {
include(dependency("org.enginehub.jinglenote:jinglenote-core"))
include(dependency("org.enginehub.jinglenote:jinglenote-bukkit"))
}
}
exclude 'GradleStart**'
exclude '.cache'
exclude 'LICENSE*'
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
repoKey = project.version.contains("SNAPSHOT") ? 'libs-snapshot-local' : 'libs-release-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
resolve {
repository {
repoKey = 'repo'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
artifactoryPublish {
publishConfigs("archives")
}
processResources {
duplicatesStrategy DuplicatesStrategy.INCLUDE
from (sourceSets.main.resources.srcDirs) {
expand 'internalVersion': project.internalVersion
include 'plugin.yml'
}
}