mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:09:49 +00:00
[CFE] Support macros in _fasta entrypoint.
R=johnniwinther@google.com Change-Id: I532e26accc2c59b8be07a6d5f7dd81403b386d24 Bug: https://github.com/dart-lang/sdk/issues/54404 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341520 Auto-Submit: Morgan :) <davidmorgan@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Morgan :) <davidmorgan@google.com>
This commit is contained in:
parent
969de20633
commit
7fbe4cc95b
|
@ -330,6 +330,7 @@ Future<Map<Uri, ExecutorFactoryToken>> _compileMacros(
|
|||
// TODO(johnniwinther): What if sdk root isn't set? How do we then get the
|
||||
// right sdk?
|
||||
precompilationOptions.sdkRoot = options.sdkRoot;
|
||||
precompilationOptions.sdkSummary = options.sdkSummary;
|
||||
|
||||
Map<String, Map<String, List<String>>> macroDeclarations = {};
|
||||
neededPrecompilations.macroDeclarations
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
"pkg/_fe_analyzer_shared/lib/src/util/colors.dart": {
|
||||
"Dynamic invocation of 'split'.": 1
|
||||
},
|
||||
"pkg/front_end/lib/src/isolate_macro_serializer.dart": {
|
||||
"Dynamic invocation of 'unregisterKernelBlobUri'.": 1,
|
||||
"Dynamic invocation of 'createUriForKernelBlob'.": 1
|
||||
},
|
||||
"pkg/_fe_analyzer_shared/lib/src/scanner/token_impl.dart": {
|
||||
"Dynamic access of 'data'.": 1,
|
||||
"Dynamic access of 'start'.": 1,
|
||||
|
|
|
@ -8,32 +8,24 @@ import 'dart:io' show exit;
|
|||
|
||||
import 'package:_fe_analyzer_shared/src/messages/severity.dart' show Severity;
|
||||
import 'package:_fe_analyzer_shared/src/util/options.dart';
|
||||
|
||||
import 'package:_fe_analyzer_shared/src/util/resolve_input_uri.dart'
|
||||
show resolveInputUri;
|
||||
import 'package:build_integration/file_system/single_root.dart'
|
||||
show SingleRootFileSystem;
|
||||
|
||||
import 'package:front_end/src/api_prototype/compiler_options.dart';
|
||||
|
||||
import 'package:front_end/src/api_prototype/experimental_flags.dart'
|
||||
show ExperimentalFlag, isExperimentEnabled;
|
||||
|
||||
import 'package:front_end/src/api_prototype/file_system.dart' show FileSystem;
|
||||
|
||||
import 'package:front_end/src/api_prototype/standard_file_system.dart'
|
||||
show StandardFileSystem;
|
||||
import 'package:front_end/src/api_prototype/terminal_color_support.dart';
|
||||
import 'package:front_end/src/base/command_line_options.dart';
|
||||
import 'package:front_end/src/base/nnbd_mode.dart';
|
||||
|
||||
import 'package:front_end/src/base/processed_options.dart'
|
||||
show ProcessedOptions;
|
||||
|
||||
import 'package:front_end/src/compute_platform_binaries_location.dart'
|
||||
show computePlatformBinariesLocation, computePlatformDillName;
|
||||
|
||||
import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
|
||||
|
||||
import 'package:front_end/src/base/command_line_options.dart';
|
||||
|
||||
import 'package:front_end/src/fasta/fasta_codes.dart'
|
||||
show
|
||||
Message,
|
||||
|
@ -41,15 +33,10 @@ import 'package:front_end/src/fasta/fasta_codes.dart'
|
|||
messageFastaUsageLong,
|
||||
messageFastaUsageShort,
|
||||
templateUnspecified;
|
||||
|
||||
import 'package:front_end/src/fasta/problems.dart' show DebugAbort;
|
||||
|
||||
import 'package:_fe_analyzer_shared/src/util/resolve_input_uri.dart'
|
||||
show resolveInputUri;
|
||||
|
||||
import 'package:front_end/src/isolate_macro_serializer.dart';
|
||||
import 'package:front_end/src/scheme_based_file_system.dart'
|
||||
show SchemeBasedFileSystem;
|
||||
|
||||
import 'package:kernel/target/targets.dart'
|
||||
show Target, TargetFlags, TestTargetFlags, getTarget, targets;
|
||||
|
||||
|
@ -254,6 +241,8 @@ ProcessedOptions analyzeCommandLine(String programName,
|
|||
..fileSystem = fileSystem
|
||||
..packagesFileUri = packages
|
||||
..target = target
|
||||
..macroTarget = target
|
||||
..macroSerializer = IsolateMacroSerializer()
|
||||
..throwOnErrorsForDebugging = errorsAreFatal
|
||||
..throwOnWarningsForDebugging = warningsAreFatal
|
||||
..skipForDebugging = fatalSkip
|
||||
|
|
|
@ -31,7 +31,7 @@ import 'package:front_end/src/fasta/kernel/utils.dart'
|
|||
import 'package:front_end/src/fasta/ticker.dart' show Ticker;
|
||||
import 'package:front_end/src/fasta/uri_translator.dart' show UriTranslator;
|
||||
import 'package:front_end/src/kernel_generator_impl.dart'
|
||||
show generateKernelInternal;
|
||||
show generateKernelInternal, precompileMacros;
|
||||
import 'package:front_end/src/linux_and_intel_specific_perf.dart';
|
||||
import 'package:kernel/kernel.dart'
|
||||
show
|
||||
|
@ -395,6 +395,15 @@ class CompileTask {
|
|||
|
||||
kernelTarget.setEntryPoints(c.options.inputs);
|
||||
dillTarget.buildOutlines();
|
||||
|
||||
final neededPrecompilations =
|
||||
await kernelTarget.computeNeededPrecompilations();
|
||||
if (neededPrecompilations != null) {
|
||||
kernelTarget.benchmarker?.enterPhase(BenchmarkPhases.precompileMacros);
|
||||
await precompileMacros(neededPrecompilations, c.options);
|
||||
kernelTarget.benchmarker
|
||||
?.enterPhase(BenchmarkPhases.unknownGenerateKernelInternal);
|
||||
}
|
||||
BuildResult buildResult = await kernelTarget.buildOutlines();
|
||||
Component? outline = buildResult.component;
|
||||
if (c.options.debugDump && output != null) {
|
||||
|
|
Loading…
Reference in a new issue