Unverified Commit 890b9394 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

indent formal parameters correctly (#41644)

parent dc03c443
...@@ -25,18 +25,18 @@ abstract class _ErrorDiagnostic extends DiagnosticsProperty<List<Object>> { ...@@ -25,18 +25,18 @@ abstract class _ErrorDiagnostic extends DiagnosticsProperty<List<Object>> {
/// interactive display of errors. /// interactive display of errors.
_ErrorDiagnostic( _ErrorDiagnostic(
String message, { String message, {
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.flat, DiagnosticsTreeStyle style = DiagnosticsTreeStyle.flat,
DiagnosticLevel level = DiagnosticLevel.info, DiagnosticLevel level = DiagnosticLevel.info,
}) : assert(message != null), }) : assert(message != null),
super( super(
null, null,
<Object>[message], <Object>[message],
showName: false, showName: false,
showSeparator: false, showSeparator: false,
defaultValue: null, defaultValue: null,
style: style, style: style,
level: level, level: level,
); );
/// In debug builds, a kernel transformer rewrites calls to the default /// In debug builds, a kernel transformer rewrites calls to the default
/// constructors for [ErrorSummary], [ErrorDetails], and [ErrorHint] to use /// constructors for [ErrorSummary], [ErrorDetails], and [ErrorHint] to use
......
...@@ -1097,8 +1097,8 @@ class TextTreeRenderer { ...@@ -1097,8 +1097,8 @@ class TextTreeRenderer {
/// single line style does not provide any meaningful style for how children /// single line style does not provide any meaningful style for how children
/// should be connected to their parents. /// should be connected to their parents.
TextTreeConfiguration _childTextConfiguration( TextTreeConfiguration _childTextConfiguration(
DiagnosticsNode child, DiagnosticsNode child,
TextTreeConfiguration textStyle, TextTreeConfiguration textStyle,
) { ) {
final DiagnosticsTreeStyle childStyle = child?.style; final DiagnosticsTreeStyle childStyle = child?.style;
return (_isSingleLine(childStyle) || childStyle == DiagnosticsTreeStyle.errorProperty) ? textStyle : child.textTreeConfiguration; return (_isSingleLine(childStyle) || childStyle == DiagnosticsTreeStyle.errorProperty) ? textStyle : child.textTreeConfiguration;
...@@ -1588,9 +1588,9 @@ abstract class DiagnosticsNode { ...@@ -1588,9 +1588,9 @@ abstract class DiagnosticsNode {
/// The provided `nodes` may be properties or children of the `parent` /// The provided `nodes` may be properties or children of the `parent`
/// [DiagnosticsNode]. /// [DiagnosticsNode].
static List<Map<String, Object>> toJsonList( static List<Map<String, Object>> toJsonList(
List<DiagnosticsNode> nodes, List<DiagnosticsNode> nodes,
DiagnosticsNode parent, DiagnosticsNode parent,
DiagnosticsSerializationDelegate delegate, DiagnosticsSerializationDelegate delegate,
) { ) {
bool truncated = false; bool truncated = false;
if (nodes == null) if (nodes == null)
......
...@@ -322,8 +322,8 @@ class BottomNavigationBar extends StatefulWidget { ...@@ -322,8 +322,8 @@ class BottomNavigationBar extends StatefulWidget {
// [BottomNavigationBarType.fixed] is used for 3 or fewer items, and // [BottomNavigationBarType.fixed] is used for 3 or fewer items, and
// [BottomNavigationBarType.shifting] is used for 4+ items. // [BottomNavigationBarType.shifting] is used for 4+ items.
static BottomNavigationBarType _type( static BottomNavigationBarType _type(
BottomNavigationBarType type, BottomNavigationBarType type,
List<BottomNavigationBarItem> items, List<BottomNavigationBarItem> items,
) { ) {
if (type != null) { if (type != null) {
return type; return type;
......
...@@ -476,13 +476,13 @@ class _RangeSliderState extends State<RangeSlider> with TickerProviderStateMixin ...@@ -476,13 +476,13 @@ class _RangeSliderState extends State<RangeSlider> with TickerProviderStateMixin
// non-zero displacement is negative, then the left thumb is selected, and if its // non-zero displacement is negative, then the left thumb is selected, and if its
// positive, then the right thumb is selected. // positive, then the right thumb is selected.
static final RangeThumbSelector _defaultRangeThumbSelector = ( static final RangeThumbSelector _defaultRangeThumbSelector = (
TextDirection textDirection, TextDirection textDirection,
RangeValues values, RangeValues values,
double tapValue, double tapValue,
Size thumbSize, Size thumbSize,
Size trackSize, Size trackSize,
double dx, // The horizontal delta or displacement of the drag update. double dx, // The horizontal delta or displacement of the drag update.
) { ) {
final double touchRadius = math.max(thumbSize.width, RangeSlider._minTouchTargetWidth) / 2; final double touchRadius = math.max(thumbSize.width, RangeSlider._minTouchTargetWidth) / 2;
final bool inStartTouchTarget = (tapValue - values.start).abs() * trackSize.width < touchRadius; final bool inStartTouchTarget = (tapValue - values.start).abs() * trackSize.width < touchRadius;
final bool inEndTouchTarget = (tapValue - values.end).abs() * trackSize.width < touchRadius; final bool inEndTouchTarget = (tapValue - values.end).abs() * trackSize.width < touchRadius;
......
...@@ -1626,16 +1626,16 @@ class RoundedRectSliderTrackShape extends SliderTrackShape with BaseSliderTrackS ...@@ -1626,16 +1626,16 @@ class RoundedRectSliderTrackShape extends SliderTrackShape with BaseSliderTrackS
@override @override
void paint( void paint(
PaintingContext context, PaintingContext context,
Offset offset, { Offset offset, {
@required RenderBox parentBox, @required RenderBox parentBox,
@required SliderThemeData sliderTheme, @required SliderThemeData sliderTheme,
@required Animation<double> enableAnimation, @required Animation<double> enableAnimation,
@required TextDirection textDirection, @required TextDirection textDirection,
@required Offset thumbCenter, @required Offset thumbCenter,
bool isDiscrete = false, bool isDiscrete = false,
bool isEnabled = false, bool isEnabled = false,
}) { }) {
assert(context != null); assert(context != null);
assert(offset != null); assert(offset != null);
assert(parentBox != null); assert(parentBox != null);
......
...@@ -1483,7 +1483,7 @@ class MaterialBasedCupertinoThemeData extends CupertinoThemeData { ...@@ -1483,7 +1483,7 @@ class MaterialBasedCupertinoThemeData extends CupertinoThemeData {
/// ///
/// The [materialTheme] parameter must not be null. /// The [materialTheme] parameter must not be null.
MaterialBasedCupertinoThemeData({ MaterialBasedCupertinoThemeData({
@required ThemeData materialTheme, @required ThemeData materialTheme,
}) : this._( }) : this._(
materialTheme, materialTheme,
(materialTheme.cupertinoOverrideTheme ?? const CupertinoThemeData()).noDefault(), (materialTheme.cupertinoOverrideTheme ?? const CupertinoThemeData()).noDefault(),
......
...@@ -469,10 +469,10 @@ class ColorProperty extends DiagnosticsProperty<Color> { ...@@ -469,10 +469,10 @@ class ColorProperty extends DiagnosticsProperty<Color> {
ColorProperty( ColorProperty(
String name, String name,
Color value, { Color value, {
bool showName = true, bool showName = true,
Object defaultValue = kNoDefaultValue, Object defaultValue = kNoDefaultValue,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.singleLine, DiagnosticsTreeStyle style = DiagnosticsTreeStyle.singleLine,
DiagnosticLevel level = DiagnosticLevel.info, DiagnosticLevel level = DiagnosticLevel.info,
}) : assert(showName != null), }) : assert(showName != null),
assert(style != null), assert(style != null),
assert(level != null), assert(level != null),
......
...@@ -37,11 +37,11 @@ Color _sample(List<Color> colors, List<double> stops, double t) { ...@@ -37,11 +37,11 @@ Color _sample(List<Color> colors, List<double> stops, double t) {
} }
_ColorsAndStops _interpolateColorsAndStops( _ColorsAndStops _interpolateColorsAndStops(
List<Color> aColors, List<Color> aColors,
List<double> aStops, List<double> aStops,
List<Color> bColors, List<Color> bColors,
List<double> bStops, List<double> bStops,
double t, double t,
) { ) {
assert(aColors.length >= 2); assert(aColors.length >= 2);
assert(bColors.length >= 2); assert(bColors.length >= 2);
......
...@@ -164,9 +164,7 @@ class MatrixUtils { ...@@ -164,9 +164,7 @@ class MatrixUtils {
} }
static Float64List _minMax; static Float64List _minMax;
static void _accumulate(Float64List m, double x, double y, static void _accumulate(Float64List m, double x, double y, bool first, bool isAffine) {
bool first, bool isAffine)
{
final double w = isAffine ? 1.0 : 1.0 / (m[3] * x + m[7] * y + m[15]); final double w = isAffine ? 1.0 : 1.0 / (m[3] * x + m[7] * y + m[15]);
final double tx = (m[0] * x + m[4] * y + m[12]) * w; final double tx = (m[0] * x + m[4] * y + m[12]) * w;
final double ty = (m[1] * x + m[5] * y + m[13]) * w; final double ty = (m[1] * x + m[5] * y + m[13]) * w;
......
...@@ -99,9 +99,10 @@ abstract class ShaderWarmUp { ...@@ -99,9 +99,10 @@ abstract class ShaderWarmUp {
/// issues seen so far. /// issues seen so far.
class DefaultShaderWarmUp extends ShaderWarmUp { class DefaultShaderWarmUp extends ShaderWarmUp {
/// Allow [DefaultShaderWarmUp] to be used as the default value of parameters. /// Allow [DefaultShaderWarmUp] to be used as the default value of parameters.
const DefaultShaderWarmUp( const DefaultShaderWarmUp({
{this.drawCallSpacing = 0.0, this.drawCallSpacing = 0.0,
this.canvasSize = const ui.Size(100.0, 100.0)}); this.canvasSize = const ui.Size(100.0, 100.0),
});
/// Constant that can be used to space out draw calls for visualizing the draws /// Constant that can be used to space out draw calls for visualizing the draws
/// for debugging purposes (example: 80.0). Be sure to also change your canvas /// for debugging purposes (example: 80.0). Be sure to also change your canvas
......
...@@ -250,9 +250,9 @@ class Hero extends StatefulWidget { ...@@ -250,9 +250,9 @@ class Hero extends StatefulWidget {
// should be considered for animation when `navigator` transitions from one // should be considered for animation when `navigator` transitions from one
// PageRoute to another. // PageRoute to another.
static Map<Object, _HeroState> _allHeroesFor( static Map<Object, _HeroState> _allHeroesFor(
BuildContext context, BuildContext context,
bool isUserGestureTransition, bool isUserGestureTransition,
NavigatorState navigator, NavigatorState navigator,
) { ) {
assert(context != null); assert(context != null);
assert(isUserGestureTransition != null); assert(isUserGestureTransition != null);
......
...@@ -75,10 +75,10 @@ class IconDataProperty extends DiagnosticsProperty<IconData> { ...@@ -75,10 +75,10 @@ class IconDataProperty extends DiagnosticsProperty<IconData> {
IconDataProperty( IconDataProperty(
String name, String name,
IconData value, { IconData value, {
String ifNull, String ifNull,
bool showName = true, bool showName = true,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.singleLine, DiagnosticsTreeStyle style = DiagnosticsTreeStyle.singleLine,
DiagnosticLevel level = DiagnosticLevel.info, DiagnosticLevel level = DiagnosticLevel.info,
}) : assert(showName != null), }) : assert(showName != null),
assert(style != null), assert(style != null),
assert(level != null), assert(level != null),
......
...@@ -1625,17 +1625,17 @@ mixin WidgetInspectorService { ...@@ -1625,17 +1625,17 @@ mixin WidgetInspectorService {
/// * [getChildrenDetailsSubtree], a method to get children of a node /// * [getChildrenDetailsSubtree], a method to get children of a node
/// in the details subtree. /// in the details subtree.
String getDetailsSubtree( String getDetailsSubtree(
String id, String id,
String groupName, { String groupName, {
int subtreeDepth = 2, int subtreeDepth = 2,
}) { }) {
return _safeJsonEncode(_getDetailsSubtree( id, groupName, subtreeDepth)); return _safeJsonEncode(_getDetailsSubtree( id, groupName, subtreeDepth));
} }
Map<String, Object> _getDetailsSubtree( Map<String, Object> _getDetailsSubtree(
String id, String id,
String groupName, String groupName,
int subtreeDepth, int subtreeDepth,
) { ) {
final DiagnosticsNode root = toObject(id); final DiagnosticsNode root = toObject(id);
if (root == null) { if (root == null) {
......
...@@ -83,8 +83,8 @@ class PathBoundsMatcher extends Matcher { ...@@ -83,8 +83,8 @@ class PathBoundsMatcher extends Matcher {
class PathPointsMatcher extends Matcher { class PathPointsMatcher extends Matcher {
const PathPointsMatcher({ const PathPointsMatcher({
this.includes = const <Offset>[], this.includes = const <Offset>[],
this.excludes = const <Offset>[], this.excludes = const <Offset>[],
}) : super(); }) : super();
final Iterable<Offset> includes; final Iterable<Offset> includes;
......
...@@ -1291,9 +1291,7 @@ void main() { ...@@ -1291,9 +1291,7 @@ void main() {
expect(selectedIndex, 13); expect(selectedIndex, 13);
}); });
testWidgets('Dropdown button will accept widgets as its underline', ( testWidgets('Dropdown button will accept widgets as its underline', (WidgetTester tester) async {
WidgetTester tester) async {
const BoxDecoration decoration = BoxDecoration( const BoxDecoration decoration = BoxDecoration(
border: Border(bottom: BorderSide(color: Color(0xFFCCBB00), width: 4.0)), border: Border(bottom: BorderSide(color: Color(0xFFCCBB00), width: 4.0)),
); );
......
...@@ -20,9 +20,9 @@ class TestCanvas implements Canvas { ...@@ -20,9 +20,9 @@ class TestCanvas implements Canvas {
} }
Widget _buildBoilerplate({ Widget _buildBoilerplate({
TextDirection textDirection = TextDirection.ltr, TextDirection textDirection = TextDirection.ltr,
EdgeInsets padding = EdgeInsets.zero, EdgeInsets padding = EdgeInsets.zero,
Widget child, Widget child,
}) { }) {
return Directionality( return Directionality(
textDirection: textDirection, textDirection: textDirection,
......
...@@ -27,19 +27,19 @@ class LoggingThumbShape extends SliderComponentShape { ...@@ -27,19 +27,19 @@ class LoggingThumbShape extends SliderComponentShape {
@override @override
void paint( void paint(
PaintingContext context, PaintingContext context,
Offset thumbCenter, { Offset thumbCenter, {
Animation<double> activationAnimation, Animation<double> activationAnimation,
Animation<double> enableAnimation, Animation<double> enableAnimation,
bool isEnabled, bool isEnabled,
bool isDiscrete, bool isDiscrete,
bool onActiveTrack, bool onActiveTrack,
TextPainter labelPainter, TextPainter labelPainter,
RenderBox parentBox, RenderBox parentBox,
SliderThemeData sliderTheme, SliderThemeData sliderTheme,
TextDirection textDirection, TextDirection textDirection,
double value, double value,
}) { }) {
log.add(thumbCenter); log.add(thumbCenter);
final Paint thumbPaint = Paint()..color = Colors.red; final Paint thumbPaint = Paint()..color = Colors.red;
context.canvas.drawCircle(thumbCenter, 5.0, thumbPaint); context.canvas.drawCircle(thumbCenter, 5.0, thumbPaint);
...@@ -54,15 +54,15 @@ class TallSliderTickMarkShape extends SliderTickMarkShape { ...@@ -54,15 +54,15 @@ class TallSliderTickMarkShape extends SliderTickMarkShape {
@override @override
void paint( void paint(
PaintingContext context, PaintingContext context,
Offset offset, { Offset offset, {
Offset thumbCenter, Offset thumbCenter,
RenderBox parentBox, RenderBox parentBox,
SliderThemeData sliderTheme, SliderThemeData sliderTheme,
Animation<double> enableAnimation, Animation<double> enableAnimation,
bool isEnabled, bool isEnabled,
TextDirection textDirection, TextDirection textDirection,
}) { }) {
final Paint paint = Paint()..color = Colors.red; final Paint paint = Paint()..color = Colors.red;
context.canvas.drawRect(Rect.fromLTWH(offset.dx, offset.dy, 10.0, 20.0), paint); context.canvas.drawRect(Rect.fromLTWH(offset.dx, offset.dy, 10.0, 20.0), paint);
} }
......
...@@ -104,30 +104,55 @@ class TestRecordingPaintingContext extends ClipContext implements PaintingContex ...@@ -104,30 +104,55 @@ class TestRecordingPaintingContext extends ClipContext implements PaintingContex
} }
@override @override
ClipRectLayer pushClipRect(bool needsCompositing, Offset offset, Rect clipRect, ClipRectLayer pushClipRect(
PaintingContextCallback painter, { Clip clipBehavior = Clip.hardEdge, ClipRectLayer oldLayer }) { bool needsCompositing,
Offset offset,
Rect clipRect,
PaintingContextCallback painter, {
Clip clipBehavior = Clip.hardEdge,
ClipRectLayer oldLayer,
}) {
clipRectAndPaint(clipRect.shift(offset), clipBehavior, clipRect.shift(offset), () => painter(this, offset)); clipRectAndPaint(clipRect.shift(offset), clipBehavior, clipRect.shift(offset), () => painter(this, offset));
return null; return null;
} }
@override @override
ClipRRectLayer pushClipRRect(bool needsCompositing, Offset offset, Rect bounds, RRect clipRRect, ClipRRectLayer pushClipRRect(
PaintingContextCallback painter, { Clip clipBehavior = Clip.antiAlias, ClipRRectLayer oldLayer }) { bool needsCompositing,
Offset offset,
Rect bounds,
RRect clipRRect,
PaintingContextCallback painter, {
Clip clipBehavior = Clip.antiAlias,
ClipRRectLayer oldLayer,
}) {
assert(clipBehavior != null); assert(clipBehavior != null);
clipRRectAndPaint(clipRRect.shift(offset), clipBehavior, bounds.shift(offset), () => painter(this, offset)); clipRRectAndPaint(clipRRect.shift(offset), clipBehavior, bounds.shift(offset), () => painter(this, offset));
return null; return null;
} }
@override @override
ClipPathLayer pushClipPath(bool needsCompositing, Offset offset, Rect bounds, Path clipPath, ClipPathLayer pushClipPath(
PaintingContextCallback painter, { Clip clipBehavior = Clip.antiAlias, ClipPathLayer oldLayer }) { bool needsCompositing,
Offset offset,
Rect bounds,
Path clipPath,
PaintingContextCallback painter, {
Clip clipBehavior = Clip.antiAlias,
ClipPathLayer oldLayer,
}) {
clipPathAndPaint(clipPath.shift(offset), clipBehavior, bounds.shift(offset), () => painter(this, offset)); clipPathAndPaint(clipPath.shift(offset), clipBehavior, bounds.shift(offset), () => painter(this, offset));
return null; return null;
} }
@override @override
TransformLayer pushTransform(bool needsCompositing, Offset offset, Matrix4 transform, TransformLayer pushTransform(
PaintingContextCallback painter, { TransformLayer oldLayer }) { bool needsCompositing,
Offset offset,
Matrix4 transform,
PaintingContextCallback painter, {
TransformLayer oldLayer,
}) {
canvas.save(); canvas.save();
canvas.transform(transform.storage); canvas.transform(transform.storage);
painter(this, offset); painter(this, offset);
......
...@@ -82,12 +82,12 @@ class TestRenderSliverBoxChildManager extends RenderSliverBoxChildManager { ...@@ -82,12 +82,12 @@ class TestRenderSliverBoxChildManager extends RenderSliverBoxChildManager {
@override @override
double estimateMaxScrollOffset( double estimateMaxScrollOffset(
SliverConstraints constraints, { SliverConstraints constraints, {
int firstIndex, int firstIndex,
int lastIndex, int lastIndex,
double leadingScrollOffset, double leadingScrollOffset,
double trailingScrollOffset, double trailingScrollOffset,
}) { }) {
assert(lastIndex >= firstIndex); assert(lastIndex >= firstIndex);
return children.length * (trailingScrollOffset - leadingScrollOffset) / (lastIndex - firstIndex + 1); return children.length * (trailingScrollOffset - leadingScrollOffset) / (lastIndex - firstIndex + 1);
} }
......
...@@ -98,10 +98,10 @@ class ViewportOffsetSpy extends ViewportOffset { ...@@ -98,10 +98,10 @@ class ViewportOffsetSpy extends ViewportOffset {
@override @override
Future<void> animateTo( Future<void> animateTo(
double to, { double to, {
@required Duration duration, @required Duration duration,
@required Curve curve, @required Curve curve,
}) async { }) async {
// Do nothing, not required in test. // Do nothing, not required in test.
} }
......
...@@ -224,10 +224,11 @@ class AndroidDevice extends Device { ...@@ -224,10 +224,11 @@ class AndroidDevice extends Device {
} }
String runAdbCheckedSync( String runAdbCheckedSync(
List<String> params, { List<String> params, {
String workingDirectory, String workingDirectory,
bool allowReentrantFlutter = false, bool allowReentrantFlutter = false,
Map<String, String> environment}) { Map<String, String> environment,
}) {
return processUtils.runSync( return processUtils.runSync(
adbCommandForDevice(params), adbCommandForDevice(params),
throwOnError: true, throwOnError: true,
...@@ -239,10 +240,10 @@ class AndroidDevice extends Device { ...@@ -239,10 +240,10 @@ class AndroidDevice extends Device {
} }
Future<RunResult> runAdbCheckedAsync( Future<RunResult> runAdbCheckedAsync(
List<String> params, { List<String> params, {
String workingDirectory, String workingDirectory,
bool allowReentrantFlutter = false, bool allowReentrantFlutter = false,
}) async { }) async {
return processUtils.run( return processUtils.run(
adbCommandForDevice(params), adbCommandForDevice(params),
throwOnError: true, throwOnError: true,
......
...@@ -79,9 +79,10 @@ import 'dart:async'; ...@@ -79,9 +79,10 @@ import 'dart:async';
/// [onError] must have type `FutureOr<T> Function(Object error)` or /// [onError] must have type `FutureOr<T> Function(Object error)` or
/// `FutureOr<T> Function(Object error, StackTrace stackTrace)` otherwise an /// `FutureOr<T> Function(Object error, StackTrace stackTrace)` otherwise an
/// [ArgumentError] will be thrown synchronously. /// [ArgumentError] will be thrown synchronously.
Future<T> asyncGuard<T>(Future<T> Function() fn, { Future<T> asyncGuard<T>(
Function onError, Future<T> Function() fn, {
}) { Function onError,
}) {
if (onError != null && if (onError != null &&
onError is! _UnaryOnError<T> && onError is! _UnaryOnError<T> &&
onError is! _BinaryOnError<T>) { onError is! _BinaryOnError<T>) {
......
...@@ -71,12 +71,10 @@ void ensureDirectoryExists(String filePath) { ...@@ -71,12 +71,10 @@ void ensureDirectoryExists(String filePath) {
/// Skips files if [shouldCopyFile] returns `false`. /// Skips files if [shouldCopyFile] returns `false`.
void copyDirectorySync( void copyDirectorySync(
Directory srcDir, Directory srcDir,
Directory destDir, Directory destDir, {
{ bool shouldCopyFile(File srcFile, File destFile),
bool shouldCopyFile(File srcFile, File destFile), void onFileCopied(File srcFile, File destFile),
void onFileCopied(File srcFile, File destFile), }) {
}
) {
if (!srcDir.existsSync()) { if (!srcDir.existsSync()) {
throw Exception('Source directory "${srcDir.path}" does not exist, nothing to copy'); throw Exception('Source directory "${srcDir.path}" does not exist, nothing to copy');
} }
......
...@@ -629,8 +629,14 @@ void verifyOutputDirectories(List<File> outputs, Environment environment, Target ...@@ -629,8 +629,14 @@ void verifyOutputDirectories(List<File> outputs, Environment environment, Target
/// A node in the build graph. /// A node in the build graph.
class Node { class Node {
Node(this.target, this.inputs, this.outputs, this.dependencies, Node(
Environment environment, this.missingDepfile) { this.target,
this.inputs,
this.outputs,
this.dependencies,
Environment environment,
this.missingDepfile,
) {
final File stamp = target._findStampFile(environment); final File stamp = target._findStampFile(environment);
// If the stamp file doesn't exist, we haven't run this step before and // If the stamp file doesn't exist, we haven't run this step before and
......
...@@ -215,8 +215,7 @@ abstract class Source { ...@@ -215,8 +215,7 @@ abstract class Source {
/// The source is provided by an [Artifact]. /// The source is provided by an [Artifact].
/// ///
/// If [artifact] points to a directory then all child files are included. /// If [artifact] points to a directory then all child files are included.
const factory Source.artifact(Artifact artifact, {TargetPlatform platform, const factory Source.artifact(Artifact artifact, {TargetPlatform platform, BuildMode mode}) = _ArtifactSource;
BuildMode mode}) = _ArtifactSource;
/// The source is provided by a depfile generated at runtime. /// The source is provided by a depfile generated at runtime.
/// ///
......
...@@ -92,8 +92,7 @@ class FuchsiaAmberCtl { ...@@ -92,8 +92,7 @@ class FuchsiaAmberCtl {
/// Instructs the pkg_resolver instance running on [device] to prefetch the /// Instructs the pkg_resolver instance running on [device] to prefetch the
/// package [packageName]. /// package [packageName].
Future<bool> pkgCtlResolve(FuchsiaDevice device, FuchsiaPackageServer server, Future<bool> pkgCtlResolve(FuchsiaDevice device, FuchsiaPackageServer server, String packageName) async {
String packageName) async {
final String packageUrl = 'fuchsia-pkg://${server.name}/$packageName'; final String packageUrl = 'fuchsia-pkg://${server.name}/$packageName';
final RunResult result = await device.shell('pkgctl resolve $packageUrl'); final RunResult result = await device.shell('pkgctl resolve $packageUrl');
return result.exitCode == 0; return result.exitCode == 0;
......
...@@ -34,10 +34,11 @@ Future<void> _timedBuildStep(String name, Future<void> Function() action) async ...@@ -34,10 +34,11 @@ Future<void> _timedBuildStep(String name, Future<void> Function() action) async
// 2. Create a manifest file for assets. // 2. Create a manifest file for assets.
// 3. Using these manifests, use the Fuchsia SDK 'pm' tool to create the // 3. Using these manifests, use the Fuchsia SDK 'pm' tool to create the
// Fuchsia package. // Fuchsia package.
Future<void> buildFuchsia( Future<void> buildFuchsia({
{@required FuchsiaProject fuchsiaProject, @required FuchsiaProject fuchsiaProject,
@required String target, // E.g., lib/main.dart @required String target, // E.g., lib/main.dart
BuildInfo buildInfo = BuildInfo.debug}) async { BuildInfo buildInfo = BuildInfo.debug,
}) async {
final Directory outDir = fs.directory(getFuchsiaBuildDirectory()); final Directory outDir = fs.directory(getFuchsiaBuildDirectory());
if (!outDir.existsSync()) { if (!outDir.existsSync()) {
outDir.createSync(recursive: true); outDir.createSync(recursive: true);
...@@ -53,9 +54,10 @@ Future<void> buildFuchsia( ...@@ -53,9 +54,10 @@ Future<void> buildFuchsia(
} }
Future<void> _buildAssets( Future<void> _buildAssets(
FuchsiaProject fuchsiaProject, FuchsiaProject fuchsiaProject,
String target, // lib/main.dart String target, // lib/main.dart
BuildInfo buildInfo) async { BuildInfo buildInfo,
) async {
final String assetDir = getAssetBuildDirectory(); final String assetDir = getAssetBuildDirectory();
final AssetBundle assets = await buildAssets( final AssetBundle assets = await buildAssets(
manifestPath: fuchsiaProject.project.pubspecFile.path, manifestPath: fuchsiaProject.project.pubspecFile.path,
...@@ -110,9 +112,10 @@ void _rewriteCmx(BuildMode mode, File src, File dst) { ...@@ -110,9 +112,10 @@ void _rewriteCmx(BuildMode mode, File src, File dst) {
// TODO(zra): Allow supplying a signing key. // TODO(zra): Allow supplying a signing key.
Future<void> _buildPackage( Future<void> _buildPackage(
FuchsiaProject fuchsiaProject, FuchsiaProject fuchsiaProject,
String target, // lib/main.dart String target, // lib/main.dart
BuildInfo buildInfo) async { BuildInfo buildInfo,
) async {
final String outDir = getFuchsiaBuildDirectory(); final String outDir = getFuchsiaBuildDirectory();
final String pkgDir = fs.path.join(outDir, 'pkg'); final String pkgDir = fs.path.join(outDir, 'pkg');
final String appName = fuchsiaProject.project.manifest.appName; final String appName = fuchsiaProject.project.manifest.appName;
......
...@@ -498,9 +498,9 @@ class FuchsiaDevice extends Device { ...@@ -498,9 +498,9 @@ class FuchsiaDevice extends Device {
return null; return null;
} }
FuchsiaIsolateDiscoveryProtocol getIsolateDiscoveryProtocol( FuchsiaIsolateDiscoveryProtocol getIsolateDiscoveryProtocol(String isolateName) {
String isolateName) => return FuchsiaIsolateDiscoveryProtocol(this, isolateName);
FuchsiaIsolateDiscoveryProtocol(this, isolateName); }
@override @override
bool isSupportedForProject(FlutterProject flutterProject) { bool isSupportedForProject(FlutterProject flutterProject) {
......
...@@ -58,8 +58,7 @@ class FuchsiaPM { ...@@ -58,8 +58,7 @@ class FuchsiaPM {
/// ///
/// where $APPNAME is the same [appName] passed to [init], and meta/package /// where $APPNAME is the same [appName] passed to [init], and meta/package
/// is set up to be the file `meta/package` created by [init]. /// is set up to be the file `meta/package` created by [init].
Future<bool> build( Future<bool> build(String buildPath, String keyPath, String manifestPath) {
String buildPath, String keyPath, String manifestPath) {
return _runPMCommand(<String>[ return _runPMCommand(<String>[
'-o', '-o',
buildPath, buildPath,
......
...@@ -279,7 +279,8 @@ class XcodeProjectInterpreter { ...@@ -279,7 +279,8 @@ class XcodeProjectInterpreter {
/// Asynchronously retrieve xcode build settings. This one is preferred for /// Asynchronously retrieve xcode build settings. This one is preferred for
/// new call-sites. /// new call-sites.
Future<Map<String, String>> getBuildSettings( Future<Map<String, String>> getBuildSettings(
String projectPath, String target, { String projectPath,
String target, {
Duration timeout = const Duration(minutes: 1), Duration timeout = const Duration(minutes: 1),
}) async { }) async {
final Status status = Status.withSpinner( final Status status = Status.withSpinner(
......
...@@ -14,8 +14,7 @@ import 'cocoapods.dart'; ...@@ -14,8 +14,7 @@ import 'cocoapods.dart';
/// For a given build, determines whether dependencies have changed since the /// For a given build, determines whether dependencies have changed since the
/// last call to processPods, then calls processPods with that information. /// last call to processPods, then calls processPods with that information.
Future<void> processPodsIfNeeded(XcodeBasedProject xcodeProject, Future<void> processPodsIfNeeded(XcodeBasedProject xcodeProject, String buildDirectory, BuildMode buildMode) async {
String buildDirectory, BuildMode buildMode) async {
final FlutterProject project = xcodeProject.parent; final FlutterProject project = xcodeProject.parent;
// Ensure that the plugin list is up to date, since hasPlugins relies on it. // Ensure that the plugin list is up to date, since hasPlugins relies on it.
refreshPluginsList(project); refreshPluginsList(project);
......
...@@ -157,8 +157,13 @@ class MDnsObservatoryDiscoveryResult { ...@@ -157,8 +157,13 @@ class MDnsObservatoryDiscoveryResult {
final String authCode; final String authCode;
} }
Future<Uri> buildObservatoryUri(Device device, Future<Uri> buildObservatoryUri(
String host, int devicePort, [int observatoryPort, String authCode]) async { Device device,
String host,
int devicePort, [
int observatoryPort,
String authCode,
]) async {
String path = '/'; String path = '/';
if (authCode != null) { if (authCode != null) {
path = authCode; path = authCode;
......
...@@ -484,8 +484,12 @@ abstract class FlutterCommand extends Command<void> { ...@@ -484,8 +484,12 @@ abstract class FlutterCommand extends Command<void> {
/// ///
/// For example, the command path (e.g. `build/apk`) and the result, /// For example, the command path (e.g. `build/apk`) and the result,
/// as well as the time spent running it. /// as well as the time spent running it.
void _sendPostUsage(String commandPath, FlutterCommandResult commandResult, void _sendPostUsage(
DateTime startTime, DateTime endTime) { String commandPath,
FlutterCommandResult commandResult,
DateTime startTime,
DateTime endTime,
) {
if (commandPath == null) { if (commandPath == null) {
return; return;
} }
......
...@@ -205,8 +205,12 @@ class FlutterWebPlatform extends PlatformPlugin { ...@@ -205,8 +205,12 @@ class FlutterWebPlatform extends PlatformPlugin {
} }
@override @override
Future<RunnerSuite> load(String path, SuitePlatform platform, Future<RunnerSuite> load(
SuiteConfiguration suiteConfig, Object message) async { String path,
SuitePlatform platform,
SuiteConfiguration suiteConfig,
Object message,
) async {
if (_closed) { if (_closed) {
return null; return null;
} }
...@@ -509,8 +513,11 @@ class BrowserManager { ...@@ -509,8 +513,11 @@ class BrowserManager {
/// Returns the browser manager, or throws an [ApplicationException] if a /// Returns the browser manager, or throws an [ApplicationException] if a
/// connection fails to be established. /// connection fails to be established.
static Future<BrowserManager> start( static Future<BrowserManager> start(
Runtime runtime, Uri url, Future<WebSocketChannel> future, Runtime runtime,
{bool debug = false}) async { Uri url,
Future<WebSocketChannel> future, {
bool debug = false,
}) async {
final Chrome chrome = final Chrome chrome =
await chromeLauncher.launch(url.toString(), headless: true); await chromeLauncher.launch(url.toString(), headless: true);
...@@ -671,8 +678,12 @@ class BrowserManager { ...@@ -671,8 +678,12 @@ class BrowserManager {
/// ///
/// All methods forward directly to [BrowserManager]. /// All methods forward directly to [BrowserManager].
class _BrowserEnvironment implements Environment { class _BrowserEnvironment implements Environment {
_BrowserEnvironment(this._manager, this.observatoryUrl, _BrowserEnvironment(
this.remoteDebuggerUrl, this.onRestart); this._manager,
this.observatoryUrl,
this.remoteDebuggerUrl,
this.onRestart,
);
final BrowserManager _manager; final BrowserManager _manager;
......
...@@ -180,8 +180,7 @@ class MockFuchsiaPM extends Mock implements FuchsiaPM { ...@@ -180,8 +180,7 @@ class MockFuchsiaPM extends Mock implements FuchsiaPM {
} }
@override @override
Future<bool> build( Future<bool> build(String buildPath, String keyPath, String manifestPath) async {
String buildPath, String keyPath, String manifestPath) async {
if (!fs.file(fs.path.join(buildPath, 'meta', 'package')).existsSync() || if (!fs.file(fs.path.join(buildPath, 'meta', 'package')).existsSync() ||
!fs.file(keyPath).existsSync() || !fs.file(keyPath).existsSync() ||
!fs.file(manifestPath).existsSync()) { !fs.file(manifestPath).existsSync()) {
...@@ -192,8 +191,7 @@ class MockFuchsiaPM extends Mock implements FuchsiaPM { ...@@ -192,8 +191,7 @@ class MockFuchsiaPM extends Mock implements FuchsiaPM {
} }
@override @override
Future<bool> archive( Future<bool> archive(String buildPath, String keyPath, String manifestPath) async {
String buildPath, String keyPath, String manifestPath) async {
if (!fs.file(fs.path.join(buildPath, 'meta', 'package')).existsSync() || if (!fs.file(fs.path.join(buildPath, 'meta', 'package')).existsSync() ||
!fs.file(keyPath).existsSync() || !fs.file(keyPath).existsSync() ||
!fs.file(manifestPath).existsSync()) { !fs.file(manifestPath).existsSync()) {
......
...@@ -128,12 +128,12 @@ void main() { ...@@ -128,12 +128,12 @@ void main() {
} }
Future<void> _testFile( Future<void> _testFile(
String testName, String testName,
String workingDirectory, String workingDirectory,
String testDirectory, { String testDirectory, {
Matcher exitCode, Matcher exitCode,
List<String> extraArguments = const <String>[], List<String> extraArguments = const <String>[],
}) async { }) async {
exitCode ??= isNonZero; exitCode ??= isNonZero;
final String fullTestExpectation = fs.path.join(testDirectory, '${testName}_expectation.txt'); final String fullTestExpectation = fs.path.join(testDirectory, '${testName}_expectation.txt');
final File expectationFile = fs.file(fullTestExpectation); final File expectationFile = fs.file(fullTestExpectation);
......
...@@ -50,12 +50,12 @@ void main() { ...@@ -50,12 +50,12 @@ void main() {
caughtByHandler = false; caughtByHandler = false;
zone = Zone.current.fork(specification: ZoneSpecification( zone = Zone.current.fork(specification: ZoneSpecification(
handleUncaughtError: ( handleUncaughtError: (
Zone self, Zone self,
ZoneDelegate parent, ZoneDelegate parent,
Zone zone, Zone zone,
Object error, Object error,
StackTrace stackTrace, StackTrace stackTrace,
) { ) {
caughtByZone = true; caughtByZone = true;
if (!caughtInZone.isCompleted) { if (!caughtInZone.isCompleted) {
caughtInZone.complete(); caughtInZone.complete();
......
...@@ -336,8 +336,7 @@ void main() { ...@@ -336,8 +336,7 @@ void main() {
}); });
group(FuchsiaIsolateDiscoveryProtocol, () { group(FuchsiaIsolateDiscoveryProtocol, () {
Future<Uri> findUri( Future<Uri> findUri(List<MockFlutterView> views, String expectedIsolateName) {
List<MockFlutterView> views, String expectedIsolateName) {
final MockPortForwarder portForwarder = MockPortForwarder(); final MockPortForwarder portForwarder = MockPortForwarder();
final MockVMService vmService = MockVMService(); final MockVMService vmService = MockVMService();
final MockVM vm = MockVM(); final MockVM vm = MockVM();
...@@ -641,11 +640,11 @@ class MockFile extends Mock implements File {} ...@@ -641,11 +640,11 @@ class MockFile extends Mock implements File {}
class MockProcess extends Mock implements Process {} class MockProcess extends Mock implements Process {}
Process _createMockProcess({ Process _createMockProcess({
int exitCode = 0, int exitCode = 0,
String stdout = '', String stdout = '',
String stderr = '', String stderr = '',
bool persistent = false, bool persistent = false,
}) { }) {
final Stream<List<int>> stdoutStream = Stream<List<int>>.fromIterable(<List<int>>[ final Stream<List<int>> stdoutStream = Stream<List<int>>.fromIterable(<List<int>>[
utf8.encode(stdout), utf8.encode(stdout),
]); ]);
...@@ -717,9 +716,9 @@ class FuchsiaDeviceWithFakeDiscovery extends FuchsiaDevice { ...@@ -717,9 +716,9 @@ class FuchsiaDeviceWithFakeDiscovery extends FuchsiaDevice {
FuchsiaDeviceWithFakeDiscovery(String id, {String name}) : super(id, name: name); FuchsiaDeviceWithFakeDiscovery(String id, {String name}) : super(id, name: name);
@override @override
FuchsiaIsolateDiscoveryProtocol getIsolateDiscoveryProtocol( FuchsiaIsolateDiscoveryProtocol getIsolateDiscoveryProtocol(String isolateName) {
String isolateName) => return FakeFuchsiaIsolateDiscoveryProtocol();
FakeFuchsiaIsolateDiscoveryProtocol(); }
} }
class FakeFuchsiaIsolateDiscoveryProtocol implements FuchsiaIsolateDiscoveryProtocol { class FakeFuchsiaIsolateDiscoveryProtocol implements FuchsiaIsolateDiscoveryProtocol {
...@@ -752,8 +751,7 @@ class FakeFuchsiaAmberCtl implements FuchsiaAmberCtl { ...@@ -752,8 +751,7 @@ class FakeFuchsiaAmberCtl implements FuchsiaAmberCtl {
} }
@override @override
Future<bool> pkgCtlResolve(FuchsiaDevice device, FuchsiaPackageServer server, Future<bool> pkgCtlResolve(FuchsiaDevice device, FuchsiaPackageServer server, String packageName) async {
String packageName) async {
return true; return true;
} }
...@@ -785,8 +783,7 @@ class FailingAmberCtl implements FuchsiaAmberCtl { ...@@ -785,8 +783,7 @@ class FailingAmberCtl implements FuchsiaAmberCtl {
} }
@override @override
Future<bool> pkgCtlResolve(FuchsiaDevice device, FuchsiaPackageServer server, Future<bool> pkgCtlResolve(FuchsiaDevice device, FuchsiaPackageServer server, String packageName) async {
String packageName) async {
return false; return false;
} }
...@@ -910,8 +907,7 @@ class FakeFuchsiaPM implements FuchsiaPM { ...@@ -910,8 +907,7 @@ class FakeFuchsiaPM implements FuchsiaPM {
} }
@override @override
Future<bool> build( Future<bool> build(String buildPath, String keyPath, String manifestPath) async {
String buildPath, String keyPath, String manifestPath) async {
if (!fs.file(fs.path.join(buildPath, 'meta', 'package')).existsSync() || if (!fs.file(fs.path.join(buildPath, 'meta', 'package')).existsSync() ||
!fs.file(keyPath).existsSync() || !fs.file(keyPath).existsSync() ||
!fs.file(manifestPath).existsSync()) { !fs.file(manifestPath).existsSync()) {
...@@ -922,8 +918,7 @@ class FakeFuchsiaPM implements FuchsiaPM { ...@@ -922,8 +918,7 @@ class FakeFuchsiaPM implements FuchsiaPM {
} }
@override @override
Future<bool> archive( Future<bool> archive(String buildPath, String keyPath, String manifestPath) async {
String buildPath, String keyPath, String manifestPath) async {
if (!fs.file(fs.path.join(buildPath, 'meta', 'package')).existsSync() || if (!fs.file(fs.path.join(buildPath, 'meta', 'package')).existsSync() ||
!fs.file(keyPath).existsSync() || !fs.file(keyPath).existsSync() ||
!fs.file(manifestPath).existsSync()) { !fs.file(manifestPath).existsSync()) {
...@@ -975,14 +970,12 @@ class FailingPM implements FuchsiaPM { ...@@ -975,14 +970,12 @@ class FailingPM implements FuchsiaPM {
} }
@override @override
Future<bool> build( Future<bool> build(String buildPath, String keyPath, String manifestPath) async {
String buildPath, String keyPath, String manifestPath) async {
return false; return false;
} }
@override @override
Future<bool> archive( Future<bool> archive(String buildPath, String keyPath, String manifestPath) async {
String buildPath, String keyPath, String manifestPath) async {
return false; return false;
} }
......
...@@ -88,13 +88,14 @@ void main() { ...@@ -88,13 +88,14 @@ void main() {
class MockProcessManager extends Mock implements ProcessManager {} class MockProcessManager extends Mock implements ProcessManager {}
class MockPlatform extends Mock implements Platform { class MockPlatform extends Mock implements Platform {
MockPlatform( MockPlatform({
{this.windows = false, this.windows = false,
this.macos = false, this.macos = false,
this.linux = false, this.linux = false,
this.environment = const <String, String>{ this.environment = const <String, String>{
kChromeEnvironment: 'chrome', kChromeEnvironment: 'chrome',
}}); },
});
final bool windows; final bool windows;
final bool macos; final bool macos;
......
...@@ -67,10 +67,11 @@ void main() { ...@@ -67,10 +67,11 @@ void main() {
// Sets up the mock environment so that searching for Visual Studio with // Sets up the mock environment so that searching for Visual Studio with
// exactly the given required components will provide a result. By default it // exactly the given required components will provide a result. By default it
// return a preset installation, but the response can be overridden. // return a preset installation, but the response can be overridden.
void setMockVswhereResponse( void setMockVswhereResponse([
[List<String> requiredComponents, List<String> requiredComponents,
List<String> additionalArguments, List<String> additionalArguments,
Map<String, dynamic> response]) { Map<String, dynamic> response,
]) {
fs.file(vswherePath).createSync(recursive: true); fs.file(vswherePath).createSync(recursive: true);
fs.file(vcvarsPath).createSync(recursive: true); fs.file(vcvarsPath).createSync(recursive: true);
......
...@@ -192,12 +192,12 @@ class MockProcessManager extends Mock implements ProcessManager { ...@@ -192,12 +192,12 @@ class MockProcessManager extends Mock implements ProcessManager {
/// a given number of times before succeeding. The returned processes will /// a given number of times before succeeding. The returned processes will
/// fail after a delay if one is supplied. /// fail after a delay if one is supplied.
ProcessFactory flakyProcessFactory({ ProcessFactory flakyProcessFactory({
int flakes, int flakes,
bool Function(List<String> command) filter, bool Function(List<String> command) filter,
Duration delay, Duration delay,
Stream<List<int>> Function() stdout, Stream<List<int>> Function() stdout,
Stream<List<int>> Function() stderr, Stream<List<int>> Function() stderr,
}) { }) {
int flakesLeft = flakes; int flakesLeft = flakes;
stdout ??= () => const Stream<List<int>>.empty(); stdout ??= () => const Stream<List<int>>.empty();
stderr ??= () => const Stream<List<int>>.empty(); stderr ??= () => const Stream<List<int>>.empty();
......
...@@ -188,25 +188,19 @@ class FakeHttpClient implements HttpClient { ...@@ -188,25 +188,19 @@ class FakeHttpClient implements HttpClient {
String userAgent; String userAgent;
@override @override
void addCredentials( void addCredentials(Uri url, String realm, HttpClientCredentials credentials) {}
Uri url, String realm, HttpClientCredentials credentials) {}
@override @override
void addProxyCredentials( void addProxyCredentials(String host, int port, String realm, HttpClientCredentials credentials) {}
String host, int port, String realm, HttpClientCredentials credentials) {}
@override @override
set authenticate( set authenticate(Future<bool> Function(Uri url, String scheme, String realm) f) {}
Future<bool> Function(Uri url, String scheme, String realm) f) {}
@override @override
set authenticateProxy( set authenticateProxy(Future<bool> Function(String host, int port, String scheme, String realm) f) {}
Future<bool> Function(String host, int port, String scheme, String realm)
f) {}
@override @override
set badCertificateCallback( set badCertificateCallback(bool Function(X509Certificate cert, String host, int port) callback) {}
bool Function(X509Certificate cert, String host, int port) callback) {}
@override @override
void close({bool force = false}) {} void close({bool force = false}) {}
......
...@@ -68,8 +68,12 @@ class VMPlatform extends PlatformPlugin { ...@@ -68,8 +68,12 @@ class VMPlatform extends PlatformPlugin {
throw UnimplementedError(); throw UnimplementedError();
@override @override
Future<RunnerSuite> load(String codePath, SuitePlatform platform, Future<RunnerSuite> load(
SuiteConfiguration suiteConfig, Object message) async { String codePath,
SuitePlatform platform,
SuiteConfiguration suiteConfig,
Object message,
) async {
final ReceivePort receivePort = ReceivePort(); final ReceivePort receivePort = ReceivePort();
Isolate isolate; Isolate isolate;
try { try {
......
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