Skip to content

Commit

Permalink
Do not use pub.dart.snapshot (#1394)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Anna Gringauze authored Aug 28, 2021
1 parent f6b8457 commit 487155d
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 28 deletions.
10 changes: 1 addition & 9 deletions dwds/test/fixtures/utilities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ Future<BuildDaemonClient> connectClient(String workingDirectory,
List<String> 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, pubSnapshot]
[dartPath]
..addAll(['run', 'build_runner', 'daemon'])
..addAll(options),
logHandler: logHandler);
Expand All @@ -36,10 +32,6 @@ 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 pubPath =
p.join(_sdkDir, 'bin', Platform.isWindows ? 'pub.bat' : 'pub');

/// Returns the port of the daemon asset server.
int daemonPort(String workingDirectory) {
Expand Down
4 changes: 0 additions & 4 deletions frontend_server_common/lib/src/utilities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +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 pubPath =
p.join(_sdkDir, 'bin', Platform.isWindows ? 'pub.bat' : 'pub');

const fs.FileSystem fileSystem = LocalFileSystem();
6 changes: 1 addition & 5 deletions webdev/lib/src/daemon_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ Future<BuildDaemonClient> connectClient(String workingDirectory,
List<String> 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, pubSnapshot]
[dartPath]
..addAll(['run', 'build_runner', 'daemon'])
..addAll(options),
logHandler: logHandler);
Expand Down
6 changes: 3 additions & 3 deletions webdev/lib/src/pubspec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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);
}
Expand Down
4 changes: 0 additions & 4 deletions webdev/lib/src/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,3 @@ final String _sdkDir = (() {
})();

final String dartPath = p.join(_sdkDir, 'bin', 'dart');
final String pubSnapshot =
p.join(_sdkDir, 'bin', 'snapshots', 'pub.dart.snapshot');
final String pubPath =
p.join(_sdkDir, 'bin', Platform.isWindows ? 'pub.bat' : 'pub');
2 changes: 1 addition & 1 deletion webdev/test/daemon/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Future<String> 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);
Expand Down
4 changes: 2 additions & 2 deletions webdev/test/e2e_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit 487155d

Please sign in to comment.