Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

refactor and simplify CI dart analysis #27370

Merged
merged 6 commits into from
Jul 14, 2021

Conversation

devoncarew
Copy link
Member

@devoncarew devoncarew commented Jul 13, 2021

Refactor and simplify CI dart analysis:

  • remove a no longer used exclude in the top-level analysis options file
  • add a new analysis options file to lib/ui/; this lets us use regular dart analysis in that directory (excluding some code that references a dart library that doesn't yet exist)
  • refactor ci/analyze.sh to use dart analyze instead of the older dartanalyzer tool
  • include lib/web_ui/ in what we analyze from ci/analyze.sh

Note one change from above - we've switched from analyzing the generated artifact "$SRC_DIR/out/host_debug_unopt/gen/sky/bindings/dart_ui/ui.dart" to the source directory "$FLUTTER_DIR/lib/ui". I believe this covers the same code - that the build step doesn't transmute it in some way that we should test - but would like someone to confirm.

@google-cla google-cla bot added the cla: yes label Jul 13, 2021
@devoncarew
Copy link
Member Author

Somewhat related to #27367.

@devoncarew devoncarew marked this pull request as ready for review July 13, 2021 22:01
@devoncarew devoncarew requested review from dnfield and zanderso July 13, 2021 22:01
exclude: [
# this test pretends to be part of dart:ui and results in lots of false
# positives.
testing/dart/window_hooks_integration_test.dart,
Copy link
Contributor

Choose a reason for hiding this comment

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

Woohoo! this file doesn't exist anymore.

ci/analyze.sh Outdated
echo ""

# Analyze dart:ui.
dart analyze "$FLUTTER_DIR/lib/ui"
Copy link
Contributor

Choose a reason for hiding this comment

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

The only thing this might be missing is that the previous way validates that _embedder.yaml generated is correct, whereas this does not. So we will miss if someone messes up _embedder.yaml

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 believe this was previously just validating out/host_debug_unopt/gen/dart-pkg/sky_engine/lib/ui/hooks.dart (and perhaps the part files in out/host_debug_unopt/gen/dart-pkg/sky_engine/lib/ui/ as a side effect)?

Through it would also be good to validate _embedder.yaml for sure.

Copy link
Member

Choose a reason for hiding this comment

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

dart -> "$DART" here and below.

Copy link
Contributor

Choose a reason for hiding this comment

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

This previously validated the whole dart:ui generated library AFAICT. It does not just look at hooks.dart.

ci/analyze.sh Outdated
dart analyze "$FLUTTER_DIR/lib/ui"

# Analyze Flutter web's dart:ui.
(cd "$FLUTTER_DIR/lib/web_ui"; dart pub get)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we somehow avoid running pub get from here? I know we run it below for web_sdk. We're trying to move to doing pub get --offline from gclient sync to avoid random network connection failures messing up various build steps.

Copy link
Contributor

Choose a reason for hiding this comment

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

(I'm taking a quick look to see if I can migrate the pubspec there to work offline)

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 can remove this from the PR? It wasn't validated here before.

I can also switch to using --offline here - I'm not sure how set up the pub cache is at this point. We could also not run pub get, and rely on some other build step running it. I'm not familiar enough w/ the build of this repo to say.

I would like to work towards being able to analyze the dart code in this repo on its own - without it having to be a full gclient checkout and having run a large ninja build. That would enable us to do more pre-submit testing of the dart code in this repo from the dart-lanbg/sdk CI system.

Copy link
Contributor

Choose a reason for hiding this comment

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

The pubspec has some non-trivial deps in it. It'd be good to migrate but will likely take some time.

However, we also run analysis on that target in //lib/web_ui/dev/web_engine_analysis.sh, so it seems like we probably shouldn't be doing it here - at least until it can avoid doing a pub get.

Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to do a full ninja build to analyze dart:ui - you can just build the sky_engine target, which is a pretty small target that mainly just copies files around.

Doing it without a gclient sync is a tougher ask - we really need to do that to make sure we're getting the right dart:* libraries and package dependencies we have from the SDK.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, I removed the web_ui validation from this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dnfield - wrt the sky_engine target - is that just running ninja -v -C out/host_debug_unopt flutter/sky/packages/sky_engine? Or something else?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's correct

Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

ci/analyze.sh Outdated
echo ""

# Analyze dart:ui.
dart analyze "$FLUTTER_DIR/lib/ui"
Copy link
Member

Choose a reason for hiding this comment

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

dart -> "$DART" here and below.

Copy link
Member Author

@devoncarew devoncarew left a comment

Choose a reason for hiding this comment

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

Thanks for the reviews! I removed the web_ui validation, and updated references in the script from dart to "$DART".

ci/analyze.sh Outdated
dart analyze "$FLUTTER_DIR/lib/ui"

# Analyze Flutter web's dart:ui.
(cd "$FLUTTER_DIR/lib/web_ui"; dart pub get)
Copy link
Member Author

Choose a reason for hiding this comment

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

OK, I removed the web_ui validation from this PR.

"$DART" --version
echo ""

"$DART" analyze "$FLUTTER_DIR/lib/ui"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know for sure if we're losing coverage of _embedder.yaml with this or not?

Copy link
Member Author

Choose a reason for hiding this comment

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

This code previously definitely didn't know about directories higher than out/host_debug_unopt/gen/dart-pkg/sky_engine/lib/ui/ - where _embedder.yaml and the other packages it references are. So I don't think we're regressing testing here. I.e., this also doesn't get us testing of _embedder.yaml, but we didn't have that before.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh ok makes sense

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

Lgtm

@zanderso zanderso added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Jul 14, 2021
@fluttergithubbot fluttergithubbot merged commit a7b5522 into flutter:master Jul 14, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 14, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 15, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 15, 2021
flar pushed a commit to flutter/flutter that referenced this pull request Jul 15, 2021
* a7b5522 refactor and simplify CI dart analysis (flutter/engine#27370)

* 137009b Switch test_suites to yaml. (flutter/engine#27368)

* a22a3ca [web] fix a few analysis lints (flutter/engine#27375)

* a02c017 make it work on <API 24 (flutter/engine#27398)

* 0220256 Make FlutterFragment usable without requiring it to be attached to an Android Activity. (Attempt 2) (flutter/engine#27397)

* 51e07a5 [fuchsia] Use FFI to get System clockMonotonic (flutter/engine#27353)

* 4015d8b Roll Skia from 224e3e257d06 to 773a0b8c7e74 (44 revisions) (flutter/engine#27399)

* 7db1a96 [ci.yaml] Add Linux Android Scenarios postsubmit (flutter/engine#27400)

* a02f6bc remove the use of package:isolate (flutter/engine#27401)

* 3237f4f Roll Skia from 773a0b8c7e74 to 36c1804e8f5c (1 revision) (flutter/engine#27402)

* 75af7c8 Roll Dart SDK from ab009483f343 to 746879714c96 (5 revisions) (flutter/engine#27403)

* be21e40 [ci.yaml] Add linux benchmarks, add enabled branches (flutter/engine#27405)

* c8d7a97 Roll Fuchsia Mac SDK from wUg-tGGCL... to uhahzGJ6H... (flutter/engine#27408)

* 3649200 Roll Skia from 36c1804e8f5c to 947a2eb3c043 (7 revisions) (flutter/engine#27410)

* f04d941 [web] enable always_specify_types lint (flutter/engine#27406)

* bdaaa4f [fuchsia] fix race in DefaultSessionConnection (flutter/engine#27377)

* 84247f2 Update the Fuchsia runner to use fpromise instead of fit::promise (flutter/engine#27416)

* 39119d2 Roll Skia from 947a2eb3c043 to 9081276b2907 (6 revisions) (flutter/engine#27426)

* 9002bc7 Roll Skia from 9081276b2907 to 0547b914f691 (2 revisions) (flutter/engine#27430)

* 58e0688 Roll Fuchsia Linux SDK from hykYtaK7D... to s2vrjrfuS... (flutter/engine#27431)

* 1dca887 Roll Dart SDK from 746879714c96 to d53eb1066384 (2 revisions) (flutter/engine#27432)

* c9008f3 Use python to run firebase testlab, do not expect recipe to know location of APK (flutter/engine#27434)

* 8f7c529 Roll Skia from 0547b914f691 to 7d336c9557bd (3 revisions) (flutter/engine#27436)

* 534404e Roll Fuchsia Mac SDK from uhahzGJ6H... to TWPguQ-ow... (flutter/engine#27438)

* 9f13308 Roll Dart SDK from d53eb1066384 to fcbaa0a90b4b (1 revision) (flutter/engine#27439)

* e5e7b94 Roll Skia from 7d336c9557bd to 7dc26fadc90b (2 revisions) (flutter/engine#27440)

* bf3d265 Roll Skia from 7dc26fadc90b to dd561d021470 (1 revision) (flutter/engine#27442)

* 6e62915 [ci.yaml] Add xcode property to ci.yaml (flutter/engine#27415)

* 33c17a1 Roll Skia from dd561d021470 to 0e99fbe5da5c (1 revision) (flutter/engine#27443)

* 0bc2479 Adjust web_sdk rule deps (flutter/engine#27435)

* 7a8969a [web] enable prefer_final_locals lint (flutter/engine#27420)

* 590902b Roll Dart SDK from fcbaa0a90b4b to 207232b5abe0 (1 revision) (flutter/engine#27446)

* 283a42f fuchsia: Log vsync stats in inspect (flutter/engine#27433)

* 4af14b9 Deeplink URI fragment on Android and iOS (flutter/engine#26185)

* 47899db Remove unused generate_dart_ui target (flutter/engine#27445)

* fb265c2 Roll Skia from 0e99fbe5da5c to a2d22b2e085e (3 revisions) (flutter/engine#27447)

* 8bb5760 [ci.yaml] Mark Linux Android Scenarios as flaky (flutter/engine#27422)
moffatman pushed a commit to moffatman/engine that referenced this pull request Aug 5, 2021
naudzghebre pushed a commit to naudzghebre/engine that referenced this pull request Sep 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants