diff --git a/Makefile b/Makefile index ad2486f..5992bbd 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,7 @@ test: $(BUILD_DIR)parigp.tmLanguage.json --grammar $(BUILD_DIR)parigp.tmLanguage.json \ $(TEST_CASES) -$(BUILD_DIR)gp_commands.tsv: +$(BUILD_DIR)gp_commands.tsv: $(BUILD_DIR) $(eval FUNCS := $(shell echo '\c' | gp -fq | grep -v 'RETURN')) @printf 'Command\tType\n' > $@ @echo $(FUNCS) |\ @@ -84,13 +84,13 @@ define get_gp_list xargs -I@ $(SHELL) -c 'echo -e \@"\n"' | xargs $(4) >> $@ endef -$(BUILD_DIR)gp_member_functions.tsv: +$(BUILD_DIR)gp_member_functions.tsv: $(BUILD_DIR) $(call get_gp_list,'Member','?.',,-n1) -$(BUILD_DIR)gp_types.tsv: +$(BUILD_DIR)gp_types.tsv: $(BUILD_DIR) $(call get_gp_list,'Type','\\t',tail -n+2 |,-n1) -$(BUILD_DIR)gp_support_commands.tsv: +$(BUILD_DIR)gp_support_commands.tsv: $(BUILD_DIR) $(call get_gp_list,'MetaCommand','?\\',tail -n+4 | cut -d'{' -f1 | cut -d' ' -f1 |,-I@ echo '\@') GP_ITEMS := commands member_functions types support_commands diff --git a/flake.nix b/flake.nix index b47fce8..4c79ee1 100644 --- a/flake.nix +++ b/flake.nix @@ -39,6 +39,7 @@ yq-go gnumake gnused + python39 jinja2-cli @@ -47,6 +48,7 @@ vscode_tmgrammar_test ]; src = self; + configurePhase = "make clean"; buildPhase = "make build"; checkPhase = "make test"; installPhase = "mkdir -p $out; cp syntaxes/* $out/"; diff --git a/scripts/compile-grammar.sh b/scripts/compile-grammar.sh index 5b2b7b8..8c9f367 100755 --- a/scripts/compile-grammar.sh +++ b/scripts/compile-grammar.sh @@ -3,7 +3,6 @@ # compile-grammar.sh - Builds TextMate grammar with help of Nix. # shellcheck shell=sh -set -e scriptPath=$(readlink -f "$0") @@ -12,7 +11,15 @@ rootDir=$(dirname "${scriptPath%/*}") statix check nix flake check --impure "$rootDir" -cp "$(nix build --impure \ - --no-link \ - --print-out-paths "$rootDir")"/parigp* "$rootDir/syntaxes/" -nix develop --check --impure "$rootDir" +outDir="$(nix build --impure \ + --no-link \ + --print-build-logs \ + --print-out-paths "$rootDir")" +cp "$outDir"/parigp* "$rootDir/syntaxes/" + +output=$(nix develop --check --impure "$rootDir") +echo "$output" +output=$(echo "$output" | grep '✖.*failed') +if [ -n "$output" ]; then + exit 1 +fi