Skip to content

Commit 487155d

Browse files
author
Anna Gringauze
authored
Do not use pub.dart.snapshot (#1394)
* Do not use pub.dart.snapshot - pub.dart.shapshot was removed since 2.15.0-49.0.dev - replace it by `dartdev.dart.snapshot pub` in webdev and tests - all versions 2.13.0 and higher contain this snapshot so no need to check for version as it is guaranteed to be 2.13.0 oe higher by our min sdk constraints. * Use instead of Pub is a package manager for Dart. Usage: pub <command> [arguments] Global options: -h, --help Print this usage information. --version Print pub version. --[no-]trace Print debugging information when an error occurs. --verbosity Control output verbosity. [all] Show all output including internal tracing messages. [error] Show only errors. [io] Also show IO operations. [normal] Show errors, warnings, and user messages. [solver] Show steps during version resolution. [warning] Show only errors and warnings. -v, --verbose Shortcut for "--verbosity=all". -C, --directory=<dir> Run the subcommand in the directory<dir>. (defaults to ".") Available commands: add Add a dependency to pubspec.yaml. cache Work with the system cache. deps Print package dependencies. downgrade Downgrade the current package's dependencies to oldest versions. get Get the current package's dependencies. global Work with global packages. login Log into pub.dev. logout Log out of pub.dev. outdated Analyze your dependencies to find which ones can be upgraded. publish Publish the current package to pub.dartlang.org. remove Removes a dependency from the current package. run Run an executable from a package. upgrade Upgrade the current package's dependencies to latest versions. uploader Manage uploaders for a package on pub.dartlang.org. version Print pub version. Run "pub help <command>" for more information about a command. See https://dart.dev/tools/pub/cmd for detailed documentation. or pub.dart.snapshot * Try fix daemon not starting on windows * Try fix test failures on windows * Remove outdated comment as well
1 parent f6b8457 commit 487155d

File tree

7 files changed

+8
-28
lines changed

7 files changed

+8
-28
lines changed

dwds/test/fixtures/utilities.dart

+1-9
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ Future<BuildDaemonClient> connectClient(String workingDirectory,
1616
List<String> options, Function(ServerLog) logHandler) =>
1717
BuildDaemonClient.connect(
1818
workingDirectory,
19-
// On Windows we need to call the snapshot directly otherwise
20-
// the process will start in a disjoint cmd without access to
21-
// STDIO. We also want to ensure the version of pub is consistent with
22-
// the SDK that was used to launch webdev.
23-
[dartPath, pubSnapshot]
19+
[dartPath]
2420
..addAll(['run', 'build_runner', 'daemon'])
2521
..addAll(options),
2622
logHandler: logHandler);
@@ -36,10 +32,6 @@ final String _sdkDir = (() {
3632

3733
final String dartSdkPath = _sdkDir;
3834
final String dartPath = p.join(_sdkDir, 'bin', 'dart');
39-
final String pubSnapshot =
40-
p.join(_sdkDir, 'bin', 'snapshots', 'pub.dart.snapshot');
41-
final String pubPath =
42-
p.join(_sdkDir, 'bin', Platform.isWindows ? 'pub.bat' : 'pub');
4335

4436
/// Returns the port of the daemon asset server.
4537
int daemonPort(String workingDirectory) {

frontend_server_common/lib/src/utilities.dart

-4
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,5 @@ final String _sdkDir = (() {
2121

2222
final String dartSdkPath = _sdkDir;
2323
final String dartPath = p.join(_sdkDir, 'bin', 'dart');
24-
final String pubSnapshot =
25-
p.join(_sdkDir, 'bin', 'snapshots', 'pub.dart.snapshot');
26-
final String pubPath =
27-
p.join(_sdkDir, 'bin', Platform.isWindows ? 'pub.bat' : 'pub');
2824

2925
const fs.FileSystem fileSystem = LocalFileSystem();

webdev/lib/src/daemon_client.dart

+1-5
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ Future<BuildDaemonClient> connectClient(String workingDirectory,
1818
List<String> options, Function(ServerLog) logHandler) =>
1919
BuildDaemonClient.connect(
2020
workingDirectory,
21-
// On Windows we need to call the snapshot directly otherwise
22-
// the process will start in a disjoint cmd without access to
23-
// STDIO. We also want to ensure the version of pub is consistent with
24-
// the SDK that was used to launch webdev.
25-
[dartPath, pubSnapshot]
21+
[dartPath]
2622
..addAll(['run', 'build_runner', 'daemon'])
2723
..addAll(options),
2824
logHandler: logHandler);

webdev/lib/src/pubspec.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ dev_dependencies:
5555
}
5656

5757
Future _runPubDeps() async {
58-
var result = Process.runSync(pubPath, ['deps']);
58+
var result = Process.runSync(dartPath, ['pub', 'deps']);
5959

6060
if (result.exitCode == 65 || result.exitCode == 66) {
6161
throw PackageException(
@@ -64,8 +64,8 @@ Future _runPubDeps() async {
6464

6565
if (result.exitCode != 0) {
6666
throw ProcessException(
67-
pubPath,
68-
['deps'],
67+
dartPath,
68+
['pub', 'deps'],
6969
'***OUT***\n${result.stdout}\n***ERR***\n${result.stderr}\n***',
7070
exitCode);
7171
}

webdev/lib/src/util.dart

-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,3 @@ final String _sdkDir = (() {
2020
})();
2121

2222
final String dartPath = p.join(_sdkDir, 'bin', 'dart');
23-
final String pubSnapshot =
24-
p.join(_sdkDir, 'bin', 'snapshots', 'pub.dart.snapshot');
25-
final String pubPath =
26-
p.join(_sdkDir, 'bin', Platform.isWindows ? 'pub.bat' : 'pub');

webdev/test/daemon/utils.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Future<String> prepareWorkspace() async {
4343
var exampleDirectory =
4444
p.absolute(p.join(p.current, '..', 'fixtures', '_webdevSmoke'));
4545

46-
var process = await TestProcess.start(pubPath, ['upgrade'],
46+
var process = await TestProcess.start(dartPath, ['pub', 'upgrade'],
4747
workingDirectory: exampleDirectory, environment: getPubEnvironment());
4848

4949
await process.shouldExit(0);

webdev/test/e2e_test.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ void main() {
4242
soundExampleDirectory =
4343
p.absolute(p.join(p.current, '..', 'fixtures', '_webdevSoundSmoke'));
4444

45-
var process = await TestProcess.start(pubPath, ['upgrade'],
45+
var process = await TestProcess.start(dartPath, ['pub', 'upgrade'],
4646
workingDirectory: exampleDirectory, environment: getPubEnvironment());
4747

4848
await process.shouldExit(0);
4949

50-
process = await TestProcess.start(pubPath, ['upgrade'],
50+
process = await TestProcess.start(dartPath, ['pub', 'upgrade'],
5151
workingDirectory: soundExampleDirectory,
5252
environment: getPubEnvironment());
5353

0 commit comments

Comments
 (0)