Create wrapper script around mojom's generate.dart in the Sky package. This CL does the following: - Moves mojom's generate.dart from bin/ to lib/ to make it available for use by a wrapper scripts in the Sky package, thus avoiding all consumers of Sky needing to directly depend on mojom to be able to call "pub run mojom:generate". - Adds a sky->mojom pub dependency and creates a wrapper script around mojom's generate.dart in the Sky package. - Augments the Sky README to explain the usage of this script. R=eseidel@chromium.org, sethladd@google.com Review URL: https://codereview.chromium.org/1136503002
diff --git a/.gitignore b/.gitignore index 6b133e2..98668a3 100644 --- a/.gitignore +++ b/.gitignore
@@ -8,6 +8,7 @@ .gdbinit .landmines .project +.pub .pydevproject .checkstyle cscope.* @@ -67,7 +68,13 @@ /third_party/yasm/source/patched-yasm/ /tools/grit/ /v8/ -# dart packages directories +# dart packages directories and related. /mojo/dart/mojom/packages /mojo/dart/mojom/bin/packages /mojo/dart/apptest/packages +/sky/examples/hello_world/packages +/sky/examples/stocks/packages +/sky/sdk/packages/mojo/packages +/sky/sdk/packages/mojo/pubspec.lock +/sky/sdk/packages/sky/packages +/sky/sdk/packages/sky/pubspec.lock
diff --git a/mojo/dart/mojom/README.md b/mojo/dart/mojom/README.md index 8932851..d7889aa 100644 --- a/mojo/dart/mojom/README.md +++ b/mojo/dart/mojom/README.md
@@ -7,11 +7,11 @@ package by saying the following after `pub get`: ``` -$ pub run mojom:generate +$ dart -p packages packages/mojom/generate.dart ``` If desired, additional directories holding .mojom.dart files can be specified; their contents will be installed to this package as well: ``` -$ pub run mojom:generate -a </path/to/mojom/dir> +$ dart -p packages packages/mojom/generate.dart -a </path/to/mojom/dir> ```
diff --git a/mojo/dart/mojom/lib/README.md b/mojo/dart/mojom/lib/README.md index f608b86..fc326c1 100644 --- a/mojo/dart/mojom/lib/README.md +++ b/mojo/dart/mojom/lib/README.md
@@ -1,8 +1,5 @@ mojom ==== -Files will appear here after running the generate script (see the top-level -documentation for this package). - -This file is a placeholder to ensure that the mojom package gets installed -under "packages/" when it is added as a dependency. +mojom.dart files will appear here after running the generate script (see the +top-level documentation for this package).
diff --git a/mojo/dart/mojom/bin/generate.dart b/mojo/dart/mojom/lib/generate.dart similarity index 100% rename from mojo/dart/mojom/bin/generate.dart rename to mojo/dart/mojom/lib/generate.dart
diff --git a/mojo/dart/mojom/pubspec.yaml b/mojo/dart/mojom/pubspec.yaml index 36bcd5f..3a38709 100644 --- a/mojo/dart/mojom/pubspec.yaml +++ b/mojo/dart/mojom/pubspec.yaml
@@ -1,5 +1,5 @@ name: mojom -version: 0.0.3 +version: 0.0.4 author: Chromium Authors <mojo-dev@googlegroups.com> description: Placeholder for mojom bindings. homepage: https://github.com/domokit/mojo
diff --git a/sky/sdk/README.md b/sky/sdk/README.md index eca9cf0..987807a 100644 --- a/sky/sdk/README.md +++ b/sky/sdk/README.md
@@ -50,8 +50,10 @@ ``` Once the pubspec is in place, create a `lib` directory (where your dart code -will go) and run `pub get` to download all necessary dependencies and create -the symlinks necessary for 'package:your_app_names/main.dart' includes to work. +will go), ensure that the 'dart' and 'pub' executables are on your $PATH and +run the following: + +`pub get && pub run sky:init`. Currently the Sky Engine assumes the entry point for your application is a `main` function located inside a `main.sky` file at the root of the package.
diff --git a/sky/sdk/packages/sky/bin/init.dart b/sky/sdk/packages/sky/bin/init.dart new file mode 100644 index 0000000..7616fec --- /dev/null +++ b/sky/sdk/packages/sky/bin/init.dart
@@ -0,0 +1,17 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/* +* This script should be invoked via 'pub run' after 'pub get': +* $ pub run sky:init +* NOTE: The 'dart' executable must be on your $PATH for this script to work. +*/ + +import 'dart:io'; + +main(List<String> arguments) { + ProcessResult result = Process.runSync('dart', ['-p', 'packages', 'packages/mojom/generate.dart']); + stdout.write(result.stdout); + stderr.write(result.stderr); +}
diff --git a/sky/sdk/packages/sky/pubspec.yaml b/sky/sdk/packages/sky/pubspec.yaml index 12f7faf..23e101f 100644 --- a/sky/sdk/packages/sky/pubspec.yaml +++ b/sky/sdk/packages/sky/pubspec.yaml
@@ -5,3 +5,4 @@ version: 0.0.5 dependencies: mojo: '>=0.0.1 <1.0.0' + mojom: '>=0.0.4 <1.0.0'