Fix dynamic version lookup.
This commit is contained in:
parent
c555f91794
commit
8d633cc049
|
@ -1,5 +1,4 @@
|
|||
image: adoptopenjdk:8-openj9
|
||||
#image: openjdk:8
|
||||
image: openjdk:8
|
||||
|
||||
pipelines:
|
||||
branches:
|
||||
|
@ -17,7 +16,7 @@ pipelines:
|
|||
- gradle
|
||||
name: Build and Release
|
||||
script:
|
||||
- ./gradlew clean versionFile build shadowJar buildRpm buildDeb
|
||||
- ./gradlew clean build shadowJar buildRpm buildDeb
|
||||
- shopt -s nullglob ; for file in ${BITBUCKET_CLONE_DIR}/build/libs/*-all.jar ; do curl -X POST --user "${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"${file}" ; done
|
||||
- shopt -s nullglob ; for file in ${BITBUCKET_CLONE_DIR}/build/distributions/*.rpm ; do curl -X POST --user "${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"${file}" ; done
|
||||
- shopt -s nullglob ; for file in ${BITBUCKET_CLONE_DIR}/build/distributions/*.deb ; do curl -X POST --user "${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"${file}" ; done
|
||||
|
|
24
build.gradle
24
build.gradle
|
@ -8,8 +8,6 @@ plugins {
|
|||
}
|
||||
|
||||
repositories {
|
||||
// Use jcenter for resolving dependencies.
|
||||
// You can declare any Maven/Ivy/file repository here.
|
||||
jcenter()
|
||||
}
|
||||
|
||||
|
@ -20,13 +18,11 @@ dependencies {
|
|||
implementation 'org.slf4j:slf4j-api:1.7.+'
|
||||
runtimeOnly 'ch.qos.logback:logback-classic:1.+'
|
||||
|
||||
// Use the awesome Spock testing and specification framework
|
||||
testImplementation('org.spockframework:spock-core:2.0-M3-groovy-3.0')
|
||||
testImplementation("org.slf4j:slf4j-simple:1.7.+")
|
||||
}
|
||||
|
||||
application {
|
||||
// Define the main class for the application.
|
||||
mainClassName = 'biz.nellemann.syslogd.SyslogServer'
|
||||
}
|
||||
|
||||
|
@ -59,7 +55,6 @@ ospackage {
|
|||
|
||||
buildRpm {
|
||||
dependsOn startShadowScripts
|
||||
//requires('java-1.8.0-openjdk-headless')
|
||||
os = LINUX
|
||||
}
|
||||
|
||||
|
@ -68,21 +63,16 @@ buildDeb {
|
|||
requires('default-jre-headless')
|
||||
}
|
||||
|
||||
processResources.dependsOn.add("versionFile")
|
||||
versionFile {
|
||||
// Path to the file to be written
|
||||
file = new File(project.buildDir, 'resources/main/version.properties')
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes(
|
||||
'Built-By' : System.properties['user.name'],
|
||||
'Build-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSSZ").toString(),
|
||||
'Build-Revision' : versioning.info.commit,
|
||||
'Created-By' : "Gradle ${gradle.gradleVersion}",
|
||||
'Build-Jdk' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
|
||||
'Build-OS' : "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}"
|
||||
'Created-By' : "Gradle ${gradle.gradleVersion}",
|
||||
'Build-OS' : "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}",
|
||||
'Build-Jdk' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
|
||||
'Build-User' : System.properties['user.name'],
|
||||
'Build-Version' : versioning.info.tag ?: (versioning.info.branch + "-" + versioning.info.build),
|
||||
'Build-Revision' : versioning.info.commit,
|
||||
'Build-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSSZ").toString(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
id = syslogd
|
||||
group = biz.nellemann.syslogd
|
||||
version = 1.0.3
|
||||
version = 1.0.4
|
||||
|
|
|
@ -3,20 +3,17 @@ package biz.nellemann.syslogd;
|
|||
import picocli.CommandLine;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Properties;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
class VersionProvider implements CommandLine.IVersionProvider {
|
||||
|
||||
public String[] getVersion() throws IOException {
|
||||
|
||||
URL url = getClass().getResource("/version.properties");
|
||||
if (url == null) {
|
||||
return new String[] { "No version information available." };
|
||||
}
|
||||
Properties properties = new Properties();
|
||||
properties.load(url.openStream());
|
||||
return new String[] { "${COMMAND-FULL-NAME} " + properties.getProperty("VERSION_GRADLE") + "-" + properties.getProperty("VERSION_BUILD") };
|
||||
Manifest manifest = new Manifest(getClass().getResourceAsStream("/META-INF/MANIFEST.MF"));
|
||||
Attributes attrs = manifest.getMainAttributes();
|
||||
|
||||
return new String[] { "${COMMAND-FULL-NAME} " + attrs.getValue("Build-Version") };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue