mirror of
https://github.com/dart-lang/sdk
synced 2024-09-04 16:03:44 +00:00
[DDC,bazel] Allow no digest when not in worker mode
Change-Id: Id4d2b385bc00e7dc4e20aefea9ba38e4839bbaca Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114065 Reviewed-by: David Morgan <davidmorgan@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Jens Johansen <jensj@google.com>
This commit is contained in:
parent
88c0c11612
commit
3f0f66cabc
|
@ -393,6 +393,7 @@ Future<CompilerResult> compile(ParsedArguments args,
|
|||
if (args.isKernel) {
|
||||
return kernel_compiler.compile(args.rest,
|
||||
compilerState: previousResult?.kernelState,
|
||||
isWorker: args.isWorker,
|
||||
useIncrementalCompiler: args.useIncrementalCompiler,
|
||||
inputDigests: inputDigests);
|
||||
} else {
|
||||
|
|
|
@ -36,11 +36,13 @@ const _binaryName = 'dartdevc -k';
|
|||
/// Returns `true` if the program compiled without any fatal errors.
|
||||
Future<CompilerResult> compile(List<String> args,
|
||||
{fe.InitializedCompilerState compilerState,
|
||||
bool isWorker = false,
|
||||
bool useIncrementalCompiler = false,
|
||||
Map<Uri, List<int>> inputDigests}) async {
|
||||
try {
|
||||
return await _compile(args,
|
||||
compilerState: compilerState,
|
||||
isWorker: isWorker,
|
||||
useIncrementalCompiler: useIncrementalCompiler,
|
||||
inputDigests: inputDigests);
|
||||
} catch (error, stackTrace) {
|
||||
|
@ -69,6 +71,7 @@ String _usageMessage(ArgParser ddcArgParser) =>
|
|||
|
||||
Future<CompilerResult> _compile(List<String> args,
|
||||
{fe.InitializedCompilerState compilerState,
|
||||
bool isWorker = false,
|
||||
bool useIncrementalCompiler = false,
|
||||
Map<Uri, List<int>> inputDigests}) async {
|
||||
// TODO(jmesserly): refactor options to share code with dartdevc CLI.
|
||||
|
@ -255,6 +258,20 @@ Future<CompilerResult> _compile(List<String> args,
|
|||
experiments: experiments,
|
||||
environmentDefines: declaredVariables);
|
||||
} else {
|
||||
// If digests weren't given and if not in worker mode, create fake data and
|
||||
// ensure we don't have a previous state (as that wouldn't be safe with
|
||||
// fake input digests).
|
||||
if (!isWorker && (inputDigests == null || inputDigests.isEmpty)) {
|
||||
oldCompilerState = null;
|
||||
inputDigests ??= {};
|
||||
if (!compileSdk) {
|
||||
inputDigests[sourcePathToUri(sdkSummaryPath)] = const [0];
|
||||
}
|
||||
for (Uri uri in summaryModules.keys) {
|
||||
inputDigests[uri] = const [0];
|
||||
}
|
||||
}
|
||||
|
||||
doneInputSummaries = List<Component>(summaryModules.length);
|
||||
compilerState = await fe.initializeIncrementalCompiler(
|
||||
oldCompilerState,
|
||||
|
|
|
@ -244,13 +244,29 @@ Future<ComputeKernelResult> computeKernel(List<String> args,
|
|||
fe.InitializedCompilerState state;
|
||||
bool usingIncrementalCompiler = false;
|
||||
bool recordUsedInputs = parsedArgs["used-inputs"] != null;
|
||||
if (parsedArgs['use-incremental-compiler'] && isWorker) {
|
||||
if (parsedArgs['use-incremental-compiler']) {
|
||||
usingIncrementalCompiler = true;
|
||||
|
||||
/// Build a map of uris to digests.
|
||||
final inputDigests = <Uri, List<int>>{};
|
||||
for (var input in inputs) {
|
||||
inputDigests[_toUri(input.path)] = input.digest;
|
||||
if (inputs != null) {
|
||||
for (var input in inputs) {
|
||||
inputDigests[_toUri(input.path)] = input.digest;
|
||||
}
|
||||
}
|
||||
|
||||
// If digests weren't given and if not in worker mode, create fake data and
|
||||
// ensure we don't have a previous state (as that wouldn't be safe with
|
||||
// fake input digests).
|
||||
if (!isWorker && inputDigests.isEmpty) {
|
||||
previousState = null;
|
||||
inputDigests[_toUri(parsedArgs['dart-sdk-summary'])] = const [0];
|
||||
for (Uri uri in summaryInputs) {
|
||||
inputDigests[uri] = const [0];
|
||||
}
|
||||
for (Uri uri in linkedInputs) {
|
||||
inputDigests[uri] = const [0];
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(sigmund): add support for experiments with the incremental compiler.
|
||||
|
|
Loading…
Reference in a new issue