This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Update build-all test for null-safe template #3773
Merged
stuartmorgan-g
merged 6 commits into
flutter:master
from
stuartmorgan-g:build-all-null-safe
Mar 30, 2021
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
89d836f
Update build-all test for null-safe template
stuartmorgan-g 2e0921b
Migrate on stable for consistency
stuartmorgan-g 3c3607a
Temporarily build in non-sound mode due to maps
stuartmorgan-g 8c53753
Ensure BRANCH_NAME is set
stuartmorgan-g 9a8fe13
Debugging echo
stuartmorgan-g cc253bb
Fix mistaken use of branch rather than channel
stuartmorgan-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'package:args/command_runner.dart'; | ||
| import 'package:file/file.dart'; | ||
| import 'package:file/local.dart'; | ||
| import 'package:flutter_plugin_tools/src/create_all_plugins_app_command.dart'; | ||
| import 'package:test/test.dart'; | ||
|
|
||
| import 'util.dart'; | ||
|
|
||
| void main() { | ||
| group('$CreateAllPluginsAppCommand', () { | ||
| CommandRunner<Null> runner; | ||
| FileSystem fileSystem; | ||
| Directory testRoot; | ||
| Directory packagesDir; | ||
| Directory appDir; | ||
|
|
||
| setUp(() { | ||
| // Since the core of this command is a call to 'flutter create', the test | ||
| // has to use the real filesystem. Put everything possible in a unique | ||
| // temporary to minimize affect on the host system. | ||
| fileSystem = LocalFileSystem(); | ||
| testRoot = fileSystem.systemTempDirectory.createTempSync(); | ||
| packagesDir = testRoot.childDirectory('packages'); | ||
|
|
||
| final CreateAllPluginsAppCommand command = CreateAllPluginsAppCommand( | ||
| packagesDir, | ||
| fileSystem, | ||
| pluginsRoot: testRoot, | ||
| ); | ||
| appDir = command.appDirectory; | ||
| runner = CommandRunner<Null>( | ||
| 'create_all_test', 'Test for $CreateAllPluginsAppCommand'); | ||
| runner.addCommand(command); | ||
| }); | ||
|
|
||
| tearDown(() { | ||
| testRoot.deleteSync(recursive: true); | ||
| }); | ||
|
|
||
| test('pubspec includes all plugins', () async { | ||
| createFakePlugin('plugina', packagesDirectory: packagesDir); | ||
| createFakePlugin('pluginb', packagesDirectory: packagesDir); | ||
| createFakePlugin('pluginc', packagesDirectory: packagesDir); | ||
|
|
||
| await runner.run(<String>['all-plugins-app']); | ||
| final List<String> pubspec = | ||
| appDir.childFile('pubspec.yaml').readAsLinesSync(); | ||
|
|
||
| expect( | ||
| pubspec, | ||
| containsAll(<Matcher>[ | ||
| contains(RegExp('path: .*/packages/plugina')), | ||
| contains(RegExp('path: .*/packages/pluginb')), | ||
| contains(RegExp('path: .*/packages/pluginc')), | ||
| ])); | ||
| }); | ||
|
|
||
| test('pubspec has overrides for all plugins', () async { | ||
| createFakePlugin('plugina', packagesDirectory: packagesDir); | ||
| createFakePlugin('pluginb', packagesDirectory: packagesDir); | ||
| createFakePlugin('pluginc', packagesDirectory: packagesDir); | ||
|
|
||
| await runner.run(<String>['all-plugins-app']); | ||
| final List<String> pubspec = | ||
| appDir.childFile('pubspec.yaml').readAsLinesSync(); | ||
|
|
||
| expect( | ||
| pubspec, | ||
| containsAllInOrder(<Matcher>[ | ||
| contains('dependency_overrides:'), | ||
| contains(RegExp('path: .*/packages/plugina')), | ||
| contains(RegExp('path: .*/packages/pluginb')), | ||
| contains(RegExp('path: .*/packages/pluginc')), | ||
| ])); | ||
| }); | ||
|
|
||
| test('pubspec is compatible with null-safe app code', () async { | ||
| createFakePlugin('plugina', packagesDirectory: packagesDir); | ||
|
|
||
| await runner.run(<String>['all-plugins-app']); | ||
| final String pubspec = | ||
| appDir.childFile('pubspec.yaml').readAsStringSync(); | ||
|
|
||
| expect(pubspec, contains(RegExp('sdk:\\s*(?:["\']>=|[^])2\\.12\\.'))); | ||
| }); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ditman I had to add this because of web Maps, so once this lands if you can update your NNBD PR to remove it, it should work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I'll update mine once this lands. (For cross-linking purposes, this is what's supposed to be updated: #3726)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Done: 479a543 )