Automatic version incrementing

Build artifact now 5.0-SNAPSHOT

Version is 5.0 build $number where number is amount of commits since
cdb13e3b66
This commit is contained in:
Rsl1122 2019-12-07 20:12:45 +02:00
parent b5d496e9ad
commit 3744b1b98b
9 changed files with 59 additions and 6 deletions

View File

@ -22,7 +22,21 @@ allprojects {
wrapper.gradleVersion = "5.5.1"
group "com.djrapitops"
version "5.0 build 292"
version "5.0-SNAPSHOT"
def determineBuildVersion = {
def buildInfo = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-list', '--count', 'HEAD', '^cdb13e3b663b18e3938ad5efc60d165fa9301f6e'
standardOutput = buildInfo
}
return buildInfo.toString().replaceAll("[^0-9]", "")
}
ext.majorVersion = '5'
ext.minorVersion = '0'
ext.buildVersion = determineBuildVersion()
ext.fullVersion = "$majorVersion.$minorVersion build $buildVersion"
test {
useJUnitPlatform()

View File

@ -18,7 +18,22 @@ dependencies {
testCompile "com.google.code.gson:gson:$gsonVersion"
}
import org.apache.tools.ant.filters.ReplaceTokens
task updateVersion(type: Copy) {
from('src/main/resources') {
include 'plugin.yml'
include 'bungee.yml'
}
into 'build/sources/resources/'
filter(ReplaceTokens, tokens: [version: '' + project.ext.fullVersion])
}
processResources {
dependsOn updateVersion
from 'build/sources/resources'
}
shadowJar {
dependsOn processResources
configurations = [project.configurations.compile]
// Exclude these files

View File

@ -1,7 +1,7 @@
name: Plan
author: Rsl1122
main: com.djrapitops.plan.PlanBungee
version: 5.0 build 292
version: @version@
softdepend:
- AdvancedBan
- LiteBans

View File

@ -1,7 +1,7 @@
name: Plan
author: Rsl1122
main: com.djrapitops.plan.Plan
version: 5.0 build 292
version: @version@
api-version: 1.13
softdepend:
- ASkyBlock

View File

@ -23,12 +23,16 @@ shadowJar {
classifier = null
}
build {
dependsOn tasks.named("shadowJar")
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'com.djrapitops'
artifactId = 'Plan-plugin'
version = project.version
version = "$fullVersion"
artifact shadowJar
}

View File

@ -1,3 +1,12 @@
plugins {
id "net.kyori.blossom" version "1.1.0"
}
blossom {
replaceTokenIn('src/main/java/com/djrapitops/plan/PlanSponge.java')
replaceToken('@version@', "$fullVersion")
}
dependencies {
compile project(path: ":common", configuration: 'shadow')
compileOnly project(":api")

View File

@ -42,7 +42,7 @@ import java.io.InputStream;
@Plugin(
id = "plan",
name = "Plan",
version = "5.0 build 292",
version = "@version@",
description = "Player Analytics Plugin by Rsl1122",
authors = {"Rsl1122"},
dependencies = {

View File

@ -1,3 +1,12 @@
plugins {
id "net.kyori.blossom" version "1.1.0"
}
blossom {
replaceTokenIn('src/main/java/com/djrapitops/plan/PlanVelocity.java')
replaceToken('@version@', "$fullVersion")
}
dependencies {
compile project(path: ":common", configuration: 'shadow')
compileOnly project(":api")
@ -13,5 +22,7 @@ dependencies {
}
shadowJar {
dependsOn blossomSourceReplacementJava
configurations = [project.configurations.compile]
}

View File

@ -45,7 +45,7 @@ import java.nio.file.Path;
@Plugin(
id = "plan",
name = "Plan",
version = "5.0 build 292",
version = "@version@",
description = "Player Analytics Plugin by Rsl1122",
authors = {"Rsl1122"}
)