Skip to content

Commit e253d07

Browse files
johnniwinthercommit-bot@chromium.org
authored andcommitted
[cfe] Add --no-deps option to compile_platform script
This allows for disabling the generation of .d deps file when compiling the platform dill files. Change-Id: I37774f0dbdae7863fc1cf53b1c5e0d29c6bbdf2c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153765 Reviewed-by: David Morgan <[email protected]> Commit-Queue: Johnni Winther <[email protected]>
1 parent e3a6824 commit e253d07

File tree

5 files changed

+24
-10
lines changed

5 files changed

+24
-10
lines changed

pkg/front_end/lib/src/api_prototype/compiler_options.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ class CompilerOptions {
236236
"."
237237
"${kernel.defaultLanguageVersion.minor}";
238238

239+
/// If `true`, a '.d' file with input dependencies is generated when
240+
/// compiling the platform dill.
241+
bool emitDeps = true;
242+
239243
bool equivalent(CompilerOptions other,
240244
{bool ignoreOnDiagnostic: true,
241245
bool ignoreVerbose: true,
@@ -290,6 +294,7 @@ class CompilerOptions {
290294
if (writeFileOnCrashReport != other.writeFileOnCrashReport) return false;
291295
if (nnbdMode != other.nnbdMode) return false;
292296
if (currentSdkVersion != other.currentSdkVersion) return false;
297+
if (emitDeps != other.emitDeps) return false;
293298

294299
return true;
295300
}

pkg/front_end/lib/src/base/command_line_options.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Flags {
2727
static const String help = "--help";
2828
static const String librariesJson = "--libraries-json";
2929
static const String noDefines = "--no-defines";
30+
static const String noDeps = "--no-deps";
3031
static const String output = "--output";
3132
static const String packages = "--packages";
3233
static const String platform = "--platform";

pkg/front_end/lib/src/base/processed_options.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ class ProcessedOptions {
170170

171171
bool get throwOnWarningsForDebugging => _raw.throwOnWarningsForDebugging;
172172

173+
bool get emitDeps => _raw.emitDeps;
174+
173175
NnbdMode get nnbdMode => _raw.nnbdMode;
174176

175177
/// The entry-points provided to the compiler.

pkg/front_end/tool/_fasta/command_line.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ const Map<String, ValueSpecification> optionSpecification =
197197
Flags.verbose: const BoolValue(false),
198198
Flags.verify: const BoolValue(false),
199199
Flags.linkDependencies: const UriListValue(),
200+
Flags.noDeps: const BoolValue(false),
200201
"-D": const DefineValue(),
201202
"-h": const AliasValue(Flags.help),
202203
"--out": const AliasValue(Flags.output),
@@ -256,6 +257,8 @@ ProcessedOptions analyzeCommandLine(String programName,
256257

257258
final bool noDefines = options[Flags.noDefines];
258259

260+
final bool noDeps = options[Flags.noDeps];
261+
259262
final bool verify = options[Flags.verify];
260263

261264
final bool dumpIr = options[Flags.dumpIr];
@@ -341,7 +344,8 @@ ProcessedOptions analyzeCommandLine(String programName,
341344
..experimentalFlags = experimentalFlags
342345
..environmentDefines = noDefines ? null : parsedArguments.defines
343346
..nnbdMode = nnbdMode
344-
..additionalDills = linkDependencies;
347+
..additionalDills = linkDependencies
348+
..emitDeps = !noDeps;
345349

346350
if (programName == "compile_platform") {
347351
if (arguments.length != 5) {

pkg/front_end/tool/_fasta/entry_points.dart

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -434,17 +434,19 @@ Future<void> compilePlatformInternal(CompilerContext c, Uri fullOutput,
434434

435435
c.options.ticker.logMs("Wrote component to ${fullOutput.toFilePath()}");
436436

437-
List<Uri> deps = result.deps.toList();
438-
for (Uri dependency in await computeHostDependencies(hostPlatform)) {
439-
// Add the dependencies of the compiler's own sources.
440-
if (dependency != outlineOutput) {
441-
// We're computing the dependencies for [outlineOutput], so we shouldn't
442-
// include it in the deps file.
443-
deps.add(dependency);
437+
if (c.options.emitDeps) {
438+
List<Uri> deps = result.deps.toList();
439+
for (Uri dependency in await computeHostDependencies(hostPlatform)) {
440+
// Add the dependencies of the compiler's own sources.
441+
if (dependency != outlineOutput) {
442+
// We're computing the dependencies for [outlineOutput], so we shouldn't
443+
// include it in the deps file.
444+
deps.add(dependency);
445+
}
444446
}
447+
await writeDepsFile(fullOutput,
448+
new File(new File.fromUri(fullOutput).path + ".d").uri, deps);
445449
}
446-
await writeDepsFile(
447-
fullOutput, new File(new File.fromUri(fullOutput).path + ".d").uri, deps);
448450
}
449451

450452
Future<List<Uri>> computeHostDependencies(Uri hostPlatform) async {

0 commit comments

Comments
 (0)