Skip to content
This repository was archived by the owner on Jan 4, 2026. It is now read-only.

Commit cb8b558

Browse files
committed
Move properties into gradle.properties and extend plugin.yml properties
Append Git hash to snapshot builds.
1 parent 58db7f6 commit cb8b558

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

build.gradle

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,24 @@ plugins {
33
id 'com.github.johnrengelman.shadow' version '8.1.1'
44
}
55

6-
group = 'es.redactado'
7-
version = '1.0-SNAPSHOT'
6+
ext.getGitHash = { ->
7+
def stdout = new ByteArrayOutputStream()
8+
exec {
9+
commandLine 'git', 'rev-parse', '--short', 'HEAD'
10+
standardOutput = stdout
11+
ignoreExitValue = true // Ignore error if there is no Git commit yet
12+
}
13+
return stdout.toString().trim() ?: "0"
14+
}
15+
16+
// We embed the git hash into jar files, and also use it for the plugin version of snapshot builds.
17+
ext.buildVersion = version + '+' + getGitHash()
18+
ext.isSnapshot = version.contains('-SNAPSHOT')
19+
ext.pluginVersion = isSnapshot ? buildVersion : version
20+
21+
println 'Project version: ' + version
22+
println 'Build version: ' + buildVersion
23+
println 'Plugin version: ' + pluginVersion
824

925
repositories {
1026
mavenCentral()
@@ -69,7 +85,11 @@ shadowJar {
6985
}
7086

7187
processResources {
72-
def props = [version: version]
88+
def props = [
89+
'pluginVersion': pluginVersion,
90+
'pluginUrl': pluginUrl,
91+
'pluginDescription': pluginDescription
92+
]
7393
inputs.properties props
7494
filteringCharset 'UTF-8'
7595
filesMatching('plugin.yml') {

gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
group=es.redactado
2+
version=1.0.0-SNAPSHOT
3+
pluginDescription=Shopkeepers ExecutableItems integration
4+
pluginUrl=https://github.com/Shopkeepers/Shopkeepers-ExecutableItems

src/main/resources/plugin.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: ShopkeepersEI
2-
version: '1.0-SNAPSHOT'
2+
version: '${pluginVersion}'
3+
authors: [Reddishye]
4+
website: '${pluginUrl}'
5+
description: '${pluginDescription}'
36
main: es.redactado.shopkeepersEI.ShopkeepersEI
47
api-version: '1.20'
58
depend: [Shopkeepers]
6-
softdepend: [ExecutableItems, SCore]
9+
softdepend: [ExecutableItems, SCore]

0 commit comments

Comments
 (0)