Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use pub.dart.snapshot #1394

Merged
merged 5 commits into from
Aug 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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