Skip to content

Commit

Permalink
Rename javy-core to javy-plugin (#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffcharles authored Nov 1, 2024
1 parent 40b6883 commit 2037ce1
Show file tree
Hide file tree
Showing 18 changed files with 54 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
10 changes: 5 additions & 5 deletions .github/workflows/build-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:

compile_cli:
name: compile_cli-${{ matrix.name }}
needs: compile_core
needs: compile_plugin
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
cli:
name: test_cli
runs-on: ubuntu-latest
needs: core
needs: plugin
steps:
- uses: actions/checkout@v4

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cli-features.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/wpt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 9 additions & 9 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[workspace]
members = [
"crates/javy",
"crates/core",
"crates/cli",
"crates/javy",
"crates/plugin",
"crates/plugin-api",
"crates/test-macros",
"crates/runner",
Expand Down
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: cli core test fmt clean
.PHONY: cli plugin test fmt clean
.DEFAULT_GOAL := cli

install:
Expand All @@ -11,45 +11,45 @@ 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

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
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn read_file(path: impl AsRef<Path>) -> Result<Vec<u8>> {
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)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion crates/core/Cargo.toml → crates/plugin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "javy-core"
name = "javy-plugin"
version = "0.2.0"
authors.workspace = true
edition.workspace = true
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions docs/docs-contributing-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/docs-contributing-building.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
10 changes: 5 additions & 5 deletions docs/docs-using-extending.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
```
2 changes: 1 addition & 1 deletion wpt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2037ce1

Please sign in to comment.