Skip to content

Commit

Permalink
Refactoring build configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
klakegg committed Oct 27, 2019
1 parent c4ab0e4 commit db6cbf6
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 82 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
steps:
- uses: actions/checkout@v1

- name: Build jar
run: make jar

- name: Build image
run: make graal

- name: Build dist
run: make dist
25 changes: 15 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,26 @@ jobs:
steps:
- uses: actions/checkout@v1

- name: Build dist
run: make dist
- name: Build jar
run: make jar

- uses: klakegg/github-upload@v0.8.3
- name: Build image
run: make graal

- uses: klakegg/github-upload@v0.9.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: target/dist.zip
name: xsdchecker-${TAG}.zip
label: Distribution (zip)
file: target/xsdchecker.jar
name: xsdchecker-${TAG}.jar
label: JAR file
type: application/java-archive

- uses: klakegg/github-upload@v0.8.3
- uses: klakegg/github-upload@v0.9.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: target/dist.tar.gz
name: xsdchecker-${TAG}.tar.gz
label: Distribution (tar.gz)
file: target/xsdchecker
name: xsdchecker-${TAG}-linux-64bit
label: Executable (Linux 64bit)
type: application/x-executable
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/dist/Main.java
target
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM klakegg/graalvm-native AS graalvm

COPY graal /src
COPY graal /src/graal
COPY java /src/java

RUN sh /src/build.sh
RUN cd /src/graal && sh build.sh


FROM alpine:3.10
Expand Down
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
.PHONY: dist graal
.PHONY: jar graal

graal:
@docker build -t klakegg/xsdchecker:snapshot .
@docker run --rm -i \
-v $(shell pwd)/target:/target \
--entrypoint cp \
klakegg/xsdchecker:snapshot \
/bin/xsdchecker /target/xsdchecker

dist:
jar:
@docker run --rm -i \
-v $(shell pwd)/dist:/src \
-v $(shell pwd)/graal/Main.java:/src/Main.java \
-v $(shell pwd)/java:/src/java \
-v $(shell pwd)/target:/target \
--workdir /src \
--workdir /src/java \
openjdk:8u212-jdk-alpine3.9 \
sh build.sh
33 changes: 0 additions & 33 deletions dist/build.sh

This file was deleted.

5 changes: 0 additions & 5 deletions dist/root/bin/xsdchecker.bat

This file was deleted.

8 changes: 0 additions & 8 deletions dist/root/bin/xsdchecker.sh

This file was deleted.

18 changes: 3 additions & 15 deletions graal/build.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
#!/bin/sh

# Create build folder
mkdir -p /target/build

# Compile class
javac \
-d /target/build \
/src/Main.java

# Generate jar
jar \
-cfe /target/build/main.jar Main \
-C /target/build \
Main.class
test -e /target/xsdchecker.jar || sh /src/java/build.sh

# Create native image
native-image \
--static \
--no-fallback \
--allow-incomplete-classpath \
-jar /target/build/main.jar \
-jar /target/xsdchecker.jar \
-H:Name=/target/bin/xsdchecker \
-H:+ReportExceptionStackTraces \
-H:ReflectionConfigurationFiles=/src/java-xerces.json \
-H:ReflectionConfigurationFiles=/src/graal/java-xerces.json \
-H:IncludeResourceBundles=com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages
15 changes: 15 additions & 0 deletions java/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

# Create build folder
mkdir -p /tmp/build /target

# Compile class
javac \
-d /tmp/build \
/src/java/src/Main.java

# Generate jar
jar \
-cfe /target/xsdchecker.jar Main \
-C /tmp/build \
Main.class
File renamed without changes.

0 comments on commit db6cbf6

Please sign in to comment.