change the SummaryTarget to extend the DevCompilerTarget

Change-Id: I2ebd09e35b8ba8a254a318103102d33291f006a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97003
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
This commit is contained in:
Jacob MacDonald 2019-03-15 20:50:25 +00:00 committed by commit-bot@chromium.org
parent 626cb68ad2
commit d267fb6bf3

View file

@ -15,6 +15,7 @@ import 'dart:io';
import 'package:args/args.dart'; import 'package:args/args.dart';
import 'package:bazel_worker/bazel_worker.dart'; import 'package:bazel_worker/bazel_worker.dart';
import 'package:build_integration/file_system/multi_root.dart'; import 'package:build_integration/file_system/multi_root.dart';
import 'package:dev_compiler/src/kernel/target.dart';
import 'package:front_end/src/api_unstable/bazel_worker.dart' as fe; import 'package:front_end/src/api_unstable/bazel_worker.dart' as fe;
import 'package:kernel/ast.dart' show Component, Library; import 'package:kernel/ast.dart' show Component, Library;
import 'package:kernel/target/targets.dart'; import 'package:kernel/target/targets.dart';
@ -159,10 +160,9 @@ Future<bool> computeKernel(List<String> args,
} }
break; break;
case 'devcompiler': case 'devcompiler':
// TODO(jakemac): change to a subclass of `DevCompilerTarget`. If // TODO(jakemac):If `generateKernel` changes to return a summary
// `generateKernel` changes to return a summary component, use the default // component, process the component instead.
// `DevCompilerTarget` and post process the component instead. target = new DevCompilerSummaryTarget(sources, excludeNonSources);
target = new SummaryTarget(sources, excludeNonSources, targetFlags);
if (!summaryOnly) { if (!summaryOnly) {
out.writeln('error: --no-summary-only not supported for the ' out.writeln('error: --no-summary-only not supported for the '
'devcompiler target'); 'devcompiler target');
@ -211,8 +211,8 @@ Future<bool> computeKernel(List<String> args,
return succeeded; return succeeded;
} }
/// A target that transforms outlines to meet the requirements of summaries in /// Extends the DevCompilerTarget to transform outlines to meet the requirements
/// bazel and package-build. /// of summaries in bazel and package-build.
/// ///
/// Build systems like package-build may provide the same input file twice to /// Build systems like package-build may provide the same input file twice to
/// the summary worker, but only intends to have it in one output summary. The /// the summary worker, but only intends to have it in one output summary. The
@ -223,15 +223,15 @@ Future<bool> computeKernel(List<String> args,
/// ///
/// Note: this transformation is destructive and is only intended to be used /// Note: this transformation is destructive and is only intended to be used
/// when generating summaries. /// when generating summaries.
class SummaryTarget extends NoneTarget { class DevCompilerSummaryTarget extends DevCompilerTarget {
final List<Uri> sources; final List<Uri> sources;
final bool excludeNonSources; final bool excludeNonSources;
SummaryTarget(this.sources, this.excludeNonSources, TargetFlags flags) DevCompilerSummaryTarget(this.sources, this.excludeNonSources);
: super(flags);
@override @override
void performOutlineTransformations(Component component) { void performOutlineTransformations(Component component) {
super.performOutlineTransformations(component);
if (!excludeNonSources) return; if (!excludeNonSources) return;
List<Library> libraries = new List.from(component.libraries); List<Library> libraries = new List.from(component.libraries);