From 2037ce1099100db827dc8180abed753897fc063f Mon Sep 17 00:00:00 2001 From: Jeffrey Charles Date: Fri, 1 Nov 2024 10:42:33 -0400 Subject: [PATCH] Rename javy-core to javy-plugin (#797) --- .github/pull_request_template.md | 2 +- .github/workflows/build-assets.yml | 10 +++---- .github/workflows/ci.yml | 12 ++++---- .github/workflows/cli-features.yml | 4 +-- .github/workflows/wpt.yml | 2 +- Cargo.lock | 18 ++++++------ Cargo.toml | 4 +-- Makefile | 28 +++++++++---------- crates/cli/build.rs | 2 +- crates/{core => plugin}/.cargo/config | 0 crates/{core => plugin}/Cargo.toml | 2 +- crates/{core => plugin}/src/lib.rs | 0 .../{core => plugin}/src/shared_config/mod.rs | 0 .../src/shared_config/runtime_config.rs | 0 docs/docs-contributing-architecture.md | 8 +++--- docs/docs-contributing-building.md | 4 +-- docs/docs-using-extending.md | 10 +++---- wpt/README.md | 2 +- 18 files changed, 54 insertions(+), 54 deletions(-) rename crates/{core => plugin}/.cargo/config (100%) rename crates/{core => plugin}/Cargo.toml (95%) rename crates/{core => plugin}/src/lib.rs (100%) rename crates/{core => plugin}/src/shared_config/mod.rs (100%) rename crates/{core => plugin}/src/shared_config/runtime_config.rs (100%) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index be4bf4a4..2860f0d4 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -4,6 +4,6 @@ ## Checklist -- [ ] I've updated the relevant CHANGELOG files if necessary. Changes to `javy-cli` and `javy-core` do not require updating CHANGELOG files. +- [ ] I've updated the relevant CHANGELOG files if necessary. Changes to `javy-cli` and `javy-plugin` do not require updating CHANGELOG files. - [ ] I've updated the relevant crate versions if necessary. [Versioning policy for library crates](https://github.com/bytecodealliance/javy/blob/main/docs/contributing.md#versioning-for-library-crates) - [ ] I've updated documentation including crate documentation if necessary. diff --git a/.github/workflows/build-assets.yml b/.github/workflows/build-assets.yml index 85597b7c..334eb52c 100644 --- a/.github/workflows/build-assets.yml +++ b/.github/workflows/build-assets.yml @@ -18,8 +18,8 @@ on: - main jobs: - compile_core: - name: compile_core + compile_plugin: + name: compile_plugin runs-on: macos-latest steps: - uses: actions/checkout@v4 @@ -33,8 +33,8 @@ jobs: tar xvf /tmp/wizer.tar.xz --strip-components=1 -C /tmp/wizer echo "/tmp/wizer" >> $GITHUB_PATH - - name: Make core - run: make core + - name: Make plugin + run: make plugin - name: Upload plugin to artifacts uses: actions/upload-artifact@v4 @@ -76,7 +76,7 @@ jobs: compile_cli: name: compile_cli-${{ matrix.name }} - needs: compile_core + needs: compile_plugin runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6e0d968..c6a5f8b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,10 +7,10 @@ on: pull_request: jobs: - core: - name: test_core + plugin: + name: test_plugin # We test on `macos-latest` to accurately reflect - # the core Wasm binary that we attach to the releases, + # the plugin Wasm binary that we attach to the releases, # which is built on the latest macOS too. # This is also helpful for testing fuel # consumption in tests. @@ -27,8 +27,8 @@ jobs: - name: Install cargo-hack uses: taiki-e/install-action@cargo-hack - - name: Compile core - run: cargo build -p javy-core --release --target=wasm32-wasip1 + - name: Compile plugin + run: cargo build -p javy-plugin --release --target=wasm32-wasip1 - name: Test env: @@ -60,7 +60,7 @@ jobs: cli: name: test_cli runs-on: ubuntu-latest - needs: core + needs: plugin steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/cli-features.yml b/.github/workflows/cli-features.yml index 6fedddc1..86cae131 100644 --- a/.github/workflows/cli-features.yml +++ b/.github/workflows/cli-features.yml @@ -1,4 +1,4 @@ -# Tests extra CLI features and their dependency with core features. +# Tests extra CLI features and their dependency with plugin features. name: Test CLI Features on: push: @@ -19,5 +19,5 @@ jobs: - name: Test `experimental_event_loop` run: | - cargo build --package=javy-core --target=wasm32-wasip1 --release --features=experimental_event_loop + cargo build --package=javy-plugin --target=wasm32-wasip1 --release --features=experimental_event_loop cargo test --package=javy-cli --features=experimental_event_loop --release -- --nocapture diff --git a/.github/workflows/wpt.yml b/.github/workflows/wpt.yml index 587f2bac..46b8e6ab 100644 --- a/.github/workflows/wpt.yml +++ b/.github/workflows/wpt.yml @@ -21,7 +21,7 @@ jobs: - name: WPT run: | - cargo build --package=javy-core --release --target=wasm32-wasip1 --features=experimental_event_loop + cargo build --package=javy-plugin --release --target=wasm32-wasip1 --features=experimental_event_loop CARGO_PROFILE_RELEASE_LTO=off cargo build --package=javy-cli --release npm install --prefix wpt npm test --prefix wpt diff --git a/Cargo.lock b/Cargo.lock index aaeacb8e..e13c11a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1558,23 +1558,23 @@ dependencies = [ ] [[package]] -name = "javy-core" -version = "0.2.0" +name = "javy-fuzz" +version = "0.0.0" dependencies = [ "anyhow", - "javy-plugin-api", - "serde", + "arbitrary-json", + "javy", + "libfuzzer-sys", "serde_json", ] [[package]] -name = "javy-fuzz" -version = "0.0.0" +name = "javy-plugin" +version = "0.2.0" dependencies = [ "anyhow", - "arbitrary-json", - "javy", - "libfuzzer-sys", + "javy-plugin-api", + "serde", "serde_json", ] diff --git a/Cargo.toml b/Cargo.toml index f9ef39af..aac6da67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [workspace] members = [ - "crates/javy", - "crates/core", "crates/cli", + "crates/javy", + "crates/plugin", "crates/plugin-api", "crates/test-macros", "crates/runner", diff --git a/Makefile b/Makefile index 7b0e82e9..2c644419 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: cli core test fmt clean +.PHONY: cli plugin test fmt clean .DEFAULT_GOAL := cli install: @@ -11,15 +11,15 @@ check-bench: CARGO_PROFILE_RELEASE_LTO=off cargo check --package=javy-cli --release --benches # Disabling LTO substantially improves compile time -cli: core +cli: plugin CARGO_PROFILE_RELEASE_LTO=off cargo build --package=javy-cli --release -core: - cargo build --package=javy-core --release --target=wasm32-wasip1 --features=$(CORE_FEATURES) +plugin: + cargo build --package=javy-plugin --release --target=wasm32-wasip1 --features=$(PLUGIN_FEATURES) docs: cargo doc --package=javy-cli --open - cargo doc --package=javy-core --open --target=wasm32-wasip1 + cargo doc --package=javy-plugin --open --target=wasm32-wasip1 test-javy: CARGO_TARGET_WASM32_WASIP1_RUNNER="wasmtime --dir=." cargo hack test --package=javy --target=wasm32-wasip1 --each-feature -- --nocapture @@ -27,29 +27,29 @@ test-javy: test-plugin-api: CARGO_TARGET_WASM32_WASIP1_RUNNER="wasmtime --dir=." cargo hack test --package=javy-plugin-api --target=wasm32-wasip1 --each-feature -- --nocapture -test-core: - CARGO_TARGET_WASM32_WASIP1_RUNNER="wasmtime" cargo test --package=javy-core --target=wasm32-wasip1 -- --nocapture +test-plugin: + CARGO_TARGET_WASM32_WASIP1_RUNNER="wasmtime" cargo test --package=javy-plugin --target=wasm32-wasip1 -- --nocapture # Test in release mode to skip some debug assertions # Note: to make this faster, the engine should be optimized beforehand (wasm-strip + wasm-opt). # Disabling LTO substantially improves compile time -test-cli: core +test-cli: plugin CARGO_PROFILE_RELEASE_LTO=off cargo test --package=javy-cli --release --features=$(CLI_FEATURES) -- --nocapture test-runner: cargo test --package=javy-runner -- --nocapture # WPT requires a Javy build with the experimental_event_loop feature to pass -test-wpt: export CORE_FEATURES ?= experimental_event_loop +test-wpt: export PLUGIN_FEATURES ?= experimental_event_loop test-wpt: # Can't use a prerequisite here b/c a prequisite will not cause a rebuild of the CLI $(MAKE) cli npm install --prefix wpt npm test --prefix wpt -tests: test-javy test-plugin-api test-core test-runner test-cli test-wpt +tests: test-javy test-plugin-api test-plugin test-runner test-cli test-wpt -fmt: fmt-javy fmt-plugin-api fmt-core fmt-cli +fmt: fmt-javy fmt-plugin-api fmt-plugin fmt-cli fmt-javy: cargo fmt --package=javy -- --check @@ -59,9 +59,9 @@ fmt-plugin-api: cargo fmt --package=javy-plugin-api -- --check cargo clippy --package=javy-plugin-api --target=wasm32-wasip1 --all-targets -- -D warnings -fmt-core: - cargo fmt --package=javy-core -- --check - cargo clippy --package=javy-core --target=wasm32-wasip1 --all-targets -- -D warnings +fmt-plugin: + cargo fmt --package=javy-plugin -- --check + cargo clippy --package=javy-plugin --target=wasm32-wasip1 --all-targets -- -D warnings # Use `--release` on CLI clippy to align with `test-cli`. # This reduces the size of the target directory which improves CI stability. diff --git a/crates/cli/build.rs b/crates/cli/build.rs index 17d8995c..486c1868 100644 --- a/crates/cli/build.rs +++ b/crates/cli/build.rs @@ -34,7 +34,7 @@ fn read_file(path: impl AsRef) -> Result> { Ok(buf) } -// Copy the plugin binary build from the `core` crate +// Copy the plugin binary build from the `plugin` crate fn copy_plugin() -> Result<()> { let cargo_manifest_dir = env::var("CARGO_MANIFEST_DIR")?; let module_path = PathBuf::from(&cargo_manifest_dir) diff --git a/crates/core/.cargo/config b/crates/plugin/.cargo/config similarity index 100% rename from crates/core/.cargo/config rename to crates/plugin/.cargo/config diff --git a/crates/core/Cargo.toml b/crates/plugin/Cargo.toml similarity index 95% rename from crates/core/Cargo.toml rename to crates/plugin/Cargo.toml index 314d7a5b..ef35ed80 100644 --- a/crates/core/Cargo.toml +++ b/crates/plugin/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "javy-core" +name = "javy-plugin" version = "0.2.0" authors.workspace = true edition.workspace = true diff --git a/crates/core/src/lib.rs b/crates/plugin/src/lib.rs similarity index 100% rename from crates/core/src/lib.rs rename to crates/plugin/src/lib.rs diff --git a/crates/core/src/shared_config/mod.rs b/crates/plugin/src/shared_config/mod.rs similarity index 100% rename from crates/core/src/shared_config/mod.rs rename to crates/plugin/src/shared_config/mod.rs diff --git a/crates/core/src/shared_config/runtime_config.rs b/crates/plugin/src/shared_config/runtime_config.rs similarity index 100% rename from crates/core/src/shared_config/runtime_config.rs rename to crates/plugin/src/shared_config/runtime_config.rs diff --git a/docs/docs-contributing-architecture.md b/docs/docs-contributing-architecture.md index 8ddbae23..78bde09b 100644 --- a/docs/docs-contributing-architecture.md +++ b/docs/docs-contributing-architecture.md @@ -8,7 +8,7 @@ This document is intended to provide an overview of the architecture of `javy`. flowchart TD javy-cli --> wasm subgraph wasm[plugin.wasm] - javy-core --> javy + javy-plugin --> javy javy --> rquickjs end ``` @@ -100,14 +100,14 @@ You should gate your feature with a cargo feature if your feature/change: the CLI would make the `--help` output harder for most users to understand. - You want to have integration tests in the `javy-cli` crate that should only - run when the `javy-core` crate is built with a non-default configuration (that + run when the `javy-plugin` crate is built with a non-default configuration (that is, with different cargo features enabled). For example, we introduced the `experimental_event_loop` cargo feature in the `javy-cli` crate since we test for different expected outputs when using a promise when the - `experimental_event_loop` cargo feature is enabled on the `javy_core` crate + `experimental_event_loop` cargo feature is enabled on the `javy-plugin` crate compared to when that cargo feature is disabled. -### `javy-core` +### `javy-plugin` Gets compiled to `plugin.wasm` for use by the CLI and in environments for running dynamically linked modules. This isn't intended to be used as a code diff --git a/docs/docs-contributing-building.md b/docs/docs-contributing-building.md index e832630f..77d093b6 100644 --- a/docs/docs-contributing-building.md +++ b/docs/docs-contributing-building.md @@ -15,14 +15,14 @@ In the repository root, run: ``` -$ cargo build -p javy-core --target=wasm32-wasip1 -r +$ cargo build -p javy-plugin --target=wasm32-wasip1 -r $ cargo build -p javy-cli -r ``` Alternatively if you want to install the `javy` binary globally, at the repository root, run: ``` -$ cargo build -p javy-core --target=wasm32-wasip1 -r +$ cargo build -p javy-plugin --target=wasm32-wasip1 -r $ cargo install --path crates/cli ``` diff --git a/docs/docs-using-extending.md b/docs/docs-using-extending.md index ac460a22..954253a0 100644 --- a/docs/docs-using-extending.md +++ b/docs/docs-using-extending.md @@ -3,10 +3,10 @@ If you want to use Javy for your own project, you may find that the existing code is not sufficient since you may want to offer custom APIs or use different branding for the CLI. The approach we'd recommend taking is to create your own -version of the `javy-cli` and `javy-core` crates (you could fork these if you +version of the `javy-cli` and `javy-plugin` crates (you could fork these if you would like) and depend on the upstream version of the `javy` crate. You can add -your own implementations of custom JS APIs in your fork of the `javy-core` crate -or in a different crate that you depend on in your `javy-core` fork. If you find +your own implementations of custom JS APIs in your fork of the `javy-plugin` crate +or in a different crate that you depend on in your `javy-plugin` fork. If you find that something is missing in the `javy` crate that you require to implement something in your fork, we would appreciate it if you would open a GitHub issue and consider making the change upstream instead of in your fork so all users of @@ -21,8 +21,8 @@ For a visual representation of how we expect forks to consume our crates: ```mermaid flowchart TD your-cli --> wasm - subgraph wasm[your_core.wasm] - your-core --> javy[upstream javy] + subgraph wasm[your_plugin.wasm] + your-plugin --> javy[upstream javy] javy --> rquickjs end ``` diff --git a/wpt/README.md b/wpt/README.md index 2ce4202d..ff244524 100644 --- a/wpt/README.md +++ b/wpt/README.md @@ -31,7 +31,7 @@ Test suites can be added in `test_spec.js`. Individual tests can be ignored by i ## Tips for getting tests to pass - Adding tests to the ignored list is acceptable if there is no intent to support the feature the test is testing. -- We highly recommend running the WPT suite with the `experimental_event_loop` Cargo feature enabled on the `javy-core` crate so tests relying on the event loop are able to pass. +- We highly recommend running the WPT suite with the `experimental_event_loop` Cargo feature enabled on the `javy-plugin` crate so tests relying on the event loop are able to pass. - Strongly consider adding tests in Rust for APIs you're adding to get faster feedback on failures the WPT suite catches while working on a fix. ### If you need to change upstream tests