Unverified Commit dfc3318e authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] dont create synthetic sdk when running consumer-only (#53466)

parent 5f972087
...@@ -276,13 +276,16 @@ class UpdatePackagesCommand extends FlutterCommand { ...@@ -276,13 +276,16 @@ class UpdatePackagesCommand extends FlutterCommand {
final File fakePackage = _pubspecFor(tempDir); final File fakePackage = _pubspecFor(tempDir);
fakePackage.createSync(); fakePackage.createSync();
fakePackage.writeAsStringSync(_generateFakePubspec(dependencies.values)); fakePackage.writeAsStringSync(_generateFakePubspec(dependencies.values));
// First, we create a synthetic flutter SDK so that transitive flutter SDK // Create a synthetic flutter SDK so that transitive flutter SDK
// constraints are not affected by this upgrade. // constraints are not affected by this upgrade.
final Directory temporaryFlutterSdk = createTemporaryFlutterSdk( Directory temporaryFlutterSdk;
if (upgrade) {
temporaryFlutterSdk = createTemporaryFlutterSdk(
globals.fs, globals.fs,
globals.fs.directory(Cache.flutterRoot), globals.fs.directory(Cache.flutterRoot),
pubspecs, pubspecs,
); );
}
// Next we run "pub upgrade" on this generated package: // Next we run "pub upgrade" on this generated package:
await pub.get( await pub.get(
...@@ -291,13 +294,15 @@ class UpdatePackagesCommand extends FlutterCommand { ...@@ -291,13 +294,15 @@ class UpdatePackagesCommand extends FlutterCommand {
upgrade: true, upgrade: true,
checkLastModified: false, checkLastModified: false,
offline: offline, offline: offline,
flutterRootOverride: temporaryFlutterSdk.path, flutterRootOverride: upgrade
? temporaryFlutterSdk.path
: null,
); );
// Cleanup the temporary SDK // Cleanup the temporary SDK
try { try {
temporaryFlutterSdk.deleteSync(recursive: true); temporaryFlutterSdk?.deleteSync(recursive: true);
} on FileSystemException { } on FileSystemException {
// So sad... // Failed to delete temporary SDK.
} }
// Then we run "pub deps --style=compact" on the result. We pipe all the // Then we run "pub deps --style=compact" on the result. We pipe all the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment