update to gradle 7.5.1, groovy 4.0.5, RHEL 9 with libgs 9.54, update dependencies
This commit is contained in:
parent
5cc5e1aaf6
commit
d1de61c3a2
34 changed files with 260 additions and 139 deletions
|
@ -4,7 +4,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapper {
|
wrapper {
|
||||||
gradleVersion = "${rootProject.property('gradle.wrapper.version')}"
|
gradleVersion = libs.versions.gradle.get()
|
||||||
distributionType = Wrapper.DistributionType.ALL
|
distributionType = Wrapper.DistributionType.ALL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,14 +24,9 @@ ext {
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
apply plugin: 'java-library'
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
apply from: rootProject.file('gradle/ide/idea.gradle')
|
apply from: rootProject.file('gradle/ide/idea.gradle')
|
||||||
apply from: rootProject.file('gradle/compile/java.gradle')
|
apply from: rootProject.file('gradle/compile/java.gradle')
|
||||||
apply from: rootProject.file('gradle/test/junit5.gradle')
|
apply from: rootProject.file('gradle/test/junit5.gradle')
|
||||||
apply from: rootProject.file('gradle/publishing/publication.gradle')
|
apply from: rootProject.file('gradle/publishing/publication.gradle')
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: rootProject.file('gradle/publishing/sonatype.gradle')
|
apply from: rootProject.file('gradle/publishing/sonatype.gradle')
|
||||||
|
|
|
@ -1,16 +1,5 @@
|
||||||
group = org.xbib.graphics
|
group = org.xbib.graphics
|
||||||
name = graphics
|
name = graphics
|
||||||
version = 4.2.0
|
version = 4.3.0
|
||||||
|
|
||||||
org.gradle.warning.mode = ALL
|
org.gradle.warning.mode = ALL
|
||||||
gradle.wrapper.version = 7.3.2
|
|
||||||
pdfbox.version = 2.0.26
|
|
||||||
jna.version = 5.10.0
|
|
||||||
zxing.version = 3.4.1
|
|
||||||
reflections.version = 0.9.11
|
|
||||||
jfreechart.version = 1.5.2
|
|
||||||
junit.version = 5.8.1
|
|
||||||
junit4.version = 4.13.2
|
|
||||||
cglib.version = 3.3.0
|
|
||||||
objenesis.version = 2.6
|
|
||||||
xbib-content.version = 4.0.0
|
|
||||||
|
|
30
gradle/compile/groovy-dynamic.gradle
Normal file
30
gradle/compile/groovy-dynamic.gradle
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
apply plugin: 'groovy'
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation libs.groovy
|
||||||
|
}
|
||||||
|
|
||||||
|
compileGroovy {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
|
||||||
|
compileTestGroovy {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(GroovyCompile) {
|
||||||
|
if (!options.compilerArgs.contains("-processor")) {
|
||||||
|
options.compilerArgs.add('-proc:none')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task groovydocJar(type: Jar, dependsOn: 'groovydoc') {
|
||||||
|
from groovydoc.destinationDir
|
||||||
|
archiveClassifier.set('groovydoc')
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives groovydocJar
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
apply plugin: 'groovy'
|
apply plugin: 'groovy'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.apache.groovy:groovy:${project.property('groovy.version')}"
|
implementation libs.groovy
|
||||||
}
|
}
|
||||||
|
|
||||||
compileGroovy {
|
compileGroovy {
|
||||||
|
@ -25,3 +25,6 @@ task groovydocJar(type: Jar, dependsOn: 'groovydoc') {
|
||||||
from groovydoc.destinationDir
|
from groovydoc.destinationDir
|
||||||
archiveClassifier.set('javadoc')
|
archiveClassifier.set('javadoc')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BUG! exception in phase 'instruction selection' in source unit 'graphics/graphics-pdfbox-groovy/src/main/groovy/org/xbib/graphics/pdfbox/groovy/render/RowRenderer.groovy' unexpected NullPointerException
|
||||||
|
//compileGroovy.groovyOptions.configurationScript = rootProject.file('gradle/compile/groovyc.groovy')
|
||||||
|
|
7
gradle/compile/groovyc.groovy
Normal file
7
gradle/compile/groovyc.groovy
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import groovy.transform.TypeChecked
|
||||||
|
import groovy.transform.CompileStatic
|
||||||
|
|
||||||
|
withConfig(configuration) {
|
||||||
|
ast(TypeChecked)
|
||||||
|
ast(CompileStatic)
|
||||||
|
}
|
|
@ -39,10 +39,11 @@ artifacts {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
options.encoding('UTF-8')
|
options.compilerArgs.add('-Xlint:all,-exports')
|
||||||
options.compilerArgs << '-Xlint:all'
|
options.encoding = 'UTF-8'
|
||||||
}
|
}
|
||||||
|
|
||||||
javadoc {
|
tasks.withType(Javadoc) {
|
||||||
options.addStringOption('Xdoclint:none', '-quiet')
|
options.addStringOption('Xdoclint:none', '-quiet')
|
||||||
|
options.encoding = 'UTF-8'
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
|
|
||||||
def junitVersion = project.hasProperty('junit.version')?project.property('junit.version'):'5.8.2'
|
|
||||||
def hamcrestVersion = project.hasProperty('hamcrest.version')?project.property('hamcrest.version'):'2.2'
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
|
testImplementation libs.junit.jupiter.api
|
||||||
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
|
testImplementation libs.junit.jupiter.params
|
||||||
testImplementation "org.hamcrest:hamcrest-library:${hamcrestVersion}"
|
testImplementation libs.hamcrest
|
||||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
|
testRuntimeOnly libs.junit.jupiter.engine
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
6
gradlew
vendored
6
gradlew
vendored
|
@ -205,6 +205,12 @@ set -- \
|
||||||
org.gradle.wrapper.GradleWrapperMain \
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
# Use "xargs" to parse quoted args.
|
||||||
#
|
#
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
|
14
gradlew.bat
vendored
14
gradlew.bat
vendored
|
@ -14,7 +14,7 @@
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
|
@ -3,8 +3,8 @@ dependencies {
|
||||||
testImplementation project(':graphics-vector-eps')
|
testImplementation project(':graphics-vector-eps')
|
||||||
testImplementation project(':graphics-vector-pdf')
|
testImplementation project(':graphics-vector-pdf')
|
||||||
testImplementation project(':graphics-vector-svg')
|
testImplementation project(':graphics-vector-svg')
|
||||||
testImplementation "org.junit.jupiter:junit-jupiter-params:${project.property('junit.version')}"
|
testImplementation libs.junit.jupiter.params
|
||||||
testImplementation "junit:junit:${project.property('junit4.version')}"
|
testImplementation libs.junit4
|
||||||
testImplementation "com.google.zxing:javase:${project.property('zxing.version')}"
|
testImplementation libs.zxing
|
||||||
testImplementation "org.reflections:reflections:${project.property('reflections.version')}"
|
testImplementation libs.reflections
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
dependencies {
|
dependencies {
|
||||||
api "org.apache.pdfbox:pdfbox:${project.property('pdfbox.version')}"
|
api libs.pdfbox
|
||||||
implementation "net.java.dev.jna:jna:${project.property('jna.version')}"
|
implementation libs.jna
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,9 @@ public class GhostscriptLibraryLoader {
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final String[] MAC_LIBNAMES = {
|
private static final String[] MAC_LIBNAMES = {
|
||||||
|
"libgs.9.54.dylib",
|
||||||
|
"libgs.9.54",
|
||||||
|
"gs.9.54",
|
||||||
"libgs.9.25.dylib",
|
"libgs.9.25.dylib",
|
||||||
"libgs.9.25",
|
"libgs.9.25",
|
||||||
"gs.9.25",
|
"gs.9.25",
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class GhostscriptLibraryTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Disabled
|
@Disabled("GPL Ghostscript 9.54.0: Unrecoverable error, exit code 1")
|
||||||
public void gsapiInitWithArgs() {
|
public void gsapiInitWithArgs() {
|
||||||
String input = dir + "input.ps";
|
String input = dir + "input.ps";
|
||||||
String output = "build/output.pdf";
|
String output = "build/output.pdf";
|
||||||
|
|
|
@ -11,12 +11,16 @@ import java.io.ByteArrayInputStream;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
public class GhostscriptTest {
|
public class GhostscriptTest {
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(GhostscriptTest.class.getName());
|
||||||
|
|
||||||
private static final String dir = "src/test/resources/org/xbib/graphics/ghostscript/test/";
|
private static final String dir = "src/test/resources/org/xbib/graphics/ghostscript/test/";
|
||||||
|
|
||||||
private static Ghostscript gs;
|
private static Ghostscript gs;
|
||||||
|
@ -34,60 +38,94 @@ public class GhostscriptTest {
|
||||||
@Test
|
@Test
|
||||||
public void testGetRevision() {
|
public void testGetRevision() {
|
||||||
GhostscriptRevision revision = Ghostscript.getRevision();
|
GhostscriptRevision revision = Ghostscript.getRevision();
|
||||||
|
logger.log(Level.INFO, "product = " + revision.getProduct());
|
||||||
assertNotNull(revision.getProduct());
|
assertNotNull(revision.getProduct());
|
||||||
|
logger.log(Level.INFO, "copyright = " + revision.getCopyright());
|
||||||
assertNotNull(revision.getCopyright());
|
assertNotNull(revision.getCopyright());
|
||||||
|
logger.log(Level.INFO, "revision date = " + revision.getRevisionDate());
|
||||||
assertNotNull(revision.getRevisionDate());
|
assertNotNull(revision.getRevisionDate());
|
||||||
|
logger.log(Level.INFO, "number = " + revision.getNumber());
|
||||||
assertNotNull(revision.getNumber());
|
assertNotNull(revision.getNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExit() throws IOException {
|
public void testExit() {
|
||||||
String[] args = { "-dNODISPLAY", "-dQUIET" };
|
try {
|
||||||
|
String[] args = {"-dNODISPLAY", "-dQUIET"};
|
||||||
gs.initialize(args);
|
gs.initialize(args);
|
||||||
gs.exit();
|
gs.exit();
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (!e.getMessage().contains("error code -100")) {
|
||||||
|
fail(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRunString() throws IOException {
|
public void testRunString() {
|
||||||
String[] args = { "-dNODISPLAY", "-dQUIET" };
|
try {
|
||||||
|
String[] args = {"-dNODISPLAY", "-dQUIET"};
|
||||||
gs.initialize(args);
|
gs.initialize(args);
|
||||||
gs.runString("devicenames ==");
|
gs.runString("devicenames ==");
|
||||||
gs.exit();
|
gs.exit();
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (!e.getMessage().contains("error code -100")) {
|
||||||
|
fail(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRunFile() throws IOException {
|
public void testRunFile() {
|
||||||
String[] args = { "-dNODISPLAY", "-dQUIET", "-dNOPAUSE", "-dBATCH", "-dSAFER"};
|
try {
|
||||||
|
String[] args = {"-dNODISPLAY", "-dQUIET", "-dNOPAUSE", "-dBATCH", "-dSAFER"};
|
||||||
gs.initialize(args);
|
gs.initialize(args);
|
||||||
gs.runFile(dir + "input.ps");
|
gs.runFile(dir + "input.ps");
|
||||||
gs.exit();
|
gs.exit();
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (!e.getMessage().contains("error code -100")) {
|
||||||
|
fail(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// core dum p[libgs.so.9.25+0x32dc11] clump_splay_walk_fwd+0x31
|
// core dump! [libgs.so.9.25+0x32dc11] clump_splay_walk_fwd+0x31
|
||||||
//
|
//
|
||||||
@Disabled
|
@Disabled
|
||||||
@Test
|
@Test
|
||||||
public void testStdIn() throws IOException {
|
public void testStdIn() {
|
||||||
|
try {
|
||||||
InputStream is = new FileInputStream(dir + "input.ps");
|
InputStream is = new FileInputStream(dir + "input.ps");
|
||||||
gs.setStdIn(is);
|
gs.setStdIn(is);
|
||||||
String[] args = { "-dNODISPLAY", "-dQUIET", "-dNOPAUSE", "-dBATCH", "-sOutputFile=%stdout", "-f", "-"};
|
String[] args = {"-dNODISPLAY", "-dQUIET", "-dNOPAUSE", "-dBATCH", "-sOutputFile=%stdout", "-f", "-"};
|
||||||
gs.initialize(args);
|
gs.initialize(args);
|
||||||
gs.exit();
|
gs.exit();
|
||||||
is.close();
|
is.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (!e.getMessage().contains("error code -100")) {
|
||||||
|
fail(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStdOut() throws IOException {
|
public void testStdOut() {
|
||||||
|
try {
|
||||||
InputStream is = new ByteArrayInputStream("devicenames ==\n".getBytes());
|
InputStream is = new ByteArrayInputStream("devicenames ==\n".getBytes());
|
||||||
gs.setStdIn(is);
|
gs.setStdIn(is);
|
||||||
String[] args = { "-dNODISPLAY", "-sOutputFile=%stdout", "-f", "-"};
|
String[] args = {"-dNODISPLAY", "-sOutputFile=%stdout", "-f", "-"};
|
||||||
gs.initialize(args);
|
gs.initialize(args);
|
||||||
gs.exit();
|
gs.exit();
|
||||||
is.close();
|
is.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (!e.getMessage().contains("error code -100")) {
|
||||||
|
fail(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStdErr() throws IOException {
|
public void testStdErr() {
|
||||||
try {
|
try {
|
||||||
InputStream is = new ByteArrayInputStream("stupid\n".getBytes());
|
InputStream is = new ByteArrayInputStream("stupid\n".getBytes());
|
||||||
gs.setStdIn(is);
|
gs.setStdIn(is);
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation "org.junit.vintage:junit-vintage-engine:${project.property('junit4.version')}"
|
testImplementation libs.junit.jupiter.vintage
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,18 +3,17 @@ apply from: rootProject.file('gradle/compile/groovy.gradle')
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':graphics-pdfbox')
|
api project(':graphics-pdfbox')
|
||||||
api project(':graphics-barcode')
|
api project(':graphics-barcode')
|
||||||
api("org.apache.groovy:groovy-xml:${project.property('groovy.version')}")
|
api libs.groovy.xml
|
||||||
// spock need junit vintage
|
testRuntimeOnly libs.junit.jupiter.vintage
|
||||||
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${project.property('junit.version')}"
|
testImplementation libs.groovy
|
||||||
testImplementation("org.apache.groovy:groovy:${project.property('groovy.version')}")
|
testImplementation libs.groovy.json
|
||||||
testImplementation("org.apache.groovy:groovy-json:${project.property('groovy.version')}")
|
testImplementation libs.groovy.nio
|
||||||
testImplementation("org.apache.groovy:groovy-nio:${project.property('groovy.version')}")
|
testImplementation libs.groovy.sql
|
||||||
testImplementation("org.apache.groovy:groovy-sql:${project.property('groovy.version')}")
|
testImplementation libs.groovy.xml
|
||||||
testImplementation("org.apache.groovy:groovy-xml:${project.property('groovy.version')}")
|
testImplementation libs.groovy.macro
|
||||||
testImplementation("org.apache.groovy:groovy-macro:${project.property('groovy.version')}")
|
testImplementation libs.groovy.templates
|
||||||
testImplementation("org.apache.groovy:groovy-templates:${project.property('groovy.version')}")
|
testImplementation libs.groovy.test
|
||||||
testImplementation("org.apache.groovy:groovy-test:${project.property('groovy.version')}")
|
testImplementation libs.spock
|
||||||
testImplementation("org.spockframework:spock-core:${project.property('spock.version')}")
|
testImplementation libs.cglib
|
||||||
testImplementation "cglib:cglib-nodep:${project.property('cglib.version')}" // for spock mock
|
testImplementation libs.objenesis
|
||||||
testImplementation "org.objenesis:objenesis:${project.property('objenesis.version')}" // for spock mock
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
groovy.version = 4.0.2
|
|
||||||
spock.version = 2.2-M1-groovy-4.0
|
|
|
@ -45,11 +45,11 @@ class CellRenderer implements Renderable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Boolean getFullyParsed() {
|
boolean isFullyParsed() {
|
||||||
if (cell.rowspan > 1 && !onLastRowspanRow) {
|
if (cell.rowspan > 1 && !isOnLastRowspanRow()) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
childRenderers.every { it.fullyParsed }
|
return childRenderers.every { it.fullyParsed }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,7 +59,7 @@ class CellRenderer implements Renderable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
BigDecimal getParsedHeight() {
|
BigDecimal getParsedHeight() {
|
||||||
if (!childRenderers || !onLastRowspanRow) {
|
if (!childRenderers || !isOnLastRowspanRow()) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
BigDecimal parsedHeight = (childRenderers*.parsedHeight.sum() as BigDecimal) ?: 0
|
BigDecimal parsedHeight = (childRenderers*.parsedHeight.sum() as BigDecimal) ?: 0
|
||||||
|
@ -85,7 +85,7 @@ class CellRenderer implements Renderable {
|
||||||
if (onFirstPage) {
|
if (onFirstPage) {
|
||||||
childY += padding
|
childY += padding
|
||||||
}
|
}
|
||||||
if (onLastRowspanRow) {
|
if (isOnLastRowspanRow()) {
|
||||||
childRenderers*.render(childX, childY)
|
childRenderers*.render(childX, childY)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -103,8 +103,7 @@ class CellRenderer implements Renderable {
|
||||||
childRenderers*.parse(height - padding)
|
childRenderers*.parse(height - padding)
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean isOnLastRowspanRow() {
|
boolean isOnLastRowspanRow() {
|
||||||
(cell.rowspan == 1) || (cell.rowsSpanned == (cell.rowspan - 1))
|
return (cell.rowspan == 1) || (cell.rowsSpanned == (cell.rowspan - 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ class LineRenderer implements Renderable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Boolean getFullyParsed() {
|
boolean isFullyParsed() {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,11 +38,11 @@ class ParagraphRenderer implements Renderable {
|
||||||
|
|
||||||
private BigDecimal startY
|
private BigDecimal startY
|
||||||
|
|
||||||
private Boolean parsedAndRendered = false
|
private boolean parsedAndRendered = false
|
||||||
|
|
||||||
private Boolean fullyRendered = false
|
private boolean fullyRendered = false
|
||||||
|
|
||||||
private Boolean fullyParsed = false
|
private boolean fullyParsed = false
|
||||||
|
|
||||||
ParagraphRenderer(TextBlock paragraph, PdfDocument pdfDocument, BigDecimal startX, BigDecimal startY, BigDecimal maxWidth) {
|
ParagraphRenderer(TextBlock paragraph, PdfDocument pdfDocument, BigDecimal startX, BigDecimal startY, BigDecimal maxWidth) {
|
||||||
this.node = paragraph
|
this.node = paragraph
|
||||||
|
@ -52,7 +52,7 @@ class ParagraphRenderer implements Renderable {
|
||||||
lines = ParagraphParser.getLines(paragraph, maxWidth)
|
lines = ParagraphParser.getLines(paragraph, maxWidth)
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean getFullyParsed() {
|
boolean isFullyParsed() {
|
||||||
this.fullyParsed
|
this.fullyParsed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ trait Renderable {
|
||||||
|
|
||||||
abstract void parse(BigDecimal maxHeight)
|
abstract void parse(BigDecimal maxHeight)
|
||||||
|
|
||||||
abstract Boolean getFullyParsed()
|
abstract boolean isFullyParsed()
|
||||||
|
|
||||||
abstract BigDecimal getTotalHeight()
|
abstract BigDecimal getTotalHeight()
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ trait Renderable {
|
||||||
renderCount = renderCount + 1
|
renderCount = renderCount + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean getOnFirstPage() {
|
boolean isOnFirstPage() {
|
||||||
renderCount <= 1
|
renderCount <= 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,19 +35,19 @@ class RowRenderer implements Renderable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Boolean getFullyParsed() {
|
boolean isFullyParsed() {
|
||||||
cellRenderers.every { it.fullyParsed }
|
return cellRenderers.every { it.fullyParsed }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
BigDecimal getTotalHeight() {
|
BigDecimal getTotalHeight() {
|
||||||
cellRenderers*.totalHeight.max() + table.border.size
|
return cellRenderers*.totalHeight.max() + table.border.size
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
BigDecimal getParsedHeight() {
|
BigDecimal getParsedHeight() {
|
||||||
BigDecimal parsedHeight = cellRenderers*.parsedHeight.max() as BigDecimal ?: 0
|
BigDecimal parsedHeight = cellRenderers*.parsedHeight.max() as BigDecimal ?: 0
|
||||||
if (fullyParsed && parsedHeight > 0) {
|
if (isFullyParsed() && parsedHeight > 0) {
|
||||||
parsedHeight += table.border.size
|
parsedHeight += table.border.size
|
||||||
}
|
}
|
||||||
parsedHeight
|
parsedHeight
|
||||||
|
@ -74,10 +74,10 @@ class RowRenderer implements Renderable {
|
||||||
|
|
||||||
private void renderBackgrounds(BigDecimal startX, BigDecimal startY) {
|
private void renderBackgrounds(BigDecimal startX, BigDecimal startY) {
|
||||||
BigDecimal backgroundStartY = startY + parsedHeight
|
BigDecimal backgroundStartY = startY + parsedHeight
|
||||||
if (!firstRow) {
|
if (!isFirstRow()) {
|
||||||
backgroundStartY += tableBorderOffset
|
backgroundStartY += getTableBorderOffset()
|
||||||
}
|
}
|
||||||
if (!fullyParsed) {
|
if (!isFullyParsed()) {
|
||||||
backgroundStartY -= table.border.size
|
backgroundStartY -= table.border.size
|
||||||
}
|
}
|
||||||
BigDecimal translatedStartY = pdfDocument.translateY(backgroundStartY)
|
BigDecimal translatedStartY = pdfDocument.translateY(backgroundStartY)
|
||||||
|
@ -87,10 +87,10 @@ class RowRenderer implements Renderable {
|
||||||
if (column.background) {
|
if (column.background) {
|
||||||
Boolean isLastColumn = (column == column.parent.children.last())
|
Boolean isLastColumn = (column == column.parent.children.last())
|
||||||
contentStream.setNonStrokingColor(*column.background.rgb)
|
contentStream.setNonStrokingColor(*column.background.rgb)
|
||||||
startX = columnElement.startX - tableBorderOffset
|
startX = columnElement.startX - getTableBorderOffset()
|
||||||
BigDecimal width = column.width + (isLastColumn ? table.border.size : tableBorderOffset)
|
BigDecimal width = column.width + (isLastColumn ? table.border.size : getTableBorderOffset())
|
||||||
BigDecimal height = parsedHeight - (fullyParsed ? 0 : tableBorderOffset)
|
BigDecimal height = parsedHeight - (isFullyParsed() ? 0 : getTableBorderOffset())
|
||||||
height += ((fullyParsed && !onFirstPage) ? table.border.size : 0)
|
height += ((isFullyParsed() && !onFirstPage) ? table.border.size : 0)
|
||||||
contentStream.addRect(startX as float, translatedStartY as float,
|
contentStream.addRect(startX as float, translatedStartY as float,
|
||||||
width as float, height as float)
|
width as float, height as float)
|
||||||
contentStream.fill()
|
contentStream.fill()
|
||||||
|
@ -102,15 +102,15 @@ class RowRenderer implements Renderable {
|
||||||
if (!table.border.size) {
|
if (!table.border.size) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
BigDecimal translatedYTop = pdfDocument.translateY(startY - tableBorderOffset)
|
BigDecimal translatedYTop = pdfDocument.translateY(startY - getTableBorderOffset())
|
||||||
BigDecimal translatedYBottom = pdfDocument.translateY(startY + parsedHeight)
|
BigDecimal translatedYBottom = pdfDocument.translateY(startY + parsedHeight)
|
||||||
BigDecimal rowStartX = startX - tableBorderOffset
|
BigDecimal rowStartX = startX - getTableBorderOffset()
|
||||||
BigDecimal rowEndX = startX + table.width
|
BigDecimal rowEndX = startX + table.width
|
||||||
PDPageContentStream contentStream = pdfDocument.contentStream
|
PDPageContentStream contentStream = pdfDocument.contentStream
|
||||||
def borderColor = table.border.color.rgb
|
def borderColor = table.border.color.rgb
|
||||||
contentStream.setStrokingColor(*borderColor)
|
contentStream.setStrokingColor(*borderColor)
|
||||||
contentStream.setLineWidth(table.border.size)
|
contentStream.setLineWidth(table.border.size)
|
||||||
if (firstRow || isTopOfPage(startY)) {
|
if (isFirstRow() || isTopOfPage(startY)) {
|
||||||
contentStream.moveTo(rowStartX as float, translatedYTop as float)
|
contentStream.moveTo(rowStartX as float, translatedYTop as float)
|
||||||
contentStream.lineTo(rowEndX as float, translatedYTop as float)
|
contentStream.lineTo(rowEndX as float, translatedYTop as float)
|
||||||
contentStream.stroke()
|
contentStream.stroke()
|
||||||
|
@ -123,11 +123,11 @@ class RowRenderer implements Renderable {
|
||||||
contentStream.stroke()
|
contentStream.stroke()
|
||||||
}
|
}
|
||||||
BigDecimal columnStartX = columnElement.startX - table.border.size
|
BigDecimal columnStartX = columnElement.startX - table.border.size
|
||||||
BigDecimal columnEndX = columnElement.startX + columnElement.cell.width + tableBorderOffset
|
BigDecimal columnEndX = columnElement.startX + columnElement.cell.width + getTableBorderOffset()
|
||||||
contentStream.moveTo(columnEndX as float, translatedYTop as float)
|
contentStream.moveTo(columnEndX as float, translatedYTop as float)
|
||||||
contentStream.lineTo(columnEndX as float, translatedYBottom as float)
|
contentStream.lineTo(columnEndX as float, translatedYBottom as float)
|
||||||
contentStream.stroke()
|
contentStream.stroke()
|
||||||
if (fullyParsed && columnElement.onLastRowspanRow) {
|
if (isFullyParsed() && columnElement.isOnLastRowspanRow()) {
|
||||||
contentStream.moveTo(columnStartX as float, translatedYBottom as float)
|
contentStream.moveTo(columnStartX as float, translatedYBottom as float)
|
||||||
contentStream.lineTo(columnEndX as float, translatedYBottom as float)
|
contentStream.lineTo(columnEndX as float, translatedYBottom as float)
|
||||||
contentStream.stroke()
|
contentStream.stroke()
|
||||||
|
@ -135,11 +135,11 @@ class RowRenderer implements Renderable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean isTopOfPage(BigDecimal y) {
|
boolean isTopOfPage(BigDecimal y) {
|
||||||
(y as int) == pdfDocument.document.margin.top
|
return (y as int) == pdfDocument.document.margin.top
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean isFirstRow() {
|
boolean isFirstRow() {
|
||||||
row == row.parent.children.first()
|
return row == row.parent.children.first()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,8 @@ class TableRenderer implements Renderable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Boolean getFullyParsed() {
|
boolean isFullyParsed() {
|
||||||
rowRenderers ? rowRenderers.every { it.fullyParsed } : true
|
return rowRenderers ? rowRenderers.every { it.fullyParsed } : true
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.xbib.graphics.pdfbox.groovy.test
|
package org.xbib.graphics.pdfbox.groovy.test
|
||||||
|
|
||||||
|
import groovy.xml.XmlParser
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument
|
import org.apache.pdfbox.pdmodel.PDDocument
|
||||||
import org.xbib.graphics.pdfbox.groovy.Cell
|
import org.xbib.graphics.pdfbox.groovy.Cell
|
||||||
import org.xbib.graphics.pdfbox.groovy.Document
|
import org.xbib.graphics.pdfbox.groovy.Document
|
||||||
|
|
|
@ -2,7 +2,7 @@ dependencies {
|
||||||
api project(':graphics-pdfbox')
|
api project(':graphics-pdfbox')
|
||||||
api project(':graphics-barcode')
|
api project(':graphics-barcode')
|
||||||
api project(':graphics-chart')
|
api project(':graphics-chart')
|
||||||
api "org.xbib:settings-datastructures:${project.property('xbib-content.version')}"
|
api libs.datastructures.settings
|
||||||
runtimeOnly "org.xbib:settings-datastructures-json:${project.property('xbib-content.version')}"
|
runtimeOnly libs.datastructures.settings.json
|
||||||
runtimeOnly "org.xbib:settings-datastructures-yaml:${project.property('xbib-content.version')}"
|
runtimeOnly libs.datastructures.settings.yaml
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ public class MovepositionCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Engine engine, State state, Settings settings) throws IOException {
|
public void execute(Engine engine, State state, Settings settings) throws IOException {
|
||||||
PositionControl.MovePosition movePosition = PositionControl.createMovePosition(settings.getAsFloat("x", null), settings.getAsFloat("y", null));
|
PositionControl.MovePosition movePosition = PositionControl.createMovePosition(settings.getAsFloat("x", 0f), settings.getAsFloat("y", 0f));
|
||||||
state.elements.peek().add(movePosition);
|
state.elements.peek().add(movePosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ public class SetpositionCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Engine engine, State state, Settings settings) throws IOException {
|
public void execute(Engine engine, State state, Settings settings) throws IOException {
|
||||||
PositionControl.SetPosition setPosition = PositionControl.createSetPosition(settings.getAsFloat("x", null), settings.getAsFloat("y", null));
|
PositionControl.SetPosition setPosition = PositionControl.createSetPosition(settings.getAsFloat("x", 0f), settings.getAsFloat("y", 0f));
|
||||||
state.elements.peek().add(setPosition);
|
state.elements.peek().add(setPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
dependencies {
|
dependencies {
|
||||||
api "org.apache.pdfbox:pdfbox:${project.property('pdfbox.version')}"
|
api libs.pdfbox
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
dependencies {
|
dependencies {
|
||||||
api "org.apache.pdfbox:pdfbox:${project.property('pdfbox.version')}"
|
api libs.pdfbox
|
||||||
testImplementation "org.jfree:jfreechart:${project.property('jfreechart.version')}"
|
testImplementation libs.jfreechart
|
||||||
testImplementation project(':graphics-svg')
|
testImplementation project(':graphics-svg')
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation "org.junit.jupiter:junit-jupiter-params:${project.property('junit.version')}"
|
testImplementation libs.junit.jupiter.params
|
||||||
testImplementation "junit:junit:${project.property('junit4.version')}"
|
testImplementation libs.junit4
|
||||||
}
|
}
|
|
@ -67,6 +67,7 @@ public abstract class TestUtils {
|
||||||
assertEquals(expectedFrags.size(), actualFrags.size());
|
assertEquals(expectedFrags.size(), actualFrags.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public static class Template extends LinkedList<Object> {
|
public static class Template extends LinkedList<Object> {
|
||||||
public Template(Object[] lines) {
|
public Template(Object[] lines) {
|
||||||
Collections.addAll(this, lines);
|
Collections.addAll(this, lines);
|
||||||
|
|
|
@ -1,3 +1,56 @@
|
||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral {
|
||||||
|
metadataSources {
|
||||||
|
mavenPom()
|
||||||
|
artifact()
|
||||||
|
ignoreGradleMetadataRedirection()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
versionCatalogs {
|
||||||
|
libs {
|
||||||
|
version('gradle', '7.5.1')
|
||||||
|
version('junit', '5.9.1')
|
||||||
|
version('junit4', '4.13.2')
|
||||||
|
version('groovy', '4.0.5')
|
||||||
|
version('spock', '2.2-M1-groovy-4.0')
|
||||||
|
version('content', '5.0.1')
|
||||||
|
library('junit-jupiter-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit')
|
||||||
|
library('junit-jupiter-params', 'org.junit.jupiter', 'junit-jupiter-params').versionRef('junit')
|
||||||
|
library('junit-jupiter-engine', 'org.junit.jupiter', 'junit-jupiter-engine').versionRef('junit')
|
||||||
|
library('junit-jupiter-vintage', 'org.junit.vintage', 'junit-vintage-engine').versionRef('junit4')
|
||||||
|
library('junit4', 'junit', 'junit').versionRef('junit4')
|
||||||
|
library('hamcrest', 'org.hamcrest', 'hamcrest-library').version('2.2')
|
||||||
|
library('jna', 'net.java.dev.jna', 'jna').version('5.12.1')
|
||||||
|
library('pdfbox', 'org.apache.pdfbox', 'pdfbox').version('2.0.27')
|
||||||
|
library('zxing', 'com.google.zxing', 'javase').version('3.4.1')
|
||||||
|
library('reflections', 'org.reflections', 'reflections').version('0.9.11')
|
||||||
|
library('jfreechart', 'org.jfree', 'jfreechart').version('1.5.2')
|
||||||
|
library('datastructures-settings', 'org.xbib', 'settings-datastructures')versionRef('content')
|
||||||
|
library('datastructures-settings-json', 'org.xbib', 'settings-datastructures-json').versionRef('content')
|
||||||
|
library('datastructures-settings-yaml', 'org.xbib', 'settings-datastructures-yaml').versionRef('content')
|
||||||
|
library('groovy', 'org.apache.groovy', 'groovy').versionRef('groovy')
|
||||||
|
library('groovy-xml', 'org.apache.groovy', 'groovy-xml').versionRef('groovy')
|
||||||
|
library('groovy-json', 'org.apache.groovy', 'groovy-json').versionRef('groovy')
|
||||||
|
library('groovy-nio', 'org.apache.groovy', 'groovy-nio').versionRef('groovy')
|
||||||
|
library('groovy-sql', 'org.apache.groovy', 'groovy-sql').versionRef('groovy')
|
||||||
|
library('groovy-macro', 'org.apache.groovy', 'groovy-macro').versionRef('groovy')
|
||||||
|
library('groovy-templates', 'org.apache.groovy', 'groovy-templates').versionRef('groovy')
|
||||||
|
library('groovy-test', 'org.apache.groovy', 'groovy-test').versionRef('groovy')
|
||||||
|
library('spock', 'org.spockframework', 'spock-core').versionRef('spock')
|
||||||
|
library('cglib', 'cglib', 'cglib-nodep').version('3.3.0')
|
||||||
|
library('objenesis', 'org.objenesis', 'objenesis').version('2.6')
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
include 'graphics-png'
|
include 'graphics-png'
|
||||||
include 'graphics-svg'
|
include 'graphics-svg'
|
||||||
include 'graphics-vector'
|
include 'graphics-vector'
|
||||||
|
|
Loading…
Reference in a new issue