Skip to content

Commit

Permalink
[cfe] Add --no-deps option to compile_platform script
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
johnniwinther authored and [email protected] committed Jul 9, 2020
1 parent e3a6824 commit e253d07
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
5 changes: 5 additions & 0 deletions pkg/front_end/lib/src/api_prototype/compiler_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ class CompilerOptions {
"."
"${kernel.defaultLanguageVersion.minor}";

/// If `true`, a '.d' file with input dependencies is generated when
/// compiling the platform dill.
bool emitDeps = true;

bool equivalent(CompilerOptions other,
{bool ignoreOnDiagnostic: true,
bool ignoreVerbose: true,
Expand Down Expand Up @@ -290,6 +294,7 @@ class CompilerOptions {
if (writeFileOnCrashReport != other.writeFileOnCrashReport) return false;
if (nnbdMode != other.nnbdMode) return false;
if (currentSdkVersion != other.currentSdkVersion) return false;
if (emitDeps != other.emitDeps) return false;

return true;
}
Expand Down
1 change: 1 addition & 0 deletions pkg/front_end/lib/src/base/command_line_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Flags {
static const String help = "--help";
static const String librariesJson = "--libraries-json";
static const String noDefines = "--no-defines";
static const String noDeps = "--no-deps";
static const String output = "--output";
static const String packages = "--packages";
static const String platform = "--platform";
Expand Down
2 changes: 2 additions & 0 deletions pkg/front_end/lib/src/base/processed_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ class ProcessedOptions {

bool get throwOnWarningsForDebugging => _raw.throwOnWarningsForDebugging;

bool get emitDeps => _raw.emitDeps;

NnbdMode get nnbdMode => _raw.nnbdMode;

/// The entry-points provided to the compiler.
Expand Down
6 changes: 5 additions & 1 deletion pkg/front_end/tool/_fasta/command_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ const Map<String, ValueSpecification> optionSpecification =
Flags.verbose: const BoolValue(false),
Flags.verify: const BoolValue(false),
Flags.linkDependencies: const UriListValue(),
Flags.noDeps: const BoolValue(false),
"-D": const DefineValue(),
"-h": const AliasValue(Flags.help),
"--out": const AliasValue(Flags.output),
Expand Down Expand Up @@ -256,6 +257,8 @@ ProcessedOptions analyzeCommandLine(String programName,

final bool noDefines = options[Flags.noDefines];

final bool noDeps = options[Flags.noDeps];

final bool verify = options[Flags.verify];

final bool dumpIr = options[Flags.dumpIr];
Expand Down Expand Up @@ -341,7 +344,8 @@ ProcessedOptions analyzeCommandLine(String programName,
..experimentalFlags = experimentalFlags
..environmentDefines = noDefines ? null : parsedArguments.defines
..nnbdMode = nnbdMode
..additionalDills = linkDependencies;
..additionalDills = linkDependencies
..emitDeps = !noDeps;

if (programName == "compile_platform") {
if (arguments.length != 5) {
Expand Down
20 changes: 11 additions & 9 deletions pkg/front_end/tool/_fasta/entry_points.dart
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,19 @@ Future<void> compilePlatformInternal(CompilerContext c, Uri fullOutput,

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

List<Uri> deps = result.deps.toList();
for (Uri dependency in await computeHostDependencies(hostPlatform)) {
// Add the dependencies of the compiler's own sources.
if (dependency != outlineOutput) {
// We're computing the dependencies for [outlineOutput], so we shouldn't
// include it in the deps file.
deps.add(dependency);
if (c.options.emitDeps) {
List<Uri> deps = result.deps.toList();
for (Uri dependency in await computeHostDependencies(hostPlatform)) {
// Add the dependencies of the compiler's own sources.
if (dependency != outlineOutput) {
// We're computing the dependencies for [outlineOutput], so we shouldn't
// include it in the deps file.
deps.add(dependency);
}
}
await writeDepsFile(fullOutput,
new File(new File.fromUri(fullOutput).path + ".d").uri, deps);
}
await writeDepsFile(
fullOutput, new File(new File.fromUri(fullOutput).path + ".d").uri, deps);
}

Future<List<Uri>> computeHostDependencies(Uri hostPlatform) async {
Expand Down

0 comments on commit e253d07

Please sign in to comment.