From 48ff0de5d40c6474595706dabea94f6448f08392 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Thu, 26 Aug 2021 15:06:32 -0700 Subject: [PATCH 1/5] 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. --- dwds/test/fixtures/utilities.dart | 8 ++++---- frontend_server_common/lib/src/utilities.dart | 2 ++ webdev/lib/src/daemon_client.dart | 4 ++-- webdev/lib/src/util.dart | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dwds/test/fixtures/utilities.dart b/dwds/test/fixtures/utilities.dart index 0e5a381dc..711dd8068 100644 --- a/dwds/test/fixtures/utilities.dart +++ b/dwds/test/fixtures/utilities.dart @@ -20,8 +20,8 @@ Future connectClient(String workingDirectory, // the process will start in a disjoint cmd without access to // STDIO. We also want to ensure the version of pub is consistent with // the SDK that was used to launch webdev. - [dartPath, pubSnapshot] - ..addAll(['run', 'build_runner', 'daemon']) + [dartPath, dartdevSnapshot] + ..addAll(['pub', 'run', 'build_runner', 'daemon']) ..addAll(options), logHandler: logHandler); @@ -36,8 +36,8 @@ final String _sdkDir = (() { final String dartSdkPath = _sdkDir; final String dartPath = p.join(_sdkDir, 'bin', 'dart'); -final String pubSnapshot = - p.join(_sdkDir, 'bin', 'snapshots', 'pub.dart.snapshot'); +final String dartdevSnapshot = + p.join(_sdkDir, 'bin', 'snapshots', 'dartdev.dart.snapshot'); final String pubPath = p.join(_sdkDir, 'bin', Platform.isWindows ? 'pub.bat' : 'pub'); diff --git a/frontend_server_common/lib/src/utilities.dart b/frontend_server_common/lib/src/utilities.dart index 9e89da85c..3d65850e9 100644 --- a/frontend_server_common/lib/src/utilities.dart +++ b/frontend_server_common/lib/src/utilities.dart @@ -23,6 +23,8 @@ final String dartSdkPath = _sdkDir; final String dartPath = p.join(_sdkDir, 'bin', 'dart'); final String pubSnapshot = p.join(_sdkDir, 'bin', 'snapshots', 'pub.dart.snapshot'); +final String dartdevSnapshot = + p.join(_sdkDir, 'bin', 'snapshots', 'dartdev.dart.snapshot'); final String pubPath = p.join(_sdkDir, 'bin', Platform.isWindows ? 'pub.bat' : 'pub'); diff --git a/webdev/lib/src/daemon_client.dart b/webdev/lib/src/daemon_client.dart index c72bba61c..aa4c6632f 100644 --- a/webdev/lib/src/daemon_client.dart +++ b/webdev/lib/src/daemon_client.dart @@ -22,8 +22,8 @@ Future connectClient(String workingDirectory, // the process will start in a disjoint cmd without access to // STDIO. We also want to ensure the version of pub is consistent with // the SDK that was used to launch webdev. - [dartPath, pubSnapshot] - ..addAll(['run', 'build_runner', 'daemon']) + [dartPath, dartdevSnapshot] + ..addAll(['pub', 'run', 'build_runner', 'daemon']) ..addAll(options), logHandler: logHandler); diff --git a/webdev/lib/src/util.dart b/webdev/lib/src/util.dart index f80b7b25e..5cc31587c 100644 --- a/webdev/lib/src/util.dart +++ b/webdev/lib/src/util.dart @@ -20,7 +20,7 @@ final String _sdkDir = (() { })(); final String dartPath = p.join(_sdkDir, 'bin', 'dart'); -final String pubSnapshot = - p.join(_sdkDir, 'bin', 'snapshots', 'pub.dart.snapshot'); +final String dartdevSnapshot = + p.join(_sdkDir, 'bin', 'snapshots', 'dartdev.dart.snapshot'); final String pubPath = p.join(_sdkDir, 'bin', Platform.isWindows ? 'pub.bat' : 'pub'); From 44fb1f50b33ac63b9620a735e536b507872da541 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Thu, 26 Aug 2021 17:10:58 -0700 Subject: [PATCH 2/5] Use instead of Pub is a package manager for Dart. Usage: pub [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= Run the subcommand in the directory. (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 " for more information about a command. See https://dart.dev/tools/pub/cmd for detailed documentation. or pub.dart.snapshot --- dwds/test/fixtures/utilities.dart | 10 +--------- frontend_server_common/lib/src/utilities.dart | 6 ------ webdev/lib/src/daemon_client.dart | 2 +- webdev/lib/src/pubspec.dart | 6 +++--- webdev/lib/src/util.dart | 4 ---- webdev/test/daemon/utils.dart | 2 +- webdev/test/e2e_test.dart | 4 ++-- 7 files changed, 8 insertions(+), 26 deletions(-) diff --git a/dwds/test/fixtures/utilities.dart b/dwds/test/fixtures/utilities.dart index 711dd8068..094432d10 100644 --- a/dwds/test/fixtures/utilities.dart +++ b/dwds/test/fixtures/utilities.dart @@ -16,11 +16,7 @@ Future connectClient(String workingDirectory, List options, Function(ServerLog) logHandler) => BuildDaemonClient.connect( workingDirectory, - // On Windows we need to call the snapshot directly otherwise - // the process will start in a disjoint cmd without access to - // STDIO. We also want to ensure the version of pub is consistent with - // the SDK that was used to launch webdev. - [dartPath, dartdevSnapshot] + [dartPath] ..addAll(['pub', 'run', 'build_runner', 'daemon']) ..addAll(options), logHandler: logHandler); @@ -36,10 +32,6 @@ final String _sdkDir = (() { final String dartSdkPath = _sdkDir; final String dartPath = p.join(_sdkDir, 'bin', 'dart'); -final String dartdevSnapshot = - p.join(_sdkDir, 'bin', 'snapshots', 'dartdev.dart.snapshot'); -final String pubPath = - p.join(_sdkDir, 'bin', Platform.isWindows ? 'pub.bat' : 'pub'); /// Returns the port of the daemon asset server. int daemonPort(String workingDirectory) { diff --git a/frontend_server_common/lib/src/utilities.dart b/frontend_server_common/lib/src/utilities.dart index 3d65850e9..9ca429eff 100644 --- a/frontend_server_common/lib/src/utilities.dart +++ b/frontend_server_common/lib/src/utilities.dart @@ -21,11 +21,5 @@ final String _sdkDir = (() { final String dartSdkPath = _sdkDir; final String dartPath = p.join(_sdkDir, 'bin', 'dart'); -final String pubSnapshot = - p.join(_sdkDir, 'bin', 'snapshots', 'pub.dart.snapshot'); -final String dartdevSnapshot = - p.join(_sdkDir, 'bin', 'snapshots', 'dartdev.dart.snapshot'); -final String pubPath = - p.join(_sdkDir, 'bin', Platform.isWindows ? 'pub.bat' : 'pub'); const fs.FileSystem fileSystem = LocalFileSystem(); diff --git a/webdev/lib/src/daemon_client.dart b/webdev/lib/src/daemon_client.dart index aa4c6632f..7814028b6 100644 --- a/webdev/lib/src/daemon_client.dart +++ b/webdev/lib/src/daemon_client.dart @@ -22,7 +22,7 @@ Future connectClient(String workingDirectory, // the process will start in a disjoint cmd without access to // STDIO. We also want to ensure the version of pub is consistent with // the SDK that was used to launch webdev. - [dartPath, dartdevSnapshot] + [dartPath] ..addAll(['pub', 'run', 'build_runner', 'daemon']) ..addAll(options), logHandler: logHandler); diff --git a/webdev/lib/src/pubspec.dart b/webdev/lib/src/pubspec.dart index a921635cd..d9bc29d6f 100644 --- a/webdev/lib/src/pubspec.dart +++ b/webdev/lib/src/pubspec.dart @@ -55,7 +55,7 @@ dev_dependencies: } Future _runPubDeps() async { - var result = Process.runSync(pubPath, ['deps']); + var result = Process.runSync(dartPath, ['pub', 'deps']); if (result.exitCode == 65 || result.exitCode == 66) { throw PackageException( @@ -64,8 +64,8 @@ Future _runPubDeps() async { if (result.exitCode != 0) { throw ProcessException( - pubPath, - ['deps'], + dartPath, + ['pub', 'deps'], '***OUT***\n${result.stdout}\n***ERR***\n${result.stderr}\n***', exitCode); } diff --git a/webdev/lib/src/util.dart b/webdev/lib/src/util.dart index 5cc31587c..14aadb1a7 100644 --- a/webdev/lib/src/util.dart +++ b/webdev/lib/src/util.dart @@ -20,7 +20,3 @@ final String _sdkDir = (() { })(); final String dartPath = p.join(_sdkDir, 'bin', 'dart'); -final String dartdevSnapshot = - p.join(_sdkDir, 'bin', 'snapshots', 'dartdev.dart.snapshot'); -final String pubPath = - p.join(_sdkDir, 'bin', Platform.isWindows ? 'pub.bat' : 'pub'); diff --git a/webdev/test/daemon/utils.dart b/webdev/test/daemon/utils.dart index 49373d8f2..1adb1e723 100644 --- a/webdev/test/daemon/utils.dart +++ b/webdev/test/daemon/utils.dart @@ -43,7 +43,7 @@ Future prepareWorkspace() async { var exampleDirectory = p.absolute(p.join(p.current, '..', 'fixtures', '_webdevSmoke')); - var process = await TestProcess.start(pubPath, ['upgrade'], + var process = await TestProcess.start(dartPath, ['pub', 'upgrade'], workingDirectory: exampleDirectory, environment: getPubEnvironment()); await process.shouldExit(0); diff --git a/webdev/test/e2e_test.dart b/webdev/test/e2e_test.dart index a0065e7f0..e5779b2b9 100644 --- a/webdev/test/e2e_test.dart +++ b/webdev/test/e2e_test.dart @@ -42,12 +42,12 @@ void main() { soundExampleDirectory = p.absolute(p.join(p.current, '..', 'fixtures', '_webdevSoundSmoke')); - var process = await TestProcess.start(pubPath, ['upgrade'], + var process = await TestProcess.start(dartPath, ['pub', 'upgrade'], workingDirectory: exampleDirectory, environment: getPubEnvironment()); await process.shouldExit(0); - process = await TestProcess.start(pubPath, ['upgrade'], + process = await TestProcess.start(dartPath, ['pub', 'upgrade'], workingDirectory: soundExampleDirectory, environment: getPubEnvironment()); From adf8fcb2331c4f17636cc8524ba9449b0604e917 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Thu, 26 Aug 2021 17:45:45 -0700 Subject: [PATCH 3/5] Try fix daemon not starting on windows --- dwds/test/fixtures/utilities.dart | 8 +++++++- webdev/lib/src/daemon_client.dart | 2 +- webdev/lib/src/util.dart | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dwds/test/fixtures/utilities.dart b/dwds/test/fixtures/utilities.dart index 094432d10..3292c0470 100644 --- a/dwds/test/fixtures/utilities.dart +++ b/dwds/test/fixtures/utilities.dart @@ -16,7 +16,11 @@ Future connectClient(String workingDirectory, List options, Function(ServerLog) logHandler) => BuildDaemonClient.connect( workingDirectory, - [dartPath] + // On Windows we need to call the snapshot directly otherwise + // the process will start in a disjoint cmd without access to + // STDIO. We also want to ensure the version of pub is consistent with + // the SDK that was used to launch webdev. + [dartPath, dartdevSnapshot] ..addAll(['pub', 'run', 'build_runner', 'daemon']) ..addAll(options), logHandler: logHandler); @@ -32,6 +36,8 @@ final String _sdkDir = (() { final String dartSdkPath = _sdkDir; final String dartPath = p.join(_sdkDir, 'bin', 'dart'); +final String dartdevSnapshot = + p.join(_sdkDir, 'bin', 'snapshots', 'dartdev.dart.snapshot'); /// Returns the port of the daemon asset server. int daemonPort(String workingDirectory) { diff --git a/webdev/lib/src/daemon_client.dart b/webdev/lib/src/daemon_client.dart index 7814028b6..aa4c6632f 100644 --- a/webdev/lib/src/daemon_client.dart +++ b/webdev/lib/src/daemon_client.dart @@ -22,7 +22,7 @@ Future connectClient(String workingDirectory, // the process will start in a disjoint cmd without access to // STDIO. We also want to ensure the version of pub is consistent with // the SDK that was used to launch webdev. - [dartPath] + [dartPath, dartdevSnapshot] ..addAll(['pub', 'run', 'build_runner', 'daemon']) ..addAll(options), logHandler: logHandler); diff --git a/webdev/lib/src/util.dart b/webdev/lib/src/util.dart index 14aadb1a7..3b2d26919 100644 --- a/webdev/lib/src/util.dart +++ b/webdev/lib/src/util.dart @@ -20,3 +20,5 @@ final String _sdkDir = (() { })(); final String dartPath = p.join(_sdkDir, 'bin', 'dart'); +final String dartdevSnapshot = + p.join(_sdkDir, 'bin', 'snapshots', 'dartdev.dart.snapshot'); From 68a3f496f9c44bde97d77e2f5a657e9c7cafdc92 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Fri, 27 Aug 2021 12:44:58 -0700 Subject: [PATCH 4/5] Try fix test failures on windows --- dwds/test/fixtures/utilities.dart | 6 ++---- webdev/lib/src/daemon_client.dart | 4 ++-- webdev/lib/src/util.dart | 2 -- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/dwds/test/fixtures/utilities.dart b/dwds/test/fixtures/utilities.dart index 3292c0470..dd77ee11a 100644 --- a/dwds/test/fixtures/utilities.dart +++ b/dwds/test/fixtures/utilities.dart @@ -20,8 +20,8 @@ Future connectClient(String workingDirectory, // the process will start in a disjoint cmd without access to // STDIO. We also want to ensure the version of pub is consistent with // the SDK that was used to launch webdev. - [dartPath, dartdevSnapshot] - ..addAll(['pub', 'run', 'build_runner', 'daemon']) + [dartPath] + ..addAll(['run', 'build_runner', 'daemon']) ..addAll(options), logHandler: logHandler); @@ -36,8 +36,6 @@ final String _sdkDir = (() { final String dartSdkPath = _sdkDir; final String dartPath = p.join(_sdkDir, 'bin', 'dart'); -final String dartdevSnapshot = - p.join(_sdkDir, 'bin', 'snapshots', 'dartdev.dart.snapshot'); /// Returns the port of the daemon asset server. int daemonPort(String workingDirectory) { diff --git a/webdev/lib/src/daemon_client.dart b/webdev/lib/src/daemon_client.dart index aa4c6632f..a7fb5b10b 100644 --- a/webdev/lib/src/daemon_client.dart +++ b/webdev/lib/src/daemon_client.dart @@ -22,8 +22,8 @@ Future connectClient(String workingDirectory, // the process will start in a disjoint cmd without access to // STDIO. We also want to ensure the version of pub is consistent with // the SDK that was used to launch webdev. - [dartPath, dartdevSnapshot] - ..addAll(['pub', 'run', 'build_runner', 'daemon']) + [dartPath] + ..addAll(['run', 'build_runner', 'daemon']) ..addAll(options), logHandler: logHandler); diff --git a/webdev/lib/src/util.dart b/webdev/lib/src/util.dart index 3b2d26919..14aadb1a7 100644 --- a/webdev/lib/src/util.dart +++ b/webdev/lib/src/util.dart @@ -20,5 +20,3 @@ final String _sdkDir = (() { })(); final String dartPath = p.join(_sdkDir, 'bin', 'dart'); -final String dartdevSnapshot = - p.join(_sdkDir, 'bin', 'snapshots', 'dartdev.dart.snapshot'); From a368e5ad1762ae8ea2d2f8ecfc2903fcd0a0ae70 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Fri, 27 Aug 2021 12:52:09 -0700 Subject: [PATCH 5/5] Remove outdated comment as well --- dwds/test/fixtures/utilities.dart | 4 ---- webdev/lib/src/daemon_client.dart | 4 ---- 2 files changed, 8 deletions(-) diff --git a/dwds/test/fixtures/utilities.dart b/dwds/test/fixtures/utilities.dart index dd77ee11a..839ce6509 100644 --- a/dwds/test/fixtures/utilities.dart +++ b/dwds/test/fixtures/utilities.dart @@ -16,10 +16,6 @@ Future connectClient(String workingDirectory, List options, Function(ServerLog) logHandler) => BuildDaemonClient.connect( workingDirectory, - // On Windows we need to call the snapshot directly otherwise - // the process will start in a disjoint cmd without access to - // STDIO. We also want to ensure the version of pub is consistent with - // the SDK that was used to launch webdev. [dartPath] ..addAll(['run', 'build_runner', 'daemon']) ..addAll(options), diff --git a/webdev/lib/src/daemon_client.dart b/webdev/lib/src/daemon_client.dart index a7fb5b10b..d8ae674b1 100644 --- a/webdev/lib/src/daemon_client.dart +++ b/webdev/lib/src/daemon_client.dart @@ -18,10 +18,6 @@ Future connectClient(String workingDirectory, List options, Function(ServerLog) logHandler) => BuildDaemonClient.connect( workingDirectory, - // On Windows we need to call the snapshot directly otherwise - // the process will start in a disjoint cmd without access to - // STDIO. We also want to ensure the version of pub is consistent with - // the SDK that was used to launch webdev. [dartPath] ..addAll(['run', 'build_runner', 'daemon']) ..addAll(options),