| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /// **Note**: If you already have a `build.dart` in your application, we | 5 /// **Note**: If you already have a `build.dart` in your application, we |
| 6 /// recommend to use the `package:polymer/builder.dart` library instead. | 6 /// recommend to use the `package:polymer/builder.dart` library instead. |
| 7 | 7 |
| 8 /// Temporary deploy command used to create a version of the app that can be | 8 /// Temporary deploy command used to create a version of the app that can be |
| 9 /// compiled with dart2js and deployed. Following pub layout conventions, this | 9 /// compiled with dart2js and deployed. Following pub layout conventions, this |
| 10 /// script will treat any HTML file under a package 'web/' and 'test/' | 10 /// script will treat any HTML file under a package 'web/' and 'test/' |
| 11 /// directories as entry points. | 11 /// directories as entry points. |
| 12 /// | 12 /// |
| 13 /// From an application package you can run deploy by creating a small program | 13 /// From an application package you can run deploy by creating a small program |
| 14 /// as follows: | 14 /// as follows: |
| 15 /// | 15 /// |
| 16 /// import "package:polymer/deploy.dart" as deploy; | 16 /// import "package:polymer/deploy.dart" as deploy; |
| 17 /// main() => deploy.main(); | 17 /// main() => deploy.main(); |
| 18 /// | 18 /// |
| 19 /// This library should go away once `pub deploy` can be configured to run | 19 /// This library should go away once `pub deploy` can be configured to run |
| 20 /// barback transformers. | 20 /// barback transformers. |
| 21 library polymer.deploy; | 21 library polymer.deploy; |
| 22 | 22 |
| 23 import 'dart:io'; | 23 import 'dart:io'; |
| 24 | 24 |
| 25 import 'package:args/args.dart'; | 25 import 'package:args/args.dart'; |
| 26 import 'package:code_transformers/tests.dart' show testingDartSdkDirectory; | 26 import 'package:code_transformers/tests.dart' show testingDartSdkDirectory; |
| 27 import 'package:path/path.dart' as path; | 27 import 'package:path/path.dart' as path; |
| 28 | 28 |
| 29 import 'src/build/common.dart' show TransformOptions, phasesForPolymer; | 29 import 'src/build/common.dart' show TransformOptions, LintOptions, |
| 30 phasesForPolymer; |
| 30 import 'src/build/runner.dart'; | 31 import 'src/build/runner.dart'; |
| 31 import 'transformer.dart'; | 32 import 'transformer.dart'; |
| 32 | 33 |
| 33 main(List<String> arguments) { | 34 main(List<String> arguments) { |
| 34 var args = _parseArgs(arguments); | 35 var args = _parseArgs(arguments); |
| 35 if (args == null) exit(1); | 36 if (args == null) exit(1); |
| 36 | 37 |
| 37 var test = args['test']; | 38 var test = args['test']; |
| 38 var outDir = args['out']; | 39 var outDir = args['out']; |
| 39 var filters = []; | 40 var filters = []; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 87 |
| 87 // Find the dart-root so we can include all package dependencies and | 88 // Find the dart-root so we can include all package dependencies and |
| 88 // transformers from other packages. | 89 // transformers from other packages. |
| 89 var pkgDir = path.join(_findDirWithDir(path.absolute(testDir), 'pkg'), 'pkg'); | 90 var pkgDir = path.join(_findDirWithDir(path.absolute(testDir), 'pkg'), 'pkg'); |
| 90 | 91 |
| 91 var phases = createDeployPhases(new TransformOptions( | 92 var phases = createDeployPhases(new TransformOptions( |
| 92 entryPoints: [path.relative(testFile, from: pubspecDir)], | 93 entryPoints: [path.relative(testFile, from: pubspecDir)], |
| 93 directlyIncludeJS: directlyIncludeJS, | 94 directlyIncludeJS: directlyIncludeJS, |
| 94 contentSecurityPolicy: contentSecurityPolicy, | 95 contentSecurityPolicy: contentSecurityPolicy, |
| 95 releaseMode: releaseMode, | 96 releaseMode: releaseMode, |
| 96 lint: false), sdkDir: testingDartSdkDirectory); | 97 lint: new LintOptions.disabled()), sdkDir: testingDartSdkDirectory); |
| 97 var dirs = {}; | 98 var dirs = {}; |
| 98 // Note: we include all packages in pkg/ to keep things simple. Ideally this | 99 // Note: we include all packages in pkg/ to keep things simple. Ideally this |
| 99 // should be restricted to the transitive dependencies of this package. | 100 // should be restricted to the transitive dependencies of this package. |
| 100 _subDirs(pkgDir).forEach((p) { dirs[path.basename(p)] = p; }); | 101 _subDirs(pkgDir).forEach((p) { dirs[path.basename(p)] = p; }); |
| 101 // Note: packageName may be a duplicate of 'polymer', but that's ok (they | 102 // Note: packageName may be a duplicate of 'polymer', but that's ok (they |
| 102 // should be the same value). | 103 // should be the same value). |
| 103 dirs[packageName]= pubspecDir; | 104 dirs[packageName]= pubspecDir; |
| 104 return new BarbackOptions(phases, outDir, | 105 return new BarbackOptions(phases, outDir, |
| 105 currentPackage: packageName, | 106 currentPackage: packageName, |
| 106 packageDirs: dirs, | 107 packageDirs: dirs, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 _showUsage(parser); | 177 _showUsage(parser); |
| 177 return null; | 178 return null; |
| 178 } | 179 } |
| 179 } | 180 } |
| 180 | 181 |
| 181 _showUsage(parser) { | 182 _showUsage(parser) { |
| 182 print('Usage: dart --package-root=packages/ ' | 183 print('Usage: dart --package-root=packages/ ' |
| 183 'package:polymer/deploy.dart [options]'); | 184 'package:polymer/deploy.dart [options]'); |
| 184 print(parser.getUsage()); | 185 print(parser.getUsage()); |
| 185 } | 186 } |
| OLD | NEW |