dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.25k stars 1.58k forks source link

Build analyzer using the forked NNBD SDK #38666

Closed munificent closed 4 years ago

munificent commented 5 years ago

The SDK (i.e. core libraries) have been forked in the repo into sdk_nnbd. Once #38662 is done and there is a flag available in the build files to detect whether that should be used, the next step is to get the various build targets for each implementation using that flag to determine which SDK to pull from.

This issue is to do that for analyzer.

stereotype441 commented 5 years ago

I think there are two subtasks:

I'd rather wait until https://github.com/dart-lang/sdk/issues/38662 is complete before working on either of these two tasks, because that task might change how the build system treats the analyzer and its summaries.

munificent commented 5 years ago

I'd rather wait until #38662 is complete before working on either of these two tasks

SGTM.

stereotype441 commented 4 years ago

We are building the necessary summaries. Need to double check that they have the correct NNBD types in them. @scheglov

scheglov commented 4 years ago

When we build the summary of the SDK, we always build it with legacy types. There is currently no way to specify pkg/analyzer/tool/summary/build_sdk_summaries.dart that we want to build NNBD summary. It accept one command build-strong, which probably does not make sense, and should be replaced with something like build-legacy and build-non-nullable.

@munificent I see that utils/dartanalyzer/BUILD.gn calls build_sdk_summaries.dart. Is there a way to tell this build script if we are building NNBD or legacy Dart SDK?

I found that we don't use SDK summary when not build mode of analyzer_cli. This means that when we are given --dart-sdk=path/to/nnbd/sdk, and --enable-experiment=non-nullable, we analyze requested files in NNBD, and resolve NNBD SDK as NNBD, even if the summary is not correct.

But we have to build correct NNBD summary of the SDK anyway, currently it is just wrong.

scheglov commented 4 years ago

Ah, I see, there is use_nnbd flag. I will try using it in utils/dartanalyzer/BUILD.gn.

scheglov commented 4 years ago

https://dart-review.googlesource.com/c/sdk/+/132800

munificent commented 4 years ago

Ah, I see, there is use_nnbd flag. I will try using it in utils/dartanalyzer/BUILD.gn.

That's right. Sorry I didn't see your comment before you figured it out. :)