Configure gradle to set version and build date

This commit is contained in:
Georgy Litvinov 2020-03-09 14:55:50 +01:00
parent 3e4ec18f67
commit abd309d8de
5 changed files with 19 additions and 305 deletions

View file

@ -2,12 +2,18 @@ apply plugin: 'java'
repositories{
mavenCentral()
}
Properties properties = new Properties()
properties.load(project.rootProject.file('project.properties').newDataInputStream())
def releaseVersion = properties.getProperty('ReleaseVersion')
def getDate() {
return new Date().format('yyyyMMddHHmmss')
}
sourceCompatibility = 1.8
jar {
manifest {
attributes("Implementation-Title": "w2phtml",
"Implementation-Version": "0.5.0",
"Implementation-Version": releaseVersion,
"Main-Class" : "w2phtml.Application",
"Class-Path" : "jasp.jar parser.jar")
}
@ -41,7 +47,7 @@ jar {
task xhtml(type: Jar) {
manifest {
attributes("Implementation-Title": "w2phtml",
"Implementation-Version": "0.5.1",
"Implementation-Version": releaseVersion,
"Built-By": "litvinovg",
"RegistrationClassName" : "org.openoffice.da.comp.writer2xhtml.W2XRegistration",
"Class-Path" : "jasp.jar parser.jar")
@ -71,12 +77,10 @@ task xhtml(type: Jar) {
include 'w2phtml/xhtml/**/**/*.properties'
from sourceSets.main.output
include 'org/**/*'
}
task oxt(type: Zip){
dependsOn xhtml
dependsOn = [ 'xhtml', 'setVersion' ]
archiveName 'w2phtml.oxt'
from 'src/main/oxt/writer2xhtml'
include '*'
@ -86,3 +90,9 @@ task oxt(type: Zip){
from 'src/main/idl/writer2xhtml'
include 'writer2xhtml.rdb'
}
task setVersion(){
ant.taskdef(name: 'xmltask', classpath: 'buildPlugins/xmltask.jar', classname: 'com.oopsconsultancy.xmltask.ant.XmlTask')
ant.xmltask(source: 'src/main/oxt/writer2xhtml/description.xml', dest: 'src/main/oxt/writer2xhtml/description.xml', report:'true') {
replace(path: "//*[local-name()='version']/@value", withText: "${releaseVersion}")
}
}