Last active
December 16, 2015 19:39
-
-
Save damondouglas/5486693 to your computer and use it in GitHub Desktop.
createWebuiCompilerTask
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library hop_runner; | |
import 'dart:async'; | |
import 'dart:io'; | |
import 'package:hop/hop.dart'; | |
import 'package:hop/hop_tasks.dart'; | |
void main(){ | |
final String out = "out/"; | |
addTask('webui', createWebuiCompilerTask("web/deleteme.html",output:out)); | |
final paths = ["$out/deleteme.html_bootstrap.dart"]; | |
addTask('dart2js', createDart2JsTask(paths, liveTypeAnalysis: true, rejectDeprecatedFeatures: true)); | |
runHop(); | |
} | |
Task createWebuiCompilerTask(String entryPoint,{String output:"web/out"}){ | |
final entryPointFile = new File(entryPoint); | |
assert(entryPointFile.existsSync() && entryPoint.endsWith(".html")); | |
return new Task.async((context){ | |
return _dwc(context, output, entryPoint) | |
.then((bool success){ | |
return success; | |
}); | |
}); | |
} | |
Future<bool> _dwc(TaskContext ctx, String output, String entryPoint){ | |
final packageDir = new Directory('packages'); | |
assert(packageDir.existsSync()); | |
final args = ["--package-root=${packageDir.path}/", | |
"packages/web_ui/dwc.dart", | |
"--out", | |
"$output/", | |
"$entryPoint" | |
]; | |
return startProcess(ctx, _getPlatformBin('dart'), args); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment