[flutter_tools] pub get skips example dir if there is no pubspec.yaml (#74264)
This commit is contained in:
@@ -164,7 +164,7 @@ class PackagesGetCommand extends FlutterCommand {
|
||||
await rootProject.regeneratePlatformSpecificTooling();
|
||||
|
||||
// Get/upgrade packages in example app as well
|
||||
if (rootProject.hasExampleApp) {
|
||||
if (rootProject.hasExampleApp && rootProject.example.pubspecFile.existsSync()) {
|
||||
final FlutterProject exampleProject = rootProject.example;
|
||||
await _runPubGet(exampleProject.directory.path, exampleProject);
|
||||
await exampleProject.regeneratePlatformSpecificTooling();
|
||||
|
||||
@@ -74,6 +74,26 @@ void main() {
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
FileSystem: () => fileSystem,
|
||||
});
|
||||
|
||||
testUsingContext('pub get skips example directory if it dooes not contain a pubspec.yaml', () async {
|
||||
fileSystem.currentDirectory.childFile('pubspec.yaml').createSync();
|
||||
fileSystem.currentDirectory.childDirectory('example').createSync(recursive: true);
|
||||
|
||||
final PackagesGetCommand command = PackagesGetCommand('get', false);
|
||||
final CommandRunner<void> commandRunner = createTestCommandRunner(command);
|
||||
|
||||
await commandRunner.run(<String>['get']);
|
||||
|
||||
expect(await command.usageValues, <CustomDimensions, Object>{
|
||||
CustomDimensions.commandPackagesNumberPlugins: '0',
|
||||
CustomDimensions.commandPackagesProjectModule: 'false',
|
||||
CustomDimensions.commandPackagesAndroidEmbeddingVersion: 'v1'
|
||||
});
|
||||
}, overrides: <Type, Generator>{
|
||||
Pub: () => pub,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
FileSystem: () => fileSystem,
|
||||
});
|
||||
}
|
||||
|
||||
class FakePub extends Fake implements Pub {
|
||||
|
||||
Reference in New Issue
Block a user