Skip to content

Commit

Permalink
Updating distribution.
Browse files Browse the repository at this point in the history
  • Loading branch information
klakegg committed Feb 8, 2020
1 parent e32c5af commit 08196e9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ dist:
@docker run --rm -i \
-v $(shell pwd):/src \
-v $(shell pwd)/target:/target \
-e GITHUB_SHA \
-e GITHUB_REF \
--workdir /src/dist \
alpine:3.11 \
sh build.sh
Expand Down
2 changes: 2 additions & 0 deletions dist/bin/xsdchecker
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

PROJECT=$(dirname $(dirname "$0"))

export XSD_PATH=${PROJECT}/xsd

if [ $JAVA_HOME ]; then
$JAVA_HOME/bin/java -jar $PROJECT/lib/xsdchecker.jar $@
else
Expand Down
8 changes: 7 additions & 1 deletion dist/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

apk --no-cache add zip gettext

test ! -e /target/dist || rm -rf /target/dist

mkdir -p /target/dist/lib
Expand All @@ -12,9 +14,13 @@ cp -r ../schemas /target/dist/xsd

cp ../LICENSE /target/dist/

export GITHUB_SHA=${GITHUB_SHA:-snapshot}
export GITHUB_REF=${GITHUB_REF:-local}
cat readme.tpl.md | envsubst > /target/dist/README.md
cat /target/dist/README.md

cd /target/dist

tar -czf ../dist.tar.gz *

apk --no-cache add zip
zip -q ../dist.zip *
8 changes: 8 additions & 0 deletions dist/readme.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# XsdChecker

Homepage: https://github.com/klakegg/xsdchecker

Build information:
* Commit: ${GITHUB_SHA}
* Branch/tag: ${GITHUB_REF}

4 changes: 3 additions & 1 deletion java/src/main/java/net/klakegg/xsdchecker/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ private static Validator prepare(String path) {

if (path.startsWith("http")) {
schema = factory.newSchema(new URL(path));
} else if (path.startsWith("--") && System.getenv("XSD_PATH") != null) {
File file = new File(System.getenv("XSD_PATH") + "/", path.substring(2) + ".xsd");
schema = factory.newSchema(file);
} else {
schema = factory.newSchema(new File(path));
}
Expand Down Expand Up @@ -78,7 +81,6 @@ private static boolean performGlob(Validator validator, String path) {
return result;
}


private static boolean perform(Validator validator, File path) {
try {
validator.validate(new StreamSource(path));
Expand Down

0 comments on commit 08196e9

Please sign in to comment.