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

[flutter_tools] pub get skips example dir if there is no pubspec.yaml (#74264)

parent ba66d7d8
...@@ -164,7 +164,7 @@ class PackagesGetCommand extends FlutterCommand { ...@@ -164,7 +164,7 @@ class PackagesGetCommand extends FlutterCommand {
await rootProject.regeneratePlatformSpecificTooling(); await rootProject.regeneratePlatformSpecificTooling();
// Get/upgrade packages in example app as well // Get/upgrade packages in example app as well
if (rootProject.hasExampleApp) { if (rootProject.hasExampleApp && rootProject.example.pubspecFile.existsSync()) {
final FlutterProject exampleProject = rootProject.example; final FlutterProject exampleProject = rootProject.example;
await _runPubGet(exampleProject.directory.path, exampleProject); await _runPubGet(exampleProject.directory.path, exampleProject);
await exampleProject.regeneratePlatformSpecificTooling(); await exampleProject.regeneratePlatformSpecificTooling();
......
...@@ -74,6 +74,26 @@ void main() { ...@@ -74,6 +74,26 @@ void main() {
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FileSystem: () => fileSystem, 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 { class FakePub extends Fake implements Pub {
......
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