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

[Merged by Bors] - Added a Boa runtime #2743

Closed
wants to merge 2 commits into from
Closed

[Merged by Bors] - Added a Boa runtime #2743

wants to merge 2 commits into from

Conversation

Razican
Copy link
Member

@Razican Razican commented Mar 25, 2023

This Pull Request fixes/closes #718.

It changes the following:

  • Adds a new boa_runtime crate, that will only include console for now
  • Changes the boa_cli crate to use the new boa_runtime crate for the console, instead of the console feature of boa_engine
  • Removes the console feature in boa_engine
  • Adds a new boa_testing helper crate with some useful functions for testing boa. This part duplicates the code from boa_engine, but I could not make boa_engine work with this crate as a dependency due to circular dependencies. Maybe doing it a bit generic could work, but didn't have enough time to check it.

To be checked: wether the WASM example works as expected with the console.

@Razican Razican added builtins PRs and Issues related to builtins/intrinsics API labels Mar 25, 2023
@Razican Razican added this to the v0.17.0 milestone Mar 25, 2023
@github-actions
Copy link

github-actions bot commented Mar 25, 2023

Test262 conformance changes

Test result main count PR count difference
Total 94,591 94,593 +2
Passed 73,210 73,210 0
Ignored 17,530 17,532 +2
Failed 3,851 3,851 0
Panics 0 0 0
Conformance 77.40% 77.39% -0.00%

@codecov
Copy link

codecov bot commented Mar 25, 2023

Codecov Report

Merging #2743 (28c9992) into main (49e39d4) will decrease coverage by 0.05%.
The diff coverage is 33.05%.

@@            Coverage Diff             @@
##             main    #2743      +/-   ##
==========================================
- Coverage   50.99%   50.95%   -0.05%     
==========================================
  Files         419      419              
  Lines       41858    41874      +16     
==========================================
- Hits        21345    21335      -10     
- Misses      20513    20539      +26     
Impacted Files Coverage Δ
boa_cli/src/main.rs 0.76% <0.00%> (-0.04%) ⬇️
boa_engine/src/builtins/mod.rs 100.00% <ø> (ø)
boa_engine/src/context/mod.rs 45.00% <0.00%> (-0.46%) ⬇️
boa_engine/src/vm/call_frame/mod.rs 88.88% <0.00%> (-11.12%) ⬇️
boa_engine/src/vm/code_block.rs 60.65% <0.00%> (-0.23%) ⬇️
boa_examples/src/bin/classes.rs 0.00% <0.00%> (ø)
boa_examples/src/bin/futures.rs 0.00% <0.00%> (ø)
boa_examples/src/bin/loadstring.rs 0.00% <0.00%> (ø)
boa_runtime/src/console/mod.rs 38.11% <11.32%> (ø)
boa_engine/src/lib.rs 78.20% <100.00%> (ø)
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -0,0 +1,73 @@
//! Example runtime for Boa
//!
//! This crate contains an example runtime for the `boa_engine` crate, so that it can be used as a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is a larger discussion, but should we be referring to this as an example runtime or as boa's basic runtime implementation and encourage implementors to use it as a template/build on it for their own needs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only has one builtin for now, so I'm not sure at this point 😅 but I'm open to it, of course

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither am I lol I mainly mention it because the crate is named boa_runtime but it only has console in it. Since there have been issues submitted around a setTimeout implementation, someone may see the crate and immediately think: "oh, it's a runtime" and then get confused. If you're fine with it, then I'm good to merge this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, I would say, let's merge it, and add timeout and all this stuff to it slowly, see how it evolves :)

@jasonwilliams
Copy link
Member

Missed opportunity to call it Boa Time!?

Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Just a small nitpick :)

boa_testing/Cargo.toml Outdated Show resolved Hide resolved
Copy link
Member

@nekevss nekevss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me :)

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think having a public boa_testing crate is a good idea, since the API of that will change constantly while we work on the engine.

I'd very much prefer to move the tests of console into boa_testing and skip publishing the crate, maybe allowing us to migrate our integration tests to that crate in the future.

@Razican
Copy link
Member Author

Razican commented Mar 30, 2023

I don't think having a public boa_testing crate is a good idea, since the API of that will change constantly while we work on the engine.

I'd very much prefer to move the tests of console into boa_testing and skip publishing the crate, maybe allowing us to migrate our integration tests to that crate in the future.

I have skipped publishing of the crate. About moving console tests there, we could do it, but then I would like to have them under #[cfg(test)] so that we keep cargo test working.

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good then!

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, typo on the attribute

boa_testing/Cargo.toml Outdated Show resolved Hide resolved
@jedel1043
Copy link
Member

Now that I think about it, cargo also considers dev dependencies to publish crates, so we cannot exclude boa_testing and also use it as a dev dependency on a published crate.

I know this because I ran cargo publish -p boa_runtime --dry-run and it returned:

no matching package named `boa_testing` found
  location searched: registry `crates-io`

even if boa_testing is only a dev dependency. We have to move the tests from boa_runtime to boa_testing if we don't want to publish it.

@Razican
Copy link
Member Author

Razican commented Mar 31, 2023

Now that I think about it, cargo also considers dev dependencies to publish crates, so we cannot exclude boa_testing and also use it as a dev dependency on a published crate.

I know this because I ran cargo publish -p boa_runtime --dry-run and it returned:

no matching package named `boa_testing` found
  location searched: registry `crates-io`

even if boa_testing is only a dev dependency. We have to move the tests from boa_runtime to boa_testing if we don't want to publish it.

Hmmm, I'm also not fully confident of having "boa_testing" and "boa_tester" as crates, can confuse people. I'll try to make the crate not depend on boa_engine, and if I can't, then I would say we should duplicate the code in boa_runtime, and improve the architecture in the future if needed.

@jedel1043
Copy link
Member

Hmmm, I'm also not fully confident of having "boa_testing" and "boa_tester" as crates, can confuse people. I'll try to make the crate not depend on boa_engine, and if I can't, then I would say we should duplicate the code in boa_runtime, and improve the architecture in the future if needed.

Maybe we could just name it 'tests'? If the crate won't be published anyways, it shouldn't matter if it doesn't have the 'boa_' prefix. It also gives a pretty strong indicator that this crate is not published, only used internally.

@Razican
Copy link
Member Author

Razican commented Apr 12, 2023

Hmmm, I'm also not fully confident of having "boa_testing" and "boa_tester" as crates, can confuse people. I'll try to make the crate not depend on boa_engine, and if I can't, then I would say we should duplicate the code in boa_runtime, and improve the architecture in the future if needed.

Maybe we could just name it 'tests'? If the crate won't be published anyways, it shouldn't matter if it doesn't have the 'boa_' prefix. It also gives a pretty strong indicator that this crate is not published, only used internally.

For now, I've gone through the route of duplicating the code in the boa_runtime crate. This should work while we find a better solution for this where we reduce code duplication, publishing works well, and it still code coverage and cargo test work.

Feel free to review it again, as I have rebased the code :)

Cargo.toml Show resolved Hide resolved
@Razican
Copy link
Member Author

Razican commented Apr 15, 2023

I re-based and ran "cargo update", which updated ICU to 1.2.0. Unfortunately, they have broken backwards compatibility, first with this: unicode-org/icu4x#3332, but then, I replaced the imports, and I now get a bunch of compile errors.

So, it seems that 1.2.0 is not backwards compatible with 1.1.0. I have pinned 1.1.0 for now.

This should probably be reviewed & merged :) Missing @jedel1043's confirmation

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can merge as it is, we'll try to deduplicate the tests logic in the future. Nice work!

@HalidOdat
Copy link
Member

bors r+

@bors
Copy link

bors bot commented Apr 18, 2023

Merge conflict.

@Razican
Copy link
Member Author

Razican commented Apr 23, 2023

I have rebased this, and reverted bitflags, since bitflags 2.2.0 was yanked. I think we can merge it now (if all tests pass)

Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Lets merge this! :)

@HalidOdat
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Apr 24, 2023
This Pull Request fixes/closes #718.

It changes the following:

- Adds a new `boa_runtime` crate, that will only include `console` for now
- Changes the `boa_cli` crate to use the new `boa_runtime` crate for the console, instead of the `console` feature of `boa_engine`
- Removes the `console` feature in `boa_engine`
- Adds a new `boa_testing` helper crate with some useful functions for testing `boa`. This part duplicates the code from `boa_engine`, but I could not make `boa_engine` work with this crate as a dependency due to circular dependencies. Maybe doing it a bit generic could work, but didn't have enough time to check it.

To be checked: wether the WASM example works as expected with the console.
@bors
Copy link

bors bot commented Apr 24, 2023

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Added a Boa runtime [Merged by Bors] - Added a Boa runtime Apr 24, 2023
@bors bors bot closed this Apr 24, 2023
@bors bors bot deleted the runtime branch April 24, 2023 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API builtins PRs and Issues related to builtins/intrinsics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split WebAPI (environment) built-in objects from the ES builtin objects.
5 participants