chore: improving build configuration

This commit is contained in:
Georgy Litvinov 2021-12-08 13:52:09 +01:00
parent 56a44ea1fd
commit 7d03b2a02d

View file

@ -23,10 +23,9 @@ sourceSets {
} }
sourceCompatibility = 1.8 sourceCompatibility = 1.8
configurations{ configurations{
bundledLibs
regressionTestsCompile.extendsFrom mainCompile regressionTestsCompile.extendsFrom mainCompile
regressionTestsRuntime.extendsFrom mainRuntime regressionTestsRuntime.extendsFrom mainRuntime
regressionTestsRuntime.extendsFrom bundledLibs regressionTestsRuntime.extendsFrom compileClasspath
} }
dependencies{ dependencies{
regressionTestsImplementation group: 'commons-io', name: 'commons-io', version: '2.8.0' regressionTestsImplementation group: 'commons-io', name: 'commons-io', version: '2.8.0'
@ -34,22 +33,21 @@ dependencies{
regressionTestsImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.7.1' regressionTestsImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.7.1'
regressionTestsRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' regressionTestsRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
bundledLibs 'org.libreoffice:jurt:5.3.2' compileClasspath 'org.libreoffice:jurt:5.3.2'
bundledLibs 'org.libreoffice:juh:5.3.2' compileClasspath 'org.libreoffice:juh:5.3.2'
bundledLibs 'org.libreoffice:ridl:5.3.2' compileClasspath 'org.libreoffice:ridl:5.3.2'
bundledLibs 'org.libreoffice:unoil:5.3.2' compileClasspath 'org.libreoffice:unoil:5.3.2'
bundledLibs 'org.json:json:20190722' compileClasspath 'org.json:json:20190722'
bundledLibs group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3' compileClasspath group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
bundledLibs group: 'ch.qos.logback', name: 'logback-core', version: '1.2.3' compileClasspath group: 'ch.qos.logback', name: 'logback-core', version: '1.2.3'
bundledLibs group: 'com.miglayout', name: 'miglayout-swing', version: '5.2' compileClasspath group: 'com.miglayout', name: 'miglayout-swing', version: '5.2'
bundledLibs group: 'org.apache.jena', name: 'jena-core', version: '3.15.0' compileClasspath group: 'org.apache.jena', name: 'jena-core', version: '3.15.0'
bundledLibs group: 'org.apache.jena', name: 'jena-arq', version: '3.15.0' compileClasspath group: 'org.apache.jena', name: 'jena-arq', version: '3.15.0'
bundledLibs group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30' compileClasspath group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
bundledLibs group: 'com.opencsv', name: 'opencsv', version: '5.1' compileClasspath group: 'com.opencsv', name: 'opencsv', version: '5.1'
bundledLibs group: 'org.imgscalr', name: 'imgscalr-lib', version: '4.2' compileClasspath group: 'org.imgscalr', name: 'imgscalr-lib', version: '4.2'
bundledLibs group: 'org.apache.commons', name: 'commons-imaging', version: '1.0-alpha2' compileClasspath group: 'org.apache.commons', name: 'commons-imaging', version: '1.0-alpha2'
configurations.compile.extendsFrom(configurations.bundledLibs)
} }
jar { jar {
archiveName 'w2phtml.jar' archiveName 'w2phtml.jar'
@ -60,8 +58,9 @@ jar {
"Class-Path" : "jasp.jar parser.jar") "Class-Path" : "jasp.jar parser.jar")
} }
duplicatesStrategy = 'exclude'
from { from {
configurations.bundledLibs.collect { it.isDirectory() ? it : zipTree(it) } configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
} }
from('src/main/java') { from('src/main/java') {
include '**/*.properties' include '**/*.properties'
@ -85,9 +84,10 @@ task xhtml(type: Jar) {
"RegistrationClassName" : "pro.litvinovg.w2phtml.RegistrationHandler", "RegistrationClassName" : "pro.litvinovg.w2phtml.RegistrationHandler",
"Class-Path" : "jasp.jar parser.jar") "Class-Path" : "jasp.jar parser.jar")
} }
duplicatesStrategy = 'exclude'
baseName = "writer2phtml" baseName = "writer2phtml"
from { from {
configurations.bundledLibs.collect { configurations.compileClasspath.collect {
exclude 'module-info.class' exclude 'module-info.class'
exclude '.gradle' exclude '.gradle'
exclude '**/LICENSE*' exclude '**/LICENSE*'
@ -108,6 +108,7 @@ task xhtml(type: Jar) {
include 'etc/*' include 'etc/*'
include 'com/**' include 'com/**'
include 'com/**/*' include 'com/**/*'
exclude '**/DEPENDENCIES'
include 'w2phtml/pageSplitters/**/*.class' include 'w2phtml/pageSplitters/**/*.class'
include 'pro/litvinovg/**/*.class' include 'pro/litvinovg/**/*.class'
include 'pro/litvinovg/**/*.png' include 'pro/litvinovg/**/*.png'
@ -130,6 +131,7 @@ task xhtml(type: Jar) {
exclude '.gradle' exclude '.gradle'
} }
from ('src/main/java'){ from ('src/main/java'){
exclude '**/DEPENDENCIES'
exclude '.gradle' exclude '.gradle'
include 'w2phtml/xhtml/**/*.properties' include 'w2phtml/xhtml/**/*.properties'
include 'w2phtml/xhtml/**/**/*.properties' include 'w2phtml/xhtml/**/**/*.properties'
@ -164,6 +166,7 @@ task oxt(type: Zip){
from 'releasenotes.txt' from 'releasenotes.txt'
include '*' include '*'
} }
task regressionTests(type: Test) { task regressionTests(type: Test) {
testClassesDirs = sourceSets.regressionTests.output.classesDirs testClassesDirs = sourceSets.regressionTests.output.classesDirs
classpath = sourceSets.regressionTests.runtimeClasspath classpath = sourceSets.regressionTests.runtimeClasspath