Make the create command call pub get online instead of offline. (#13505)
We thought it would be OK to call the create command offline-only, but it turns out that isn't a great idea because not all of the create template dependencies are cached by running flutter_tool. This PR makes it go online by default when running pub get after creating a project, and adds an "--offline" flag to the create command so that offline users can use it offline if their cache is warm.
This commit is contained in:
@@ -303,7 +303,24 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
testUsingContext('invokes pub offline', () async {
|
||||
testUsingContext('invokes pub offline when requested', () async {
|
||||
Cache.flutterRoot = '../..';
|
||||
|
||||
final CreateCommand command = new CreateCommand();
|
||||
final CommandRunner<Null> runner = createTestCommandRunner(command);
|
||||
|
||||
await runner.run(<String>['create', '--pub', '--offline', projectDir.path]);
|
||||
final List<String> commands = loggingProcessManager.commands;
|
||||
expect(commands, contains(matches(r'dart-sdk[\\/]bin[\\/]pub')));
|
||||
expect(commands, contains('--offline'));
|
||||
},
|
||||
timeout: allowForCreateFlutterProject,
|
||||
overrides: <Type, Generator>{
|
||||
ProcessManager: () => loggingProcessManager,
|
||||
},
|
||||
);
|
||||
|
||||
testUsingContext('invokes pub online when offline not requested', () async {
|
||||
Cache.flutterRoot = '../..';
|
||||
|
||||
final CreateCommand command = new CreateCommand();
|
||||
@@ -312,7 +329,7 @@ void main() {
|
||||
await runner.run(<String>['create', '--pub', projectDir.path]);
|
||||
final List<String> commands = loggingProcessManager.commands;
|
||||
expect(commands, contains(matches(r'dart-sdk[\\/]bin[\\/]pub')));
|
||||
expect(commands, contains('--offline'));
|
||||
expect(commands, isNot(contains('--offline')));
|
||||
},
|
||||
timeout: allowForCreateFlutterProject,
|
||||
overrides: <Type, Generator>{
|
||||
|
||||
Reference in New Issue
Block a user