[mod] build-Skripte verbessert
This commit is contained in:
parent
8a2bd79206
commit
a76f362c59
2 changed files with 53 additions and 24 deletions
44
tools/build
44
tools/build
|
@ -1,14 +1,40 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
## args
|
import os as _os
|
||||||
|
import argparse as _argparse
|
||||||
if [ $# -ge 1 ] ; then arg1=$1 && shift ; else arg1="" ; fi
|
|
||||||
|
|
||||||
|
|
||||||
## exec
|
def main():
|
||||||
|
## args
|
||||||
|
argument_parser = _argparse.ArgumentParser()
|
||||||
|
argument_parser.add_argument(
|
||||||
|
"--output-directory",
|
||||||
|
"-o",
|
||||||
|
type = str,
|
||||||
|
default = "build",
|
||||||
|
help = "output directory",
|
||||||
|
)
|
||||||
|
argument_parser.add_argument(
|
||||||
|
"--tests",
|
||||||
|
"-t",
|
||||||
|
action = "store_true",
|
||||||
|
default = False,
|
||||||
|
help = "whether to also build the test routines",
|
||||||
|
)
|
||||||
|
args = argument_parser.parse_args()
|
||||||
|
|
||||||
targets=""
|
## exec
|
||||||
targets="${targets} build/espe"
|
targets = []
|
||||||
if [ ${arg1} == "-t" ] ; then targets="${targets} test" ; fi
|
targets.append("main")
|
||||||
|
if args.tests:
|
||||||
|
targets.append("test")
|
||||||
|
_os.system(
|
||||||
|
"make dir_build=%s --file=tools/makefile %s"
|
||||||
|
% (
|
||||||
|
args.output_directory,
|
||||||
|
" ".join(targets),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
make --file=tools/makefile ${targets}
|
|
||||||
|
main()
|
||||||
|
|
|
@ -17,11 +17,8 @@ cmd_cp := cp
|
||||||
.PHONY: default
|
.PHONY: default
|
||||||
default: main
|
default: main
|
||||||
|
|
||||||
.PHONY: main
|
.PHONY: core
|
||||||
main: node_modules ${dir_build}/espe
|
core: node_modules ${dir_temp}/espe-core.js ${dir_temp}/espe-core.d.ts
|
||||||
|
|
||||||
.PHONY: test
|
|
||||||
test: ${dir_build}/espe-test.mocha.js
|
|
||||||
|
|
||||||
.PHONY: node_modules
|
.PHONY: node_modules
|
||||||
node_modules:
|
node_modules:
|
||||||
|
@ -55,6 +52,9 @@ ${dir_temp}/espe-core.js ${dir_temp}/espe-core.d.ts: \
|
||||||
@ ${cmd_mkdir} $(dir $@)
|
@ ${cmd_mkdir} $(dir $@)
|
||||||
@ tsc --lib es2020 $^ --outFile ${dir_temp}/espe-core.js --declaration
|
@ tsc --lib es2020 $^ --outFile ${dir_temp}/espe-core.js --declaration
|
||||||
|
|
||||||
|
.PHONY: main
|
||||||
|
main: core ${dir_build}/espe
|
||||||
|
|
||||||
${dir_temp}/espe-main-raw.js: \
|
${dir_temp}/espe-main-raw.js: \
|
||||||
${dir_lib}/plankton/plankton.d.ts \
|
${dir_lib}/plankton/plankton.d.ts \
|
||||||
${dir_temp}/espe-core.d.ts \
|
${dir_temp}/espe-core.d.ts \
|
||||||
|
@ -63,15 +63,6 @@ ${dir_temp}/espe-main-raw.js: \
|
||||||
@ ${cmd_mkdir} $(dir $@)
|
@ ${cmd_mkdir} $(dir $@)
|
||||||
@ tsc --lib es2020 $^ --outFile $@
|
@ tsc --lib es2020 $^ --outFile $@
|
||||||
|
|
||||||
${dir_temp}/espe-test-raw.js: \
|
|
||||||
${dir_lib}/plankton/plankton.d.ts \
|
|
||||||
${dir_temp}/espe-core.d.ts \
|
|
||||||
${dir_lib}/node/node_modules/@types/mocha/index.d.ts \
|
|
||||||
${dir_source}/tests.mocha.ts
|
|
||||||
@ ${cmd_log} "compile | test …"
|
|
||||||
@ ${cmd_mkdir} $(dir $@)
|
|
||||||
@ tsc --lib es2020 $^ --outFile $@
|
|
||||||
|
|
||||||
${dir_build}/espe: \
|
${dir_build}/espe: \
|
||||||
${dir_source}/head.js \
|
${dir_source}/head.js \
|
||||||
${dir_lib}/plankton/plankton.js \
|
${dir_lib}/plankton/plankton.js \
|
||||||
|
@ -82,6 +73,18 @@ ${dir_build}/espe: \
|
||||||
@ ${cmd_cat} $^ > $@
|
@ ${cmd_cat} $^ > $@
|
||||||
@ ${cmd_chmod} +x $@
|
@ ${cmd_chmod} +x $@
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test: core ${dir_build}/espe-test.mocha.js
|
||||||
|
|
||||||
|
${dir_temp}/espe-test-raw.js: \
|
||||||
|
${dir_lib}/plankton/plankton.d.ts \
|
||||||
|
${dir_temp}/espe-core.d.ts \
|
||||||
|
${dir_lib}/node/node_modules/@types/mocha/index.d.ts \
|
||||||
|
${dir_source}/tests.mocha.ts
|
||||||
|
@ ${cmd_log} "compile | test …"
|
||||||
|
@ ${cmd_mkdir} $(dir $@)
|
||||||
|
@ tsc --lib es2020 $^ --outFile $@
|
||||||
|
|
||||||
${dir_build}/espe-test.mocha.js: \
|
${dir_build}/espe-test.mocha.js: \
|
||||||
${dir_source}/head.js \
|
${dir_source}/head.js \
|
||||||
${dir_lib}/plankton/plankton.js \
|
${dir_lib}/plankton/plankton.js \
|
||||||
|
|
Loading…
Add table
Reference in a new issue