Commit 7be58b1a authored by Adam Barth's avatar Adam Barth

Merge pull request #442 from abarth/run_flutter_mojo

Switch flutter run_mojo over to flutter.mojo
parents 2734627a b8e16d7c
...@@ -56,7 +56,7 @@ String _getCloudStorageBaseUrl({String category, String platform, String revisio ...@@ -56,7 +56,7 @@ String _getCloudStorageBaseUrl({String category, String platform, String revisio
enum ArtifactType { enum ArtifactType {
snapshot, snapshot,
shell, shell,
viewer, mojo,
} }
class Artifact { class Artifact {
...@@ -121,17 +121,17 @@ class ArtifactStore { ...@@ -121,17 +121,17 @@ class ArtifactStore {
hostPlatform: HostPlatform.mac hostPlatform: HostPlatform.mac
), ),
const Artifact._( const Artifact._(
name: 'Sky Viewer', name: 'Flutter for Mojo',
fileName: 'sky_viewer.mojo', fileName: 'flutter.mojo',
category: _kViewerCategory, category: _kShellCategory,
type: ArtifactType.viewer, type: ArtifactType.mojo,
targetPlatform: TargetPlatform.android targetPlatform: TargetPlatform.android
), ),
const Artifact._( const Artifact._(
name: 'Sky Viewer', name: 'Flutter for Mojo',
fileName: 'sky_viewer.mojo', fileName: 'flutter.mojo',
category: _kViewerCategory, category: _kShellCategory,
type: ArtifactType.viewer, type: ArtifactType.mojo,
targetPlatform: TargetPlatform.linux targetPlatform: TargetPlatform.linux
), ),
]; ];
......
...@@ -73,39 +73,39 @@ class RunMojoCommand extends FlutterCommand { ...@@ -73,39 +73,39 @@ class RunMojoCommand extends FlutterCommand {
} }
Future<List<String>> _getShellConfig() async { Future<List<String>> _getShellConfig() async {
List<String> args = []; List<String> args = <String>[];
final useDevtools = _useDevtools(); final bool useDevtools = _useDevtools();
final command = useDevtools ? _getDevtoolsPath() : _getMojoShellPath(); final String command = useDevtools ? _getDevtoolsPath() : _getMojoShellPath();
args.add(command); args.add(command);
if (argResults['android']) { if (argResults['android']) {
args.add('--android'); args.add('--android');
final skyViewerUrl = ArtifactStore.getCloudStorageBaseUrl('viewer', 'android-arm'); final String cloudStorageBaseUrl = ArtifactStore.getCloudStorageBaseUrl('shell', 'android-arm');
final appPath = _makePathAbsolute(argResults['app']); final String appPath = _makePathAbsolute(argResults['app']);
final appName = path.basename(appPath); final String appName = path.basename(appPath);
final appDir = path.dirname(appPath); final String appDir = path.dirname(appPath);
args.add('http://app/$appName'); args.add('http://app/$appName');
args.add('--map-origin=http://app/=$appDir'); args.add('--map-origin=http://app/=$appDir');
args.add('--map-origin=http://sky_viewer/=$skyViewerUrl'); args.add('--map-origin=http://flutter/=$cloudStorageBaseUrl');
args.add('--url-mappings=mojo:sky_viewer=http://sky_viewer/sky_viewer.mojo'); args.add('--url-mappings=mojo:flutter=http://flutter/flutter.mojo');
} else { } else {
final appPath = _makePathAbsolute(argResults['app']); final String appPath = _makePathAbsolute(argResults['app']);
String viewerPath; String flutterPath;
BuildConfiguration config = _getCurrentHostConfig(); BuildConfiguration config = _getCurrentHostConfig();
if (config.type == BuildType.prebuilt) { if (config == null || config.type == BuildType.prebuilt) {
Artifact artifact = ArtifactStore.getArtifact(type: ArtifactType.viewer, targetPlatform: TargetPlatform.linux); Artifact artifact = ArtifactStore.getArtifact(type: ArtifactType.mojo, targetPlatform: TargetPlatform.linux);
viewerPath = _makePathAbsolute(await ArtifactStore.getPath(artifact)); flutterPath = _makePathAbsolute(await ArtifactStore.getPath(artifact));
} else { } else {
String localPath = path.join(config.buildDir, 'sky_viewer.mojo'); String localPath = path.join(config.buildDir, 'flutter.mojo');
viewerPath = _makePathAbsolute(localPath); flutterPath = _makePathAbsolute(localPath);
} }
args.add('file://$appPath'); args.add('file://$appPath');
args.add('--url-mappings=mojo:sky_viewer=file://$viewerPath'); args.add('--url-mappings=mojo:flutter=file://$flutterPath');
} }
if (useDevtools) { if (useDevtools) {
final buildFlag = argResults['mojo-debug'] ? '--debug' : '--release'; final String buildFlag = argResults['mojo-debug'] ? '--debug' : '--release';
args.add(buildFlag); args.add(buildFlag);
if (_logging.level <= Level.INFO) { if (_logging.level <= Level.INFO) {
args.add('--verbose'); args.add('--verbose');
...@@ -116,7 +116,7 @@ class RunMojoCommand extends FlutterCommand { ...@@ -116,7 +116,7 @@ class RunMojoCommand extends FlutterCommand {
} }
if (argResults['checked']) { if (argResults['checked']) {
args.add('--args-for=mojo:sky_viewer --enable-checked-mode'); args.add('--args-for=mojo:flutter --enable-checked-mode');
} }
args.addAll(argResults.rest); args.addAll(argResults.rest);
......
...@@ -12,7 +12,7 @@ import 'package:bignum/bignum.dart'; ...@@ -12,7 +12,7 @@ import 'package:bignum/bignum.dart';
import 'signing.dart'; import 'signing.dart';
// Magic string we put at the top of all bundle files. // Magic string we put at the top of all bundle files.
const String kBundleMagic = '#!mojo mojo:sky_viewer\n'; const String kBundleMagic = '#!mojo mojo:flutter\n';
// Prefix of the above, used when reading bundle files. This allows us to be // Prefix of the above, used when reading bundle files. This allows us to be
// more flexbile about what we accept. // more flexbile about what we accept.
...@@ -135,7 +135,7 @@ class Bundle { ...@@ -135,7 +135,7 @@ class Bundle {
void writeSync() { void writeSync() {
assert(_contentBytes != null); assert(_contentBytes != null);
RandomAccessFile outputFile = new File(path).openSync(mode: FileMode.WRITE); RandomAccessFile outputFile = new File(path).openSync(mode: FileMode.WRITE);
outputFile.writeStringSync('#!mojo mojo:sky_viewer\n'); outputFile.writeStringSync(kBundleMagic);
_writeBytesWithLengthSync(outputFile, signatureBytes); _writeBytesWithLengthSync(outputFile, signatureBytes);
_writeBytesWithLengthSync(outputFile, manifestBytes); _writeBytesWithLengthSync(outputFile, manifestBytes);
outputFile.writeFromSync(_contentBytes); outputFile.writeFromSync(_contentBytes);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment