| 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/' |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 runBarback(options) | 58 runBarback(options) |
| 59 .then((_) => print('Done! All files written to "$outDir"')) | 59 .then((_) => print('Done! All files written to "$outDir"')) |
| 60 .catchError(_reportErrorAndExit); | 60 .catchError(_reportErrorAndExit); |
| 61 } | 61 } |
| 62 | 62 |
| 63 createDeployPhases(options) => new PolymerTransformerGroup(options).phases; | 63 createDeployPhases(options) => new PolymerTransformerGroup(options).phases; |
| 64 | 64 |
| 65 BarbackOptions _createTestOptions(String testFile, String outDir, | 65 BarbackOptions _createTestOptions(String testFile, String outDir, |
| 66 bool directlyIncludeJS, bool contentSecurityPolicy, bool releaseMode) { | 66 bool directlyIncludeJS, bool contentSecurityPolicy, bool releaseMode) { |
| 67 |
| 67 var testDir = path.normalize(path.dirname(testFile)); | 68 var testDir = path.normalize(path.dirname(testFile)); |
| 68 | 69 |
| 69 // A test must be allowed to import things in the package. | 70 // A test must be allowed to import things in the package. |
| 70 // So we must find its package root, given the entry point. We can do this | 71 // So we must find its package root, given the entry point. We can do this |
| 71 // by walking up to find pubspec.yaml. | 72 // by walking up to find pubspec.yaml. |
| 72 var pubspecDir = _findDirWithFile(path.absolute(testDir), 'pubspec.yaml'); | 73 var pubspecDir = _findDirWithFile(path.absolute(testDir), 'pubspec.yaml'); |
| 73 if (pubspecDir == null) { | 74 if (pubspecDir == null) { |
| 74 print('error: pubspec.yaml file not found, please run this script from ' | 75 print('error: pubspec.yaml file not found, please run this script from ' |
| 75 'your package root directory or a subdirectory.'); | 76 'your package root directory or a subdirectory.'); |
| 76 return null; | 77 return null; |
| 77 } | 78 } |
| 78 var packageName = readCurrentPackageFromPubspec(pubspecDir); | 79 var packageName = readCurrentPackageFromPubspec(pubspecDir); |
| 79 | 80 |
| 80 // Find the dart-root so we can include both polymer and smoke as additional | 81 // Find the dart-root so we can include both polymer and smoke as additional |
| 81 // packages whose transformers we need to run. | 82 // packages whose transformers we need to run. |
| 82 var pkgDir = path.join(_findDirWithDir(path.absolute(testDir), 'pkg'), 'pkg'); | 83 var pkgDir = path.join(_findDirWithDir(path.absolute(testDir), 'pkg'), 'pkg'); |
| 83 | 84 |
| 84 var phases = createDeployPhases(new TransformOptions( | 85 var phases = createDeployPhases(new TransformOptions( |
| 85 entryPoints: [path.relative(testFile, from: pubspecDir)], | 86 entryPoints: [path.relative(testFile, from: pubspecDir)], |
| 86 directlyIncludeJS: directlyIncludeJS, | 87 directlyIncludeJS: directlyIncludeJS, |
| 87 contentSecurityPolicy: contentSecurityPolicy, | 88 contentSecurityPolicy: contentSecurityPolicy, |
| 88 releaseMode: releaseMode)); | 89 releaseMode: releaseMode, |
| 90 lint: false)); |
| 89 return new BarbackOptions(phases, outDir, | 91 return new BarbackOptions(phases, outDir, |
| 90 currentPackage: packageName, | 92 currentPackage: packageName, |
| 91 packageDirs: { | 93 packageDirs: { |
| 92 'polymer': path.join(pkgDir, 'polymer'), | 94 'polymer': path.join(pkgDir, 'polymer'), |
| 93 'smoke': path.join(pkgDir, 'smoke'), | 95 'smoke': path.join(pkgDir, 'smoke'), |
| 94 // packageName may be a duplicate of 'polymer', but that's ok, the | 96 // packageName may be a duplicate of 'polymer', but that's ok, the |
| 95 // following will be the value used in the map (they should also be the | 97 // following will be the value used in the map (they should also be the |
| 96 // same value). | 98 // same value). |
| 97 packageName: pubspecDir, | 99 packageName: pubspecDir, |
| 98 }, | 100 }, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 _showUsage(parser); | 162 _showUsage(parser); |
| 161 return null; | 163 return null; |
| 162 } | 164 } |
| 163 } | 165 } |
| 164 | 166 |
| 165 _showUsage(parser) { | 167 _showUsage(parser) { |
| 166 print('Usage: dart --package-root=packages/ ' | 168 print('Usage: dart --package-root=packages/ ' |
| 167 'package:polymer/deploy.dart [options]'); | 169 'package:polymer/deploy.dart [options]'); |
| 168 print(parser.getUsage()); | 170 print(parser.getUsage()); |
| 169 } | 171 } |
| OLD | NEW |