Integrate new compilation scripts, remove cqueue and Makefile.2
This is a major step toward normalcy---removing the kluge of a build process that was causing so many issues. Rather than echoing all operations to a queue file before passing it off to dslc, the new build scripts in `bin/' are used to invoke tame normally, as needed. This solves all of the current issues with things not rebuilding when they should. And, as a bonus, tab completion on targets works. Sorry this took so long. There wasn't much motivation until we hired so many people that are suffering from this. This does a few major things, along with some miscellaneous others: - Invoke bin/tame directly; - Merge Makefile.2.in into Makefile.am; and - Fix up some targets. * build-aux/Makefile.2.in: Delete file. Mostly merged with Makefile.am. * build-aux/Makefile.am: Add a bunch of new targets and definitions from Makefile.2.in. Modify all that previously used .cqueue to now invoke `$(TAME)' directly. Remove miscellaneous targets for trying to proxy targets to Makefile.2. (saneout, _go): Remove definitions. (.NOTPARALLEL): Add to prevent parallel builds. (ui/program.expanded.xml)[.version.xml]: Remove dependency for now. (clean): Also clean generated PHP files. Follow symlinks to clean core. This is still incomplete (does not clean all rate table stuff). (suppliers.mk)[xmlo_cmd]: Remove. See `gen-make' and `gen-c1make'. (lvroot)[summary-html]: New dependency. (kill-tamed, tamed-die): New targets (former alias of latter) to kill tamed. * build-aux/gen-c1make: Generate `$(TAME)' invocation. * build-aux/gen-make: Likewise. Remove `xmlo_cmd' output. Ignore recursive `tame' symlink (this can be removed once we clean `rater/' up. * build-aux/m4/calcdsl.m4 (TAME): Update description to reflect that it should now be the path to `bin/tame'. Adjust `AC_CHECK_FILE' lines accordingly. (tame_needed_ver): Remove. We have been in the same repo as TAME itself for quite some time. Remove associated code. (AC_CONFIG_FILES): Remove `Makefile.2'. * src/current/src/com/lovullo/dslc/DslCompiler.java (_DslCompiler)[compile]: Perform validation prefore `compile' command rather than a separate `validate' step. Remove `rm'. [compileSrc]: Stop echoing command. This was only necessary because of the previous Makefile klugery; now Make echoes on its own correctly.master
parent
88da519c5e
commit
6027769633
30
bin/tame
30
bin/tame
|
@ -43,6 +43,10 @@ command-runner()
|
|||
|
||||
verify-runner "$base" "$pid"
|
||||
|
||||
# forward signals to runner so that build is actually halted
|
||||
# (rather than continuing in background after we die)
|
||||
trap 'kill -TERM $pid &>/dev/null' INT TERM
|
||||
|
||||
# all remaining arguments are passed to the runner
|
||||
echo "$@" > "$base/0"
|
||||
|
||||
|
@ -163,10 +167,11 @@ saneout()
|
|||
awk ' \
|
||||
/^~~~~\[begin /,/^~~~~\[end / { next } \
|
||||
/^rm / { next } \
|
||||
/^COMMAND / { next } \
|
||||
/^Exception|^\t+at / { \
|
||||
if ( /^E/ ) { \
|
||||
print; \
|
||||
print "Stack trace written to .runlog"; \
|
||||
print "Stack trace written to run-*.log"; \
|
||||
} \
|
||||
next; \
|
||||
} \
|
||||
|
@ -184,14 +189,19 @@ saneout()
|
|||
usage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: $0 cmdline
|
||||
Usage: $0 [-v|--verbose] cmdline
|
||||
Or: $0 --kill
|
||||
Send command line CMDLINE to a tamed runner. Start tamed if
|
||||
not already running.
|
||||
|
||||
Options:
|
||||
--kill kill tamed
|
||||
--help show this message
|
||||
--help show this message
|
||||
--kill kill tamed
|
||||
-v, --verbose show runner logs
|
||||
|
||||
Environment Variables:
|
||||
TAME_VERBOSE when greater than zero, show runner logs
|
||||
(see also --verbose)
|
||||
EOF
|
||||
|
||||
exit $EX_USAGE
|
||||
|
@ -203,17 +213,27 @@ main()
|
|||
{
|
||||
local -r root=/run/user/$UID/tamed
|
||||
|
||||
local outcmd=saneout
|
||||
|
||||
test $# -gt 0 || usage
|
||||
|
||||
case "${1:-}" in
|
||||
--kill) kill-tamed "$root"; exit;;
|
||||
-v|--verbose) outcmd=cat;;
|
||||
--help) usage;;
|
||||
esac
|
||||
|
||||
# alternative to --verbose
|
||||
if [ "${TAME_VERBOSE:-0}" -ge 1 ]; then
|
||||
outcmd=cat
|
||||
fi
|
||||
|
||||
start-tamed "$root"
|
||||
|
||||
# for now we only support a single runner
|
||||
command-runner 0 "$root" "$@" | saneout
|
||||
command-runner 0 "$root" "$@" \
|
||||
| tee -a "run-0.log" \
|
||||
| "$outcmd"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
68
bin/tamed
68
bin/tamed
|
@ -25,6 +25,9 @@ declare -ri EX_RUNNING=1
|
|||
declare -ri EX_USAGE=64 # incorrect usage; sysexits.h
|
||||
declare -ri EX_CANTCREAT=73 # cannot create file; sysexits.h
|
||||
|
||||
# number of seconds before runners are considered unused and terminate
|
||||
declare -ri TAMED_STALL_SECONDS="${TAMED_STALL_SECONDS:-30}"
|
||||
|
||||
# set by `main', global for `cleanup'
|
||||
declare root=
|
||||
|
||||
|
@ -50,6 +53,9 @@ mkfifos()
|
|||
echo "fatal: failed to create FIFO at $in"
|
||||
exit $EX_CANTCREAT
|
||||
}
|
||||
|
||||
# keep FIFOs open so we don't get EOF from writers
|
||||
tail -f >"$root/$n" &
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -69,13 +75,13 @@ spawn-runner()
|
|||
|
||||
mkfifos "$base"
|
||||
|
||||
# TODO: should we separate back out std{out,err}?
|
||||
# XXX: why does dslc quit (with a 0 exit code) occsionally? stdin?
|
||||
# monitor runner usage and kill when inactive
|
||||
stall-monitor "$base" &
|
||||
|
||||
# loop to restart runner in case of crash
|
||||
while true; do
|
||||
"$mypath/dslc" < <( persistent-cat "$base/0" ) \
|
||||
>"$base/1" \
|
||||
2>&1
|
||||
echo "warning: runner $id exited with code $?; restarting"
|
||||
"$mypath/dslc" < "$base/0" &> "$base/1"
|
||||
echo "warning: runner $id exited with code ${PIPESTATUS[0]}; restarting" >&2
|
||||
done &
|
||||
|
||||
echo "$!" > "$base/pid"
|
||||
|
@ -84,19 +90,37 @@ spawn-runner()
|
|||
}
|
||||
|
||||
|
||||
# Persistently read commands from FIFO IN
|
||||
# Kill runner at BASE when it becomes inactive for TAMED_STALL_SECONDS
|
||||
# seconds
|
||||
#
|
||||
# This will continue to read from the FIFO as long as it is
|
||||
# readable. This is necessary since SIGPIPE gets sent to
|
||||
# processes reading/writing from/to the FIFO whenever a
|
||||
# process detaches from it.
|
||||
persistent-cat()
|
||||
# This monitors the modification time on the stdout FIFO. stdin does not
|
||||
# need to be monitored since dslc immediately echoes back commands it
|
||||
# receives.
|
||||
#
|
||||
# dslc is pretty chatty at the time of writing this, so TAMED_STALL_SECONDS
|
||||
# can easily be <=30s even for large packages. This may need to change in
|
||||
# the future if it becomes too much less chatty. Increase that environment
|
||||
# variable if runners stall unexpectedly in the middle of builds.
|
||||
stall-monitor()
|
||||
{
|
||||
local -r in="${1?Missing input path}"
|
||||
local -r base="${1?Missing base}"
|
||||
|
||||
while test -r "$in"; do
|
||||
read -r < "$in" || return
|
||||
echo "$REPLY"
|
||||
# monitor output FIFO modification time
|
||||
while true; do
|
||||
local -i since=$( date +%s )
|
||||
sleep "$TAMED_STALL_SECONDS"
|
||||
local -i last=$( stat -c%Y "$base/1" )
|
||||
|
||||
# keep waiting if there has been activity since $since
|
||||
test "$last" -le "$since" || continue
|
||||
|
||||
# no activity; kill
|
||||
local -r pid=$( cat "$base/pid" )
|
||||
kill "$pid"
|
||||
wait "$pid" 2>/dev/null
|
||||
|
||||
# this stall subprocess is no longer needed
|
||||
break
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -154,8 +178,6 @@ kill-running()
|
|||
# recurse.
|
||||
cleanup()
|
||||
{
|
||||
echo "killing remaining runners..."
|
||||
|
||||
rm -rf "$root"
|
||||
kill 0
|
||||
}
|
||||
|
@ -170,11 +192,17 @@ Start tamed and runners. Do not fork into background process.
|
|||
|
||||
The default value of RUNPATH is \`/run/user/$UID/tamed'.
|
||||
|
||||
Only one runner is currently supported.
|
||||
Only one runner is currently supported. tamed exits once all
|
||||
runners have terminated. Runners will be killed once they are
|
||||
inactive for at least TAMED_STALL_SECONDS (default 30).
|
||||
|
||||
Options:
|
||||
--kill kill a runing tamed at path RUNPATH
|
||||
--help show this message
|
||||
--kill kill a runing tamed at path RUNPATH
|
||||
|
||||
Environment Variables:
|
||||
TAMED_STALL_SECONDS number of seconds of runner inactivity before
|
||||
runner is automatically killed (default 30)
|
||||
EOF
|
||||
|
||||
exit $EX_USAGE
|
||||
|
|
|
@ -1,215 +0,0 @@
|
|||
# @configure_input@
|
||||
#
|
||||
# Compiles packages written in the Calc DSL.
|
||||
#
|
||||
# Copyright (C) 2018 R-T Specialty, LLC.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Note that this build process is unconventional in order to avoid the startup
|
||||
# costs that would be associated with executing dslc with each and every package
|
||||
# (see the other Makefile for more information). Therefore, everything is
|
||||
# written to .cqueue for later processing by dslc.
|
||||
#
|
||||
# The issue of re-building based on timestamps---which Make would normally take
|
||||
# care of exclusively---must also be given special care now that we are handling
|
||||
# the building separately from Make. Each enqueued request also touches the
|
||||
# destination file to update its timestamp, ensuring that it is seen by Make as
|
||||
# modified (as if it were compiled) and therefore will trigger the building of
|
||||
# the targets that depend upon it. In the case of the object files (xmlo), a
|
||||
# temporary file is created when it is enqueued. As part of the queued request
|
||||
# for compilation is a request to delete this temporary file. In the event that
|
||||
# the build fails, this temporary file will be seen and will force a rebuild of
|
||||
# the file, despite its timestamp.
|
||||
#
|
||||
# The same issue does not exist for xmle, js, and html files, since they have
|
||||
# linear dependency trees and dslc will rm the file on failure, which
|
||||
# obliterates the timestamp.
|
||||
# #
|
||||
|
||||
path_rates := $(path_suppliers)/rates
|
||||
path_map := map
|
||||
path_c1map := $(path_map)/c1
|
||||
path_dsl := rater
|
||||
path_ui := ui
|
||||
path_suppliers := suppliers
|
||||
path_lv := lovullo
|
||||
path_srv := srv
|
||||
|
||||
src_suppliers := $(wildcard $(path_suppliers)/*.xml)
|
||||
src_map := $(wildcard $(path_map)/*.xml)
|
||||
src_c1map := $(wildcard $(path_c1map)/*.xml)
|
||||
|
||||
dest_summary_html := $(patsubst \
|
||||
$(path_suppliers)/%.xml, \
|
||||
$(path_suppliers)/%.html, \
|
||||
$(src_suppliers))
|
||||
dest_standalone := $(patsubst \
|
||||
$(path_suppliers)/%.xml, \
|
||||
$(path_suppliers)/%.js, \
|
||||
$(src_suppliers))
|
||||
dest_map := $(patsubst \
|
||||
$(path_map)/%.xml, \
|
||||
$(path_map)/%.xmle, \
|
||||
$(src_map))
|
||||
dest_c1map := $(patsubst \
|
||||
$(path_c1map)/%.xml, \
|
||||
$(path_c1map)/%.php, \
|
||||
$(src_c1map))
|
||||
|
||||
compiled_suppliers := $(src_suppliers:.xml=.xmlo)
|
||||
linked_suppliers := $(src_suppliers:.xml=.xmle)
|
||||
|
||||
comma := ,
|
||||
extless_supp_delim := $(subst .xml,,$(subst .xml ,$(comma),$(src_suppliers)))
|
||||
|
||||
cqueue=.cqueue
|
||||
|
||||
ant = @ANT@ -e
|
||||
|
||||
.DELETE_ON_ERROR:
|
||||
|
||||
.PHONY: default clean \
|
||||
interp-rate-tables summary-html c1map \
|
||||
standalones program-ui program-ui-immediate program-data-copy \
|
||||
do-build version FORCE
|
||||
|
||||
# these files will never be deleted when Make considers them to be intermediate
|
||||
# (e.g. when building summary pages), since they are still needed or take a
|
||||
# while to build
|
||||
.PRECIOUS: %.js %.xml %.xmle %.xmlo
|
||||
|
||||
SHELL = /bin/bash -O extglob
|
||||
|
||||
default: program-ui c1map FORCE
|
||||
|
||||
program-ui: standalones ui/package.js ui/Program.js program-ui-immediate
|
||||
program-ui-immediate: ui/html/index.phtml
|
||||
|
||||
include suppliers.mk
|
||||
|
||||
# starts with a fresh cqueue
|
||||
prexmlo:
|
||||
@>$(cqueue)
|
||||
|
||||
summary-html: $(dest_summary_html) ;
|
||||
|
||||
%.html: %.js
|
||||
@echo "summary $*.xmle $@" >>.cqueue
|
||||
@touch $@
|
||||
|
||||
standalones: $(dest_standalone)
|
||||
%.xmle: %.xmlo
|
||||
@echo "link $< $@" >>.cqueue
|
||||
@touch $@
|
||||
%.js: %.xmle
|
||||
@echo "standalone $< $@" >>.cqueue
|
||||
@touch $@
|
||||
|
||||
# C1 XML (specific recipes are in suppliers.mk)
|
||||
c1map: $(dest_c1map)
|
||||
|
||||
%.dot: %.xmlo
|
||||
@echo "dot $< $@" >> .cqueue
|
||||
%.dote: %.xmle
|
||||
@echo "dot $< $@" >> .cqueue
|
||||
|
||||
%.svg: %.dote
|
||||
dot -Tsvg "$<" > "$@"
|
||||
%.svg: %.dot
|
||||
dot -Tsvg "$<" > "$@"
|
||||
|
||||
%.xml: %.dat
|
||||
rater/tools/tdat2xml $< > $@
|
||||
|
||||
%.xml: %.typelist
|
||||
rater/tame/build-aux/list2typedef $(*F) < $< > $@
|
||||
|
||||
%.csvo: %.csvm
|
||||
rater/tools/csvm2csv $< > $@
|
||||
%.csvo: %.csvi
|
||||
rater/tools/csvi $< > $@
|
||||
%.csvo: %.csv
|
||||
cp $< $@
|
||||
|
||||
%.xml: %.csvo
|
||||
rater/tools/csv2xml $< > $@
|
||||
|
||||
version: .version.xml
|
||||
.version.xml: FORCE
|
||||
git log HEAD^.. -1 --pretty=format:'<version>%h</version>' > .version.xml
|
||||
|
||||
ui/program.expanded.xml: ui/program.xml | .version.xml
|
||||
@echo "progui-expand $< $@" >> .cqueue
|
||||
ui/Program.js: ui/program.expanded.xml ui/package.js
|
||||
@echo "progui-class $< $@ include-path=../../../ui/" >> .cqueue
|
||||
ui/html/index.phtml: ui/program.expanded.xml
|
||||
@echo "progui-html $< $@ out-path=./" >> .cqueue
|
||||
ui/package-dfns.xmlo: ui/package-dfns.xml
|
||||
ui/package-dfns.xml: ui/program.expanded.xml
|
||||
@echo "progui-pkg $< $@" >> .cqueue
|
||||
ui/package-map.xmlo: ui/package-map.xml
|
||||
ui/package-map.xml: ui/program.expanded.xml ui/package-dfns.xml
|
||||
@echo "progui-pkg-map $< $@" >> .cqueue
|
||||
|
||||
# for the time being, this does not depend on clean-rate-tables because $(ant) will
|
||||
specs:
|
||||
$(MAKE) -C doc/specs
|
||||
#
|
||||
# this will eventually go away once we don't have X-repo klugery
|
||||
|
||||
# for the time being, this does not depend on clean-rate-tables because ant will
|
||||
# run it
|
||||
clean:
|
||||
find $(path_suppliers) $(path_map) $(path_c1map) common/ rater/core rater/lv \( \
|
||||
-name '*.xmlo' \
|
||||
-o -name '*.xmle' \
|
||||
-o -name '*.js' \
|
||||
-o -name '*.html' \
|
||||
-o -name '*.dep' \
|
||||
-o -name '*.tmp' \
|
||||
\) -exec rm -v {} \;
|
||||
rm -rf $(path_ui)/package-dfns.* \
|
||||
$(path_ui)/package-map.* \
|
||||
$(path_ui)/program.expanded.xml \
|
||||
$(path_ui)/include.js \
|
||||
$(path_ui)/Program.js \
|
||||
$(path_ui)/html
|
||||
find . -path '*/tables/*.csvm' -o -path '*/territories/*.dat' \
|
||||
| sed 's/\.csvm$$/\.xml/; s/\.dat$$/\.xml/' \
|
||||
| xargs rm -fv
|
||||
|
||||
# generates a Makefile that will properly build all package dependencies; note
|
||||
# that territory and rate packages also have includes; see top of this file for
|
||||
# an explanation
|
||||
suppliers.mk:
|
||||
$(ant) pkg-dep \
|
||||
&& mv $(path_ui)/program.dep $(path_ui)/package-dfns.dep
|
||||
xmlo_cmd='@echo "validate $$(patsubst %.tmp,%.xml,$$<) $$@" >> .cqueue \
|
||||
&& echo "compile $$(patsubst %.tmp,%.xml,$$<) $$@" >> .cqueue \
|
||||
&& echo "rm $$(patsubst %.xmlo,%.tmp,$$@)" >> .cqueue \
|
||||
&& touch $$@ \
|
||||
&& touch -d +1sec $$(patsubst %.xmlo,%.tmp,$$@) >> .cqueue' \
|
||||
./rater/tame/build-aux/gen-make common/ $(path_suppliers)/ $(path_dsl)/ $(path_map)/ $(path_ui)/ >$@ \
|
||||
&& ./rater/tame/build-aux/gen-c1make $(path_c1map)/*.xml >>$@
|
||||
|
||||
me-a-sandwich:
|
||||
@test $$EUID -eq 0 \
|
||||
&& echo 'You actually ran me as root? Are you insane!?' \
|
||||
|| echo 'Make it yourself.'
|
||||
|
||||
# simply forces a job to run, thereby forcing the invocation of the secondary
|
||||
# Makefile (this is not explicitly required, because of prepare, but signifies
|
||||
# intent and is self-documenting)
|
||||
FORCE: ;
|
|
@ -16,15 +16,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# This fragment exists as a kluge to provide support for running a command
|
||||
# after all targets have been run (in this case, dslc).
|
||||
#
|
||||
# A list of everything to be compiled is output into .cqueue, which is then
|
||||
# picked up by dslc; this avoids the overhead of starting the JVM,
|
||||
# recompiling XSL stylesheets, etc, which is quite substantial.
|
||||
#
|
||||
# !!! Unfortunately, this does not yet support parallel job execution.
|
||||
##
|
||||
|
||||
path_rates := $(path_suppliers)/rates
|
||||
path_map := map
|
||||
|
@ -38,63 +30,153 @@ path_srv := srv
|
|||
path_lvroot := lvroot
|
||||
path_intralov_root := "intralov-root/@program@"
|
||||
|
||||
.PHONY: FORCE prepare program-data-copy lvroot program-ui-immediate test
|
||||
src_suppliers := $(wildcard $(path_suppliers)/*.xml)
|
||||
src_map := $(wildcard $(path_map)/*.xml)
|
||||
src_c1map := $(wildcard $(path_c1map)/*.xml)
|
||||
|
||||
JAVA_HEAP_SIZE ?= 5120M
|
||||
JAVA_STACK_SIZE ?= 5M
|
||||
dest_summary_html := $(patsubst \
|
||||
$(path_suppliers)/%.xml, \
|
||||
$(path_suppliers)/%.html, \
|
||||
$(src_suppliers))
|
||||
dest_standalone := $(patsubst \
|
||||
$(path_suppliers)/%.xml, \
|
||||
$(path_suppliers)/%.js, \
|
||||
$(src_suppliers))
|
||||
dest_map := $(patsubst \
|
||||
$(path_map)/%.xml, \
|
||||
$(path_map)/%.xmle, \
|
||||
$(src_map))
|
||||
dest_c1map := $(patsubst \
|
||||
$(path_c1map)/%.xml, \
|
||||
$(path_c1map)/%.php, \
|
||||
$(src_c1map))
|
||||
|
||||
compiled_suppliers := $(src_suppliers:.xml=.xmlo)
|
||||
linked_suppliers := $(src_suppliers:.xml=.xmle)
|
||||
|
||||
comma := ,
|
||||
extless_supp_delim := $(subst .xml,,$(subst .xml ,$(comma),$(src_suppliers)))
|
||||
|
||||
ant = @ANT@ -e
|
||||
|
||||
.PHONY: FORCE default program-data-copy lvroot program-ui-immediate test \
|
||||
default clean interp-rate-tables summary-html c1map standalones \
|
||||
program-ui version FORCE
|
||||
|
||||
default: program-ui c1map FORCE
|
||||
|
||||
.DELETE_ON_ERROR:
|
||||
|
||||
# less verbose output; all to runlog
|
||||
define saneout
|
||||
time -f 'total time: %E' awk ' \
|
||||
BEGIN { e=0; w=0; } \
|
||||
{ printf "[%d] ", systime() >> ".runlog"; print >> ".runlog"; } \
|
||||
/^~~~~\[begin /,/^~~~~\[end / { next } \
|
||||
/^rm / { next } \
|
||||
/^Exception|^\t+at / { \
|
||||
if ( /^E/ ) { \
|
||||
print; \
|
||||
print "Stack trace written to .runlog"; \
|
||||
} \
|
||||
next; \
|
||||
} \
|
||||
/[Ww]arning:|[Nn]otice:/ { printf "\033[0;33m"; w++; out=1; } \
|
||||
/[Ff]atal:/ { printf "\033[0;31m"; out=1; } \
|
||||
/!|[Ee]rror:/ { printf "\033[0;31m"; e++; out=1; } \
|
||||
/internal:/ { printf "\033[0;35m"; out=1; } \
|
||||
/internal error:/ { printf "\033[1m"; out=1; } \
|
||||
/^[^[]/ || out { print; printf "\033[0;0m"; out=0; } \
|
||||
END { printf "%d error(s); %d warning(s).\n", e, w; } \
|
||||
'
|
||||
endef
|
||||
|
||||
define _go
|
||||
touch .cqueue \
|
||||
&& ( test -s .cqueue || echo "Nothing to be done for \`$@'." ) \
|
||||
&& echo "$(JAVA_HEAP_SIZE) $(JAVA_STACK_SIZE)" \ \
|
||||
&& CLASSPATH="$(RATER_CLASSPATH):rater/src/dslc.jar" \
|
||||
$(JAVA) -Xmx$(JAVA_HEAP_SIZE) -Xss$(JAVA_STACK_SIZE) \
|
||||
com.lovullo.dslc.DslCompiler < .cqueue 2>&1 \
|
||||
| $(saneout); \
|
||||
exit $${PIPESTATUS[0]}; \
|
||||
@>.cqueue
|
||||
endef
|
||||
.NOTPARALLEL:
|
||||
|
||||
SHELL = /bin/bash -O extglob
|
||||
|
||||
# these files will never be deleted when Make considers them to be intermediate
|
||||
# (e.g. when building summary pages), since they are still needed or take a
|
||||
# while to build
|
||||
.PRECIOUS: %.js %.xml %.xmle %.xmlo
|
||||
|
||||
all: program-data-copy
|
||||
|
||||
program-ui-immediate:
|
||||
@>.cqueue
|
||||
@$(MAKE) --no-print-directory -f Makefile.2 program-ui-immediate
|
||||
@$(MAKE) program-data-copy
|
||||
@$(_go)
|
||||
program-ui: standalones ui/package.js ui/Program.js program-ui-immediate
|
||||
program-ui-immediate: ui/html/index.phtml
|
||||
|
||||
program-data-copy:
|
||||
@>.cqueue
|
||||
@$(MAKE) --no-print-directory -f Makefile.2 standalones program-ui c1map
|
||||
@$(_go)
|
||||
# Note the `$()' here to prevent Automake from inlining this file---it is
|
||||
# to be generated when imports change, which can be at any time.
|
||||
include $()suppliers.mk
|
||||
|
||||
summary-html: $(dest_summary_html) ;
|
||||
|
||||
%.html: %.js
|
||||
$(TAME) summary $*.xmle $@
|
||||
|
||||
standalones: $(dest_standalone)
|
||||
%.xmle: %.xmlo
|
||||
$(TAME) link $< $@
|
||||
%.js: %.xmle
|
||||
$(TAME) standalone $< $@
|
||||
|
||||
# C1 XML (specific recipes are in suppliers.mk)
|
||||
c1map: $(dest_c1map)
|
||||
|
||||
%.dot: %.xmlo
|
||||
$(TAME) dot $< $@
|
||||
%.dote: %.xmle
|
||||
$(TAME) dot $< $@
|
||||
|
||||
%.svg: %.dote
|
||||
dot -Tsvg "$<" > "$@"
|
||||
%.svg: %.dot
|
||||
dot -Tsvg "$<" > "$@"
|
||||
|
||||
%.xml: %.dat
|
||||
rater/tools/tdat2xml $< > $@
|
||||
|
||||
%.xml: %.typelist
|
||||
rater/tame/build-aux/list2typedef $(*F) < $< > $@
|
||||
|
||||
%.csvo: %.csvm
|
||||
rater/tools/csvm2csv $< > $@
|
||||
%.csvo: %.csvi
|
||||
rater/tools/csvi $< > $@
|
||||
%.csvo: %.csv
|
||||
cp $< $@
|
||||
|
||||
%.xml: %.csvo
|
||||
rater/tools/csv2xml $< > $@
|
||||
|
||||
version: .version.xml
|
||||
.version.xml: FORCE
|
||||
git log HEAD^.. -1 --pretty=format:'<version>%h</version>' > .version.xml
|
||||
|
||||
ui/program.expanded.xml: ui/program.xml
|
||||
$(TAME) progui-expand $< $@
|
||||
ui/Program.js: ui/program.expanded.xml ui/package.js
|
||||
$(TAME) progui-class $< $@ include-path=../../../ui/
|
||||
ui/html/index.phtml: ui/program.expanded.xml
|
||||
$(TAME) progui-html $< $@ out-path=./
|
||||
ui/package-dfns.xmlo: ui/package-dfns.xml
|
||||
ui/package-dfns.xml: ui/program.expanded.xml
|
||||
$(TAME) progui-pkg $< $@
|
||||
ui/package-map.xmlo: ui/package-map.xml
|
||||
ui/package-map.xml: ui/program.expanded.xml ui/package-dfns.xml
|
||||
$(TAME) progui-pkg-map $< $@
|
||||
|
||||
# for the time being, this does not depend on clean-rate-tables because $(ant) will
|
||||
specs:
|
||||
$(MAKE) -C doc/specs
|
||||
|
||||
# for the time being, this does not depend on clean-rate-tables because ant will
|
||||
# run it
|
||||
clean:
|
||||
find -L $(path_suppliers) $(path_map) $(path_c1map) common/ rater/core rater/lv \( \
|
||||
-name '*.xmlo' \
|
||||
-o -name '*.xmle' \
|
||||
-o -name '*.js' \
|
||||
-o -name '*.html' \
|
||||
-o -name '*.dep' \
|
||||
-o -name '*.tmp' \
|
||||
-o -name '*.php' \
|
||||
\) -exec rm -v {} \;
|
||||
rm -rf $(path_ui)/package-dfns.* \
|
||||
$(path_ui)/package-map.* \
|
||||
$(path_ui)/program.expanded.xml \
|
||||
$(path_ui)/include.js \
|
||||
$(path_ui)/Program.js \
|
||||
$(path_ui)/html
|
||||
find . -path '*/tables/*.csvm' -o -path '*/territories/*.dat' \
|
||||
| sed 's/\.csvm$$/\.xml/; s/\.dat$$/\.xml/' \
|
||||
| xargs rm -fv
|
||||
|
||||
# generates a Makefile that will properly build all package dependencies; note
|
||||
# that territory and rate packages also have includes; see top of this file for
|
||||
# an explanation
|
||||
suppliers.mk:
|
||||
$(ant) pkg-dep
|
||||
mv $(path_ui)/program.dep $(path_ui)/package-dfns.dep
|
||||
./rater/tame/build-aux/gen-make common/ $(path_suppliers)/ $(path_dsl)/ $(path_map)/ $(path_ui)/ >$@
|
||||
./rater/tame/build-aux/gen-c1make $(path_c1map)/*.xml >>$@
|
||||
|
||||
program-data-copy: standalones program-ui c1map .version.xml
|
||||
mkdir -p "$(path_lv)/src/node/program/rater/programs/@program@"
|
||||
mkdir -p "$(path_lv)/src/node/program/classify"
|
||||
mkdir -p "$(path_lv)/src/node/program/ui/custom"
|
||||
|
@ -124,7 +206,7 @@ program-data-copy:
|
|||
ant -f "$(path_lv)/build.xml" js-mod-order
|
||||
|
||||
# TODO: merge this and the above
|
||||
lvroot: prepare
|
||||
lvroot: summary-html
|
||||
mkdir -p "$(path_lvroot)/src/node/program/rater/programs/@program@"
|
||||
mkdir -p "$(path_lvroot)/src/node/program/classify"
|
||||
mkdir -p "$(path_lvroot)/src/node/program/ui/custom"
|
||||
|
@ -155,28 +237,18 @@ intralov-root: summary-html
|
|||
ln -fL $(path_dsl)/scripts/*.js "$(path_intralov_root)/rater/scripts/"
|
||||
ln -fL $(path_suppliers)/*.{html,js} "$(path_intralov_root)/suppliers"
|
||||
|
||||
|
||||
# because of the crazy wildcard target below, we want to ignore
|
||||
# some Automake-generated stuff
|
||||
%.am:
|
||||
%.m4:
|
||||
%.ac:
|
||||
|
||||
%: prepare
|
||||
@if [[ "$@" != [Mm]akefile ]]; then \
|
||||
$(MAKE) --no-print-directory -f Makefile.2 $@; \
|
||||
$(_go); \
|
||||
fi
|
||||
|
||||
clean:
|
||||
$(MAKE) --no-print-directory -f Makefile.2 clean
|
||||
|
||||
prepare: FORCE
|
||||
@>.cqueue
|
||||
|
||||
test: check
|
||||
check-am: standalones ui/package.js
|
||||
@$(path_dsl)/build-aux/progtest-runner $(path_suppliers) $(path_tests)
|
||||
@$(path_dsl)/build-aux/progtest-runner ui/package.xml $(path_tests)/ui
|
||||
|
||||
kill-tamed: tamed-die
|
||||
tamed-die:
|
||||
$(TAME) --kill
|
||||
|
||||
me-a-sandwich:
|
||||
@test $$EUID -eq 0 \
|
||||
&& echo 'You actually ran me as root? Are you insane!?' \
|
||||
|| echo 'Make it yourself.'
|
||||
|
||||
FORCE: ;
|
||||
|
|
|
@ -75,8 +75,7 @@ c1recipe()
|
|||
)
|
||||
|
||||
echo "$dir/$base.php: $file $includes"
|
||||
echo -e '\t@echo "c1map $< $@" >> .cqueue'
|
||||
echo -e '\t@touch $@'
|
||||
echo -e '\t$(TAME) c1map $< $@'
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -54,16 +54,8 @@ resolv-path()
|
|||
|
||||
# rule for building
|
||||
[ -z "$GEN_MAKE" ] && {
|
||||
echo "%.xmlo:: %.tmp"
|
||||
echo -e "\t@rm -f \$@ \$<"
|
||||
[ -n "$xmlo_cmd" ] \
|
||||
&& echo -e "\t$xmlo_cmd" \
|
||||
|| echo -e "\ttouch \$@"
|
||||
|
||||
echo "%.xmlo:: %.xml | prexmlo"
|
||||
[ -n "$xmlo_cmd" ] \
|
||||
&& echo -e "\t$xmlo_cmd" \
|
||||
|| echo -e "\ttouch \$@"
|
||||
echo "%.xmlo: %.xml"
|
||||
echo -e '\t$(TAME) compile $< $@'
|
||||
|
||||
export GEN_MAKE="$( pwd )/$0"
|
||||
exec "$GEN_MAKE" "$@"
|
||||
|
@ -119,6 +111,8 @@ until [ $# -eq 0 ]; do (
|
|||
# recurse on every subdirectory
|
||||
for p in */; do
|
||||
[ "$p" == ./ -o "$p" == ../ ] && continue
|
||||
[ "$p" == node_modules/ -o "$p" == tame/ ] && continue
|
||||
|
||||
[ ! -d "$p" ] || ( cd "$OLDPWD" && "$GEN_MAKE" "$path/$p" ) || {
|
||||
echo "fatal: failed to recurse on $( pwd )/$path/$p" >&2
|
||||
exit 1
|
||||
|
|
|
@ -33,13 +33,10 @@ AM_INIT_AUTOMAKE([foreign])
|
|||
AC_ARG_VAR([JAVA], [The Java executable])
|
||||
AC_ARG_VAR([ANT], [Apache Ant])
|
||||
AC_ARG_VAR([DSLC_JAR], [Path to DSL Compiler JAR])
|
||||
AC_ARG_VAR([TAME], [Path to TAME])
|
||||
AC_ARG_VAR([TAME], [The TAME compiler])
|
||||
AC_ARG_VAR([RATER_CLASSPATH], [DSL Compiler Saxon class path])
|
||||
AC_ARG_VAR([PROGUI_TEST_PATH], [Path to JavaScript tests for Program UI])
|
||||
|
||||
# Required version of TAME
|
||||
AC_SUBST([tame_needed_ver], [1.0.0])
|
||||
|
||||
# Auto-discover Java and Ant paths
|
||||
AC_CHECK_PROGS(JAVA, [java])
|
||||
AC_CHECK_PROGS(ANT, [ant])
|
||||
|
@ -64,34 +61,18 @@ AS_IF([test ! "$DSLC_JAR"],
|
|||
|
||||
# TAME is the compiler (whereas dslc invokes it, keeps things in memory, etc)
|
||||
AS_IF([test ! "$TAME"],
|
||||
[AC_CHECK_FILE([$CALCROOT/tame],
|
||||
[AC_SUBST([TAME], [$CALCROOT/tame])],
|
||||
[AC_CHECK_FILE([$CALCROOT/tame/bin/tame],
|
||||
[AC_SUBST([TAME], [$CALCROOT/tame/bin/tame])],
|
||||
[AC_MSG_ERROR(
|
||||
[TAME not found])])],
|
||||
[])
|
||||
|
||||
AC_MSG_CHECKING([TAME version])
|
||||
|
||||
AC_SUBST_FILE([tame_version])
|
||||
tame_version=$( cat "$TAME/VERSION" )
|
||||
|
||||
# We get subtle errors or potential compiler bugs if the TAME version is
|
||||
# incorrect; check for >= the required version
|
||||
AS_VERSION_COMPARE([$tame_version], [$tame_needed_ver],
|
||||
[
|
||||
AC_MSG_RESULT([$tame_version])
|
||||
AC_MSG_ERROR([TAME version $tame_needed_ver or greater required])
|
||||
],
|
||||
[AC_MSG_RESULT([$tame_version])],
|
||||
[AC_MSG_RESULT([$tame_version (>$tame_needed_ver)])])
|
||||
|
||||
# @program@ in *.in files will be replaced with the program name provided by AC_INIT
|
||||
AC_SUBST([program], AC_PACKAGE_NAME)
|
||||
|
||||
# Final files to be output by `configure'. The path before the colon is the
|
||||
# destination name; after the colon is the source.
|
||||
AC_CONFIG_FILES(Makefile:m4_defn(`calc_root')/build-aux/Makefile.in
|
||||
Makefile.2:m4_defn(`calc_root')/build-aux/Makefile.2.in)
|
||||
AC_CONFIG_FILES(Makefile:m4_defn(`calc_root')/build-aux/Makefile.in)
|
||||
|
||||
# Generate configure script
|
||||
AC_OUTPUT
|
||||
|
|
|
@ -69,17 +69,10 @@ public class DslCompiler
|
|||
HashMap<String,String> params
|
||||
) throws Exception
|
||||
{
|
||||
if ( cmd.equals( "validate" ) )
|
||||
// validate before compilation
|
||||
if ( cmd.equals( "compile" ) )
|
||||
{
|
||||
_xsd.validate( doc );
|
||||
return;
|
||||
}
|
||||
else if ( cmd.equals( "rm" ) )
|
||||
{
|
||||
// remove file (purposely uncaught)
|
||||
( new File( src ) ).delete();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( dest.equals( "" ) )
|
||||
|
@ -295,7 +288,8 @@ public class DslCompiler
|
|||
|
||||
private static void compileSrc( _DslCompiler dslc, String cmdline ) throws Exception
|
||||
{
|
||||
System.err.println( cmdline );
|
||||
System.err.printf( "COMMAND " + cmdline + "\n" );
|
||||
|
||||
String[] args = cmdline.split( " " );
|
||||
String dest = "";
|
||||
|
||||
|
|
Loading…
Reference in New Issue