From cb436b2558f267a5cfd913981b7b03c67c540622 Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Sun, 14 Dec 2025 23:57:47 -0800 Subject: [PATCH] Refactor project structure (#507) --- .github/workflows/lint.yaml | 4 +-- .github/workflows/release.yaml | 2 +- .github/workflows/test.yaml | 10 +++--- Cargo.lock | 28 +++++++++++++++ Cargo.toml | 4 +++ cspell.json | 1 + examples/Cargo.lock | 63 ---------------------------------- examples/Cargo.toml | 8 ----- examples/test.sh | 12 ------- tools/example_test.sh | 20 +++++++++++ 10 files changed, 60 insertions(+), 92 deletions(-) delete mode 100644 examples/Cargo.lock delete mode 100644 examples/Cargo.toml delete mode 100755 examples/test.sh create mode 100755 tools/example_test.sh diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 51a43bb..bce06e1 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v6 with: submodules: true - - uses: Swatinem/rust-cache@v2 + - uses: swatinem/rust-cache@v2 - run: cargo clippy -- -D warnings format: runs-on: ubuntu-latest @@ -30,5 +30,3 @@ jobs: steps: - uses: actions/checkout@v6 - uses: lycheeverse/lychee-action@v2 - with: - fail: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 178ac17..97069a4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v6 with: submodules: true - - uses: raviqqe/cargo-cache@v1 + - uses: swatinem/rust-cache@v2 - run: cargo install cargo-workspaces - uses: rust-lang/crates-io-auth-action@v1 id: auth diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9810d54..adcfa42 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v6 with: submodules: true - - uses: Swatinem/rust-cache@v2 + - uses: swatinem/rust-cache@v2 - run: cargo build test: runs-on: ubuntu-latest @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v6 with: submodules: true - - uses: Swatinem/rust-cache@v2 + - uses: swatinem/rust-cache@v2 - run: cargo test examples: runs-on: ubuntu-latest @@ -27,13 +27,13 @@ jobs: - uses: actions/checkout@v6 with: submodules: true - - uses: Swatinem/rust-cache@v2 - - run: examples/test.sh + - uses: swatinem/rust-cache@v2 + - run: tools/example_test.sh cmake: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: submodules: true - - uses: Swatinem/rust-cache@v2 + - uses: swatinem/rust-cache@v2 - run: cargo build --no-default-features --features cmake diff --git a/Cargo.lock b/Cargo.lock index 1e55af7..c6f858a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -39,12 +39,33 @@ dependencies = [ "cc", ] +[[package]] +name = "dynamic_threads" +version = "0.1.0" +dependencies = [ + "bdwgc-alloc", +] + [[package]] name = "find-msvc-tools" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" +[[package]] +name = "free_by_borrow" +version = "0.1.0" +dependencies = [ + "bdwgc-alloc", +] + +[[package]] +name = "free_by_gc" +version = "0.1.0" +dependencies = [ + "bdwgc-alloc", +] + [[package]] name = "libc" version = "0.2.178" @@ -56,3 +77,10 @@ name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "static_threads" +version = "0.1.0" +dependencies = [ + "bdwgc-alloc", +] diff --git a/Cargo.toml b/Cargo.toml index 90650d8..f2bb8b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,10 @@ repository = "https://github.com/raviqqe/bdwgc-alloc" license = "MIT" categories = ["api-bindings", "memory-management", "no-std", "no-std::no-alloc"] +[workspace] +resolver = "3" +members = ["examples/*"] + [dependencies] libc = "0.2.178" diff --git a/cspell.json b/cspell.json index 3a78c87..831e11e 100644 --- a/cspell.json +++ b/cspell.json @@ -15,6 +15,7 @@ "repr", "rustc", "stackbottom", + "swatinem", "unregisters" ] } diff --git a/examples/Cargo.lock b/examples/Cargo.lock deleted file mode 100644 index 951c3ef..0000000 --- a/examples/Cargo.lock +++ /dev/null @@ -1,63 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "autotools" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef941527c41b0fc0dd48511a8154cd5fc7e29200a0ff8b7203c5d777dbc795cf" -dependencies = [ - "cc", -] - -[[package]] -name = "bdwgc-alloc" -version = "0.6.12" -dependencies = [ - "autotools", - "libc", -] - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - -[[package]] -name = "dynamic_threads" -version = "0.1.0" -dependencies = [ - "bdwgc-alloc", -] - -[[package]] -name = "free_by_borrow" -version = "0.1.0" -dependencies = [ - "bdwgc-alloc", -] - -[[package]] -name = "free_by_gc" -version = "0.1.0" -dependencies = [ - "bdwgc-alloc", -] - -[[package]] -name = "libc" -version = "0.2.178" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" - -[[package]] -name = "static_threads" -version = "0.1.0" -dependencies = [ - "bdwgc-alloc", -] diff --git a/examples/Cargo.toml b/examples/Cargo.toml deleted file mode 100644 index b72a7e3..0000000 --- a/examples/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[workspace] -resolver = "3" -members = [ - "dynamic_threads", - "free_by_borrow", - "free_by_gc", - "static_threads", -] diff --git a/examples/test.sh b/examples/test.sh deleted file mode 100755 index a5569b1..0000000 --- a/examples/test.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -set -ex - -cd $(dirname $0) - -for cargo_file in */Cargo.toml; do - cargo run --bin $(dirname $cargo_file) & - pid=$! - sleep 20 - kill $pid -done diff --git a/tools/example_test.sh b/tools/example_test.sh new file mode 100755 index 0000000..b4282b7 --- /dev/null +++ b/tools/example_test.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +set -ex + +duration=20 + +cd $(dirname $0)/.. + +for directory in $(ls examples); do + ( + cd examples/$directory + + cargo build + cargo run & + + pid=$! + sleep $duration + kill $pid + ) +done