-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
92 lines (76 loc) · 2.55 KB
/
Copy pathbuild.gradle
File metadata and controls
92 lines (76 loc) · 2.55 KB
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
plugins {
id 'java-library'
id 'eclipse'
}
defaultTasks 'clean', 'build', 'publishToMavenLocal'
ext.getGitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
ignoreExitValue = true // Ignore error if there is no Git commit yet
}
return stdout.toString().trim() ?: "0"
}
// We embed the git hash into jar files, and also use it for the plugin version of snapshot builds.
ext.buildVersion = version + '+' + getGitHash()
ext.isSnapshot = version.contains('-SNAPSHOT')
ext.pluginVersion = isSnapshot ? buildVersion : version
println 'Project version: ' + version
println 'Build version: ' + buildVersion
println 'Plugin version: ' + pluginVersion
repositories {
mavenLocal()
mavenCentral()
// Bukkit/Spigot API
maven { url 'https://hub.spigotmc.org/nexus/content/groups/public/' }
// Shopkeepers
maven { url 'https://raw.githubusercontent.com/Shopkeepers/Repository/main/releases/' }
// Shopkeepers snapshots
//maven { url 'https://raw.githubusercontent.com/Shopkeepers/Repository/main/snapshots/' }
// Shopkeepers Fallback
//maven { url 'https://jitpack.io' }
// BlueMap
maven { url 'https://repo.bluecolored.de/releases' }
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.21.5-R0.1-SNAPSHOT'
compileOnly 'com.nisovin.shopkeepers:ShopkeepersAPI:2.25.0'
// Fallback
//compileOnly 'com.github.Shopkeepers:Shopkeepers:master-SNAPSHOT'
compileOnly 'de.bluecolored:bluemap-api:2.7.7'
testImplementation 'org.spigotmc:spigot-api:1.21.5-R0.1-SNAPSHOT'
testImplementation 'junit:junit:4.13.1'
}
java
{
sourceCompatibility = JavaVersion.VERSION_21
}
tasks.withType(JavaCompile) {
options.encoding = 'utf8'
}
processResources {
inputs.property 'pluginVersion', pluginVersion
inputs.property 'pluginUrl', pluginUrl
inputs.property 'pluginDescription', pluginDescription
from project.sourceSets.main.resources.srcDirs
filesMatching('plugin.yml') {
expand([
'pluginVersion': pluginVersion,
'pluginUrl': pluginUrl,
'pluginDescription': pluginDescription
])
}
// TODO Some plugins might add resource directories twice.
// See https://github.com/gradle/gradle/issues/17236
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
jar {
manifest {
attributes 'Implementation-Title': "${project.group}:${project.name}",
'Implementation-Version': project.buildVersion
// Include versions of compile dependencies:
attributes configurations.compileClasspath.resolvedConfiguration.firstLevelModuleDependencies
.collectEntries{[it.moduleName, it.moduleVersion]}
}
}