-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (65 loc) · 3.04 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
rebuild-test: | rebuild test
rebuild: docker-compose.yaml
docker-compose build --pull --no-cache
test: | jenkins_up real-test jenkins_down
jenkins_up: docker-compose.yaml
docker-compose up -d jenkins
docker-compose run -T jenkins $(CHECK_JENKINS) $(RETRY) $(JENKINS)
$(RUN_NATIVE_IMAGE) $(CHECK_JENKINS) $(JENKINS)
docker-compose ps
CHECK_JENKINS = curl --fail --silent --show-error --location -o /dev/null
RETRY = --retry-connrefused --retry 3 --retry-delay 15
RUN_NATIVE_IMAGE = docker-compose run -T native-image
export MYUID := $(shell id -u)
export GID := $(shell id -g)
JENKINS = http://jenkins:8080/
SWARM_CLIENT = $(basename $(SWARM_CLIENT_JAR))
SWARM_CLIENT_JAR = $(notdir $(SWARM_CLIENT_URL))
SWARM_CLIENT_URL = http://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/swarm-client/$(JENKINS_SWARM_VERSION)/swarm-client-$(JENKINS_SWARM_VERSION).jar
JENKINS_SWARM_VERSION ?= 3.17
real-test: $(SWARM_CLIENT) libsunec.so
$(RUN_NATIVE_IMAGE) ./$(SWARM_CLIENT) $(TEST_HELP)
: # TODO: Will fail until https://github.com/oracle/graal/issues/460 is resolved
$(RUN_NATIVE_IMAGE) timeout 15 ./$(SWARM_CLIENT) $(TEST_FULL) || [ $$? -eq 124 ]
TEST_HELP = -help > /dev/null
TEST_FULL = -master http://jenkins/ -username admin -password admin -retry 0
$(SWARM_CLIENT): $(SWARM_CLIENT_JAR) config/$(SWARM_CLIENT)
$(NATIVE_IMAGE) $(SWARM_OPTS) -jar $<
TOCLEAN += swarm-client ./\?
NATIVE_IMAGE = $(RUN_NATIVE_IMAGE) native-image --no-server --no-fallback -H:+ReportExceptionStackTraces
SWARM_OPTS += --initialize-at-run-time=sun.awt.dnd.SunDropTargetContextPeer\$$EventDispatcher
SWARM_OPTS += -H:IncludeResourceBundles=org.kohsuke.args4j.Messages
SWARM_OPTS += -H:ConfigurationFileDirectories=config/$@
SWARM_OPTS += -H:IncludeResourceBundles=org.kohsuke.args4j.spi.Messages
SWARM_OPTS += -H:EnableURLProtocols=https,http
$(SWARM_CLIENT_JAR):
wget --timestamping $(SWARM_CLIENT_URL)
TOCLEAN += $(SWARM_CLIENT_JAR)
# arg4j requires heavy introspection see
# https://github.com/oracle/graal/issues/1137 and
# https://github.com/oracle/graal/blob/master/substratevm/CONFIGURE.md
config/%: %.jar | clean-config jenkins_up
echo Inspecting $^ for $@
mkdir -p config
$(NATIVE_IMAGE_AGENT) -jar $< -master 'https://www.google.com' -retry 0 || true
$(NATIVE_IMAGE_AGENT) -jar $< $(TEST_HELP)
# TODO: hudson.FilePath
: timeout 15 $(NATIVE_IMAGE_AGENT) -jar $< $(TEST_FULL) || [ $$? -eq 124 ]
clean-config:
: TODO: Make native-image run as current user
rm -rvf config
NATIVE_IMAGE_AGENT = $(RUN_NATIVE_IMAGE) java -agentlib:native-image-agent=config-merge-dir=$@
libsunec.so:
echo Fetching $@
$(RUN_NATIVE_IMAGE) find $(GRAALVM_DIR) -name $@ -exec cp -v '{}' $@ ';'
GRAALVM_DIR = $(shell $(RUN_NATIVE_IMAGE) find /opt -maxdepth 1 -type d -name graal\*)
TOCLEAN += libsunec.so
jenkins_down: docker-compose.yaml
docker-compose down
clean: | clean-config
echo Cleaning
docker-compose down --remove-orphans
rm -rvf $(TOCLEAN) || true
realclean: clean
docker-compose down --rmi local --volumes -remove-orphans
docker image rm $$(awk '$$1=="FROM"{print $$2}' native-image/Dockerfile) || true