Closed munificent closed 4 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.
I'd rather wait until #38662 is complete before working on either of these two tasks
SGTM.
We are building the necessary summaries. Need to double check that they have the correct NNBD types in them. @scheglov
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.
Ah, I see, there is use_nnbd
flag. I will try using it in utils/dartanalyzer/BUILD.gn
.
Ah, I see, there is
use_nnbd
flag. I will try using it inutils/dartanalyzer/BUILD.gn
.
That's right. Sorry I didn't see your comment before you figured it out. :)
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.