mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Merge pull request #52 from nlacasse/release-debug
run_mojo: Add --mojo-release and --mojo-debug flags.
This commit is contained in:
commit
be0b3e61be
@ -22,6 +22,9 @@ class RunMojoCommand extends Command {
|
||||
final description = 'Run a Flutter app in mojo.';
|
||||
RunMojoCommand() {
|
||||
argParser.addFlag('android', negatable: false, help: 'Run on an Android device');
|
||||
argParser.addFlag('mojo-debug', negatable: false, help: 'Use Debug build of mojo');
|
||||
argParser.addFlag('mojo-release', negatable: false, help: 'Use Release build of mojo (default)');
|
||||
|
||||
argParser.addOption('app', defaultsTo: 'app.flx');
|
||||
argParser.addOption('mojo-path', help: 'Path to directory containing mojo_shell and services');
|
||||
argParser.addOption('package-root', defaultsTo: 'packages');
|
||||
@ -40,9 +43,10 @@ class RunMojoCommand extends Command {
|
||||
String command = await _makePathAbsolute(path.join(results['mojo-path'], 'mojo', 'devtools', 'common', 'mojo_run'));
|
||||
String appName = path.basename(appPath);
|
||||
String appDir = path.dirname(appPath);
|
||||
String buildFlag = argResults['mojo-debug'] ? '--debug' : '--release';
|
||||
List<String> args = [
|
||||
'--android',
|
||||
'--release',
|
||||
buildFlag,
|
||||
'http://app/$appName',
|
||||
'--map-origin=http://app/=$appDir',
|
||||
'--map-origin=http://sky_viewer/=$skyViewerUrl',
|
||||
@ -60,7 +64,8 @@ class RunMojoCommand extends Command {
|
||||
|
||||
Future<int> _runLinux(ArgResults results, String appPath, ArtifactStore artifacts) async {
|
||||
String viewerPath = await _makePathAbsolute(await artifacts.getPath(Artifact.SkyViewerMojo));
|
||||
String mojoShellPath = await _makePathAbsolute(path.join(results['mojo-path'], 'out', 'Release', 'mojo_shell'));
|
||||
String mojoBuildType = argResults['mojo-debug'] ? 'Debug' : 'Release';
|
||||
String mojoShellPath = await _makePathAbsolute(path.join(results['mojo-path'], 'out', mojoBuildType, 'mojo_shell'));
|
||||
List<String> args = [
|
||||
'file://${appPath}',
|
||||
'--url-mappings=mojo:sky_viewer=file://${viewerPath}'
|
||||
@ -75,6 +80,10 @@ class RunMojoCommand extends Command {
|
||||
_logging.severe('Must specify --mojo-path to mojo_run');
|
||||
return 1;
|
||||
}
|
||||
if (argResults['mojo-debug'] && argResults['mojo-release']) {
|
||||
_logging.severe('Cannot specify both --mojo-debug and --mojo-release');
|
||||
return 1;
|
||||
}
|
||||
String packageRoot = argResults['package-root'];
|
||||
ArtifactStore artifacts = new ArtifactStore(packageRoot);
|
||||
String appPath = await _makePathAbsolute(argResults['app']);
|
||||
|
Loading…
Reference in New Issue
Block a user