Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

add a --dart-sdk option to the repo analysis command #3959

Merged
merged 4 commits into from
May 24, 2021

Conversation

devoncarew
Copy link
Member

This PR adds an option to the 'flutter_plugin_tools analyze' command which allows you to replace the Dart SDK used to analyze the code. This will enable a Dart SDK built from head to analyze this repo; which will enable upstream testing of this repo before changes are committed to Dart's static analysis. Here's the delta to the current UI:

Analyzes all packages using dart analyze.

This command requires "dart" and "flutter" to be in your path.

Usage: pub global run flutter_plugin_tools analyze [arguments]

...

    --dart-sdk=<dart-sdk-path>                An optional path to a Dart SDK; this is used to override the SDK used to provide analysis.

Run "pub global run flutter_plugin_tools help" to see global options.

List which issues are fixed by this PR. You must list at least one issue.

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides. (Note that unlike the flutter/flutter repo, the flutter/plugins repo does use dart format. See plugin_tool format)
  • I signed the CLA.
  • [-] The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • [-] I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • [-] I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@devoncarew
Copy link
Member Author

devoncarew commented May 21, 2021

Actually, I think that when I use this flag from the bash script:

./script/tool_runner.sh analyze --dart-sdk ...

./script/tool_runner.sh does not substitute the automatic list of CUSTOM_ANALYSIS_PLUGINS. I think we should remove that option, or, push the special casing for that from the bash script into the dart code. Otherwise I'll see:

Verifying analysis settings...
Found an extra analysis_options.yaml in /Users/devoncarew/projects/flutter/plugins/packages/flutter_plugin_android_lifecycle/analysis_options.yaml.
If this was deliberate, pass the package to the analyze command with the --custom-analysis flag and try again.

Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

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

./script/tool_runner.sh does not substitute the automatic list of CUSTOM_ANALYSIS_PLUGINS. I think we should remove that option, or, push the special casing for that from the bash script into the dart code.

I'd like to remove it, but there are thousands of fixes to make first.

In the short term you can just fix lines 62 and 63 to check the first item in the list (62), and concatenate instead of replacing (63).

script/tool/lib/src/analyze_command.dart Outdated Show resolved Hide resolved
script/tool/lib/src/analyze_command.dart Outdated Show resolved Hide resolved
script/tool/lib/src/analyze_command.dart Outdated Show resolved Hide resolved
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 review! Updates in-line.

In the short term you can just fix lines 62 and 63 to check the first item in the list (62), and concatenate instead of replacing (63).

Yup, I changed the check to compare the first arg w/ 'analysis', and to append the changes to the command line to the existing ACTIONS variable.

script/tool/lib/src/analyze_command.dart Outdated Show resolved Hide resolved
script/tool/lib/src/analyze_command.dart Outdated Show resolved Hide resolved
script/tool/lib/src/analyze_command.dart Outdated Show resolved Hide resolved
Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

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

Mostly looks good, but you have a test failure in the tool tests; probably there's a mock that needs to be updated for the changes in how the analyze call is being made.

You'll also want to resync with the current master since the tree is finally green after several days of mostly red. That will resolve most of the CI failures, and let us see if there's anything other than the above that's real.

script/common.sh Show resolved Hide resolved
.cirrus.yml Show resolved Hide resolved
@devoncarew
Copy link
Member Author

devoncarew commented May 21, 2021

Mostly looks good, but you have a test failure in the tool tests; probably there's a mock that needs to be updated for the changes in how the analyze call is being made.

Ah, ok, I hadn't seen those tests. That test failure did catch a type error in my code. That's fixed, and I added a test for the new --analysis-sdk flag.

You'll also want to resync with the current master since the tree is finally green after several days of mostly red. That will resolve most of the CI failures, and let us see if there's anything other than the above that's real.

Sync'd! I'll see if this builds through now.

@devoncarew devoncarew added the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label May 22, 2021
@fluttergithubbot
Copy link

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

  • This pull request has changes requested by @stuartmorgan. Please resolve those before re-applying the label.

@fluttergithubbot fluttergithubbot removed the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label May 22, 2021
Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

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

LGTM!

@stuartmorgan stuartmorgan added the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label May 23, 2021
@fluttergithubbot fluttergithubbot merged commit 7d64ffc into flutter:master May 24, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 24, 2021
fotiDim pushed a commit to fotiDim/plugins that referenced this pull request Sep 13, 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 (Use "autosubmit") 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.

3 participants