diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6a31aa3..ce9d232 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,12 +21,12 @@ jobs: - name: Build static executables run: | make static - cp target/x86_64-unknown-linux-musl/release/treereduce-{c,java,javascript,lua,rust,souffle} . + cp target/x86_64-unknown-linux-musl/release/treereduce-{c,java,javascript,lua,rust,souffle,swift} . - uses: ncipollo/release-action@v1 if: ${{ startsWith(github.ref, 'refs/tags/v') }} with: - artifacts: "treereduce-c,treereduce-java,treereduce-javascript,treereduce-lua,treereduce-rust,treereduce-souffle" + artifacts: "treereduce-c,treereduce-java,treereduce-javascript,treereduce-lua,treereduce-rust,treereduce-souffle,treereduce-swift" artifactErrorsFailBuild: true body: "See [CHANGELOG.md](https://github.com/langston-barrett/treereduce/blob/main/doc/CHANGELOG.md)." draft: true @@ -38,7 +38,7 @@ jobs: # Only push on actual release tags PUSH: ${{ startsWith(github.ref, 'refs/tags/v') }} run: | - for pkg in treereduce{,-c,-java,-javascript,-lua,-rust,-souffle}; do + for pkg in treereduce{,-c,-java,-javascript,-lua,-rust,-souffle,-swift}; do if [[ ${PUSH} == true ]]; then cargo publish --token ${CRATES_IO_TOKEN} -p "${pkg}" else diff --git a/Cargo.lock b/Cargo.lock index dff360f..4492db3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -580,6 +580,16 @@ dependencies = [ "tree-sitter", ] +[[package]] +name = "tree-sitter-swift" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e55ecb0372483057cb8f0f80c54d1cf76a3e301281d8db16d6c080e19395360f" +dependencies = [ + "cc", + "tree-sitter", +] + [[package]] name = "tree-sitter-traversal" version = "0.1.2" @@ -668,6 +678,15 @@ dependencies = [ "treereduce", ] +[[package]] +name = "treereduce-swift" +version = "0.3.0" +dependencies = [ + "anyhow", + "tree-sitter-swift", + "treereduce", +] + [[package]] name = "unicode-ident" version = "1.0.8" diff --git a/Cargo.toml b/Cargo.toml index bb6cc4d..b06207e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ members = [ "crates/treereduce-lua", "crates/treereduce-rust", "crates/treereduce-souffle", + "crates/treereduce-swift", ] # https://nnethercote.github.io/perf-book/build-configuration.html diff --git a/Makefile b/Makefile index 22e5ca9..04a9eb7 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ static: --bin treereduce-lua \ --bin treereduce-rust \ --bin treereduce-souffle \ + --bin treereduce-swift \ --locked \ --release \ --target=x86_64-unknown-linux-musl diff --git a/crates/treereduce-swift/Cargo.toml b/crates/treereduce-swift/Cargo.toml new file mode 100644 index 0000000..7587c4b --- /dev/null +++ b/crates/treereduce-swift/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "treereduce-swift" +description = "Fast, parallel, syntax-aware program reducer for Swift" +version = "0.3.0" +keywords = ["program-reducer", "minimization", "test-case-reduction", "swift"] +edition = "2021" +authors = ["Langston Barrett "] +license = "MIT" +readme = "../../README.md" +homepage = "https://github.com/langston-barrett/treereduce" +repository = "https://github.com/langston-barrett/treereduce" + +[dependencies] +anyhow = "1.0" +treereduce = { version = "0.3.0", path = "../treereduce", features = ["cli"] } +tree-sitter-swift = "0.4.3" diff --git a/crates/treereduce-swift/src/main.rs b/crates/treereduce-swift/src/main.rs new file mode 100644 index 0000000..16a4b19 --- /dev/null +++ b/crates/treereduce-swift/src/main.rs @@ -0,0 +1,11 @@ +use std::collections::HashMap; + +use anyhow::Result; + +fn main() -> Result<()> { + treereduce::cli::main( + tree_sitter_swift::language(), + tree_sitter_swift::NODE_TYPES, + HashMap::new(), + ) +} diff --git a/doc/overview.md b/doc/overview.md index 581f57e..490a603 100644 --- a/doc/overview.md +++ b/doc/overview.md @@ -18,6 +18,7 @@ - Lua - Rust - [Soufflé][souffle] + - Swift ## Comparison to Other Tools