From 508475586a371fc29caa1368800c825b29e820be Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Wed, 25 Nov 2020 12:05:51 +0100 Subject: [PATCH] build improvements --- build.gradle | 37 ++++++++++++++----------- gradle.properties | 1 + src/main/tmp/w2phtml/project.properties | 2 -- 3 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 gradle.properties delete mode 100644 src/main/tmp/w2phtml/project.properties diff --git a/build.gradle b/build.gradle index cdad635..39d345c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,14 @@ apply plugin: 'java' +jar.archiveName = "${jar.baseName}.${jar.extension}" repositories{ mavenCentral() } -def releaseVersion = "0.9.1" def propertyFile = file "src/main/java/w2phtml/project.properties" def propertyDestFile = file "src/main/tmp/w2phtml/project.properties" Properties properties = new Properties() propertyFile.withReader { properties.load(it) } properties.setProperty('releaseDate', new Date().format('HH:mm:ss dd-MM-YYYY')) -properties.setProperty('releaseVersion', releaseVersion ) +properties.setProperty('releaseVersion', project.version ) propertyDestFile.withWriter { properties.store(it, null) } sourceCompatibility = 1.8 @@ -35,7 +35,7 @@ dependencies{ jar { manifest { attributes("Implementation-Title": rootProject.name, - "Implementation-Version": releaseVersion, + "Implementation-Version": project.version, "Main-Class" : "w2phtml.Application", "Class-Path" : "jasp.jar parser.jar") } @@ -60,7 +60,7 @@ jar { task xhtml(type: Jar) { manifest { attributes("Implementation-Title": rootProject.name, - "Implementation-Version": releaseVersion, + "Implementation-Version": project.version, "RegistrationClassName" : "org.openoffice.da.comp.writer2xhtml.W2XRegistration", "Class-Path" : "jasp.jar parser.jar") } @@ -98,7 +98,7 @@ task xhtml(type: Jar) { task xhtml2(type: Jar) { manifest { attributes("Implementation-Title": rootProject.name, - "Implementation-Version": releaseVersion, + "Implementation-Version": project.version, "RegistrationClassName" : "pro.litvinovg.w2phtml.RegistrationHandler", "Class-Path" : "jasp.jar parser.jar") } @@ -108,7 +108,7 @@ task xhtml2(type: Jar) { it.isDirectory() ? it : zipTree(it) } } - from sourceSets.main.output + from (sourceSets.main.output){ exclude '**/*Test.class' exclude '**/AllTests.class' exclude '**/*.java' @@ -130,16 +130,19 @@ task xhtml2(type: Jar) { include 'w2phtml/xhtml/**/*.class' include 'w2phtml/xhtml/**/*.xml' include 'w2phtml/xmerge/**/*.class' - from 'src/main/java' + } + from ('src/main/java'){ include 'w2phtml/xhtml/**/*.properties' include 'w2phtml/xhtml/**/**/*.properties' exclude 'w2phtml/project.properties' - from sourceSets.main.output + } + from (sourceSets.main.output){ include 'org/**/*' include 'net/**/*' include 'logback.xml' include 'ch/**/*' include '**/*.properties' + } from('src/main/tmp') { include 'w2phtml/project.properties' } @@ -163,16 +166,18 @@ task oxt(type: Zip){ task oxtNew(type: Zip){ dependsOn = [ 'xhtml2', 'setVersion' ] archiveName 'w2phtml-new.oxt' - from 'src/main/oxt2' - include '*' - include '**' - exclude '.gradle' - exclude 'description.xml' + from ('src/main/oxt2'){ + include '*' + include '**' + exclude '.gradle' + exclude 'description.xml' + } from('src/main/tmp') { include 'description.xml' } - from 'build/libs/writer2phtml.jar' - include '*' + from ('build/libs/writer2phtml.jar'){ + include '*' + } from 'idl/writer2paginatedhtml.rdb' from 'releasenotes.txt' include '*' @@ -181,6 +186,6 @@ task oxtNew(type: Zip){ task setVersion(){ ant.taskdef(name: 'xmltask', classpath: 'buildPlugins/xmltask.jar', classname: 'com.oopsconsultancy.xmltask.ant.XmlTask') ant.xmltask(source: 'src/main/oxt2/description.xml', dest: 'src/main/tmp/description.xml', report:'true') { - replace(path: "//*[local-name()='version']/@value", withText: "${releaseVersion}") + replace(path: "//*[local-name()='version']/@value", withText: "${project.version}") } } diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..7ec4447 --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +version=0.9.3 diff --git a/src/main/tmp/w2phtml/project.properties b/src/main/tmp/w2phtml/project.properties deleted file mode 100644 index 647a9ce..0000000 --- a/src/main/tmp/w2phtml/project.properties +++ /dev/null @@ -1,2 +0,0 @@ -releaseVersion=testing only -releaseDate=now