diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html index 6637ad7b3d7..9228c47c2e7 100644 --- a/pkg/analysis_server/doc/api.html +++ b/pkg/analysis_server/doc/api.html @@ -356,6 +356,7 @@ a:focus, a:hover { "params": { "version": String "pid": int + "sessionId": optional String } }
@@ -375,6 +376,9 @@ a:focus, a:hover {
The process id of the analysis server process.
+The session id for this session.
notification: { "event": "server.error" "params": { diff --git a/pkg/analysis_server/lib/plugin/protocol/generated_protocol.dart b/pkg/analysis_server/lib/plugin/protocol/generated_protocol.dart index ce67998f1fe..f3c2d98a855 100644 --- a/pkg/analysis_server/lib/plugin/protocol/generated_protocol.dart +++ b/pkg/analysis_server/lib/plugin/protocol/generated_protocol.dart @@ -267,6 +267,7 @@ class ServerSetSubscriptionsResult { * { * "version": String * "pid": int + * "sessionId": optional String * } * * Clients may not extend, implement or mix-in this class. @@ -276,6 +277,8 @@ class ServerConnectedParams implements HasToJson { int _pid; + String _sessionId; + /** * The version number of the analysis server. */ @@ -302,9 +305,22 @@ class ServerConnectedParams implements HasToJson { this._pid = value; } - ServerConnectedParams(String version, int pid) { + /** + * The session id for this session. + */ + String get sessionId => _sessionId; + + /** + * The session id for this session. + */ + void set sessionId(String value) { + this._sessionId = value; + } + + ServerConnectedParams(String version, int pid, {String sessionId}) { this.version = version; this.pid = pid; + this.sessionId = sessionId; } factory ServerConnectedParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) { @@ -324,7 +340,11 @@ class ServerConnectedParams implements HasToJson { } else { throw jsonDecoder.missingKey(jsonPath, "pid"); } - return new ServerConnectedParams(version, pid); + String sessionId; + if (json.containsKey("sessionId")) { + sessionId = jsonDecoder.decodeString(jsonPath + ".sessionId", json["sessionId"]); + } + return new ServerConnectedParams(version, pid, sessionId: sessionId); } else { throw jsonDecoder.mismatch(jsonPath, "server.connected params", json); } @@ -339,6 +359,9 @@ class ServerConnectedParams implements HasToJson { Mapresult = {}; result["version"] = version; result["pid"] = pid; + if (sessionId != null) { + result["sessionId"] = sessionId; + } return result; } @@ -353,7 +376,8 @@ class ServerConnectedParams implements HasToJson { bool operator==(other) { if (other is ServerConnectedParams) { return version == other.version && - pid == other.pid; + pid == other.pid && + sessionId == other.sessionId; } return false; } @@ -363,6 +387,7 @@ class ServerConnectedParams implements HasToJson { int hash = 0; hash = JenkinsSmiHash.combine(hash, version.hashCode); hash = JenkinsSmiHash.combine(hash, pid.hashCode); + hash = JenkinsSmiHash.combine(hash, sessionId.hashCode); return JenkinsSmiHash.finish(hash); } } diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart index aa20e42dfc3..d53d90b26d7 100644 --- a/pkg/analysis_server/lib/src/analysis_server.dart +++ b/pkg/analysis_server/lib/src/analysis_server.dart @@ -376,8 +376,9 @@ class AnalysisServer { _setupIndexInvalidation(); pubSummaryManager = new PubSummaryManager(resourceProvider, '${io.pid}.temp'); - Notification notification = - new ServerConnectedParams(VERSION, io.pid).toNotification(); + Notification notification = new ServerConnectedParams(VERSION, io.pid, + sessionId: instrumentationService.sessionId) + .toNotification(); channel.sendNotification(notification); channel.listen(handleRequest, onDone: done, onError: error); handlers = serverPlugin.createDomains(this); diff --git a/pkg/analysis_server/test/integration/integration_test_methods.dart b/pkg/analysis_server/test/integration/integration_test_methods.dart index 580499d9e6c..9e4a5ee41a9 100644 --- a/pkg/analysis_server/test/integration/integration_test_methods.dart +++ b/pkg/analysis_server/test/integration/integration_test_methods.dart @@ -92,6 +92,10 @@ abstract class IntegrationTestMixin { * pid (int) * * The process id of the analysis server process. + * + * sessionId (optional String) + * + * The session id for this session. */ Stream onServerConnected; diff --git a/pkg/analysis_server/test/integration/protocol_matchers.dart b/pkg/analysis_server/test/integration/protocol_matchers.dart index 5c8e84a6ac3..fef9ef3fab5 100644 --- a/pkg/analysis_server/test/integration/protocol_matchers.dart +++ b/pkg/analysis_server/test/integration/protocol_matchers.dart @@ -66,12 +66,15 @@ final Matcher isServerSetSubscriptionsResult = isNull; * { * "version": String * "pid": int + * "sessionId": optional String * } */ final Matcher isServerConnectedParams = new LazyMatcher(() => new MatchesJsonObject( "server.connected params", { "version": isString, "pid": isInt + }, optionalFields: { + "sessionId": isString })); /** diff --git a/pkg/analysis_server/tool/spec/generate_files b/pkg/analysis_server/tool/spec/generate_files index 85092ea4503..ee9e9701f05 100755 --- a/pkg/analysis_server/tool/spec/generate_files +++ b/pkg/analysis_server/tool/spec/generate_files @@ -32,27 +32,31 @@ SCRIPT_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" ROOT_DIR="$(cd "${SCRIPT_DIR}/../../../.." ; pwd -P)" -BIN_DIR="${ROOT_DIR}/sdk/bin" - -if [ -z "$DART_CONFIGURATION" ]; +if [[ $1 == '--arch' && $2 == 'x64' ]]; +then + DART_CONFIGURATION="ReleaseX64" +elif [ -z "$DART_CONFIGURATION" ]; then DART_CONFIGURATION="ReleaseIA32" fi if [[ `uname` == 'Darwin' ]]; then - BUILD_DIR="${ROOT_DIR}/xcodebuild/$DART_CONFIGURATION" -else - BUILD_DIR="${ROOT_DIR}/out/$DART_CONFIGURATION" + if [[ $GYP_GENERATORS == 'ninja' ]]; + then + BUILD_DIR="${ROOT_DIR}/out/$DART_CONFIGURATION" + else + BUILD_DIR="${ROOT_DIR}/xcodebuild/$DART_CONFIGURATION" + fi fi -PKG_DIR="${BUILD_DIR}/packages" +PKG_FILE="${ROOT_DIR}/pkg/analysis_server/.packages" -DART="${BIN_DIR}/dart" +DART="${BUILD_DIR}/dart-sdk/bin/dart" declare -a VM_OPTIONS VM_OPTIONS+=("--checked") -VM_OPTIONS+=("--package-root=${PKG_DIR}") +VM_OPTIONS+=("--packages=${PKG_FILE}") cd "${SCRIPT_DIR}" "${DART}" "${VM_OPTIONS[@]}" "generate_all.dart" diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html index cadad70e326..5290921df23 100644 --- a/pkg/analysis_server/tool/spec/spec_input.html +++ b/pkg/analysis_server/tool/spec/spec_input.html @@ -243,6 +243,10 @@ int The process id of the analysis server process.
++ String + The session id for this session.
+diff --git a/pkg/analyzer/lib/instrumentation/file_instrumentation.dart b/pkg/analyzer/lib/instrumentation/file_instrumentation.dart index fe36a9eb8bb..d4088f87fd1 100644 --- a/pkg/analyzer/lib/instrumentation/file_instrumentation.dart +++ b/pkg/analyzer/lib/instrumentation/file_instrumentation.dart @@ -20,6 +20,9 @@ class FileInstrumentationServer implements InstrumentationServer { _sink = file.openWrite(); } + @override + String get sessionId => ''; + @override void log(String message) { _sink.writeln(message); diff --git a/pkg/analyzer/lib/instrumentation/instrumentation.dart b/pkg/analyzer/lib/instrumentation/instrumentation.dart index eaf95ba56e8..abc2799315e 100644 --- a/pkg/analyzer/lib/instrumentation/instrumentation.dart +++ b/pkg/analyzer/lib/instrumentation/instrumentation.dart @@ -22,6 +22,11 @@ class AnalysisPerformanceKind { * server. */ abstract class InstrumentationServer { + /** + * Return the identifier used to identify the current session. + */ + String get sessionId; + /** * Pass the given [message] to the instrumentation server so that it will be * logged with other messages. @@ -95,6 +100,11 @@ class InstrumentationService { */ bool get isActive => _instrumentationServer != null; + /** + * Return the identifier used to identify the current session. + */ + String get sessionId => _instrumentationServer?.sessionId ?? ''; + /** * The current time, expressed as a decimal encoded number of milliseconds. */ @@ -356,6 +366,9 @@ class MulticastInstrumentationServer implements InstrumentationServer { MulticastInstrumentationServer(this._servers); + @override + String get sessionId => _servers[0].sessionId; + @override void log(String message) { for (InstrumentationServer server in _servers) { diff --git a/pkg/analyzer/test/instrumentation/instrumentation_test.dart b/pkg/analyzer/test/instrumentation/instrumentation_test.dart index 8386ee70f4f..e6cafc002b5 100644 --- a/pkg/analyzer/test/instrumentation/instrumentation_test.dart +++ b/pkg/analyzer/test/instrumentation/instrumentation_test.dart @@ -164,6 +164,9 @@ class TestInstrumentationServer implements InstrumentationServer { StringBuffer normalChannel = new StringBuffer(); StringBuffer priorityChannel = new StringBuffer(); + @override + String get sessionId => ''; + @override void log(String message) { normalChannel.writeln(message);