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

Use moztools instead of mozilla-build #368

Merged
merged 3 commits into from
Sep 4, 2023
Merged

Conversation

sagudev
Copy link
Member

@sagudev sagudev commented Aug 17, 2023

This makes mozjs on windows more standalone and allows to remove presetting variables in servo.

Servo's ./mach bootstrap can still download moztools and mozjs will use downloaded moztools if they are right version.

WIP because I still need to make companion PR for servo.

Fixes #300
Supersedes #326 & #356

@mrobinson
Copy link
Member

mrobinson commented Aug 17, 2023

This is a nice change!

Some suggestions:

  1. Can you have build.rs not download anything yet, but focus on whether or not to do that in a followup? Just download Servo's Mozilla tools in the GitHub action. That way we have two clean changes:
    • Switch to Servo's packaged tools.
    • Decide if we want build.rs to take care of that.
  2. The documentation should be updated to reflect this change.
  3. Let's move the changes to the actions unrelated to this change to a new PR (not running actions in forks).

@sagudev
Copy link
Member Author

sagudev commented Aug 17, 2023

  1. This could be problematic as if we switch to moztools but do not implement downloading step the in this middle commit users needs to manually set MOZ_TOOLS_PATH or manually download moztools and extract it to target/dependencies, so I think it would be better to have it in same change.
  2. Will do!
  3. Run CI only on master in upstream but everywhere in forks #369

@mrobinson
Copy link
Member

  1. This could be problematic as if we switch to moztools but do not implement downloading step the in this middle commit users needs to manually set MOZ_TOOLS_PATH or manually download moztools and extract it to target/dependencies, so I think it would be better to have it in same change.

This is the status quo with MozillaBuild so I think it's fine to keep this behavior for now. I think we should hold off on the download step...because we really haven't decided what to do with this dependency. For instance, maybe we could convert it into a crate and avoid having to do a manual download at all.

@sagudev
Copy link
Member Author

sagudev commented Aug 17, 2023

  1. This could be problematic as if we switch to moztools but do not implement downloading step the in this middle commit users needs to manually set MOZ_TOOLS_PATH or manually download moztools and extract it to target/dependencies, so I think it would be better to have it in same change.

This is the status quo with MozillaBuild so I think it's fine to keep this behavior for now. I think we should hold off on the download step...because we really haven't decided what to do with this dependency. For instance, maybe we could convert it into a crate and avoid having to do a manual download at all.

Using mozilla-build was easier as you can just simply install mozilla-build using installer and open mozilla-build shell (like you would do if you wanted to develop for firefox) and run commands from there. Manually setting MOZILLA_BUILD was just a trick to simulate mozilla-build env in github actions where you cannot open mozilla-build shell to run commands.

@sagudev sagudev force-pushed the moztool branch 2 times, most recently from 9acc49f to 2882c4a Compare August 17, 2023 10:54
mozjs/build.rs Outdated Show resolved Hide resolved
mozjs/build.rs Outdated Show resolved Hide resolved
mozjs/build.rs Outdated Show resolved Hide resolved
mozjs/build.rs Outdated Show resolved Hide resolved
mozjs/build.rs Outdated Show resolved Hide resolved
mozjs/build.rs Outdated Show resolved Hide resolved
@sagudev sagudev force-pushed the moztool branch 2 times, most recently from 288ac5e to cece0e2 Compare August 17, 2023 11:19
mozjs/build.rs Outdated Show resolved Hide resolved
mozjs/build.rs Outdated Show resolved Hide resolved
Copy link
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

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

I think we should not download moztools in build.rs. In addition the comments above, this introduces a hidden dependency on cURL to build this crate. Let's just do the minimal change here and require that it be unzipped ahead of time and an environment variable set.

@sagudev
Copy link
Member Author

sagudev commented Aug 17, 2023

In addition the comments above, this introduces a hidden dependency on cURL to build this crate.

Curl is installed on every Win10+ system by default otherwise we could just depend on some rust crate for downloading.

I already have separation per commits, but now I would like to test with servo first and then do changes here.

@sagudev
Copy link
Member Author

sagudev commented Aug 18, 2023

Successful servo test here: https://github.com/sagudev/servo/actions/runs/5899499296

@sagudev sagudev marked this pull request as ready for review August 18, 2023 08:27
@sagudev sagudev requested a review from mrobinson August 18, 2023 08:27
@Redfire75369
Copy link
Contributor

Redfire75369 commented Aug 18, 2023

I think this should accept either MOZ_TOOLS_PATH or MOZILLA_BUILD aa the env variable for backwards compatibility. Mainly outside of servo, this could be pretty annoying as a change.

My suggestion is env::var_os("MOZ_TOOLS_PATH").or_else(|| env::var_os("MOZILLA_BUILD").

@sagudev
Copy link
Member Author

sagudev commented Aug 18, 2023

I think this should accept either MOZ_TOOLS_PATH or MOZILLA_BUILD aa the env variable for backwards compatibility. Mainly outside of servo, this could be pretty annoying as a change.

You are right, while we are still on moztools-3.2 we can still support MozillaBuild 3.2+

@sagudev
Copy link
Member Author

sagudev commented Aug 25, 2023

@mrobinson any progress?

Copy link
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

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

Sorry for the delay in reviewing. This looks good to me. The one larger change I think we should have apart from the small things below is that we should update the README to explain downloading, unzipping, and setting the environment variable for moztools. Thanks!

mozjs/build.rs Outdated Show resolved Hide resolved
mozjs/build.rs Outdated Show resolved Hide resolved
.github/workflows/rust.yml Outdated Show resolved Hide resolved
mozjs/build.rs Outdated Show resolved Hide resolved
Copy link
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

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

Sorry, a couple other tiny things.

mozjs/build.rs Outdated Show resolved Hide resolved
mozjs/build.rs Outdated Show resolved Hide resolved
ObjectOpResult {
code_: ObjectOpResult_SpecialCodes::Uninitialized as usize,
}
ObjectOpResult { code_: ObjectOpResult_SpecialCodes::Uninitialized as usize }
Copy link
Member

Choose a reason for hiding this comment

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

Were these changes added by mistake?

Copy link
Member Author

Choose a reason for hiding this comment

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

I run cargo fmt and I guess this was not formatted properly before.

Copy link
Member

@mrobinson mrobinson 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, thanks!

auto-merge was automatically disabled August 31, 2023 10:45

Head branch was pushed to by a user without write access

@sagudev
Copy link
Member Author

sagudev commented Aug 31, 2023

Failures are not my fault: actions/runner-images#8125

@mrobinson mrobinson added this pull request to the merge queue Sep 4, 2023
Merged via the queue into servo:master with commit 8dcf64e Sep 4, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI broken with mozilla-build 4.0
3 participants