这是indexloc提供的服务,不要输入任何密码
Skip to content

Migrate analyze_size to null safety #81002

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

Merged
merged 1 commit into from
Apr 26, 2021
Merged

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Apr 22, 2021

Part of #71511

@jmagman jmagman added c: contributor-productivity Team-specific productivity, code health, technical debt. tool Affects the "flutter" command-line tool. See also t: labels. a: null-safety Support for Dart's null safety feature labels Apr 22, 2021
@jmagman jmagman self-assigned this Apr 22, 2021
@google-cla google-cla bot added the cla: yes label Apr 22, 2021
Comment on lines +58 to +60
if (decodedAotSnapshot == null) {
throwToolExit('AOT snapshot is invalid for analysis');
}
Copy link
Member Author

@jmagman jmagman Apr 22, 2021

Choose a reason for hiding this comment

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

I can't imagine this ever being null (more likely a FormatException) but just in case. I added a test for it.

}
final Map<String, Object?> processedAotSnapshotJson = treemapFromJson(decodedAotSnapshot);
final _SymbolNode? aotSnapshotJsonRoot = _parseAotSnapshot(processedAotSnapshotJson);
if (aotSnapshotJsonRoot != null) {
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 mostly ignored null nodes or missing keys instead of throwing, I can change it if we want to be more aggressive with the expected formatting instead of silently handling it, if preferred.

import 'test_utils.dart';

const String apkDebugMessage = 'A summary of your APK analysis can be found at: ';
const String iosDebugMessage = 'A summary of your iOS bundle analysis can be found at: ';
const String runDevToolsMessage = 'flutter pub global activate devtools; flutter pub global run devtools ';

void main() {
testWithoutContext('--analyze-size flag produces expected output on hello_world for Android', () async {
testUsingContext('--analyze-size flag produces expected output on hello_world for Android', () async {
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 didn't even pass locally on master, it needs the context shutdown hook.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is definitely running on CI right? How would it be passing otherwise

Copy link
Member Author

@jmagman jmagman Apr 22, 2021

Choose a reason for hiding this comment

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

It passes on CI but not locally because the code that uses the context is in getFlutterRoot, which gets bypassed on LUCI because FLUTTER_ROOT is set. I explained it a bit more in #79975.

Really I need to fix the underlying problem, but I've prioritized patching up these integration tests with testUsingContext so I can at least run them locally.

@jmagman jmagman requested a review from jonahwilliams April 22, 2021 22:53
Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

  • The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@jmagman jmagman force-pushed the analyze-size-null branch from b77b45b to e95617d Compare April 23, 2021 22:49
@jmagman jmagman merged commit 8d3bc18 into flutter:master Apr 26, 2021
@jmagman jmagman deleted the analyze-size-null branch April 26, 2021 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: null-safety Support for Dart's null safety feature c: contributor-productivity Team-specific productivity, code health, technical debt. tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants