enable avoid_single_cascade_in_expression_statements (#51944)
This commit is contained in:
parent
3018d8ddb3
commit
c2ae654ddf
@ -79,7 +79,7 @@ linter:
|
|||||||
# - avoid_returning_this # there are plenty of valid reasons to return this
|
# - avoid_returning_this # there are plenty of valid reasons to return this
|
||||||
# - avoid_setters_without_getters # not yet tested
|
# - avoid_setters_without_getters # not yet tested
|
||||||
# - avoid_shadowing_type_parameters # not yet tested
|
# - avoid_shadowing_type_parameters # not yet tested
|
||||||
# - avoid_single_cascade_in_expression_statements # not yet tested
|
- avoid_single_cascade_in_expression_statements
|
||||||
- avoid_slow_async_io
|
- avoid_slow_async_io
|
||||||
- avoid_types_as_parameter_names
|
- avoid_types_as_parameter_names
|
||||||
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
|
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
|
||||||
|
@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Does flutter_test catch leaking tickers?', (WidgetTester tester) async {
|
testWidgets('Does flutter_test catch leaking tickers?', (WidgetTester tester) async {
|
||||||
Ticker((Duration duration) { })..start();
|
Ticker((Duration duration) { }).start();
|
||||||
|
|
||||||
final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.paused');
|
final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.paused');
|
||||||
await ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) {});
|
await ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) {});
|
||||||
|
@ -193,8 +193,7 @@ class _PointDemoState extends State<_PointDemo> {
|
|||||||
ImmediateMultiDragGestureRecognizer: GestureRecognizerFactoryWithHandlers<ImmediateMultiDragGestureRecognizer>(
|
ImmediateMultiDragGestureRecognizer: GestureRecognizerFactoryWithHandlers<ImmediateMultiDragGestureRecognizer>(
|
||||||
() => ImmediateMultiDragGestureRecognizer(),
|
() => ImmediateMultiDragGestureRecognizer(),
|
||||||
(ImmediateMultiDragGestureRecognizer instance) {
|
(ImmediateMultiDragGestureRecognizer instance) {
|
||||||
instance
|
instance.onStart = _handleOnStart;
|
||||||
..onStart = _handleOnStart;
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@ -366,8 +365,7 @@ class _RectangleDemoState extends State<_RectangleDemo> {
|
|||||||
ImmediateMultiDragGestureRecognizer: GestureRecognizerFactoryWithHandlers<ImmediateMultiDragGestureRecognizer>(
|
ImmediateMultiDragGestureRecognizer: GestureRecognizerFactoryWithHandlers<ImmediateMultiDragGestureRecognizer>(
|
||||||
() => ImmediateMultiDragGestureRecognizer(),
|
() => ImmediateMultiDragGestureRecognizer(),
|
||||||
(ImmediateMultiDragGestureRecognizer instance) {
|
(ImmediateMultiDragGestureRecognizer instance) {
|
||||||
instance
|
instance.onStart = _handleOnStart;
|
||||||
..onStart = _handleOnStart;
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
@ -188,16 +188,14 @@ class _ExpansionTileState extends State<ExpansionTile> with SingleTickerProvider
|
|||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
final ThemeData theme = Theme.of(context);
|
final ThemeData theme = Theme.of(context);
|
||||||
_borderColorTween
|
_borderColorTween.end = theme.dividerColor;
|
||||||
..end = theme.dividerColor;
|
|
||||||
_headerColorTween
|
_headerColorTween
|
||||||
..begin = theme.textTheme.subtitle1.color
|
..begin = theme.textTheme.subtitle1.color
|
||||||
..end = theme.accentColor;
|
..end = theme.accentColor;
|
||||||
_iconColorTween
|
_iconColorTween
|
||||||
..begin = theme.unselectedWidgetColor
|
..begin = theme.unselectedWidgetColor
|
||||||
..end = theme.accentColor;
|
..end = theme.accentColor;
|
||||||
_backgroundColorTween
|
_backgroundColorTween.end = widget.backgroundColor;
|
||||||
..end = widget.backgroundColor;
|
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -563,8 +563,7 @@ class _ChildOverflowBox extends SingleChildRenderObjectWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void updateRenderObject(BuildContext context, _RenderChildOverflowBox renderObject) {
|
void updateRenderObject(BuildContext context, _RenderChildOverflowBox renderObject) {
|
||||||
renderObject
|
renderObject.textDirection = Directionality.of(context);
|
||||||
..textDirection = Directionality.of(context);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,8 +198,7 @@ class InkRipple extends InteractiveInkFeature {
|
|||||||
..forward();
|
..forward();
|
||||||
// This confirm may have been preceded by a cancel.
|
// This confirm may have been preceded by a cancel.
|
||||||
_fadeInController.forward();
|
_fadeInController.forward();
|
||||||
_fadeOutController
|
_fadeOutController.animateTo(1.0, duration: _kFadeOutDuration);
|
||||||
..animateTo(1.0, duration: _kFadeOutDuration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -581,8 +581,7 @@ class PaintingContext extends ClipContext {
|
|||||||
..save()
|
..save()
|
||||||
..transform(effectiveTransform.storage);
|
..transform(effectiveTransform.storage);
|
||||||
painter(this, offset);
|
painter(this, offset);
|
||||||
canvas
|
canvas.restore();
|
||||||
..restore();
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,7 @@ mixin ServicesBinding on BindingBase {
|
|||||||
super.initInstances();
|
super.initInstances();
|
||||||
_instance = this;
|
_instance = this;
|
||||||
_defaultBinaryMessenger = createBinaryMessenger();
|
_defaultBinaryMessenger = createBinaryMessenger();
|
||||||
window
|
window.onPlatformMessage = defaultBinaryMessenger.handlePlatformMessage;
|
||||||
..onPlatformMessage = defaultBinaryMessenger.handlePlatformMessage;
|
|
||||||
initLicenses();
|
initLicenses();
|
||||||
SystemChannels.system.setMessageHandler(handleSystemMessage);
|
SystemChannels.system.setMessageHandler(handleSystemMessage);
|
||||||
}
|
}
|
||||||
|
@ -1306,8 +1306,7 @@ class CompositedTransformTarget extends SingleChildRenderObjectWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void updateRenderObject(BuildContext context, RenderLeaderLayer renderObject) {
|
void updateRenderObject(BuildContext context, RenderLeaderLayer renderObject) {
|
||||||
renderObject
|
renderObject.link = link;
|
||||||
..link = link;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4993,8 +4992,7 @@ class Flow extends MultiChildRenderObjectWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void updateRenderObject(BuildContext context, RenderFlow renderObject) {
|
void updateRenderObject(BuildContext context, RenderFlow renderObject) {
|
||||||
renderObject
|
renderObject.delegate = delegate;
|
||||||
..delegate = delegate;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class ColorFiltered extends SingleChildRenderObjectWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void updateRenderObject(BuildContext context, _ColorFilterRenderObject renderObject) {
|
void updateRenderObject(BuildContext context, _ColorFilterRenderObject renderObject) {
|
||||||
renderObject..colorFilter = colorFilter;
|
renderObject.colorFilter = colorFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -624,8 +624,7 @@ class GestureDetector extends StatelessWidget {
|
|||||||
gestures[DoubleTapGestureRecognizer] = GestureRecognizerFactoryWithHandlers<DoubleTapGestureRecognizer>(
|
gestures[DoubleTapGestureRecognizer] = GestureRecognizerFactoryWithHandlers<DoubleTapGestureRecognizer>(
|
||||||
() => DoubleTapGestureRecognizer(debugOwner: this),
|
() => DoubleTapGestureRecognizer(debugOwner: this),
|
||||||
(DoubleTapGestureRecognizer instance) {
|
(DoubleTapGestureRecognizer instance) {
|
||||||
instance
|
instance.onDoubleTap = onDoubleTap;
|
||||||
..onDoubleTap = onDoubleTap;
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ class ImageFiltered extends SingleChildRenderObjectWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void updateRenderObject(BuildContext context, _ImageFilterRenderObject renderObject) {
|
void updateRenderObject(BuildContext context, _ImageFilterRenderObject renderObject) {
|
||||||
renderObject..imageFilter = imageFilter;
|
renderObject.imageFilter = imageFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -63,8 +63,7 @@ class _ImageFilterRenderObject extends RenderProxyBox {
|
|||||||
layer = ImageFilterLayer(imageFilter: imageFilter);
|
layer = ImageFilterLayer(imageFilter: imageFilter);
|
||||||
} else {
|
} else {
|
||||||
final ImageFilterLayer filterLayer = layer as ImageFilterLayer;
|
final ImageFilterLayer filterLayer = layer as ImageFilterLayer;
|
||||||
filterLayer
|
filterLayer.imageFilter = imageFilter;
|
||||||
..imageFilter = imageFilter;
|
|
||||||
}
|
}
|
||||||
context.pushLayer(layer, super.paint, offset);
|
context.pushLayer(layer, super.paint, offset);
|
||||||
assert(layer != null);
|
assert(layer != null);
|
||||||
|
@ -168,7 +168,7 @@ abstract class Route<T> {
|
|||||||
// For example, ModalRoute create a focus scope in its overlay entries. The
|
// For example, ModalRoute create a focus scope in its overlay entries. The
|
||||||
// focused child can only be attached to navigator after initState which
|
// focused child can only be attached to navigator after initState which
|
||||||
// will be guarded by the asynchronous gap.
|
// will be guarded by the asynchronous gap.
|
||||||
TickerFuture.complete()..then<void>((void _) {
|
TickerFuture.complete().then<void>((void _) {
|
||||||
navigator.focusScopeNode.requestFocus();
|
navigator.focusScopeNode.requestFocus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1519,8 +1519,7 @@ class SliverOverlapAbsorber extends SingleChildRenderObjectWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void updateRenderObject(BuildContext context, RenderSliverOverlapAbsorber renderObject) {
|
void updateRenderObject(BuildContext context, RenderSliverOverlapAbsorber renderObject) {
|
||||||
renderObject
|
renderObject.handle = handle;
|
||||||
..handle = handle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -1694,8 +1693,7 @@ class SliverOverlapInjector extends SingleChildRenderObjectWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void updateRenderObject(BuildContext context, RenderSliverOverlapInjector renderObject) {
|
void updateRenderObject(BuildContext context, RenderSliverOverlapInjector renderObject) {
|
||||||
renderObject
|
renderObject.handle = handle;
|
||||||
..handle = handle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -287,12 +287,12 @@ void main() {
|
|||||||
test('Live image cache avoids leaks of unlistened streams', () async {
|
test('Live image cache avoids leaks of unlistened streams', () async {
|
||||||
imageCache.maximumSize = 3;
|
imageCache.maximumSize = 3;
|
||||||
|
|
||||||
const TestImageProvider(1, 1)..resolve(ImageConfiguration.empty);
|
const TestImageProvider(1, 1).resolve(ImageConfiguration.empty);
|
||||||
const TestImageProvider(2, 2)..resolve(ImageConfiguration.empty);
|
const TestImageProvider(2, 2).resolve(ImageConfiguration.empty);
|
||||||
const TestImageProvider(3, 3)..resolve(ImageConfiguration.empty);
|
const TestImageProvider(3, 3).resolve(ImageConfiguration.empty);
|
||||||
const TestImageProvider(4, 4)..resolve(ImageConfiguration.empty);
|
const TestImageProvider(4, 4).resolve(ImageConfiguration.empty);
|
||||||
const TestImageProvider(5, 5)..resolve(ImageConfiguration.empty);
|
const TestImageProvider(5, 5).resolve(ImageConfiguration.empty);
|
||||||
const TestImageProvider(6, 6)..resolve(ImageConfiguration.empty);
|
const TestImageProvider(6, 6).resolve(ImageConfiguration.empty);
|
||||||
|
|
||||||
// wait an event loop to let image resolution process.
|
// wait an event loop to let image resolution process.
|
||||||
await null;
|
await null;
|
||||||
@ -304,12 +304,12 @@ void main() {
|
|||||||
test('Disabled image cache does not leak live images', () async {
|
test('Disabled image cache does not leak live images', () async {
|
||||||
imageCache.maximumSize = 0;
|
imageCache.maximumSize = 0;
|
||||||
|
|
||||||
const TestImageProvider(1, 1)..resolve(ImageConfiguration.empty);
|
const TestImageProvider(1, 1).resolve(ImageConfiguration.empty);
|
||||||
const TestImageProvider(2, 2)..resolve(ImageConfiguration.empty);
|
const TestImageProvider(2, 2).resolve(ImageConfiguration.empty);
|
||||||
const TestImageProvider(3, 3)..resolve(ImageConfiguration.empty);
|
const TestImageProvider(3, 3).resolve(ImageConfiguration.empty);
|
||||||
const TestImageProvider(4, 4)..resolve(ImageConfiguration.empty);
|
const TestImageProvider(4, 4).resolve(ImageConfiguration.empty);
|
||||||
const TestImageProvider(5, 5)..resolve(ImageConfiguration.empty);
|
const TestImageProvider(5, 5).resolve(ImageConfiguration.empty);
|
||||||
const TestImageProvider(6, 6)..resolve(ImageConfiguration.empty);
|
const TestImageProvider(6, 6).resolve(ImageConfiguration.empty);
|
||||||
|
|
||||||
// wait an event loop to let image resolution process.
|
// wait an event loop to let image resolution process.
|
||||||
await null;
|
await null;
|
||||||
|
@ -122,8 +122,7 @@ void main() {
|
|||||||
TapGestureRecognizer: GestureRecognizerFactoryWithHandlers<TapGestureRecognizer>(
|
TapGestureRecognizer: GestureRecognizerFactoryWithHandlers<TapGestureRecognizer>(
|
||||||
() => TapGestureRecognizer(),
|
() => TapGestureRecognizer(),
|
||||||
(TapGestureRecognizer instance) {
|
(TapGestureRecognizer instance) {
|
||||||
instance
|
instance.onTap = () { logs.add('tap'); };
|
||||||
..onTap = () { logs.add('tap'); };
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
@ -146,8 +145,7 @@ void main() {
|
|||||||
HorizontalDragGestureRecognizer: GestureRecognizerFactoryWithHandlers<HorizontalDragGestureRecognizer>(
|
HorizontalDragGestureRecognizer: GestureRecognizerFactoryWithHandlers<HorizontalDragGestureRecognizer>(
|
||||||
() => HorizontalDragGestureRecognizer(),
|
() => HorizontalDragGestureRecognizer(),
|
||||||
(HorizontalDragGestureRecognizer instance) {
|
(HorizontalDragGestureRecognizer instance) {
|
||||||
instance
|
instance.onStart = (_) { logs.add('horizontal'); };
|
||||||
..onStart = (_) { logs.add('horizontal'); };
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
@ -103,7 +103,7 @@ class AotBuilder {
|
|||||||
if ((await Future.wait<int>(exitCodes.values)).every((int buildExitCode) => buildExitCode == 0)) {
|
if ((await Future.wait<int>(exitCodes.values)).every((int buildExitCode) => buildExitCode == 0)) {
|
||||||
final Iterable<String> dylibs = iosBuilds.values.map<String>(
|
final Iterable<String> dylibs = iosBuilds.values.map<String>(
|
||||||
(String outputDir) => globals.fs.path.join(outputDir, 'App.framework', 'App'));
|
(String outputDir) => globals.fs.path.join(outputDir, 'App.framework', 'App'));
|
||||||
globals.fs.directory(globals.fs.path.join(outputPath, 'App.framework'))..createSync();
|
globals.fs.directory(globals.fs.path.join(outputPath, 'App.framework')).createSync();
|
||||||
await processUtils.run(
|
await processUtils.run(
|
||||||
<String>[
|
<String>[
|
||||||
'lipo',
|
'lipo',
|
||||||
|
@ -418,7 +418,7 @@ class LicenseCollector {
|
|||||||
licenseText = rawLicense;
|
licenseText = rawLicense;
|
||||||
}
|
}
|
||||||
packageLicenses.putIfAbsent(licenseText, () => <String>{})
|
packageLicenses.putIfAbsent(licenseText, () => <String>{})
|
||||||
..addAll(packageNames);
|
.addAll(packageNames);
|
||||||
allPackages.addAll(packageNames);
|
allPackages.addAll(packageNames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ Future<void> main() async {
|
|||||||
''';
|
''';
|
||||||
}
|
}
|
||||||
environment.buildDir.childFile('main.dart')
|
environment.buildDir.childFile('main.dart')
|
||||||
..writeAsStringSync(contents);
|
.writeAsStringSync(contents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,12 +134,12 @@ void main() {
|
|||||||
|
|
||||||
// Project files.
|
// Project files.
|
||||||
fileSystem.file('.packages')
|
fileSystem.file('.packages')
|
||||||
..writeAsStringSync('''
|
.writeAsStringSync('''
|
||||||
foo:lib/
|
foo:lib/
|
||||||
fizz:bar/lib/
|
fizz:bar/lib/
|
||||||
''');
|
''');
|
||||||
fileSystem.file('pubspec.yaml')
|
fileSystem.file('pubspec.yaml')
|
||||||
..writeAsStringSync('''
|
.writeAsStringSync('''
|
||||||
name: foo
|
name: foo
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -167,7 +167,7 @@ flutter:
|
|||||||
class UrlLauncherPlugin {}
|
class UrlLauncherPlugin {}
|
||||||
''');
|
''');
|
||||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart'))
|
fileSystem.file(fileSystem.path.join('lib', 'main.dart'))
|
||||||
..writeAsStringSync('void main() { }');
|
.writeAsStringSync('void main() { }');
|
||||||
|
|
||||||
// Process calls. We're not testing that these invocations are correct because
|
// Process calls. We're not testing that these invocations are correct because
|
||||||
// that is covered in targets/web_test.dart.
|
// that is covered in targets/web_test.dart.
|
||||||
|
@ -42,7 +42,7 @@ void main() {
|
|||||||
fs.currentDirectory = tempDir;
|
fs.currentDirectory = tempDir;
|
||||||
fs.directory('test').createSync();
|
fs.directory('test').createSync();
|
||||||
fs.directory('test_driver').createSync();
|
fs.directory('test_driver').createSync();
|
||||||
fs.file('pubspec.yaml')..createSync();
|
fs.file('pubspec.yaml').createSync();
|
||||||
fs.file('.packages').createSync();
|
fs.file('.packages').createSync();
|
||||||
setExitFunctionForTests();
|
setExitFunctionForTests();
|
||||||
appStarter = (DriveCommand command, Uri webUri) {
|
appStarter = (DriveCommand command, Uri webUri) {
|
||||||
|
@ -48,7 +48,7 @@ void main() {
|
|||||||
final GenerateCommand command = GenerateCommand();
|
final GenerateCommand command = GenerateCommand();
|
||||||
applyMocksToCommand(command);
|
applyMocksToCommand(command);
|
||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart'))
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart'))
|
||||||
..createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
globals.fs.currentDirectory
|
globals.fs.currentDirectory
|
||||||
.childDirectory('.dart_tool')
|
.childDirectory('.dart_tool')
|
||||||
|
@ -58,7 +58,7 @@ void main() {
|
|||||||
void _populateDir(Map<String, String> manifest) {
|
void _populateDir(Map<String, String> manifest) {
|
||||||
for (final String key in manifest.keys) {
|
for (final String key in manifest.keys) {
|
||||||
if (manifest[key] == 'dir') {
|
if (manifest[key] == 'dir') {
|
||||||
tempDir.childDirectory(key)..createSync(recursive: true);
|
tempDir.childDirectory(key).createSync(recursive: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (final String key in manifest.keys) {
|
for (final String key in manifest.keys) {
|
||||||
|
@ -156,9 +156,9 @@ void main() {
|
|||||||
fs.currentDirectory = tempDir;
|
fs.currentDirectory = tempDir;
|
||||||
|
|
||||||
tempDir.childFile('pubspec.yaml')
|
tempDir.childFile('pubspec.yaml')
|
||||||
..writeAsStringSync('name: flutter_app');
|
.writeAsStringSync('name: flutter_app');
|
||||||
tempDir.childFile('.packages')
|
tempDir.childFile('.packages')
|
||||||
..writeAsStringSync('# Generated by pub on 2019-11-25 12:38:01.801784.');
|
.writeAsStringSync('# Generated by pub on 2019-11-25 12:38:01.801784.');
|
||||||
final Directory libDir = tempDir.childDirectory('lib');
|
final Directory libDir = tempDir.childDirectory('lib');
|
||||||
libDir.createSync();
|
libDir.createSync();
|
||||||
final File mainFile = libDir.childFile('main.dart');
|
final File mainFile = libDir.childFile('main.dart');
|
||||||
|
@ -1414,7 +1414,7 @@ plugin1=${plugin1.path}
|
|||||||
.childDirectory('apk')
|
.childDirectory('apk')
|
||||||
.childDirectory('release')
|
.childDirectory('release')
|
||||||
.childFile('app-release.apk')
|
.childFile('app-release.apk')
|
||||||
..createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
await buildGradleApp(
|
await buildGradleApp(
|
||||||
project: FlutterProject.current(),
|
project: FlutterProject.current(),
|
||||||
@ -1580,7 +1580,7 @@ plugin1=${plugin1.path}
|
|||||||
.childDirectory('apk')
|
.childDirectory('apk')
|
||||||
.childDirectory('release')
|
.childDirectory('release')
|
||||||
.childFile('app-release.apk')
|
.childFile('app-release.apk')
|
||||||
..createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
await buildGradleApp(
|
await buildGradleApp(
|
||||||
project: FlutterProject.current(),
|
project: FlutterProject.current(),
|
||||||
@ -2621,7 +2621,7 @@ FlutterProject generateFakeAppBundle(String directoryName, String fileName) {
|
|||||||
final Directory bundleDirectory = getBundleDirectory(project);
|
final Directory bundleDirectory = getBundleDirectory(project);
|
||||||
bundleDirectory
|
bundleDirectory
|
||||||
.childDirectory(directoryName)
|
.childDirectory(directoryName)
|
||||||
..createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
bundleDirectory
|
bundleDirectory
|
||||||
.childDirectory(directoryName)
|
.childDirectory(directoryName)
|
||||||
|
@ -236,8 +236,8 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('returns the gradlew path', () {
|
testUsingContext('returns the gradlew path', () {
|
||||||
final Directory androidDirectory = globals.fs.directory('/android')..createSync();
|
final Directory androidDirectory = globals.fs.directory('/android')..createSync();
|
||||||
androidDirectory.childFile('gradlew')..createSync();
|
androidDirectory.childFile('gradlew').createSync();
|
||||||
androidDirectory.childFile('gradlew.bat')..createSync();
|
androidDirectory.childFile('gradlew.bat').createSync();
|
||||||
androidDirectory.childFile('gradle.properties').createSync();
|
androidDirectory.childFile('gradle.properties').createSync();
|
||||||
|
|
||||||
when(gradleUtils.injectGradleWrapperIfNeeded(any)).thenReturn(null);
|
when(gradleUtils.injectGradleWrapperIfNeeded(any)).thenReturn(null);
|
||||||
|
@ -134,7 +134,7 @@ name: example''')
|
|||||||
|
|
||||||
// touch .packages to make sure its change time is after pubspec.yaml's
|
// touch .packages to make sure its change time is after pubspec.yaml's
|
||||||
globals.fs.file('.packages')
|
globals.fs.file('.packages')
|
||||||
..setLastModifiedSync(modifiedTime);
|
.setLastModifiedSync(modifiedTime);
|
||||||
|
|
||||||
// Even though the previous file was removed, it is left in the
|
// Even though the previous file was removed, it is left in the
|
||||||
// asset manifest and not updated. This is due to the devfs not
|
// asset manifest and not updated. This is due to the devfs not
|
||||||
|
@ -57,7 +57,7 @@ flutter:
|
|||||||
- a/b/c/foo
|
- a/b/c/foo
|
||||||
'''
|
'''
|
||||||
);
|
);
|
||||||
globals.fs.file('.packages')..createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
|
|
||||||
final List<String> assets = <String>[
|
final List<String> assets = <String>[
|
||||||
'a/b/c/foo',
|
'a/b/c/foo',
|
||||||
|
@ -921,8 +921,8 @@ void main() {
|
|||||||
outputPreferences: OutputPreferences.test(showColor: false),
|
outputPreferences: OutputPreferences.test(showColor: false),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
timeoutConfiguration: const TimeoutConfiguration(),
|
||||||
);
|
);
|
||||||
logger.startProgress('AAA', timeout: const TimeoutConfiguration().fastOperation)..stop();
|
logger.startProgress('AAA', timeout: const TimeoutConfiguration().fastOperation).stop();
|
||||||
logger.startProgress('BBB', timeout: const TimeoutConfiguration().fastOperation)..stop();
|
logger.startProgress('BBB', timeout: const TimeoutConfiguration().fastOperation).stop();
|
||||||
final List<String> output = outputStdout();
|
final List<String> output = outputStdout();
|
||||||
|
|
||||||
expect(output.length, equals(3));
|
expect(output.length, equals(3));
|
||||||
@ -947,8 +947,8 @@ void main() {
|
|||||||
),
|
),
|
||||||
stopwatchFactory: FakeStopwatchFactory(),
|
stopwatchFactory: FakeStopwatchFactory(),
|
||||||
);
|
);
|
||||||
logger.startProgress('AAA', timeout: const TimeoutConfiguration().fastOperation)..stop();
|
logger.startProgress('AAA', timeout: const TimeoutConfiguration().fastOperation).stop();
|
||||||
logger.startProgress('BBB', timeout: const TimeoutConfiguration().fastOperation)..stop();
|
logger.startProgress('BBB', timeout: const TimeoutConfiguration().fastOperation).stop();
|
||||||
|
|
||||||
expect(outputStdout(), <Matcher>[
|
expect(outputStdout(), <Matcher>[
|
||||||
matches(r'^\[ (?: {0,2}\+[0-9]{1,4} ms| )\] AAA$'),
|
matches(r'^\[ (?: {0,2}\+[0-9]{1,4} ms| )\] AAA$'),
|
||||||
@ -967,8 +967,8 @@ void main() {
|
|||||||
),
|
),
|
||||||
outputPreferences: OutputPreferences.test(),
|
outputPreferences: OutputPreferences.test(),
|
||||||
);
|
);
|
||||||
logger.startProgress('AAA', timeout: const TimeoutConfiguration().fastOperation)..stop();
|
logger.startProgress('AAA', timeout: const TimeoutConfiguration().fastOperation).stop();
|
||||||
logger.startProgress('BBB', timeout: const TimeoutConfiguration().fastOperation)..stop();
|
logger.startProgress('BBB', timeout: const TimeoutConfiguration().fastOperation).stop();
|
||||||
|
|
||||||
expect(logger.statusText, 'AAA\nBBB\n');
|
expect(logger.statusText, 'AAA\nBBB\n');
|
||||||
});
|
});
|
||||||
|
@ -34,7 +34,7 @@ void main() {
|
|||||||
|
|
||||||
// create pre-requisites.
|
// create pre-requisites.
|
||||||
environment.buildDir.childFile('app.dill')
|
environment.buildDir.childFile('app.dill')
|
||||||
..writeAsStringSync('abcd');
|
.writeAsStringSync('abcd');
|
||||||
final Directory hostDirectory = globals.fs.currentDirectory
|
final Directory hostDirectory = globals.fs.currentDirectory
|
||||||
.childDirectory(getNameForHostPlatform(getCurrentHostPlatform()))
|
.childDirectory(getNameForHostPlatform(getCurrentHostPlatform()))
|
||||||
..createSync(recursive: true);
|
..createSync(recursive: true);
|
||||||
@ -61,7 +61,7 @@ void main() {
|
|||||||
|
|
||||||
// create pre-requisites.
|
// create pre-requisites.
|
||||||
environment.buildDir.childFile('app.so')
|
environment.buildDir.childFile('app.so')
|
||||||
..writeAsStringSync('abcd');
|
.writeAsStringSync('abcd');
|
||||||
|
|
||||||
await const ProfileAndroidApplication().build(environment);
|
await const ProfileAndroidApplication().build(environment);
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ void main() {
|
|||||||
|
|
||||||
// create pre-requisites.
|
// create pre-requisites.
|
||||||
environment.buildDir.childFile('app.so')
|
environment.buildDir.childFile('app.so')
|
||||||
..writeAsStringSync('abcd');
|
.writeAsStringSync('abcd');
|
||||||
|
|
||||||
await const ReleaseAndroidApplication().build(environment);
|
await const ReleaseAndroidApplication().build(environment);
|
||||||
|
|
||||||
|
@ -26,13 +26,13 @@ void main() {
|
|||||||
);
|
);
|
||||||
fileSystem.file(environment.buildDir.childFile('app.dill')).createSync(recursive: true);
|
fileSystem.file(environment.buildDir.childFile('app.dill')).createSync(recursive: true);
|
||||||
fileSystem.file('packages/flutter_tools/lib/src/build_system/targets/assets.dart')
|
fileSystem.file('packages/flutter_tools/lib/src/build_system/targets/assets.dart')
|
||||||
..createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fileSystem.file('assets/foo/bar.png')
|
fileSystem.file('assets/foo/bar.png')
|
||||||
..createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fileSystem.file('assets/wildcard/#bar.png')
|
fileSystem.file('assets/wildcard/#bar.png')
|
||||||
..createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fileSystem.file('.packages')
|
fileSystem.file('.packages')
|
||||||
..createSync();
|
.createSync();
|
||||||
fileSystem.file('pubspec.yaml')
|
fileSystem.file('pubspec.yaml')
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync('''
|
..writeAsStringSync('''
|
||||||
|
@ -111,7 +111,7 @@ void main() {
|
|||||||
globals.fs.file('.packages').writeAsStringSync('\n');
|
globals.fs.file('.packages').writeAsStringSync('\n');
|
||||||
// Plist file
|
// Plist file
|
||||||
globals.fs.file(globals.fs.path.join('ios', 'Flutter', 'AppFrameworkInfo.plist'))
|
globals.fs.file(globals.fs.path.join('ios', 'Flutter', 'AppFrameworkInfo.plist'))
|
||||||
..createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
// App kernel
|
// App kernel
|
||||||
environment.buildDir.childFile('app.dill').createSync(recursive: true);
|
environment.buildDir.childFile('app.dill').createSync(recursive: true);
|
||||||
// Stub framework
|
// Stub framework
|
||||||
@ -140,7 +140,7 @@ void main() {
|
|||||||
globals.fs.file('.packages').writeAsStringSync('\n');
|
globals.fs.file('.packages').writeAsStringSync('\n');
|
||||||
// Plist file
|
// Plist file
|
||||||
globals.fs.file(globals.fs.path.join('ios', 'Flutter', 'AppFrameworkInfo.plist'))
|
globals.fs.file(globals.fs.path.join('ios', 'Flutter', 'AppFrameworkInfo.plist'))
|
||||||
..createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
// Real framework
|
// Real framework
|
||||||
environment.buildDir
|
environment.buildDir
|
||||||
|
@ -137,7 +137,7 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('bin', 'cache', 'artifacts', 'engine', 'darwin-x64',
|
globals.fs.file(globals.fs.path.join('bin', 'cache', 'artifacts', 'engine', 'darwin-x64',
|
||||||
'isolate_snapshot.bin')).createSync(recursive: true);
|
'isolate_snapshot.bin')).createSync(recursive: true);
|
||||||
globals.fs.file(globals.fs.path.join(environment.buildDir.path, 'App.framework', 'App'))
|
globals.fs.file(globals.fs.path.join(environment.buildDir.path, 'App.framework', 'App'))
|
||||||
..createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
final String inputKernel = globals.fs.path.join(environment.buildDir.path, 'app.dill');
|
final String inputKernel = globals.fs.path.join(environment.buildDir.path, 'app.dill');
|
||||||
final String outputKernel = globals.fs.path.join('App.framework', 'Versions', 'A', 'Resources',
|
final String outputKernel = globals.fs.path.join('App.framework', 'Versions', 'A', 'Resources',
|
||||||
@ -160,7 +160,7 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('bin', 'cache', 'artifacts', 'engine', 'darwin-x64',
|
globals.fs.file(globals.fs.path.join('bin', 'cache', 'artifacts', 'engine', 'darwin-x64',
|
||||||
'isolate_snapshot.bin')).createSync(recursive: true);
|
'isolate_snapshot.bin')).createSync(recursive: true);
|
||||||
globals.fs.file(globals.fs.path.join(environment.buildDir.path, 'App.framework', 'App'))
|
globals.fs.file(globals.fs.path.join(environment.buildDir.path, 'App.framework', 'App'))
|
||||||
..createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
final String outputKernel = globals.fs.path.join('App.framework', 'Resources',
|
final String outputKernel = globals.fs.path.join('App.framework', 'Resources',
|
||||||
'flutter_assets', 'kernel_blob.bin');
|
'flutter_assets', 'kernel_blob.bin');
|
||||||
final String precompiledVm = globals.fs.path.join('App.framework', 'Resources',
|
final String precompiledVm = globals.fs.path.join('App.framework', 'Resources',
|
||||||
|
@ -90,9 +90,9 @@ void main() {
|
|||||||
environment.defines[kBuildMode] = 'release';
|
environment.defines[kBuildMode] = 'release';
|
||||||
final Directory webResources = environment.projectDir.childDirectory('web');
|
final Directory webResources = environment.projectDir.childDirectory('web');
|
||||||
webResources.childFile('index.html')
|
webResources.childFile('index.html')
|
||||||
..createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
webResources.childFile('foo.txt')
|
webResources.childFile('foo.txt')
|
||||||
..writeAsStringSync('A');
|
.writeAsStringSync('A');
|
||||||
environment.buildDir.childFile('main.dart.js').createSync();
|
environment.buildDir.childFile('main.dart.js').createSync();
|
||||||
|
|
||||||
await const WebReleaseBundle().build(environment);
|
await const WebReleaseBundle().build(environment);
|
||||||
@ -315,7 +315,7 @@ void main() {
|
|||||||
environment.defines[kBuildMode] = 'release';
|
environment.defines[kBuildMode] = 'release';
|
||||||
when(globals.processManager.run(any)).thenAnswer((Invocation invocation) async {
|
when(globals.processManager.run(any)).thenAnswer((Invocation invocation) async {
|
||||||
environment.buildDir.childFile('main.dart.js.deps')
|
environment.buildDir.childFile('main.dart.js.deps')
|
||||||
..writeAsStringSync('file:///a.dart');
|
.writeAsStringSync('file:///a.dart');
|
||||||
return FakeProcessResult(exitCode: 0);
|
return FakeProcessResult(exitCode: 0);
|
||||||
});
|
});
|
||||||
await const Dart2JSTarget().build(environment);
|
await const Dart2JSTarget().build(environment);
|
||||||
|
@ -423,7 +423,7 @@ void main() {
|
|||||||
final File ideviceScreenshotFile = iosUsbArtifacts.location.childFile('idevicescreenshot')
|
final File ideviceScreenshotFile = iosUsbArtifacts.location.childFile('idevicescreenshot')
|
||||||
..createSync();
|
..createSync();
|
||||||
iosUsbArtifacts.location.childFile('idevicesyslog')
|
iosUsbArtifacts.location.childFile('idevicesyslog')
|
||||||
..createSync();
|
.createSync();
|
||||||
|
|
||||||
expect(iosUsbArtifacts.isUpToDateInner(), true);
|
expect(iosUsbArtifacts.isUpToDateInner(), true);
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ void main() {
|
|||||||
],
|
],
|
||||||
onRun: () {
|
onRun: () {
|
||||||
globals.fs.file('.packages')
|
globals.fs.file('.packages')
|
||||||
..setLastModifiedSync(DateTime(2002));
|
.setLastModifiedSync(DateTime(2002));
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
const FakeCommand(
|
const FakeCommand(
|
||||||
@ -280,7 +280,7 @@ void main() {
|
|||||||
],
|
],
|
||||||
onRun: () {
|
onRun: () {
|
||||||
globals.fs.file('pubspec.yaml')
|
globals.fs.file('pubspec.yaml')
|
||||||
..setLastModifiedSync(DateTime(2002));
|
.setLastModifiedSync(DateTime(2002));
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
const FakeCommand(
|
const FakeCommand(
|
||||||
@ -309,9 +309,9 @@ void main() {
|
|||||||
testLogger.clear();
|
testLogger.clear();
|
||||||
// bad scenario 1: pub doesn't update file; doesn't matter, because we do instead
|
// bad scenario 1: pub doesn't update file; doesn't matter, because we do instead
|
||||||
globals.fs.file('.packages')
|
globals.fs.file('.packages')
|
||||||
..setLastModifiedSync(DateTime(2000));
|
.setLastModifiedSync(DateTime(2000));
|
||||||
globals.fs.file('pubspec.yaml')
|
globals.fs.file('pubspec.yaml')
|
||||||
..setLastModifiedSync(DateTime(2001));
|
.setLastModifiedSync(DateTime(2001));
|
||||||
await pub.get(context: PubContext.flutterTests, checkLastModified: true); // pub does nothing
|
await pub.get(context: PubContext.flutterTests, checkLastModified: true); // pub does nothing
|
||||||
expect(testLogger.statusText, 'Running "flutter pub get" in /...\n');
|
expect(testLogger.statusText, 'Running "flutter pub get" in /...\n');
|
||||||
expect(testLogger.errorText, isEmpty);
|
expect(testLogger.errorText, isEmpty);
|
||||||
@ -321,9 +321,9 @@ void main() {
|
|||||||
testLogger.clear();
|
testLogger.clear();
|
||||||
// bad scenario 2: pub changes pubspec.yaml instead
|
// bad scenario 2: pub changes pubspec.yaml instead
|
||||||
globals.fs.file('.packages')
|
globals.fs.file('.packages')
|
||||||
..setLastModifiedSync(DateTime(2000));
|
.setLastModifiedSync(DateTime(2000));
|
||||||
globals.fs.file('pubspec.yaml')
|
globals.fs.file('pubspec.yaml')
|
||||||
..setLastModifiedSync(DateTime(2001));
|
.setLastModifiedSync(DateTime(2001));
|
||||||
try {
|
try {
|
||||||
await pub.get(context: PubContext.flutterTests, checkLastModified: true);
|
await pub.get(context: PubContext.flutterTests, checkLastModified: true);
|
||||||
expect(true, isFalse, reason: 'pub.get did not throw');
|
expect(true, isFalse, reason: 'pub.get did not throw');
|
||||||
@ -337,9 +337,9 @@ void main() {
|
|||||||
expect(globals.fs.file('.packages').lastModifiedSync(), DateTime(2000)); // because nothing touched it
|
expect(globals.fs.file('.packages').lastModifiedSync(), DateTime(2000)); // because nothing touched it
|
||||||
// bad scenario 3: pubspec.yaml was created in the future
|
// bad scenario 3: pubspec.yaml was created in the future
|
||||||
globals.fs.file('.packages')
|
globals.fs.file('.packages')
|
||||||
..setLastModifiedSync(DateTime(2000));
|
.setLastModifiedSync(DateTime(2000));
|
||||||
globals.fs.file('pubspec.yaml')
|
globals.fs.file('pubspec.yaml')
|
||||||
..setLastModifiedSync(DateTime(9999));
|
.setLastModifiedSync(DateTime(9999));
|
||||||
assert(DateTime(9999).isAfter(DateTime.now()));
|
assert(DateTime(9999).isAfter(DateTime.now()));
|
||||||
await pub.get(context: PubContext.flutterTests, checkLastModified: true); // pub does nothing
|
await pub.get(context: PubContext.flutterTests, checkLastModified: true); // pub does nothing
|
||||||
expect(testLogger.statusText, contains('Running "flutter pub get" in /...\n'));
|
expect(testLogger.statusText, contains('Running "flutter pub get" in /...\n'));
|
||||||
|
@ -575,7 +575,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
..writeAsStringSync('Existing lock file.');
|
..writeAsStringSync('Existing lock file.');
|
||||||
await Future<void>.delayed(const Duration(milliseconds: 10));
|
await Future<void>.delayed(const Duration(milliseconds: 10));
|
||||||
projectUnderTest.ios.podfile
|
projectUnderTest.ios.podfile
|
||||||
..writeAsStringSync('Updated Podfile');
|
.writeAsStringSync('Updated Podfile');
|
||||||
await cocoaPodsUnderTest.processPods(
|
await cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
engineDir: 'engine/path',
|
engineDir: 'engine/path',
|
||||||
|
@ -236,7 +236,7 @@ flutter:
|
|||||||
.childDirectory('java')
|
.childDirectory('java')
|
||||||
.childDirectory(pluginName)
|
.childDirectory(pluginName)
|
||||||
.childFile('UseOldEmbedding.java')
|
.childFile('UseOldEmbedding.java')
|
||||||
..createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
flutterProject.directory
|
flutterProject.directory
|
||||||
.childFile('.packages')
|
.childFile('.packages')
|
||||||
@ -855,7 +855,7 @@ EndGlobal''');
|
|||||||
.childDirectory('lib')
|
.childDirectory('lib')
|
||||||
.childDirectory('src')
|
.childDirectory('src')
|
||||||
.childFile('web_plugin.dart')
|
.childFile('web_plugin.dart')
|
||||||
..createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
flutterProject.directory
|
flutterProject.directory
|
||||||
.childFile('.packages')
|
.childFile('.packages')
|
||||||
|
@ -81,7 +81,7 @@ void main() {
|
|||||||
urlTunneller: null,
|
urlTunneller: null,
|
||||||
) as ResidentWebRunner;
|
) as ResidentWebRunner;
|
||||||
globals.fs.currentDirectory.childFile('.packages')
|
globals.fs.currentDirectory.childFile('.packages')
|
||||||
..writeAsStringSync('\n');
|
.writeAsStringSync('\n');
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -632,8 +632,7 @@ class MockDeviceLogReader extends DeviceLogReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void applyMocksToCommand(FlutterCommand command) {
|
void applyMocksToCommand(FlutterCommand command) {
|
||||||
command
|
command.applicationPackages = MockApplicationPackageStore();
|
||||||
..applicationPackages = MockApplicationPackageStore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Common functionality for tracking mock interaction
|
/// Common functionality for tracking mock interaction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user