Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart

Issue 11740025: Add dart2js option to select library categories. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix dartdoc and some unit tests Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/compiler/implementation/dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart b/dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart
index 91e9ebf53805bedc7be2a86fe5d12387d9499896..fd9ccd9b00e6179d70f3f367c6ddf9078254c3f4 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart
@@ -22,10 +22,12 @@ class Compiler extends leg.Compiler {
final Uri packageRoot;
List<String> options;
bool mockableLibraryUsed = false;
+ final Set<String> allowedLibraryCategories;
Compiler(this.provider, this.handler, this.libraryRoot, this.packageRoot,
List<String> options)
: this.options = options,
+ this.allowedLibraryCategories = getAllowedLibraryCategories(options),
super(
tracer: new ssa.HTracer(),
enableTypeAssertions: hasOption(options, '--enable-checked-mode'),
@@ -60,7 +62,19 @@ class Compiler extends leg.Compiler {
return option.substring('--force-strip='.length).split(',');
}
}
- return [];
+ return const <String>[];
+ }
+
+ static Set<String> getAllowedLibraryCategories(List<String> options) {
+ for (String option in options) {
+ if (option.startsWith('--categories=')) {
+ var result = option.substring('--categories='.length).split(',');
+ result.add('Shared');
+ result.add('Internal');
+ return new Set<String>.from(result);
+ }
+ }
+ return new Set<String>.from(['Client', 'Shared', 'Internal']);
}
static bool hasOption(List<String> options, String option) {
@@ -73,6 +87,7 @@ class Compiler extends leg.Compiler {
LibraryInfo info = LIBRARIES[dartLibraryName];
if (info == null) return null;
if (!info.isDart2jsLibrary) return null;
+ if (!allowedLibraryCategories.contains(info.category)) return null;
String path = info.dart2jsPath;
if (path == null) {
path = info.path;
@@ -210,6 +225,7 @@ class Compiler extends leg.Compiler {
translatePackageUri(Uri uri, tree.Node node) => packageRoot.resolve(uri.path);
bool run(Uri uri) {
+ log('Allowed library categories: $allowedLibraryCategories');
bool success = super.run(uri);
int cumulated = 0;
for (final task in tasks) {
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/compiler/implementation/dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698