Index: pkg/polymer/lib/deploy.dart |
diff --git a/pkg/polymer/lib/deploy.dart b/pkg/polymer/lib/deploy.dart |
index c63e74524de13e647acc0adbc14cecb76d900fbc..7cc5dc1ff2e3bce76bb75f2642232094047d27e1 100644 |
--- a/pkg/polymer/lib/deploy.dart |
+++ b/pkg/polymer/lib/deploy.dart |
@@ -45,6 +45,8 @@ main(List<String> arguments) { |
releaseMode: !args['debug']); |
var phases = createDeployPhases(transformOps); |
options = new BarbackOptions(phases, outDir, |
+ // TODO(sigmund): include here also smoke transformer when it's on by |
+ // default. |
packagePhases: {'polymer': phasesForPolymer}); |
} else { |
options = _createTestOptions( |
@@ -77,6 +79,10 @@ BarbackOptions _createTestOptions(String testFile, String outDir, |
} |
var packageName = readCurrentPackageFromPubspec(pubspecDir); |
+ // Find the dart-root so we can include both polymer and smoke as additional |
+ // packages whose transformers we need to run. |
+ var pkgDir = path.join(_findDirWithDir(path.absolute(testDir), 'pkg'), 'pkg'); |
+ |
var phases = createDeployPhases(new TransformOptions( |
entryPoints: [path.relative(testFile, from: pubspecDir)], |
directlyIncludeJS: directlyIncludeJS, |
@@ -84,7 +90,16 @@ BarbackOptions _createTestOptions(String testFile, String outDir, |
releaseMode: releaseMode)); |
return new BarbackOptions(phases, outDir, |
currentPackage: packageName, |
- packageDirs: {packageName : pubspecDir}, |
+ packageDirs: { |
+ 'polymer': path.join(pkgDir, 'polymer'), |
+ 'smoke': path.join(pkgDir, 'smoke'), |
+ // packageName may be a duplicate of 'polymer', but that's ok, the |
+ // following will be the value used in the map (they should also be the |
+ // same value). |
+ packageName: pubspecDir, |
+ }, |
+ // TODO(sigmund): include here also smoke transformer when it's on by |
+ // default. |
packagePhases: {'polymer': phasesForPolymer}, |
transformTests: true); |
} |
@@ -99,6 +114,16 @@ String _findDirWithFile(String dir, String filename) { |
return dir; |
} |
+String _findDirWithDir(String dir, String subdir) { |
+ while (!new Directory(path.join(dir, subdir)).existsSync()) { |
+ var parentDir = path.dirname(dir); |
+ // If we reached root and failed to find it, bail. |
+ if (parentDir == dir) return null; |
+ dir = parentDir; |
+ } |
+ return dir; |
+} |
+ |
void _reportErrorAndExit(e, trace) { |
print('Uncaught error: $e'); |
if (trace != null) print(trace); |