Skip to content

Commit

Permalink
Bump asciidoctor-pdf gem to v1.6.1
Browse files Browse the repository at this point in the history
* Remove some code warnings
* Remove unused build properties
* Bump AsciidoctorJ to v2.5.2 for upstream tests
* Add Java 11 and 17 to upstream tests
  • Loading branch information
abelsromero committed Dec 23, 2021
1 parent 90e81f4 commit 7b11dfb
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 23 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/upstream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@ on:
jobs:
build:
name: Build
strategy:
max-parallel: 2
matrix:
java:
- '8'
- '11'
- '17'
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '8'
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Upstream Build
run: |
./test-asciidoctor-upstream.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.util.List;
import java.util.Map;

import static org.asciidoctor.OptionsBuilder.options;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;

Expand All @@ -33,7 +32,7 @@ public void pdf_should_include_images() throws IOException {
File outputFile1 = new File(inputFile.getParentFile(), filename + ".pdf");
removeFileIfItExists(outputFile1);

asciidoctor.convertFile(inputFile, options().backend("pdf").safe(SafeMode.UNSAFE).get());
asciidoctor.convertFile(inputFile, Options.builder().backend("pdf").safe(SafeMode.UNSAFE).build());

assertThat(outputFile1.exists(), is(true));
ImageProcessor imageProcessor = new ImageProcessor();
Expand All @@ -49,7 +48,7 @@ public void pdf_source_code_should_be_highlighted() throws IOException {
File outputFile1 = new File(inputFile.getParentFile(), filename + ".pdf");
removeFileIfItExists(outputFile1);

asciidoctor.convertFile(inputFile, options().backend("pdf").safe(SafeMode.UNSAFE).get());
asciidoctor.convertFile(inputFile, Options.builder().backend("pdf").safe(SafeMode.UNSAFE).build());

assertThat(outputFile1.exists(), is(true));

Expand All @@ -72,7 +71,7 @@ public void pdf_text_should_be_hyphenated_german() throws IOException {
File outputFile1 = new File(inputFile.getParentFile(), filename + ".pdf");
removeFileIfItExists(outputFile1);

asciidoctor.convertFile(inputFile, options().backend("pdf").safe(SafeMode.UNSAFE).get());
asciidoctor.convertFile(inputFile, Options.builder().backend("pdf").safe(SafeMode.UNSAFE).build());

assertThat(outputFile1.exists(), is(true));

Expand All @@ -89,7 +88,7 @@ public void pdf_text_should_be_hyphenated_english() throws IOException {
File outputFile1 = new File(inputFile.getParentFile(), filename + ".pdf");
removeFileIfItExists(outputFile1);

asciidoctor.convertFile(inputFile, options().backend("pdf").safe(SafeMode.UNSAFE).get());
asciidoctor.convertFile(inputFile, Options.builder().backend("pdf").safe(SafeMode.UNSAFE).build());

assertThat(outputFile1.exists(), is(true));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class ImageProcessor extends PDFStreamEngine {
private static final String INVOKE_OPERATOR = "Do";

private int currentPage = 0;
private List<Image> images = new ArrayList<Image>();
private List<Image> images = new ArrayList<>();

/**
* Default constructor
Expand Down Expand Up @@ -79,7 +79,7 @@ protected void processOperator( PDFOperator operator, List arguments ) throws IO
if (INVOKE_OPERATOR.equals(operation)) {
COSName objectName = (COSName)arguments.get( 0 );
Map<String, PDXObject> xobjects = getResources().getXObjects();
PDXObject xobject = (PDXObject)xobjects.get( objectName.getName() );
PDXObject xobject = xobjects.get( objectName.getName() );

if (xobject instanceof PDXObjectImage) {
PDXObjectImage image = (PDXObjectImage)xobject;
Expand Down Expand Up @@ -133,7 +133,7 @@ protected void processOperator( PDFOperator operator, List arguments ) throws IO
processSubStream( page, pdResources, invoke );

// restore the graphics state
setGraphicsState( (PDGraphicsState)getGraphicsStack().pop() );
setGraphicsState( getGraphicsStack().pop() );
}
} else {
super.processOperator( operator, arguments );
Expand Down
14 changes: 2 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,16 @@ ext {
// jar versions
arquillianVersion = '1.1.10.Final'
arquillianSpockVersion = '1.0.0.Beta3'
commonsioVersion = '2.4'
guavaVersion = '18.0'
jrubyVersion = '9.2.17.0'
saxonVersion = '9.5.1-6'
xmlMatchersVersion = '1.0-RC1'
pdfboxVersion = '1.8.16'
junitVersion = '4.13.2'
hamcrestVersion = '2.2'

// gem versions
asciidoctorJVersion = project.hasProperty('asciidoctorJVersion') ? project.asciidoctorJVersion : '2.5.2'
asciidoctorPdfGemVersion = project.hasProperty('asciidoctorPdfGemVersion') ? project.asciidoctorPdfGemVersion : project(':asciidoctorj-pdf').version.replace('-', '.')
asciidoctorPdfGemVersion = project.hasProperty('asciidoctorPdfGemVersion') ? project.asciidoctorPdfGemVersion : '1.6.1'

groovyVersion = '2.1.8'

addressableVersion = '2.7.0'
addressableVersion = '2.8.0'
concurrentRubyVersion = '1.1.7'
public_suffixVersion = '1.4.6'
prawnGemVersion=project.hasProperty('prawnGemVersion') ? project.prawnGemVersion : '2.4.0'
Expand Down Expand Up @@ -100,10 +94,6 @@ subprojects {
dependencies {
testImplementation "junit:junit:$junitVersion"
testImplementation "org.hamcrest:hamcrest-library:$hamcrestVersion"
testImplementation("org.spockframework:spock-core:$spockVersion") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
testImplementation "org.codehaus.groovy:groovy-all:$groovyVersion"
testImplementation "org.jboss.arquillian.junit:arquillian-junit-container:$arquillianVersion"
testImplementation "org.jboss.arquillian.spock:arquillian-spock-container:$arquillianSpockVersion"
}
Expand Down
2 changes: 1 addition & 1 deletion test-asciidoctor-upstream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ cd ../..
#rm -rf build/maven-pdf
cd ..

$GRADLE_CMD -S -Pskip.signing -PasciidoctorJVersion=${ASCIIDOCTORJ_VERSION:-2.4.3} \
$GRADLE_CMD -S -Pskip.signing -PasciidoctorJVersion=${ASCIIDOCTORJ_VERSION:-2.5.2} \
-PasciidoctorPdfGemVersion=${ASCIIDOCTOR_PDF_VERSION}-SNAPSHOT \
-PprawnGemVersion=${PRAWN_VERSION:-2.4.0} \
-PuseMavenLocal=true \
Expand Down

0 comments on commit 7b11dfb

Please sign in to comment.