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

Analysis server's BazelWorkspace needs to support dart_package directives in BUILD files #42594

Closed
stereotype441 opened this issue Jul 6, 2020 · 3 comments
Assignees
Labels
analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. NNBD Issues related to NNBD Release

Comments

@stereotype441
Copy link
Member

The way to opt packages into NNBD in a Bazel workspace will be to include this directive in a BUILD file:

dart_package(
    non_nullable = True,
)

The analysis server needs to recognize this pattern and use it to determine whether a package is opted in to NNBD.

Note that BUILD files are auto-formatted so it's not necessary to parse the whole file to find this directive; a simple regexp should suffice.

@stereotype441 stereotype441 added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-server NNBD Issues related to NNBD Release labels Jul 6, 2020
@scheglov scheglov self-assigned this Jul 8, 2020
dart-bot pushed a commit that referenced this issue Jul 8, 2020
We need this so that we can look if the file is NullSafe by asking
the package that contains it.

Bug: #42594
Change-Id: I11c71faf7bddd53b458a66f0786454ecd7453b5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153521
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
@scheglov
Copy link
Contributor

scheglov commented Aug 3, 2020

@davidmorgan
Copy link
Contributor

Thanks! A few notes:

It's true that the file is auto formatted, but some variation is allowed. These are all valid:

dart_package(non_nullable = True)

dart_package(
    non_nullable = True,
)

dart_package(
    # Preceding comment.
    non_nullable = True,  # Trailing comment.
)  # Last comment.

And: it's desirable that the analyzer react to changes to the BUILD file, so that adding non_nullable = True changes the analysis mode for the package as soon as the file is saved.

@scheglov
Copy link
Contributor

scheglov commented Aug 6, 2020

dart-bot pushed a commit that referenced this issue Aug 6, 2020
Bug: #42594
Change-Id: I927184d9065eb5c54790275a429927de8099a7e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157474
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
@scheglov scheglov closed this as completed Aug 7, 2020
dart-bot pushed a commit that referenced this issue Aug 7, 2020
The flag was renamed since the original issue was open.

R=brianwilkerson@google.com

Bug: #42594
Change-Id: Ie92d43d09d97386f3e61ad226c0a0c88287d2ea3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157725
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. NNBD Issues related to NNBD Release
Projects
None yet
Development

No branches or pull requests

3 participants