Copy the flutter version JSON file into the simulated Flutter SDK used by update_packages (#143035)

Dart pub now expects that file to be present in a Flutter SDK (see
https://dart.googlesource.com/pub/+/dce232ec195df802a730eb3a66163e28d2ec6444)
This commit is contained in:
Jason Simmons
2024-02-06 20:00:08 -08:00
committed by GitHub
parent bf9aa556d2
commit db141ecd28
3 changed files with 41 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ import '../globals.dart' as globals;
import '../project.dart';
import '../runner/flutter_command.dart';
import '../update_packages_pins.dart';
import '../version.dart';
class UpdatePackagesCommand extends FlutterCommand {
UpdatePackagesCommand() {
@@ -1713,6 +1714,10 @@ Directory createTemporaryFlutterSdk(
// Fill in version info.
realFlutter.childFile('version')
.copySync(directory.childFile('version').path);
final File versionJson = FlutterVersion.getVersionFile(realFlutter.fileSystem, realFlutter.path);
final Directory binCacheDirectory = directory.childDirectory('bin').childDirectory('cache');
binCacheDirectory.createSync(recursive: true);
versionJson.copySync(binCacheDirectory.childFile('flutter.version.json').path);
// Directory structure should mirror the current Flutter SDK
final Directory packages = directory.childDirectory('packages');