-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile_jvm
77 lines (57 loc) · 2.96 KB
/
Makefile_jvm
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
groupid=com.natpryce
jvm_outdir=out/jvm
jvm_srcdir_main=platform/jvm/src/main
jvm_srcdir_test=platform/jvm/src/test
JVM_KOTLINC=kotlinc-jvm
JVM_KOTLINCFLAGS=-Xmulti-platform -language-version 1.8 -api-version 1.8
jvm_classpath=$(patsubst %,-classpath %,$(call topath,$(filter-out %-sources.jar,$(filter %.jar,$^))))
jvm_src_main:=$(call srcfiles,jvm,main)
jvm_src_test:=$(call srcfiles,jvm,test)
jvm_tests=$(shell echo $(jvm_src_test) | tr [:space:] "\n" | grep -F Test.kt | sed -E 's:.*/[^/]*src/test/(.+)\.kt:\1:' | tr / .)
jvm_package_distro += \
$(jvm_outdir)/$(package)-$(version).pom \
$(jvm_outdir)/$(package)-$(version).jar \
$(jvm_outdir)/$(package)-$(version)-sources.jar \
$(jvm_outdir)/$(package)-$(version)-javadoc.jar \
jvm_published_archives = $(jvm_package_distro)
jvm_published_signatures = $(jvm_published_archives:%=%.asc)
jvm_published_files = $(jvm_published_archives) $(jvm_published_signatures)
jvm: jvm-tested jvm-distro
jvm-ci: jvm-tested $(jvm_published_archives)
jvm-tested: $(jvm_outdir)/test-report.txt
jvm-distro: $(jvm_published_files)
include platform/jvm/libs/main.mk
include platform/jvm/libs/runtime.mk
include platform/jvm/libs/test.mk
platform/jvm/libs/%.mk: %.dependencies
rm -rf platform/jvm/libs/$*
mkdir -p platform/jvm/libs/$*
tools/sm-download $< platform/jvm/libs/$*
echo 'libs_$*=$$(filter-out %-source.jar,$$(wildcard platform/jvm/libs/$*/*.jar))' > $@
$(jvm_outdir)/$(package)-$(version).jar: $(jvm_src_main) $(libs_main) $(libs_runtime)
$(jvm_outdir)/$(package)-$(version)-test.jar: $(jvm_src_test) $(jvm_outdir)/$(package)-$(version).jar \
$(libs_main) $(libs_runtime) $(libs_test) \
$(KOTLINHOME)/lib/kotlin-test.jar
$(jvm_outdir)/test-report.txt: $(jvm_outdir)/$(package)-$(version)-test.jar $(jvm_outdir)/$(package)-$(version).jar $(libs_main) $(libs_runtime) $(libs_test)
kotlin $(jvm_classpath):$(KOTLINHOME)/lib/kotlin-test.jar org.junit.runner.JUnitCore $(jvm_tests) | tee "$@"
@tail -n 2 "$@" | head -n 1 | grep -E --quiet '^OK'
$(jvm_outdir)/$(package)-$(version)-sources.jar: $(jvm_src_main)
$(JAR) cf $@ -C $(jvm_srcdir_main) .
$(jvm_outdir)/$(package)-$(version)-javadoc.jar: $(jvm_outdir)/$(package)-$(version)-javadoc/index.html
$(JAR) cf $@ -C $(dir $<) .
$(jvm_outdir)/$(package)-$(version)-javadoc/index.html: $(jvm_src_main) $(libs_main)
@mkdir -p $(dir $@)
$(DOKKA) $(jvm_src_main) -format html -output $(dir $@)
$(jvm_outdir)/$(package)-$(version).pom: main.dependencies $(published_jars)
@mkdir -p $(dir $@)
tools/sm-pom mvn:$(groupid):$(package):jar:$(version) main.dependencies $(dir $@)
mv $@ $@-tmp
xsltproc tools/pom.xslt $@-tmp | xmllint --format --nsclean - > $@
$(jvm_outdir)/%.asc: $(jvm_outdir)/%
gpg --yes --detach-sign --armor $<
%.jar:
@mkdir -p $(dir $@)
$(JVM_KOTLINC) $(JVM_KOTLINCFLAGS) $(filter-out %.jar,$^) $(jvm_classpath) -d $@
jvm-published: $(jvm_published_files)
publish-to-bintray $(groupid) $(package) $(version) $^
.PHONY: jvm jvm-ci jvm-tested jvm-distro jvm-published