Skip to content

Commit

Permalink
Barcode and QRcode processing added (#19)
Browse files Browse the repository at this point in the history
* Code updated for barcode support

* barcode4j project added

* Makefile updated

Co-authored-by: Ronald Tse <[email protected]>
  • Loading branch information
Intelligent2013 and ronaldtse authored Apr 3, 2020
1 parent f7dc663 commit 1c7bc59
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 73 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ jobs:
- name: Build
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
PAT_USERNAME: ${{ secrets.PAT_USERNAME }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_USERNAME: ${{ github.actor }}
run: |
make all
- name: Run tests
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
PAT_USERNAME: ${{ secrets.PAT_USERNAME }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_USERNAME: ${{ github.actor }}
run: |
export MN_PDF_FONT_PATH=${GITHUB_WORKSPACE}/fonts
ls -alR ${MN_PDF_FONT_PATH}
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ jobs:
- uses: actions/checkout@master

- name: Build
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_USERNAME: ${{ github.actor }}
run: |
make all
- name: Run tests
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_USERNAME: ${{ github.actor }}
MN_PDF_FONT_PATH: ~/.fonts
run: |
make test
Expand All @@ -46,7 +51,7 @@ jobs:
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
Expand All @@ -64,7 +69,7 @@ jobs:
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/mn2pdf-${{ steps.get_version.outputs.VERSION }}.jar
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ jobs:
# If necessary
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
sudo apt-get install ttf-mscorefonts-installer
# sudo apt-get install ttf-mscorefonts-installer

- name: Setup Cambria fonts
run: |
curl -Ls https://raw.githubusercontent.com/metanorma/vista-fonts-installer/master/vista-fonts-installer.sh | sudo bash
# - name: Setup Cambria fonts
# run: |
# curl -Ls https://raw.githubusercontent.com/metanorma/vista-fonts-installer/master/vista-fonts-installer.sh | sudo bash

- name: Build
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
PAT_USERNAME: ${{ secrets.PAT_USERNAME }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_USERNAME: ${{ github.actor }}
run: |
make all
- name: Run tests
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
PAT_USERNAME: ${{ secrets.PAT_USERNAME }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_USERNAME: ${{ github.actor }}
MN_PDF_FONT_PATH: ~/.fonts
run: |
make test
21 changes: 12 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ JAR_FILE := mn2pdf-$(JAR_VERSION).jar

all: target/$(JAR_FILE)

target/$(JAR_FILE): settings.xml
mvn -DskipTests clean package shade:shade
target/$(JAR_FILE):
mvn --settings settings.xml -DskipTests clean package shade:shade

test: target/$(JAR_FILE)
mvn test surefire-report:report

settings.xml:
PAT_TOKEN=${PAT_TOKEN}; \
PAT_USERNAME=${PAT_USERNAME}; \
envsubst < settings.xml.in > ~/.m2/settings.xml
cat ~/.m2/settings.xml
mvn --settings settings.xml test surefire-report:report

# settings.xml: settings.xml.in
#settings:
# GITHUB_USERNAME=${GITHUB_USERNAME}
# GITHUB_TOKEN=${GITHUB_TOKEN}
# envsubst < settings.xml > ~/.m2/settings.xml
# cp settings.xml ~/.m2/settings.xml
# cat ~/.m2/settings.xml


clean:
mvn clean
Expand Down
10 changes: 5 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ You will need the `maven` build tool and `make`.

[source,sh]
----
java -jar target/mn2pdf-1.5.jar --xml-file <XML-FileName> --xsl-file <XSLT-FileName> --pdf-file <Output-PDF-FileName>
java -jar target/mn2pdf-1.6.jar --xml-file <XML-FileName> --xsl-file <XSLT-FileName> --pdf-file <Output-PDF-FileName>
----

e.g.

[source,sh]
----
java -jar target/mn2pdf-1.5.jar --xml-file tests/G.191.xml --xsl-file tests/itu.recommendation.xsl --pdf-file tests/G.191.pdf
java -jar target/mn2pdf-1.6.jar --xml-file tests/G.191.xml --xsl-file tests/itu.recommendation.xsl --pdf-file tests/G.191.pdf
----


Expand All @@ -41,7 +41,7 @@ Update version in `pom.xml`, e.g.:
----
<groupId>com.metanorma.fop</groupId>
<artifactId>mn2pdf</artifactId>
<version>1.5</version>
<version>1.6</version>
<name>Metanorma XML to PDF converter</name>
----

Expand All @@ -52,8 +52,8 @@ Tag the same version in Git:

[source,xml]
----
git tag v1.5
git push origin v1.5
git tag v1.6
git push origin v1.6
----

Then the corresponding GitHub release will be automatically created at:
Expand Down
24 changes: 16 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,21 @@
<exec.mainClass>com.metanorma.fop.mn2pdf</exec.mainClass>
<junit.version>5.4.2</junit.version>
</properties>
<repositories>
<repository>
<id>metanormarepository</id>
<name>Metanorma repository</name>
<url>https://maven.pkg.github.com/metanorma/barcode4j</url>
</repository>
</repositories>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>metanorma</id>
<name>GitHub Metanorma Apache Maven Packages</name>
<url>https://maven.pkg.github.com/metanorma/barcode4j</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -105,7 +113,7 @@
<dependency>
<groupId>net.sf.barcode4j</groupId>
<artifactId>barcode4j</artifactId>
<version>2.2-SNAPSHOT</version>
<version>2.3</version>
</dependency>
<dependency>
<groupId>net.sf.barcode4j</groupId>
Expand Down
33 changes: 33 additions & 0 deletions settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<activeProfiles>
<activeProfile>multiple-repos</activeProfile>
</activeProfiles>

<profiles>
<profile>
<id>multiple-repos</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>metanorma</id>
<name>GitHub Metanorma Apache Maven Packages</name>
<url>https://maven.pkg.github.com/metanorma/barcode4j</url>
</repository>
</repositories>
</profile>
</profiles>

<servers>
<server>
<id>metanorma</id>
<username>${env.GITHUB_USERNAME}</username>
<password>${env.GITHUB_TOKEN}</password>
</server>
</servers>
</settings>
37 changes: 0 additions & 37 deletions settings.xml.in

This file was deleted.

0 comments on commit 1c7bc59

Please sign in to comment.