Implements phase 2 of docs/design-sql-bound-parameters.md. jetc --lint-sql [--strict] <file|dir>... lists each <sql> whose statement contains a $[...] or #[...] reference instead of a <bind>, with file:line and where each value comes from. Row values ($[.col], $[session.col], $[?N], $[#]) are only reported with --strict. References in <bind>, <if>, <set> and the other attribute-only tags, <comment> and |> <| are skipped. A custom tag defined as <sql><container></sql> (barant.com's <showtable>) is checked at each use. Exit status is 0 for none found, 1 for findings, 2 for an unreadable path. - jetc/JetLint.*: the scanner; jetc.cpp: the option - build scripts and runbindtests.sh: link JetLint.cpp - tests/runlinttests.sh and tests/lintsql/: fixtures and expected output - docs: worklist for the local copies of both sites, design doc status, manual note on the lint Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
50 lines
1.6 KiB
Bash
Executable File
50 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Builds jetc itself (if needed), compiles a .jet file to C++, and links the
|
|
# result into a standalone executable against CoreUtils + the JetCore
|
|
# runtime (everything jet-2.0 itself links against, minus jet-2.0.cpp's own
|
|
# main() - the compiled program brings its own).
|
|
#
|
|
# Usage: ./build-compiled.sh <input.jet> <output-binary-name>
|
|
|
|
set -e
|
|
JC="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
CU="$JC/../CoreUtils"
|
|
HERE="$JC/jetc"
|
|
|
|
if [ $# -ne 2 ]; then
|
|
echo "usage: $0 <input.jet> <output-binary-name>"
|
|
exit 1
|
|
fi
|
|
|
|
INPUT="$1"
|
|
OUTNAME="$2"
|
|
|
|
if [ ! -x "$HERE/jetc" ]; then
|
|
echo "Building jetc..."
|
|
g++ -g -std=c++23 -o "$HERE/jetc" "$HERE/jetc.cpp" "$HERE/JetParser.cpp" "$HERE/JetCodegen.cpp" "$HERE/JetLint.cpp"
|
|
fi
|
|
|
|
echo "Compiling $INPUT -> $OUTNAME.compiled.cpp"
|
|
"$HERE/jetc" "$INPUT" "$HERE/$OUTNAME.compiled.cpp"
|
|
|
|
echo "Building JetCore runtime objects (everything Tag::interpretSpan's fallback path may need)..."
|
|
# Rebuild whenever the source is newer than the cached object, not just
|
|
# when the object is missing - same stale-cache bug found and fixed in
|
|
# build-shared.sh (see its comment for the full story).
|
|
list=""
|
|
for f in "$JC"/*.cpp; do
|
|
base=$(basename "$f")
|
|
if [ "$base" = "jet-2.0.cpp" ]; then continue; fi
|
|
obj="$HERE/${base%.cpp}.o"
|
|
if [ ! -f "$obj" ] || [ "$f" -nt "$obj" ]; then
|
|
g++ -g -c -std=c++23 -I"$CU" -I"$JC" "$f" -o "$obj" &
|
|
fi
|
|
list="$list $obj"
|
|
done
|
|
wait
|
|
|
|
g++ -g -c -std=c++23 -I"$CU" -I"$JC" "$HERE/$OUTNAME.compiled.cpp" -o "$HERE/$OUTNAME.compiled.o"
|
|
g++ -g -o "$HERE/$OUTNAME" "$HERE/$OUTNAME.compiled.o" $list -std=c++23 -L"$CU" -lCoreUtils -lmysqlclient -lssl -lcrypto
|
|
|
|
echo "Built $HERE/$OUTNAME"
|