w2phtml/build.gradle

184 lines
6.4 KiB
Groovy

apply plugin: 'java'
apply plugin: 'eclipse'
repositories{
mavenCentral()
}
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', project.version )
mkdir "src/main/tmp/w2phtml"
propertyDestFile.withWriter { properties.store(it, null) }
sourceSets {
regressionTests {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output + files('src/main/java')
srcDir file('src/r_tests/java')
}
}
}
sourceCompatibility = 1.8
configurations{
regressionTestsCompile.extendsFrom mainCompile
regressionTestsRuntime.extendsFrom mainRuntime
regressionTestsRuntime.extendsFrom compileClasspath
regressionTestsImplementation.extendsFrom compileClasspath
}
dependencies{
regressionTestsImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.7.1'
regressionTestsImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.7.1'
regressionTestsImplementation 'org.junit.jupiter:junit-jupiter-engine'
compileClasspath 'org.libreoffice:jurt:5.3.2'
compileClasspath 'org.libreoffice:juh:5.3.2'
compileClasspath 'org.libreoffice:ridl:5.3.2'
compileClasspath 'org.libreoffice:unoil:5.3.2'
compileClasspath 'org.json:json:20190722'
compileClasspath group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
compileClasspath group: 'ch.qos.logback', name: 'logback-core', version: '1.2.3'
compileClasspath group: 'com.miglayout', name: 'miglayout-swing', version: '5.2'
compileClasspath group: 'org.apache.jena', name: 'jena-core', version: '3.15.0'
compileClasspath group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
compileClasspath group: 'com.opencsv', name: 'opencsv', version: '5.1'
compileClasspath group: 'org.imgscalr', name: 'imgscalr-lib', version: '4.2'
compileClasspath group: 'org.apache.commons', name: 'commons-imaging', version: '1.0-alpha2'
}
jar {
archiveName 'w2phtml.jar'
manifest {
attributes("Implementation-Title": rootProject.name,
"Implementation-Version": project.version,
"Main-Class" : "w2phtml.Application",
"Class-Path" : "jasp.jar parser.jar")
}
duplicatesStrategy = 'exclude'
from {
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
from('src/main/java') {
include '**/*.properties'
include '**/*.rdf'
include '**/*.xml'
include 'pro/litvinovg/w2phtml/gui/resources/*.png'
exclude '**/*Test.class'
exclude '**/AllTests.class'
exclude 'org/openoffice/**/*'
exclude 'w2phtml/project.properties'
}
from('src/main/tmp') {
include 'w2phtml/project.properties'
}
}
task xhtml(type: Jar) {
archiveName 'writer2phtml.jar'
manifest {
attributes("Implementation-Title": rootProject.name,
"Implementation-Version": project.version,
"RegistrationClassName" : "pro.litvinovg.w2phtml.RegistrationHandler",
"Class-Path" : "jasp.jar parser.jar")
}
duplicatesStrategy = 'exclude'
baseName = "writer2phtml"
from {
configurations.compileClasspath.collect {
exclude 'module-info.class'
exclude '.gradle'
exclude '**/LICENSE*'
exclude '**/DEPENDENCIES'
exclude '**/NOTICE*'
exclude '**/pom.xml'
exclude 'steps.txt'
exclude 'META-INF/services'
it.isDirectory() ? it : zipTree(it)
}
}
from (sourceSets.main.output){
exclude '**/*Test.class'
exclude '**/AllTests.class'
exclude '**/*.java'
include '**/*.classes'
include 'etc/*'
include 'com/**'
include 'com/**/*'
exclude '**/DEPENDENCIES'
include 'w2phtml/pageSplitters/**/*.class'
include 'pro/litvinovg/**/*.class'
include 'pro/litvinovg/**/*.png'
include 'w2phtml/api/**/*.class'
include 'w2phtml/*.class'
include 'w2phtml/*.properties'
include 'w2phtml/base/**/*.class'
include 'w2phtml/rdf/**/*.class'
include 'w2phtml/epub/**/*.class'
include 'w2phtml/office/**/*.class'
include 'w2phtml/util/**/*.class'
include 'w2phtml/xhtml/**/*.class'
include 'w2phtml/xhtml/**/*.xml'
include 'w2phtml/xmerge/**/*.class'
include 'org/**/*'
include 'net/**/*'
include 'logback.xml'
include 'ch/**/*'
include '**/*.properties'
exclude '.gradle'
}
from ('src/main/java'){
exclude '**/DEPENDENCIES'
exclude '.gradle'
include 'w2phtml/xhtml/**/*.properties'
include 'w2phtml/xhtml/**/**/*.properties'
include 'pro/litvinovg/**/*.classes'
include 'logback.xml'
include '**/*.png'
include 'pro/litvinovg/w2phtml/gui/localizations/*.properties'
exclude 'w2phtml/project.properties'
}
from('src/main/tmp') {
exclude '.gradle'
include 'w2phtml/project.properties'
}
}
task oxt(type: Zip){
dependsOn = [ 'xhtml', 'setVersion' ]
archiveName 'w2phtml.oxt'
from ('src/main/oxt'){
include '*'
include '**'
exclude '.gradle'
exclude 'description.xml'
}
from('src/main/tmp') {
include 'description.xml'
}
from ('build/libs/writer2phtml.jar'){
include '*'
}
from 'releasenotes.txt'
include '*'
}
task regressionTests(type: Test) {
testClassesDirs = sourceSets.regressionTests.output.classesDirs
classpath = sourceSets.regressionTests.runtimeClasspath
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
}
mustRunAfter jar
}
task setVersion(){
ant.taskdef(name: 'xmltask', classpath: 'buildPlugins/xmltask.jar', classname: 'com.oopsconsultancy.xmltask.ant.XmlTask')
ant.xmltask(source: 'src/main/oxt/description.xml', dest: 'src/main/tmp/description.xml', report:'true') {
replace(path: "//*[local-name()='version']/@value", withText: "${project.version}")
}
}