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

create a config facade #15919

Closed
wants to merge 2 commits into from
Closed

Conversation

@karan1276
Copy link
Contributor

karan1276 commented Mar 12, 2017

Ref: #15460


  • ./mach build -d does not report any errors

  • ./mach test-tidy does not report any errors

  • These changes fix #15460(github issue number if applicable).

  • These changes do not require tests because no new functionality is added. Existing test should cover all the changes.


This change is Reviewable

@highfive
Copy link

highfive commented Mar 12, 2017

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @cbrewster (or someone else) soon.

@highfive
Copy link

highfive commented Mar 12, 2017

Heads up! This PR modifies the following files:

  • @bholley: components/style/lib.rs, components/style/servo_config_facade.rs, components/style/stylesheets.rs, components/style/traversal.rs, components/style/context.rs, components/style/matching.rs
  • @emilio: components/style/lib.rs, components/style/servo_config_facade.rs, components/style/stylesheets.rs, components/style/traversal.rs, components/style/context.rs, components/style/matching.rs
@highfive
Copy link

highfive commented Mar 12, 2017

warning Warning warning

  • These commits modify style code, but no tests are modified. Please consider adding a test!
@karan1276
Copy link
Contributor Author

karan1276 commented Mar 12, 2017

./mach build-geckolib --verbose gives an error i am not able to debug, it says:
error: could not execute process rustc -vV (never executed)

If someone can help that will be great

@nox nox added the S-needs-squash label Mar 13, 2017
Copy link
Member

canova left a comment

It looks like the problem is the use statement as I mentioned in the comment below.
Also nox suggested to make this name simply config instead of servo_config_facade. Could you change this?

/* Ref: https://github.com/servo/servo/issues/15460 for more info for why it's needed. */

// TODO: write docs for this mod
use servo_config;

This comment has been minimized.

@canova

canova Mar 15, 2017

Member

You've changed the extern crate servo_config; to #[cfg(feature = "servo")] extern crate servo_config; in components/style/lib.rs.
In gecko build it tries to find this crate but fails. You can either add a cfg to this use statement or you can simply add related use statements inside servo functions.(as Manishearth wrote in issue example.)

This comment has been minimized.

@karan1276

karan1276 Mar 17, 2017

Author Contributor

aah, that explains it. I think ill add an cfg. Just curious, how did you debug that because error did not log anything

This comment has been minimized.

@canova

canova Mar 17, 2017

Member

rustc should give you an error like this when you run ./mach build-geckolib:

error[E0432]: unresolved import `servo_config`
  --> /Users/canova/projects/servo/components/style/config.rs:11:5
   |
11 | use servo_config;
   |     ^^^^^^^^^^^^ no `servo_config` in the root

error: aborting due to previous error

What OS do you use? If this didn't show up, maybe it was a rustc bug?

* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* Ref: https://github.com/servo/servo/issues/15460 for more info for why it's needed. */

This comment has been minimized.

@canova

canova Mar 15, 2017

Member

I think adding a brief explanation about this module with //! comments would be better instead.

@KiChjang
Copy link
Member

KiChjang commented Mar 15, 2017

I'm still not comfortable calling it a facade.

@karan1276
Copy link
Contributor Author

karan1276 commented Mar 17, 2017

@KiChjang I am fine calling it anything. Maybe you and @Manishearth can talk and come to a conclusion ?

@KiChjang
Copy link
Member

KiChjang commented Mar 17, 2017

In the issue, @nox suggested to call it config instead, and there seemed to be no objections from anyone.

@karan1276
Copy link
Contributor Author

karan1276 commented Mar 17, 2017

Okay, cool 👍

* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/*
* servo_config is a crate in components/config that pulls in a lot of random stuff. In gecko mode,

This comment has been minimized.

@canova

canova Mar 17, 2017

Member

Rustdoc uses //! for module or crate level documentation. Could you convert /* .. */ to that please? With this change you can remove the #[allow(missing_docs)] attribute in the
#[allow(missing_docs)] pub mod config; line. Also we will be able to see this comment in the doc.servo.org after this.

nit: also it would be wonderful if you can shorten these lines to match license length while you're here.

/* Ref: https://github.com/servo/servo/issues/15460 for more info for why it's needed. */

// TODO: write docs for this mod
use servo_config;

This comment has been minimized.

@canova

canova Mar 17, 2017

Member

rustc should give you an error like this when you run ./mach build-geckolib:

error[E0432]: unresolved import `servo_config`
  --> /Users/canova/projects/servo/components/style/config.rs:11:5
   |
11 | use servo_config;
   |     ^^^^^^^^^^^^ no `servo_config` in the root

error: aborting due to previous error

What OS do you use? If this didn't show up, maybe it was a rustc bug?

#[cfg(feature = "servo")] use servo_config;

// prefs functions
#[cfg(feature = "servo")] #[allow(missing_docs)]

This comment has been minimized.

@canova

canova Mar 17, 2017

Member

nit: I'm not comfortable with these #[allow(missing_docs)] attributes but it's OK, I guess. At least we can move them to a separate line maybe?

@bors-servo
Copy link
Contributor

bors-servo commented Mar 19, 2017

The latest upstream changes (presumably #16014) made this pull request unmergeable. Please resolve the merge conflicts.

@cbrewster
Copy link
Member

cbrewster commented Mar 24, 2017

This looks good, maybe address @canaltinova's comment about either documenting the settings or moving the no_doc to a new line
There some tidy failures:

Checking files for tidiness...
./components/style/matching.rs:27: use statement is not in alphabetical order
	expected: selectors::matching::AFFECTED_BY_PSEUDO_ELEMENTS
	found: config
./components/style/stylesheets.rs:22: use statement is not in alphabetical order
	expected: selectors::parser::SelectorList
	found: config
./components/style/traversal.rs:16: use statement is not in alphabetical order
	expected: selector_parser::RestyleDamage
	found: config
@KiChjang
Copy link
Member

KiChjang commented Mar 24, 2017

Please also remove the merge commit.

@karan1276
Copy link
Contributor Author

karan1276 commented Mar 24, 2017

Actually i tried to rebase 2-3 times but always mess it up. There are conflicts at same line for multiple commits. It gets really difficult to remove just the right change.

merge on the other hand just compares final results and points out all conflicts in one go. If it's not really a big issue i would suggest we go for a merge here.

@wafflespeanut
Copy link
Member

wafflespeanut commented Mar 25, 2017

No, we don't allow merge commits in general because it's a result of an improper (or absence of) rebase. If you want help with it, please ask.

@karan1276
Copy link
Contributor Author

karan1276 commented Mar 25, 2017

Yes it will be awesome if you can help.

@canova
Copy link
Member

canova commented Mar 25, 2017

https://github.com/servo/servo/wiki/Beginner's-guide-to-rebasing-and-squashing

I think this guide is very good for explaining how to do rebase and squash. But for this specific situation here's how I would do it:

First you need to delete this merge commit and squash others with interactive rebase:
git rebase -ip HEAD~9
-i tells that you want to use interactive rebase, and -p tells to preserve merge commits.
This will open an editor that you can manipulate the commits. You can delete the merge commit with deleting its line. And you should write the fixup or f keyword instead of pick to other commits except the first commit. Fixup will merge the commits into previous ones and they will become one.
When you save and exit, rebase will take care of it. And you will have just one commit. After that, you will need to fetch and rebase again like this:
git pull upstream master --rebase (you should replace upstream with your servo/servo remote name)
During rebase, some conflicts will happen. You should resolve the conflicts and git add <file> them. After that, you can write git rebase --continue and you are done.

Let us know if you still have questions. Or we can do it for you if you check the "Allow edits from maintainers" checkbox.

@karan1276
Copy link
Contributor Author

karan1276 commented Mar 27, 2017

@canaltinova Thanks! That's a good strategy. I won't follow it exactly but i will first squash and then rebase. I don't want to do them together because i suspect squash will have it's own conflicts(maybe not, not sure) and then rebase will defiantly have conflicts. And it's easier for me to handle them separately.

Thanks again

@canova
Copy link
Member

canova commented Mar 27, 2017

Yes, you can probably try to delete merge commit with git rebase -ip HEAD~2 first and then proceed to squash them. I don't think you will have merge conflicts during squash but it would be easier.

@bors-servo
Copy link
Contributor

bors-servo commented Apr 3, 2017

The latest upstream changes (presumably #16241) made this pull request unmergeable. Please resolve the merge conflicts.

@karan1276 karan1276 force-pushed the karan1276:karan_config_facade branch from cb93038 to 978f945 Apr 4, 2017
@jdm
Copy link
Member

jdm commented Apr 4, 2017

./mach test-tidy says:

./components/style/matching.rs:26: use statement is not in alphabetical order
	expected: selectors::matching::AFFECTED_BY_PSEUDO_ELEMENTS
	found: config
./components/style/stylesheets.rs:31: use statement is not in alphabetical order
	expected: selectors::parser::SelectorList
	found: config
./components/style/traversal.rs:16: use statement is not in alphabetical order
	expected: selector_parser::RestyleDamage
	found: config
@bors-servo
Copy link
Contributor

bors-servo commented Apr 7, 2017

The latest upstream changes (presumably #16297) made this pull request unmergeable. Please resolve the merge conflicts.

@karan1276
Copy link
Contributor Author

karan1276 commented Apr 7, 2017

These conflicts will pop up every time there is a merge in master. I would resolve them at the end just before this PR gets merged. Are there any other outstanding issues except for the conflicts?

@cbrewster
Copy link
Member

cbrewster commented Apr 7, 2017

this looks good if you address @canaltinova's comment about converting /* ... */ to //! and rebase/squash

@karan1276
Copy link
Contributor Author

karan1276 commented Apr 11, 2017

some changes in #16297 are pretty major, ill remove conflicts but be cautious while reviewing

@karan1276 karan1276 force-pushed the karan1276:karan_config_facade branch from 6a1caa4 to 8ad84f7 Apr 11, 2017
Copy link
Member

canova left a comment

Oh, it looks like c857878 implemented something like this. Sorry about that :/ I don't know whether we should still continue to this or not.

impl TraversalStatistics {
/// Returns whether statistics dumping is enabled.
pub fn should_dump() -> bool {

This comment has been minimized.

@canova

canova Apr 11, 2017

Member

It looks like you removed the function header here.

impl TraversalStatistics {
/// Returns whether statistics dumping is enabled.
pub fn should_dump() -> bool {
shall_stat_style_sharing()
*DUMP_STYLE_STATISTICS || config::style_sharing_stats_enabled()

This comment has been minimized.

@canova

canova Apr 11, 2017

Member

This looks wrong. Currently servo returns opts::get().style_sharing_stats and gecko returns *DUMP_STYLE_STATISTICS. We need to preserve that behavior. You should remove the *DUMP_STYLE_STATISTICS || from here and return *DUMP_STYLE_STATISTICS in gecko's style_sharing_stats_enabled function.

if is_share_style_cache_disabled() {
=======
if config::disable_share_style_cache_enabled() {
>>>>>>> Change code for serialization for {box,text}-shadow so blur-radius

This comment has been minimized.

@canova

canova Apr 11, 2017

Member

There is a merge conflict here.


if traversal_flags.for_reconstruct() {
if cfg!(feature = "servo") && config::nonincremental_layout_enabled() {

This comment has been minimized.

@canova

canova Apr 11, 2017

Member

Why did you remove traversal_flags.for_reconstruct()?

@bors-servo
Copy link
Contributor

bors-servo commented Apr 12, 2017

The latest upstream changes (presumably #16358) made this pull request unmergeable. Please resolve the merge conflicts.

@karan1276
Copy link
Contributor Author

karan1276 commented Apr 12, 2017

Oh, it looks like c857878 implemented something like this. Sorry about that :/ I don't know whether we should still continue to this or not.

Yup, you are probably right. Maybe you can tell me for sure if this pr is needed anymore ? If not then lets just shut it right away, why spend more time.

@cbrewster
Copy link
Member

cbrewster commented Apr 22, 2017

Closing as it looks like this is already implemented.

@cbrewster cbrewster closed this Apr 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

9 participants
You can’t perform that action at this time.