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

Refactor and polish the 'felt' tool #12258

Merged
merged 5 commits into from Sep 16, 2019
Merged

Conversation

mdebbar
Copy link
Contributor

@mdebbar mdebbar commented Sep 12, 2019

  1. Various functionalities offered by this tool are now organized into commands (e.g. felt test, felt check-licenses).
  2. The felt tool can now be invoked from anywhere, not necessarily from the web_ui directory.
  3. This new structure helps us scale better as we add more commands (e.g. soon a build/watch command is coming).

}

@override
String get name => 'chrome-installer';
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we adopt verbs instead of nouns for command names? "install-chrome", "test", etc.

@@ -44,4 +44,4 @@ then
ninja -C $HOST_DEBUG_UNOPT_DIR
fi

(cd $WEB_UI_DIR && $DART_SDK_DIR/bin/dart dev/felt.dart $@)
($DART_SDK_DIR/bin/dart "$DEV_DIR/felt.dart" $@)
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems you don't need the parens any more

_checkExitCode();
}
@override
final String name = 'tests';
Copy link
Contributor

Choose a reason for hiding this comment

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

How about "test"?


class LicensesCommand extends Command<bool> {
@override
final String name = 'licenses';
Copy link
Contributor

Choose a reason for hiding this comment

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

How about "check-licenses"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Too long? 😛

Copy link
Contributor

Choose a reason for hiding this comment

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

I imagine it will be used infrequently. Instead, we'll probably have a felt presubmit that we'll encourage everyone to run before sending a PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made the change anyway :)

import 'environment.dart';

class FilePath {
FilePath.fromCwd(String filePath) : _path = path.absolute(filePath);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I'd call it FilePath.relativeToCwd and rename filePath to relativePath.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In case you haven't noticed, there are getters called relativeToCwd and relativeToWebUi. If I rename the constructors, what should I call the getters, any idea?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, nvm then. "From" seems to convey the meaning just fine.

lib/web_ui/dev/utils.dart Outdated Show resolved Hide resolved
FilePath.fromWebUi(String filePath)
: _path = path.join(environment.webUiRootDir.path, filePath);

final String _path;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be called _absolutePath to be absolutely clear :)


@override
bool operator ==(dynamic other) {
if (other is String) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, not sure about this :/ Equality is supposed to be symmetric.

@@ -44,4 +44,4 @@ then
ninja -C $HOST_DEBUG_UNOPT_DIR
fi

(cd $WEB_UI_DIR && $DART_SDK_DIR/bin/dart dev/felt.dart $@)
($DART_SDK_DIR/bin/dart "$DEV_DIR/felt.dart" $@)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add set -e at the top of the script so it doesn't keep on truckin' when intermediate commands fail?

final List<String> validationErrors = <String>[];
scene.debugValidate(validationErrors);
if (validationErrors.isNotEmpty) {
print('ENGINE LAYER TREE INCONSISTENT:\n'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yjbanov FYI this is spamming our test output so I'll skip it in test mode.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is trying to surface a problem though. I was meaning to look into it.

runner.printUsage();
io.exit(64); // Exit code 64 indicates a usage error.
} else if (!result) {
if (result == false) {
print('Command returned false: `felt ${args.join(' ')}`');
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, it's not the felt ARGS that returned false but a sub-command, so more like Sub-command returned false: ${args.join(' '}

@mdebbar mdebbar merged commit 968c3aa into flutter:master Sep 16, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 16, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Sep 16, 2019
git@github.com:flutter/engine.git/compare/2c4ed36c60ae...8a8610a

git log 2c4ed36..8a8610a --no-merges --oneline
2019-09-16 liyuqian@google.com Implement Base32Decode (flutter/engine#12253)
2019-09-16 liyuqian@google.com Reland "Smooth out iOS irregular input events delivery (#11817)" (flutter/engine#12280)
2019-09-16 mouad.debbar@gmail.com Refactor and polish the 'felt' tool (flutter/engine#12258)


If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jimgraham@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
@mdebbar mdebbar deleted the felt_commands branch September 17, 2019 19:57
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Sep 30, 2019
git@github.com:flutter/engine.git/compare/2c4ed36c60ae...8a8610a

git log 2c4ed36..8a8610a --no-merges --oneline
2019-09-16 liyuqian@google.com Implement Base32Decode (flutter/engine#12253)
2019-09-16 liyuqian@google.com Reland "Smooth out iOS irregular input events delivery (flutter#11817)" (flutter/engine#12280)
2019-09-16 mouad.debbar@gmail.com Refactor and polish the 'felt' tool (flutter/engine#12258)


If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jimgraham@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants