-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
feat(capture_webrender): write webrender revision into text #20320
Conversation
Heads up! This PR modifies the following files:
|
Unfortunately |
|
Let me try to explore if there's way to grab commit sha when bootstrapping. |
cargo.lock contains the revision: Line 3484 in 74d6a91
|
My bad, seems I wasn't correctly searching lockfile. Appreciate for tip, let me try to update PR using it. |
79e2ebb
to
5c5c237
Compare
@jdm appreciate for pointing, PR now updated to include sha from lockfile. |
f76eabb
to
56b9d7e
Compare
.gitignore
Outdated
@@ -23,6 +23,7 @@ Servo.app | |||
.config.mk.last | |||
/glfw | |||
capture_webrender/ | |||
/components/compositing/webrender_revision.rs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason for routing the revision through rust code? could just generate a "wr.txt" and just copy it, alternatively
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I mentioned in PR body if this is an acceptable approach. I wasn't entirely sure about copying text file for cases if user downloaded nightly build wanted to capture it, does lookup generated text file would works with same path resolution to dev build? Thought having constant in build itself will makes those always working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't understand the concern "does lookup generated text file would works with same path resolution to dev build". Please rephrase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's my misunderstanding mostly. in short, does packaged nightly build can lookup where wr.txt same as mach run on dev build?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, I see. So it's a question to package builders on how to make sure "wr.txt" is included. @jdm do you know who forward this to?
As it appears to me, the generated "wr.txt" contains the full repo path in addition to the revision. FYI, this is different from Gecko-generated file which only has the SHA. Not a blocker, just wondering if this is intentional. |
Not an intentional, mostly cause just grabbed (edited): PR updated to grab sha only. |
1e78da6
to
6287a95
Compare
components/compositing/compositor.rs
Outdated
let revision_file_path = capture_path.join("wr.txt"); | ||
|
||
if let Err(err) = create_dir_all(&capture_path) { | ||
println!("Unable to create path '{:?}' for capture: {:?}", capture_path, err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eprintln
@nox because nobody bothered to explore this path yet. In Gecko, the revision was already tracked and maintained in a text file, so all I had to do is move it into a separate file and copy into a capture when requested. If the logic required in Servo is equivalent to just doing it in WR upstream, then let's move it to WR and then we'll patch Gecko to avoid redundant revision tracking. |
Putting it in the public API of WR seems better to me. What do you think? |
If WR exports it, I think consumer(servo) would be easier to read it. Guess I can close this PR? |
@nox wait. Gecko vendors WR dependency, so the |
@kvark Ok. In any case, I'm 0- for what is suggested here. Please use a build script to generate the Rust constant that will hold the revision, let's not have to explicitly run mach to generate it. |
@nox to clarify, "0-" means you are not objecting but not so fond of the change either?
So you don't want to keep track of a separate file and consider the current approach to be good (minus the "eprintln" nit)? I'm fine with that. |
Yes.
My issue isn't about the separate file, but the fact that the generation is made from |
1926571
to
5218910
Compare
6453d9f
to
1818f00
Compare
Updated per review suggestion and rebased to latest master. Let me know anytime if there's thing should followup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from my question about alternate build configurations, this implementation looks solid to me.
components/compositing/build.rs
Outdated
.iter() | ||
.find(|pkg| pkg.get("name").and_then(|name| name.as_str()).unwrap_or("") == "webrender") | ||
.and_then(|pkg| pkg.get("source").and_then(|source| source.as_str())) | ||
.expect("webrender package does not conatin source to read revision"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the build still work if you create an override for webrender in Cargo.toml?
[patch."https://github.com/servo/webrender"]
webrender = { path = "../webrender/webrender" }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried locally by specifying above section in components/composition/cargo.toml
, seems build success without failure. Not sure if I tried correct way to validate this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It belongs in the Cargo.toml in the root of the repository instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, thanks for let me know.
Just tried and build fails with overriding, as updated cargo lock omits source
property to read revision information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in that case we should let the build proceed with a warning that the webrender revision could not be determined, and store a value like <unknown>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, I'll try to update implementation to reflect those cases. Appreciate for let me know.
1818f00
to
5f69773
Compare
|
@bors-servo: r+ |
📌 Commit 5f69773 has been approved by |
feat(capture_webrender): write webrender revision into text <!-- Please describe your changes on the following line: --> Relates to #20315 (comment). This PR try to generate `wr.txt` when trigger webrender capture. By reading gecko's implementation at [here](https://github.com/mozilla/gecko-dev/blob/3b8e63c66ae1989cfc2c7fb48ca9e025a3828e74/gfx/doc/README.webrender#L53), it seems gecko's build script generates txt file for containing revision of webrender and read it each time trigger capturing. In this PR tries to similar in cruxwise with small differences: - `cargo build` reads `cargo.lock`, export it into `${OUT_DIR}/`, included via macro in build time. - when capturing triggered, those revision will be written as `wr.txt`. Probably point of discussion & need to be updated in PR if necessary: ~- Is it acceptable `mach` generates module file on build bootstrapping? Should there be other recommendation?~ Now cargo build takes care of generation. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #20295 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ - This PR manually verified on local mac OS machine. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20320) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
Relates to #20315 (comment).
This PR try to generate
wr.txt
when trigger webrender capture. By reading gecko's implementation at here, it seems gecko's build script generates txt file for containing revision of webrender and read it each time trigger capturing.In this PR tries to similar in cruxwise with small differences:
cargo build
readscargo.lock
, export it into${OUT_DIR}/
, included via macro in build time.wr.txt
.Probably point of discussion & need to be updated in PR if necessary:
- Is it acceptableNow cargo build takes care of generation.mach
generates module file on build bootstrapping? Should there be other recommendation?./mach build -d
does not report any errors./mach test-tidy
does not report any errorsThere are tests for these changes OR
These changes do not require tests because _____
This PR manually verified on local mac OS machine.
This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)