Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Unified Diff: pkg/dartino_compiler/lib/src/worker/developer.dart

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/dartino_compiler/lib/src/worker/developer.dart
diff --git a/pkg/fletchc/lib/src/worker/developer.dart b/pkg/dartino_compiler/lib/src/worker/developer.dart
similarity index 90%
rename from pkg/fletchc/lib/src/worker/developer.dart
rename to pkg/dartino_compiler/lib/src/worker/developer.dart
index 98ca9081031af6419f79fe4cc96c468e44559cb2..7df56a9d517d4f7cad4b1e92a5243717b38b50ad 100644
--- a/pkg/fletchc/lib/src/worker/developer.dart
+++ b/pkg/dartino_compiler/lib/src/worker/developer.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE.md file.
-library fletchc.worker.developer;
+library dartino_compiler.worker.developer;
import 'dart:async' show
Future,
@@ -32,12 +32,12 @@ import 'package:sdk_services/sdk_services.dart' show
OutputService,
SDKServices;
-import 'package:fletch_agent/agent_connection.dart' show
+import 'package:dartino_agent/agent_connection.dart' show
AgentConnection,
AgentException,
VmData;
-import 'package:fletch_agent/messages.dart' show
+import 'package:dartino_agent/messages.dart' show
AGENT_DEFAULT_PORT,
MessageDecodeException;
@@ -69,7 +69,7 @@ import '../../program_info.dart' show
buildProgramInfo;
import '../hub/session_manager.dart' show
- FletchVm,
+ DartinoVm,
SessionState,
Sessions;
@@ -81,8 +81,8 @@ import '../verbs/infrastructure.dart' show
ClientCommand,
CommandSender,
DiagnosticKind,
- FletchCompiler,
- FletchDelta,
+ DartinoCompiler,
+ DartinoDelta,
IncrementalCompiler,
WorkerConnection,
IsolatePool,
@@ -91,22 +91,22 @@ import '../verbs/infrastructure.dart' show
StreamIterator,
throwFatalError;
-import '../../incremental/fletchc_incremental.dart' show
+import '../../incremental/dartino_compiler_incremental.dart' show
IncrementalCompilationFailed,
IncrementalMode,
parseIncrementalMode,
unparseIncrementalMode;
-export '../../incremental/fletchc_incremental.dart' show
+export '../../incremental/dartino_compiler_incremental.dart' show
IncrementalMode;
-import '../../fletch_compiler.dart' show fletchDeviceType;
+import '../../dartino_compiler.dart' show dartinoDeviceType;
import '../hub/exit_codes.dart' as exit_codes;
-import '../../fletch_system.dart' show
- FletchFunction,
- FletchSystem;
+import '../../dartino_system.dart' show
+ DartinoFunction,
+ DartinoSystem;
import '../../bytecodes.dart' show
Bytecode,
@@ -117,8 +117,8 @@ import '../diagnostic.dart' show
import '../guess_configuration.dart' show
executable,
- fletchVersion,
- guessFletchVm;
+ dartinoVersion,
+ guessDartinoVm;
import '../device_type.dart' show
DeviceType,
@@ -205,44 +205,44 @@ void disconnectFromAgent(AgentConnection connection) {
}
Future<Null> checkAgentVersion(Uri base, SessionState state) async {
- String deviceFletchVersion = await withAgentConnection(state,
- (connection) => connection.fletchVersion());
- Uri packageFile = await lookForAgentPackage(base, version: fletchVersion);
+ String deviceDartinoVersion = await withAgentConnection(state,
+ (connection) => connection.dartinoVersion());
+ Uri packageFile = await lookForAgentPackage(base, version: dartinoVersion);
String fixit;
if (packageFile != null) {
fixit = "Try running\n"
- " 'fletch x-upgrade agent in session ${state.name}'.";
+ " 'dartino x-upgrade agent in session ${state.name}'.";
} else {
fixit = "Try downloading a matching SDK and running\n"
- " 'fletch x-upgrade agent in session ${state.name}'\n"
+ " 'dartino x-upgrade agent in session ${state.name}'\n"
"from the SDK's root directory.";
}
- if (fletchVersion != deviceFletchVersion) {
+ if (dartinoVersion != deviceDartinoVersion) {
throwFatalError(DiagnosticKind.agentVersionMismatch,
- userInput: fletchVersion,
- additionalUserInput: deviceFletchVersion,
+ userInput: dartinoVersion,
+ additionalUserInput: deviceDartinoVersion,
fixit: fixit);
}
}
Future<Null> startAndAttachViaAgent(Uri base, SessionState state) async {
- // TODO(wibling): integrate with the FletchVm class, e.g. have a
- // AgentFletchVm and LocalFletchVm that both share the same interface
+ // TODO(wibling): integrate with the DartinoVm class, e.g. have a
+ // AgentDartinoVm and LocalDartinoVm that both share the same interface
// where the former is interacting with the agent.
await checkAgentVersion(base, state);
VmData vmData = await withAgentConnection(state,
(connection) => connection.startVm());
- state.fletchAgentVmId = vmData.id;
+ state.dartinoAgentVmId = vmData.id;
String host = state.settings.deviceAddress.host;
await attachToVm(host, vmData.port, state);
await state.session.disableVMStandardOutput();
}
Future<Null> startAndAttachDirectly(SessionState state, Uri base) async {
- String fletchVmPath = state.compilerHelper.fletchVm.toFilePath();
- state.fletchVm = await FletchVm.start(fletchVmPath, workingDirectory: base);
- await attachToVm(state.fletchVm.host, state.fletchVm.port, state);
+ String dartinoVmPath = state.compilerHelper.dartinoVm.toFilePath();
+ state.dartinoVm = await DartinoVm.start(dartinoVmPath, workingDirectory: base);
+ await attachToVm(state.dartinoVm.host, state.dartinoVm.port, state);
await state.session.disableVMStandardOutput();
}
@@ -255,14 +255,14 @@ Future<Null> attachToVm(String host, int port, SessionState state) async {
// Perform handshake with VM which validates that VM and compiler
// have the same versions.
- HandShakeResult handShakeResult = await session.handShake(fletchVersion);
+ HandShakeResult handShakeResult = await session.handShake(dartinoVersion);
if (handShakeResult == null) {
throwFatalError(DiagnosticKind.handShakeFailed, address: '$host:$port');
}
if (!handShakeResult.success) {
throwFatalError(DiagnosticKind.versionMismatch,
address: '$host:$port',
- userInput: fletchVersion,
+ userInput: dartinoVersion,
additionalUserInput: handShakeResult.version);
}
@@ -284,9 +284,9 @@ Future<int> compile(
state.resetCompiler();
}
Uri firstScript = state.script;
- List<FletchDelta> previousResults = state.compilationResults;
+ List<DartinoDelta> previousResults = state.compilationResults;
- FletchDelta newResult;
+ DartinoDelta newResult;
try {
if (analyzeOnly) {
state.resetCompiler();
@@ -359,16 +359,16 @@ Future<Settings> createSettings(
StreamIterator<ClientCommand> commandIterator) async {
bool userProvidedSettings = uri != null;
if (!userProvidedSettings) {
- // Try to find a $sessionName.fletch-settings file starting from the current
+ // Try to find a $sessionName.dartino-settings file starting from the current
// working directory and walking up its parent directories.
- uri = await findFile(cwd, '$sessionName.fletch-settings');
+ uri = await findFile(cwd, '$sessionName.dartino-settings');
- // If no $sessionName.fletch-settings file is found, try to find the
+ // If no $sessionName.dartino-settings file is found, try to find the
// settings template file (in the SDK or git repo) by looking for a
- // .fletch-settings file starting from the fletch executable's directory
+ // .dartino-settings file starting from the dartino executable's directory
// and walking up its parent directory chain.
if (uri == null) {
- uri = await findFile(executable, '.fletch-settings');
+ uri = await findFile(executable, '.dartino-settings');
if (uri != null) print('Using template settings file $uri');
}
}
@@ -381,16 +381,16 @@ Future<Settings> createSettings(
if (userProvidedSettings) return settings;
// TODO(wibling): get rid of below special handling of the sessions 'remote'
- // and 'local' and come up with a fletch project concept that can contain
+ // and 'local' and come up with a dartino project concept that can contain
// these settings.
Uri packagesUri;
Address address;
switch (sessionName) {
case "remote":
- uri = configFileUri.resolve("remote.fletch-settings");
+ uri = configFileUri.resolve("remote.dartino-settings");
Settings remoteSettings = await readSettings(uri);
if (remoteSettings != null) return remoteSettings;
- packagesUri = executable.resolve("fletch-sdk.packages");
+ packagesUri = executable.resolve("dartino-sdk.packages");
address = await readAddressFromUser(commandSender, commandIterator);
if (address == null) {
// Assume user aborted data entry.
@@ -399,11 +399,11 @@ Future<Settings> createSettings(
break;
case "local":
- uri = configFileUri.resolve("local.fletch-settings");
+ uri = configFileUri.resolve("local.dartino-settings");
Settings localSettings = await readSettings(uri);
if (localSettings != null) return localSettings;
// TODO(ahe): Use mock packages here.
- packagesUri = executable.resolve("fletch-sdk.packages");
+ packagesUri = executable.resolve("dartino-sdk.packages");
break;
default:
@@ -449,7 +449,7 @@ Future<Address> readAddressFromUser(
devices = await discoverDevices(prefixWithNumber: true);
if (devices.isEmpty) {
commandSender.sendStdout(
- "Couldn't find Fletch capable devices\n");
+ "Couldn't find Dartino capable devices\n");
commandSender.sendStdout(message);
} else {
if (devices.length == 1) {
@@ -458,7 +458,7 @@ Future<Address> readAddressFromUser(
} else {
commandSender.sendStdout("\n");
commandSender.sendStdout(
- "Found ${devices.length} Fletch capable devices\n");
+ "Found ${devices.length} Dartino capable devices\n");
commandSender.sendStdout(
"Please enter the number or the IP address of "
"the remote device you would like to use "
@@ -503,33 +503,33 @@ SessionState createSessionState(
String name,
Settings settings,
{Uri libraryRoot,
- Uri fletchVm,
+ Uri dartinoVm,
Uri nativesJson}) {
if (settings == null) {
settings = const Settings.empty();
}
- List<String> compilerOptions = const bool.fromEnvironment("fletchc-verbose")
+ List<String> compilerOptions = const bool.fromEnvironment("dartino_compiler-verbose")
? <String>['--verbose'] : <String>[];
compilerOptions.addAll(settings.options);
Uri packageConfig = settings.packages;
if (packageConfig == null) {
- packageConfig = executable.resolve("fletch-sdk.packages");
+ packageConfig = executable.resolve("dartino-sdk.packages");
}
DeviceType deviceType = settings.deviceType ??
- parseDeviceType(fletchDeviceType);
+ parseDeviceType(dartinoDeviceType);
String platform = (deviceType == DeviceType.embedded)
- ? "fletch_embedded.platform"
- : "fletch_mobile.platform";
+ ? "dartino_embedded.platform"
+ : "dartino_mobile.platform";
- FletchCompiler compilerHelper = new FletchCompiler(
+ DartinoCompiler compilerHelper = new DartinoCompiler(
options: compilerOptions,
packageConfig: packageConfig,
environment: settings.constants,
platform: platform,
libraryRoot: libraryRoot,
- fletchVm: fletchVm,
+ dartinoVm: dartinoVm,
nativesJson: nativesJson);
return new SessionState(
@@ -564,10 +564,10 @@ Future<int> run(
SessionState state,
{List<String> testDebuggerCommands,
bool terminateDebugger: true}) async {
- List<FletchDelta> compilationResults = state.compilationResults;
+ List<DartinoDelta> compilationResults = state.compilationResults;
Session session = state.session;
- for (FletchDelta delta in compilationResults) {
+ for (DartinoDelta delta in compilationResults) {
await session.applyDelta(delta);
}
@@ -586,7 +586,7 @@ Future<int> run(
if (command == null) {
await session.kill();
await session.shutdown();
- throwInternalError("No command received from Fletch VM");
+ throwInternalError("No command received from Dartino VM");
}
Future printException() async {
@@ -633,12 +633,12 @@ Future<int> run(
break;
case VmCommandCode.ConnectionError:
- state.log("Error on connection to Fletch VM: ${command.error}");
+ state.log("Error on connection to Dartino VM: ${command.error}");
exitCode = exit_codes.COMPILER_EXITCODE_CONNECTION_ERROR;
break;
default:
- throwInternalError("Unexpected result from Fletch VM: '$command'");
+ throwInternalError("Unexpected result from Dartino VM: '$command'");
break;
}
} finally {
@@ -660,11 +660,11 @@ Future<int> run(
Future<int> export(SessionState state,
Uri snapshot,
{bool binaryProgramInfo: false}) async {
- List<FletchDelta> compilationResults = state.compilationResults;
+ List<DartinoDelta> compilationResults = state.compilationResults;
Session session = state.session;
state.session = null;
- for (FletchDelta delta in compilationResults) {
+ for (DartinoDelta delta in compilationResults) {
await session.applyDelta(delta);
}
@@ -703,7 +703,7 @@ Future<int> compileAndAttachToVmThen(
Future<int> action(),
{ClientEventHandler eventHandler}) async {
bool startedVmDirectly = false;
- List<FletchDelta> compilationResults = state.compilationResults;
+ List<DartinoDelta> compilationResults = state.compilationResults;
if (compilationResults.isEmpty || script != null) {
if (script == null) {
throwFatalError(DiagnosticKind.noFileTarget);
@@ -719,7 +719,7 @@ Future<int> compileAndAttachToVmThen(
// We cannot reuse a session that has already been loaded. Loading
// currently implies that some of the code has been run.
if (state.explicitAttach) {
- // If the user explicitly called 'fletch attach' we cannot
+ // If the user explicitly called 'dartino attach' we cannot
// create a new VM session since we don't know if the vm is
// running locally or remotely and if running remotely there
// is no guarantee there is an agent to start a new vm.
@@ -741,10 +741,10 @@ Future<int> compileAndAttachToVmThen(
} else {
startedVmDirectly = true;
await startAndAttachDirectly(state, base);
- state.fletchVm.stdoutLines.listen((String line) {
+ state.dartinoVm.stdoutLines.listen((String line) {
commandSender.sendStdout("$line\n");
});
- state.fletchVm.stderrLines.listen((String line) {
+ state.dartinoVm.stderrLines.listen((String line) {
commandSender.sendStderr("$line\n");
});
}
@@ -765,7 +765,7 @@ Future<int> compileAndAttachToVmThen(
}
} finally {
if (waitForVmExit && startedVmDirectly) {
- exitCode = await state.fletchVm.exitCode;
+ exitCode = await state.dartinoVm.exitCode;
}
state.detachCommandSender();
}
@@ -778,10 +778,10 @@ void setupClientInOut(
ClientEventHandler eventHandler) {
// Forward output going into the state's outputSink using the passed in
// commandSender. This typically forwards output to the hub (main isolate)
- // which forwards it on to stdout of the Fletch C++ client.
+ // which forwards it on to stdout of the Dartino C++ client.
state.attachCommandSender(commandSender);
- // Start event handling for input passed from the Fletch C++ client.
+ // Start event handling for input passed from the Dartino C++ client.
eventHandler(state.session);
// Let the hub (main isolate) know that event handling has been started.
@@ -811,7 +811,7 @@ ClientEventHandler defaultClientEventHandler(
void handleSignal(SessionState state, int signalNumber) {
state.log("Received signal $signalNumber");
- if (!state.hasRemoteVm && state.fletchVm == null) {
+ if (!state.hasRemoteVm && state.dartinoVm == null) {
// This can happen if a user has attached to a vm using the "attach" verb
// in which case we don't forward the signal to the vm.
// TODO(wibling): Determine how to interpret the signal for the persistent
@@ -823,21 +823,21 @@ void handleSignal(SessionState state, int signalNumber) {
if (state.hasRemoteVm) {
signalAgentVm(state, signalNumber);
} else {
- assert(state.fletchVm.process != null);
- int vmPid = state.fletchVm.process.pid;
+ assert(state.dartinoVm.process != null);
+ int vmPid = state.dartinoVm.process.pid;
Process.runSync("kill", ["-$signalNumber", "$vmPid"]);
}
}
Future signalAgentVm(SessionState state, int signalNumber) async {
await withAgentConnection(state, (connection) {
- return connection.signalVm(state.fletchAgentVmId, signalNumber);
+ return connection.signalVm(state.dartinoAgentVmId, signalNumber);
});
}
String extractVersion(Uri uri) {
List<String> nameParts = uri.pathSegments.last.split('_');
- if (nameParts.length != 3 || nameParts[0] != 'fletch-agent') {
+ if (nameParts.length != 3 || nameParts[0] != 'dartino-agent') {
throwFatalError(DiagnosticKind.upgradeInvalidPackageName);
}
String version = nameParts[1];
@@ -848,7 +848,7 @@ String extractVersion(Uri uri) {
return version;
}
-/// Try to locate an Fletch agent package file assuming the normal SDK layout
+/// Try to locate an Dartino agent package file assuming the normal SDK layout
/// with SDK base directory [base].
///
/// If the parameter [version] is passed, the Uri is only returned, if
@@ -864,7 +864,7 @@ Future<Uri> lookForAgentPackage(Uri base, {String version}) async {
for (FileSystemEntity entry in platformDir.listSync()) {
Uri uri = entry.uri;
String name = uri.pathSegments.last;
- if (name.startsWith('fletch-agent') &&
+ if (name.startsWith('dartino-agent') &&
name.endsWith('.deb') &&
(version == null || extractVersion(uri) == version)) {
return uri;
@@ -1007,7 +1007,7 @@ Future<int> upgradeAgent(
Version existingVersion = parseVersion(
await withAgentConnection(state,
- (connection) => connection.fletchVersion()));
+ (connection) => connection.dartinoVersion()));
if (existingVersion == version) {
print('Target device is already at $version');
@@ -1046,10 +1046,10 @@ Future<int> upgradeAgent(
}
List<int> data = await new File.fromUri(packageUri).readAsBytes();
- print("Sending package to fletch agent");
+ print("Sending package to dartino agent");
await withAgentConnection(state,
(connection) => connection.upgradeAgent(version.toString(), data));
- print("Transfer complete, waiting for the Fletch agent to restart. "
+ print("Transfer complete, waiting for the Dartino agent to restart. "
"This can take a few seconds.");
Version newVersion;
@@ -1066,7 +1066,7 @@ Future<int> upgradeAgent(
state.log("Connected to TCP waitForAgentUpgrade $info");
});
AgentConnection connection = new AgentConnection(socket);
- newVersion = parseVersion(await connection.fletchVersion());
+ newVersion = parseVersion(await connection.dartinoVersion());
disconnectFromAgent(connection);
if (newVersion != existingVersion) {
break;
@@ -1082,8 +1082,8 @@ Future<int> upgradeAgent(
"If the upgrade fails again, try rebooting the device.");
return 1;
} else if (newVersion == null) {
- print("Could not connect to Fletch agent after upgrade.");
- print("Try running 'fletch show devices' later to see if it has been"
+ print("Could not connect to Dartino agent after upgrade.");
+ print("Try running 'dartino show devices' later to see if it has been"
" restarted. If the device does not show up, try rebooting it.");
return 1;
} else {
@@ -1123,7 +1123,7 @@ Future<int> downloadTools(
}
const String gcsRoot = "https://storage.googleapis.com";
- String gcsBucket = "fletch-archive";
+ String gcsBucket = "dartino-archive";
Future downloadTool(String gcsPath, String zipFile, String toolName) async {
Uri url = Uri.parse("$gcsRoot/$gcsBucket/$gcsPath/$zipFile");
@@ -1150,12 +1150,12 @@ Future<int> downloadTools(
String gcsPath;
- Version version = parseVersion(fletchVersion);
+ Version version = parseVersion(dartinoVersion);
if (version.isEdgeVersion) {
print("WARNING: For bleeding edge a fixed image is used.");
// For edge versions download use a well known version for now.
var knownVersion = "0.3.0-edge.3c85dbafe006eb2ce16545aaf3df1352fa7a4500";
- gcsBucket = "fletch-temporary";
+ gcsBucket = "dartino-temporary";
gcsPath = "channels/be/raw/$knownVersion/sdk";
} else if (version.isDevVersion) {
// TODO(sgjesse): Change this to channels/dev/release at some point.
@@ -1232,7 +1232,7 @@ Future<String> getAgentVersion(InternetAddress host, int port) async {
}
try {
AgentConnection connection = new AgentConnection(socket);
- return await connection.fletchVersion();
+ return await connection.dartinoVersion();
} finally {
socket.close();
}
« no previous file with comments | « pkg/dartino_compiler/lib/src/verbs/x_upgrade_verb.dart ('k') | pkg/dartino_compiler/lib/src/worker/worker_main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698