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

Unified Diff: mojo/dart/packages/mojom/lib/src/generate.dart

Issue 1539673003: Generate Mojom Types in Dart (Take 2) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Merge with master Created 4 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: mojo/dart/packages/mojom/lib/src/generate.dart
diff --git a/mojo/dart/packages/mojom/lib/src/generate.dart b/mojo/dart/packages/mojom/lib/src/generate.dart
index e9c73d4964b80fd29905f7b7d5f61861ea993bda..f419f34d776a5c247ee99391b86cb616433b953b 100644
--- a/mojo/dart/packages/mojom/lib/src/generate.dart
+++ b/mojo/dart/packages/mojom/lib/src/generate.dart
@@ -16,6 +16,8 @@ import 'package:path/path.dart' as path;
part 'mojom_finder.dart';
+const String mojoTestPackage = '_mojo_for_test_only';
+
class MojomGenerator {
static dev.Counter _genMs;
final bool _errorOnDuplicate;
@@ -161,6 +163,12 @@ class MojomGenerator {
final servicesPath = _sniffForMojoServicesInclude(mojom.path);
+ // Force type information to be generated for the test package.
+ // TODO(afandria): Is there a better way to accomplish this goal?
+ // https://github.com/domokit/mojo/issues/641
+ final generateTypeInfoFlag = packageName == mojoTestPackage ?
+ '--generate-type-info' : '--no-generate-type-info';
+
final arguments = [
'--use_bundled_pylibs',
'-g',
@@ -171,7 +179,8 @@ class MojomGenerator {
sdkInc,
'-I',
importDir.path,
- '--no-gen-imports'
+ '--no-gen-imports',
+ generateTypeInfoFlag
];
if (servicesPath != null) {
arguments.add('-I');
@@ -197,7 +206,7 @@ class MojomGenerator {
// Generated .mojom.dart is under $output/dart-gen/$PACKAGE/lib/$X
// Move $X to |destination|/lib/$X.
- // Throw an exception if $PACKGE != [packageName].
+ // Throw an exception if $PACKAGE != [packageName].
final generatedDirName = path.join(output, 'dart-gen');
final generatedDir = new Directory(generatedDirName);
log.info("generatedDir= $generatedDir");

Powered by Google App Engine
This is Rietveld 408576698