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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/dart2js.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
Index: dart/sdk/lib/_internal/compiler/implementation/dart2js.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/dart2js.dart b/dart/sdk/lib/_internal/compiler/implementation/dart2js.dart
index 3f7281123ded0bb1369a018e1265f103f7b97727..cf774f53339c93fdbef3d737fc56292812d3ea5d 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/dart2js.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/dart2js.dart
@@ -15,6 +15,7 @@ import 'source_file.dart';
import 'source_file_provider.dart';
import 'filenames.dart';
import 'util/uri_extras.dart';
+import '../../libraries.dart';
const String LIBRARY_ROOT = '../../../../..';
const String OUTPUT_LANGUAGE_DART = 'Dart';
@@ -127,6 +128,30 @@ void compile(List<String> argv) {
passThrough(argument);
}
+ setCategories(String argument) {
+ List<String> categories = extractParameter(argument).split(',');
+ Set<String> allowedCategories =
+ LIBRARIES.values.mappedBy((x) => x.category).toSet();
+ allowedCategories.remove('Shared');
+ allowedCategories.remove('Internal');
+ List<String> allowedCategoriesList =
+ new List<String>.from(allowedCategories);
+ allowedCategoriesList.sort();
+ if (categories.contains('all')) {
+ categories = allowedCategoriesList;
+ } else {
+ String allowedCategoriesString =
+ Strings.join(allowedCategoriesList, ', ');
+ for (String category in categories) {
+ if (!allowedCategories.contains(category)) {
+ fail('Error: unsupported library category "$category", '
+ 'supported categories are: $allowedCategoriesString');
+ }
+ }
+ }
+ return passThrough('--categories=${Strings.join(categories, ",")}');
+ }
+
handleShortOptions(String argument) {
var shortOptions = argument.substring(1).splitChars();
for (var shortOption in shortOptions) {
@@ -180,6 +205,7 @@ void compile(List<String> argv) {
new OptionHandler('--reject-deprecated-language-features', passThrough),
new OptionHandler('--report-sdk-use-of-deprecated-language-features',
passThrough),
+ new OptionHandler('--categories=.*', setCategories),
// The following two options must come last.
new OptionHandler('-.*', (String argument) {
@@ -378,6 +404,13 @@ be removed in a future version:
--reject-deprecated-language-features controls if these usages are
reported as errors or warnings.
+ --categories=<categories>
+
+ A comma separated list of allowed library categories. The default
+ is "Client". Possible categories can be seen by providing an
+ unsupported category, for example, --categories=help. To enable
+ all categories, use --categories=all.
+
'''.trim());
}
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart ('k') | dart/sdk/lib/_internal/dartdoc/lib/dartdoc.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698