Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: runtime api spec gen scripts #1478

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions kclvm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions kclvm/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ gen-runtime-api:
make -C ./runtime gen-api-spec
make fmt

# Install the wasm target
# Install the wasm32-unknown-unknown target
install-rustc-wasm:
rustup target add wasm32-unknown-unknown

# Install python3 pytest
install-pytest:
python3 -mpip install --user -U pytest pytest-html pytest-xdist
# Install the wasm-wasi target
install-rustc-wasm-wasi:
rustup target add wasm32-wasi

# Install kclvm-py
install-kclvm-py:
python3 -mpip install --user -U kclvm
# Install python3 pytest
install-test-deps:
python3 -mpip install --user -U pytest pytest-html pytest-xdist ruamel.yaml

# ------------------------
# Compile and run
Expand Down Expand Up @@ -82,19 +82,19 @@ codecov-lcov:
cargo llvm-cov --features llvm --lcov --output-path $(PWD)/.kclvm_cov/lcov.info -r --workspace --ignore-filename-regex gpyrpc.rs -- --nocapture

# Test runtime libaries using python functions
test-runtime: install-kclvm-py install-pytest
test-runtime: install-test-deps
cd ./tests/test_units && PYTHONPATH=./../../tests/test_units/runtime python3 -m pytest -vv || { echo 'kclvm/tests/test_units failed' ; exit 1; }

# E2E grammar tests.
test-grammar: install-kclvm-py install-pytest
test-grammar: install-test-deps
cd tests/integration/grammar && python3 -m pytest -v -n 5

# E2E grammar tests with the fast evaluator
test-grammar-evaluator: install-kclvm-py install-pytest
test-grammar-evaluator: install-test-deps
cd tests/integration/grammar && KCL_FAST_EVAL=1 python3 -m pytest -v -n 5

# E2E konfig tests.
test-konfig: install-kclvm-py install-pytest
test-konfig: install-test-deps
cd tests/integration/konfig && python3 -m pytest -v -n 5

# Parser fuzz.
Expand Down
5 changes: 5 additions & 0 deletions kclvm/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ num-integer = "0.1.44"
glob = "0.3.0"
uuid = { version = "1.7.0", features = ["serde", "v4"] }
handlebars = "5.1.2"
walkdir = "2.5.0"

[[bin]]
name = "gen-api-spec"
path = "scripts/gen-api-spec.rs"
5 changes: 2 additions & 3 deletions kclvm/runtime/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
default:
make gen-api-spec
cargo test

gen-api-spec:
mkdir -p target

cargo clean -q

KCLVM_RUNTIME_GEN_API_SPEC= cargo build > ./src/_kclvm_api_spec.rs.tmp
KCLVM_RUNTIME_GEN_API_SPEC= cargo build -r > ./src/_kclvm_api_spec.rs.tmp

echo "// Copyright The KCL Authors. All rights reserved.\n" > ./src/_kclvm_api_spec.rs
echo "// Auto generated by <make gen-api-spec> command, DONOT EDIT!!!\n" >> ./src/_kclvm_api_spec.rs
cat ./src/_kclvm_api_spec.rs.tmp >> ./src/_kclvm_api_spec.rs
rm ./src/_kclvm_api_spec.rs.tmp

make -C ./tools/kclvm-runtime-gen-api
cargo run -r --bin gen-api-spec
7 changes: 0 additions & 7 deletions kclvm/runtime/readme.md

This file was deleted.

Loading
Loading