d7cef28bee
This change further prepares for the removal of Observatory from the shipped Dart SDK by creating a fork to be used by the remaining Observatory users. This is basically a straight copy of the contents from runtime/observatory with the exception of two new scripts: - `bin/observatory.dart`, a utility to launch Observatory - `bin/activate.dart`, which globally activates `bin/observatory.dart` as `observatory` This change also updates the presubmits to ensure that `runtime/observatory` is effectively placed in read-only mode to prevent any divergences with the fork. Work towards https://github.com/dart-lang/sdk/issues/50233 Change-Id: Iff3a7512058f36afa2a96d45d94a1dff424401d6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429800 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Ben Konyi <bkonyi@google.com>
36 lines
1.0 KiB
Dart
36 lines
1.0 KiB
Dart
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'dart:io';
|
|
|
|
void main() {
|
|
final snapshotDir = Directory(
|
|
Platform.script.resolve('../.dart_tool/pub/bin/observatory').toFilePath(),
|
|
);
|
|
if (snapshotDir.existsSync()) {
|
|
print('Deleting previous observatory script snapshot at $snapshotDir');
|
|
snapshotDir.deleteSync(recursive: true);
|
|
}
|
|
|
|
print('Globally activating observatory...');
|
|
Process.runSync(Platform.resolvedExecutable, <String>[
|
|
'pub',
|
|
'global',
|
|
'activate',
|
|
'--source',
|
|
'path',
|
|
Platform.script.resolve('..').toFilePath(),
|
|
]);
|
|
print('observatory has been globally activated.');
|
|
|
|
try {
|
|
Process.runSync('observatory', const <String>['--help']);
|
|
} on ProcessException {
|
|
stderr.writeln('''
|
|
WARNING: observatory is globally activated but not available on your path.
|
|
Be sure to add \$PUB_CACHE/bin/ to your path.
|
|
''');
|
|
}
|
|
}
|