[mod] build-Skripte verbessert
This commit is contained in:
parent
8a2bd79206
commit
a76f362c59
2 changed files with 53 additions and 24 deletions
46
tools/build
46
tools/build
|
@ -1,14 +1,40 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env python3
|
||||
|
||||
## args
|
||||
|
||||
if [ $# -ge 1 ] ; then arg1=$1 && shift ; else arg1="" ; fi
|
||||
import os as _os
|
||||
import argparse as _argparse
|
||||
|
||||
|
||||
## 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()
|
||||
|
||||
## exec
|
||||
targets = []
|
||||
targets.append("main")
|
||||
if args.tests:
|
||||
targets.append("test")
|
||||
_os.system(
|
||||
"make dir_build=%s --file=tools/makefile %s"
|
||||
% (
|
||||
args.output_directory,
|
||||
" ".join(targets),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
targets=""
|
||||
targets="${targets} build/espe"
|
||||
if [ ${arg1} == "-t" ] ; then targets="${targets} test" ; fi
|
||||
|
||||
make --file=tools/makefile ${targets}
|
||||
main()
|
||||
|
|
|
@ -17,11 +17,8 @@ cmd_cp := cp
|
|||
.PHONY: default
|
||||
default: main
|
||||
|
||||
.PHONY: main
|
||||
main: node_modules ${dir_build}/espe
|
||||
|
||||
.PHONY: test
|
||||
test: ${dir_build}/espe-test.mocha.js
|
||||
.PHONY: core
|
||||
core: node_modules ${dir_temp}/espe-core.js ${dir_temp}/espe-core.d.ts
|
||||
|
||||
.PHONY: node_modules
|
||||
node_modules:
|
||||
|
@ -55,6 +52,9 @@ ${dir_temp}/espe-core.js ${dir_temp}/espe-core.d.ts: \
|
|||
@ ${cmd_mkdir} $(dir $@)
|
||||
@ tsc --lib es2020 $^ --outFile ${dir_temp}/espe-core.js --declaration
|
||||
|
||||
.PHONY: main
|
||||
main: core ${dir_build}/espe
|
||||
|
||||
${dir_temp}/espe-main-raw.js: \
|
||||
${dir_lib}/plankton/plankton.d.ts \
|
||||
${dir_temp}/espe-core.d.ts \
|
||||
|
@ -63,15 +63,6 @@ ${dir_temp}/espe-main-raw.js: \
|
|||
@ ${cmd_mkdir} $(dir $@)
|
||||
@ 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_source}/head.js \
|
||||
${dir_lib}/plankton/plankton.js \
|
||||
|
@ -82,6 +73,18 @@ ${dir_build}/espe: \
|
|||
@ ${cmd_cat} $^ > $@
|
||||
@ ${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_source}/head.js \
|
||||
${dir_lib}/plankton/plankton.js \
|
||||
|
|
Loading…
Add table
Reference in a new issue