* Run tests from scratch when a grammar is generated

* Deduplicate code for grammars generators scripts
This commit is contained in:
Luni-4 2021-03-11 15:47:22 +01:00 коммит произвёл GitHub
Родитель 33264d3edf
Коммит 4b6b6357d6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 9 добавлений и 65 удалений

Просмотреть файл

@ -39,4 +39,4 @@ cargo fmt
# Run rust code-analysis to verify if everything works correctly and to
# update the Cargo.lock
cargo test --workspace
cargo clean && cargo test --workspace

Просмотреть файл

@ -31,39 +31,11 @@ popd
# Copy tree-sitter-cpp `scanner.cc` functions into the `src` directory
cp --verbose tree-sitter-cpp/src/scanner.cc ./src/scanner.cc
# Init npm
npm init -y
# Install a small module that lets the parser be used from Node
npm install --save nan
# Install the Tree-sitter CLI
npm install --save-dev tree-sitter-cli
# Generate moz-cpp grammar
./node_modules/.bin/tree-sitter generate
# Delete node_modules
rm -rf node_modules
# Delete tree-sitter-cpp directory
rm -rf tree-sitter-cpp
# Exit tree-sitter-mozcpp directory
popd
# Enter enums directory
pushd enums
# Generate tree-sitter-mozcpp grammar
./generate-grammars/generate-grammar.sh tree-sitter-mozcpp
# Recreate the grammar for rust-code-analysis
cargo clean && cargo run -- -lrust -o ../src/languages
# Exit enums directory
popd
# Format the produced grammars
cargo fmt
# Run rust code-analysis to verify if everything works correctly and to
# update the Cargo.lock
cargo test --workspace
# Delete tree-sitter-mozcpp/tree-sitter-cpp directory
rm -rf ./tree-sitter-mozcpp/tree-sitter-cpp

Просмотреть файл

@ -35,39 +35,11 @@ popd
SED_PATTERN="s/tree_sitter_javascript_external_scanner_/tree_sitter_javascript_external_scanner_mozjs_/g"
sed $SED_PATTERN tree-sitter-javascript/src/scanner.c > ./src/tree_sitter_javascript_scanner.c
# Init npm
npm init -y
# Install a small module that lets the parser be used from Node
npm install --save nan
# Install the Tree-sitter CLI
npm install --save-dev tree-sitter-cli
# Generate moz-cpp grammar
./node_modules/.bin/tree-sitter generate
# Delete node_modules
rm -rf node_modules
# Delete tree-sitter-javascript directory
rm -rf tree-sitter-javascript
# Exit tree-sitter-mozjs directory
popd
# Enter enums directory
pushd enums
# Generate tree-sitter-mozjs grammar
./generate-grammars/generate-grammar.sh tree-sitter-mozjs
# Recreate the grammar for rust-code-analysis
cargo clean && cargo run -- -lrust -o ../src/languages
# Exit enums directory
popd
# Format the produced grammars
cargo fmt
# Run rust code-analysis to verify if everything works correctly and to
# update the Cargo.lock
cargo test --workspace
# Delete tree-sitter-mozjs/tree-sitter-javascript directory
rm -rf ./tree-sitter-mozjs/tree-sitter-javascript