Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upstyle/gfx/metrics/script crates serialize build #19422
Comments
|
The one need to move it one by one or finish it in one time? |
|
Moving one by one shouldn't hurt anything. |
|
OK! I will work on this. |
|
@jdm if some codes in |
|
ummm... I think they should all be moved, otherwise |
|
Exactly. If it's moved from gfx to gfx_traits, the other crates that depend on the move items should be updated to use gfx_traits. |
|
This issue is much harder than I though before. Actually almost everything depend on each other. For example, If I want to move So, in this case, we can make sure moving more something from |
|
Try creating a trait that can replace https://dxr.mozilla.org/servo/source/components/metrics/lib.rs#306-315. That trait can live in gfx_traits, and the implementation in gfx. |
|
I don't understand. If we move that code to |
|
No, because metrics would depend on gfx_traits, and gfx would depend on gfx_traits. |
|
That code use |
|
The code in metrics is calculating a boolean value using the display list types from gfx. The types do not need to move - we can create a trait in gfx_traits that encapsulates the calculation in a method, and implement the trait on the types in gfx. The code in metrics only needs to refer to the trait. |
|
@tigercosmos Is this still being worked on? |
|
@KiChjang NO. I can't handle this. I didn't understand how to do. |
|
I'd like to take a shot at this then. |
|
Please do! |
|
I opened a pull request for the gfx-metrics part. But style-gfx seems a lot harder because there is non zero amount of metaprogramming in the style crate and I would be really happy about some pointers what's going on there. gfx depends mainly on font_weight and some other font related structs, but I don't really get where they get declared. |
|
The various mako.rs files under style/properties/ are Python Mako templates that generate Rust code. font_weight is defined in style/properties/longhand/font.mako.rs, and it invokes Python code from style/properties/helpers.mako.rs. However, it may be possible to modify the imports from gfx to directly import |
Decouple metrics and gfx Added gfx_traits::DisplayList so metrics doesn't depend on the gfx crate for gfx::display_list::DisplayList. --- <!-- 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 #19422 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because succesful compilation should be enough <!-- 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/19755) <!-- Reviewable:end -->
|
I'm working on removing the style dependency from gfx, but am currently stuck fighting the rust compiler. The problem is that |
|
@streichgeorg Could you push your code to a branch so it's easier to understand the problems that you're facing? |
|
Sure |
|
The name of the branch is |
|
Here is what I propose:
There should be no need to mess with traits for that change; the code in gfx can use the type defined in style_traits directly, and style will continue to use the same type implicitly by reexporting it with the same name in its old location. |
|
Oh I see, style_traits isn't really all about traits. |
|
(Renaming those |
|
Reopening since this seems to not have been solved yet. |
|
#19934 was an unfinished PR to address this. |
This was done at some point, meaning that the only intermediate dependency between The above is a screenshot of This feels good enough for me, so closing. |
I tried `cargo graph` and some of its successors, but didn’t manage to make them produce what I wanted (or in some cases make them work at all.) This Python script reimplements similar functionality based on parsing the (JSON) output of `cargo metadata`. Graphviz graphs can become hard to read very quickly as the number of nodes grows. Servo’s dependency graph is very large, so pruning as much as possible is important. This only shows `path` dependencies (that have their source in this repo), and can take a parameter to only show recursive dependencies of a given crate. See #19422 (comment) for an example. I find that `xdot` is best for visualization since it is interactive. This script is not used by anything. I am making this PR only so that we have it somewhere in case it becomes useful again at some point.
Add a minimal alternative to `cargo graph` I tried `cargo graph` and some of its successors, but didn’t manage to make them produce what I wanted (or in some cases make them work at all.) This Python script reimplements similar functionality based on parsing the (JSON) output of `cargo metadata`. Graphviz graphs can become hard to read very quickly as the number of nodes grows. Servo’s dependency graph is very large, so pruning as much as possible is important. This only shows `path` dependencies (that have their source in this repo), and can take a parameter to only show recursive dependencies of a given crate. See #19422 (comment) for an example. I find that `xdot` is best for visualization since it is interactive. This script is not used by anything. I am making this PR only so that we have it somewhere in case it becomes useful again at some point.
Add a minimal alternative to `cargo graph` I tried `cargo graph` and some of its successors, but didn’t manage to make them produce what I wanted (or in some cases make them work at all.) This Python script reimplements similar functionality based on parsing the (JSON) output of `cargo metadata`. Graphviz graphs can become hard to read very quickly as the number of nodes grows. Servo’s dependency graph is very large, so pruning as much as possible is important. This only shows `path` dependencies (that have their source in this repo), and can take a parameter to only show recursive dependencies of a given crate. See #19422 (comment) for an example. I find that `xdot` is best for visualization since it is interactive. This script is not used by anything. I am making this PR only so that we have it somewhere in case it becomes useful again at some point.
I tried `cargo graph` and some of its successors, but didn’t manage to make them produce what I wanted (or in some cases make them work at all.) This Python script reimplements similar functionality based on parsing the (JSON) output of `cargo metadata`. Graphviz graphs can become hard to read very quickly as the number of nodes grows. Servo’s dependency graph is very large, so pruning as much as possible is important. This only shows `path` dependencies (that have their source in this repo), and can take a parameter to only show recursive dependencies of a given crate. See servo#19422 (comment) for an example. I find that `xdot` is best for visualization since it is interactive. This script is not used by anything. I am making this PR only so that we have it somewhere in case it becomes useful again at some point.

script depends on metrics, and metrics depends on gfx, and gfx depends on style (script also depends on style). If we move the bits of style that gfx depends upon into style_traits, and possibly the bits of gfx that metrics depends upon into gfx_traits, this should allow more crates to build in parallel.