parent
e2a55fe83f
commit
758009ba70
@ -531,10 +531,12 @@ linter:
|
||||
File _writeSection(Section section) {
|
||||
final String sectionId = _createNameFromSource('sample', section.start.filename, section.start.line);
|
||||
final File outputFile = File(path.join(_tempDirectory.path, '$sectionId.dart'))..createSync(recursive: true);
|
||||
final List<Line> mainContents = headers.toList();
|
||||
mainContents.add(const Line(''));
|
||||
mainContents.add(Line('// From: ${section.start.filename}:${section.start.line}'));
|
||||
mainContents.addAll(section.code);
|
||||
final List<Line> mainContents = <Line>[
|
||||
...headers,
|
||||
const Line(''),
|
||||
Line('// From: ${section.start.filename}:${section.start.line}'),
|
||||
...section.code,
|
||||
];
|
||||
outputFile.writeAsStringSync(mainContents.map<String>((Line line) => line.code).join('\n'));
|
||||
return outputFile;
|
||||
}
|
||||
@ -820,10 +822,9 @@ class Line {
|
||||
class Section {
|
||||
const Section(this.code);
|
||||
factory Section.combine(List<Section> sections) {
|
||||
final List<Line> code = <Line>[];
|
||||
for (Section section in sections) {
|
||||
code.addAll(section.code);
|
||||
}
|
||||
final List<Line> code = sections
|
||||
.expand((Section section) => section.code)
|
||||
.toList();
|
||||
return Section(code);
|
||||
}
|
||||
factory Section.fromStrings(Line firstLine, List<String> code) {
|
||||
|
@ -40,9 +40,10 @@ Future<void> main(List<String> args) async {
|
||||
|
||||
{
|
||||
// Analyze all the Dart code in the repo.
|
||||
final List<String> options = <String>['--flutter-repo'];
|
||||
options.addAll(args);
|
||||
await _runFlutterAnalyze(flutterRoot, options: options);
|
||||
await _runFlutterAnalyze(flutterRoot, options: <String>[
|
||||
'--flutter-repo',
|
||||
...args,
|
||||
]);
|
||||
}
|
||||
|
||||
// Ensure that all package dependencies are in sync.
|
||||
@ -59,9 +60,12 @@ Future<void> main(List<String> args) async {
|
||||
// Try with the --watch analyzer, to make sure it returns success also.
|
||||
// The --benchmark argument exits after one run.
|
||||
{
|
||||
final List<String> options = <String>['--flutter-repo', '--watch', '--benchmark'];
|
||||
options.addAll(args);
|
||||
await _runFlutterAnalyze(flutterRoot, options: options);
|
||||
await _runFlutterAnalyze(flutterRoot, options: <String>[
|
||||
'--flutter-repo',
|
||||
'--watch',
|
||||
'--benchmark',
|
||||
...args,
|
||||
]);
|
||||
}
|
||||
|
||||
await _checkForTrailingSpaces();
|
||||
@ -79,9 +83,11 @@ Future<void> main(List<String> args) async {
|
||||
workingDirectory: flutterRoot,
|
||||
);
|
||||
{
|
||||
final List<String> options = <String>['--watch', '--benchmark'];
|
||||
options.addAll(args);
|
||||
await _runFlutterAnalyze(outDir.path, options: options);
|
||||
await _runFlutterAnalyze(outDir.path, options: <String>[
|
||||
'--watch',
|
||||
'--benchmark',
|
||||
...args,
|
||||
]);
|
||||
}
|
||||
} finally {
|
||||
outDir.deleteSync(recursive: true);
|
||||
|
@ -601,14 +601,14 @@ class ArchivePublisher {
|
||||
if (dest.endsWith('.json')) {
|
||||
mimeType = 'application/json';
|
||||
}
|
||||
final List<String> args = <String>[];
|
||||
// Use our preferred MIME type for the files we care about
|
||||
// and let gsutil figure it out for anything else.
|
||||
if (mimeType != null) {
|
||||
args.addAll(<String>['-h', 'Content-Type:$mimeType']);
|
||||
}
|
||||
args.addAll(<String>['cp', src, dest]);
|
||||
return await _runGsUtil(args);
|
||||
return await _runGsUtil(<String>[
|
||||
// Use our preferred MIME type for the files we care about
|
||||
// and let gsutil figure it out for anything else.
|
||||
if (mimeType != null) ...<String>['-h', 'Content-Type:$mimeType'],
|
||||
'cp',
|
||||
src,
|
||||
dest,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -754,11 +754,13 @@ Future<void> _runFlutterWebTest(String workingDirectory, {
|
||||
Duration timeout = _kLongTimeout,
|
||||
List<String> tests,
|
||||
}) async {
|
||||
final List<String> args = <String>['test', '-v', '--platform=chrome'];
|
||||
if (flutterTestArgs != null && flutterTestArgs.isNotEmpty)
|
||||
args.addAll(flutterTestArgs);
|
||||
|
||||
args.addAll(tests);
|
||||
final List<String> args = <String>[
|
||||
'test',
|
||||
'-v',
|
||||
'--platform=chrome',
|
||||
...?flutterTestArgs,
|
||||
...tests,
|
||||
];
|
||||
|
||||
// TODO(jonahwilliams): fix relative path issues to make this unecessary.
|
||||
final Directory oldCurrent = Directory.current;
|
||||
@ -791,9 +793,11 @@ Future<void> _runFlutterTest(String workingDirectory, {
|
||||
Map<String, String> environment,
|
||||
List<String> tests = const <String>[],
|
||||
}) async {
|
||||
final List<String> args = <String>['test', ...options];
|
||||
if (flutterTestArgs != null && flutterTestArgs.isNotEmpty)
|
||||
args.addAll(flutterTestArgs);
|
||||
final List<String> args = <String>[
|
||||
'test',
|
||||
...options,
|
||||
...?flutterTestArgs,
|
||||
];
|
||||
|
||||
final bool shouldProcessOutput = useFlutterTestFormatter && !expectFailure && !options.contains('--coverage');
|
||||
if (shouldProcessOutput) {
|
||||
|
@ -106,16 +106,14 @@ void main() {
|
||||
|
||||
test('sets PUB_CACHE properly', () async {
|
||||
final String createBase = path.join(tempDir.absolute.path, 'create_');
|
||||
final Map<String, List<ProcessResult>> calls = <String, List<ProcessResult>>{
|
||||
final String archiveName = path.join(tempDir.absolute.path,
|
||||
'flutter_${platformName}_v1.2.3-dev${platform.isLinux ? '.tar.xz' : '.zip'}');
|
||||
processManager.fakeResults = <String, List<ProcessResult>>{
|
||||
'git clone -b dev https://chromium.googlesource.com/external/github.com/flutter/flutter': null,
|
||||
'git reset --hard $testRef': null,
|
||||
'git remote set-url origin https://github.com/flutter/flutter.git': null,
|
||||
'git describe --tags --exact-match $testRef': <ProcessResult>[ProcessResult(0, 0, 'v1.2.3', '')],
|
||||
};
|
||||
if (platform.isWindows) {
|
||||
calls['7za x ${path.join(tempDir.path, 'mingit.zip')}'] = null;
|
||||
}
|
||||
calls.addAll(<String, List<ProcessResult>>{
|
||||
if (platform.isWindows) '7za x ${path.join(tempDir.path, 'mingit.zip')}': null,
|
||||
'$flutter doctor': null,
|
||||
'$flutter update-packages': null,
|
||||
'$flutter precache': null,
|
||||
@ -124,17 +122,10 @@ void main() {
|
||||
'$flutter create --template=package ${createBase}package': null,
|
||||
'$flutter create --template=plugin ${createBase}plugin': null,
|
||||
'git clean -f -X **/.packages': null,
|
||||
});
|
||||
final String archiveName = path.join(tempDir.absolute.path,
|
||||
'flutter_${platformName}_v1.2.3-dev${platform.isLinux ? '.tar.xz' : '.zip'}');
|
||||
if (platform.isWindows) {
|
||||
calls['7za a -tzip -mx=9 $archiveName flutter'] = null;
|
||||
} else if (platform.isMacOS) {
|
||||
calls['zip -r -9 $archiveName flutter'] = null;
|
||||
} else if (platform.isLinux) {
|
||||
calls['tar cJf $archiveName flutter'] = null;
|
||||
}
|
||||
processManager.fakeResults = calls;
|
||||
if (platform.isWindows) '7za a -tzip -mx=9 $archiveName flutter': null
|
||||
else if (platform.isMacOS) 'zip -r -9 $archiveName flutter': null
|
||||
else if (platform.isLinux) 'tar cJf $archiveName flutter': null,
|
||||
};
|
||||
await creator.initializeRepo();
|
||||
await creator.createArchive();
|
||||
expect(
|
||||
@ -149,16 +140,14 @@ void main() {
|
||||
|
||||
test('calls the right commands for archive output', () async {
|
||||
final String createBase = path.join(tempDir.absolute.path, 'create_');
|
||||
final String archiveName = path.join(tempDir.absolute.path,
|
||||
'flutter_${platformName}_v1.2.3-dev${platform.isLinux ? '.tar.xz' : '.zip'}');
|
||||
final Map<String, List<ProcessResult>> calls = <String, List<ProcessResult>>{
|
||||
'git clone -b dev https://chromium.googlesource.com/external/github.com/flutter/flutter': null,
|
||||
'git reset --hard $testRef': null,
|
||||
'git remote set-url origin https://github.com/flutter/flutter.git': null,
|
||||
'git describe --tags --exact-match $testRef': <ProcessResult>[ProcessResult(0, 0, 'v1.2.3', '')],
|
||||
};
|
||||
if (platform.isWindows) {
|
||||
calls['7za x ${path.join(tempDir.path, 'mingit.zip')}'] = null;
|
||||
}
|
||||
calls.addAll(<String, List<ProcessResult>>{
|
||||
if (platform.isWindows) '7za x ${path.join(tempDir.path, 'mingit.zip')}': null,
|
||||
'$flutter doctor': null,
|
||||
'$flutter update-packages': null,
|
||||
'$flutter precache': null,
|
||||
@ -167,16 +156,10 @@ void main() {
|
||||
'$flutter create --template=package ${createBase}package': null,
|
||||
'$flutter create --template=plugin ${createBase}plugin': null,
|
||||
'git clean -f -X **/.packages': null,
|
||||
});
|
||||
final String archiveName = path.join(tempDir.absolute.path,
|
||||
'flutter_${platformName}_v1.2.3-dev${platform.isLinux ? '.tar.xz' : '.zip'}');
|
||||
if (platform.isWindows) {
|
||||
calls['7za a -tzip -mx=9 $archiveName flutter'] = null;
|
||||
} else if (platform.isMacOS) {
|
||||
calls['zip -r -9 $archiveName flutter'] = null;
|
||||
} else if (platform.isLinux) {
|
||||
calls['tar cJf $archiveName flutter'] = null;
|
||||
}
|
||||
if (platform.isWindows) '7za a -tzip -mx=9 $archiveName flutter': null
|
||||
else if (platform.isMacOS) 'zip -r -9 $archiveName flutter': null
|
||||
else if (platform.isLinux) 'tar cJf $archiveName flutter': null,
|
||||
};
|
||||
processManager.fakeResults = calls;
|
||||
creator = ArchiveCreator(
|
||||
tempDir,
|
||||
@ -206,16 +189,14 @@ void main() {
|
||||
|
||||
test('non-strict mode calls the right commands', () async {
|
||||
final String createBase = path.join(tempDir.absolute.path, 'create_');
|
||||
final String archiveName = path.join(tempDir.absolute.path,
|
||||
'flutter_${platformName}_v1.2.3-dev${platform.isLinux ? '.tar.xz' : '.zip'}');
|
||||
final Map<String, List<ProcessResult>> calls = <String, List<ProcessResult>>{
|
||||
'git clone -b dev https://chromium.googlesource.com/external/github.com/flutter/flutter': null,
|
||||
'git reset --hard $testRef': null,
|
||||
'git remote set-url origin https://github.com/flutter/flutter.git': null,
|
||||
'git describe --tags --abbrev=0 $testRef': <ProcessResult>[ProcessResult(0, 0, 'v1.2.3', '')],
|
||||
};
|
||||
if (platform.isWindows) {
|
||||
calls['7za x ${path.join(tempDir.path, 'mingit.zip')}'] = null;
|
||||
}
|
||||
calls.addAll(<String, List<ProcessResult>>{
|
||||
if (platform.isWindows) '7za x ${path.join(tempDir.path, 'mingit.zip')}': null,
|
||||
'$flutter doctor': null,
|
||||
'$flutter update-packages': null,
|
||||
'$flutter precache': null,
|
||||
@ -224,16 +205,10 @@ void main() {
|
||||
'$flutter create --template=package ${createBase}package': null,
|
||||
'$flutter create --template=plugin ${createBase}plugin': null,
|
||||
'git clean -f -X **/.packages': null,
|
||||
});
|
||||
final String archiveName = path.join(tempDir.absolute.path,
|
||||
'flutter_${platformName}_v1.2.3-dev${platform.isLinux ? '.tar.xz' : '.zip'}');
|
||||
if (platform.isWindows) {
|
||||
calls['7za a -tzip -mx=9 $archiveName flutter'] = null;
|
||||
} else if (platform.isMacOS) {
|
||||
calls['zip -r -9 $archiveName flutter'] = null;
|
||||
} else if (platform.isLinux) {
|
||||
calls['tar cJf $archiveName flutter'] = null;
|
||||
}
|
||||
if (platform.isWindows) '7za a -tzip -mx=9 $archiveName flutter': null
|
||||
else if (platform.isMacOS) 'zip -r -9 $archiveName flutter': null
|
||||
else if (platform.isLinux) 'tar cJf $archiveName flutter': null,
|
||||
};
|
||||
processManager.fakeResults = calls;
|
||||
creator = ArchiveCreator(
|
||||
tempDir,
|
||||
|
@ -377,13 +377,12 @@ class ArchiveUnpublisher {
|
||||
if (dest.endsWith('.json')) {
|
||||
mimeType = 'application/json';
|
||||
}
|
||||
final List<String> args = <String>[];
|
||||
// Use our preferred MIME type for the files we care about
|
||||
// and let gsutil figure it out for anything else.
|
||||
if (mimeType != null) {
|
||||
args.addAll(<String>['-h', 'Content-Type:$mimeType']);
|
||||
}
|
||||
args.addAll(<String>['cp', src, dest]);
|
||||
final List<String> args = <String>[
|
||||
// Use our preferred MIME type for the files we care about
|
||||
// and let gsutil figure it out for anything else.
|
||||
if (mimeType != null) ...<String>['-h', 'Content-Type:$mimeType'],
|
||||
...<String>['cp', src, dest],
|
||||
];
|
||||
return await _runGsUtil(args, confirm: confirmed);
|
||||
}
|
||||
}
|
||||
|
@ -252,10 +252,10 @@ Future<ProcessResult> _resultOfGradleTask({String workingDirectory, String task,
|
||||
|
||||
print('\nUsing JAVA_HOME=$javaHome');
|
||||
|
||||
final List<String> args = <String>['app:$task'];
|
||||
if (options != null) {
|
||||
args.addAll(options);
|
||||
}
|
||||
final List<String> args = <String>[
|
||||
'app:$task',
|
||||
...?options,
|
||||
];
|
||||
final String gradle = Platform.isWindows ? 'gradlew.bat' : './gradlew';
|
||||
print('Running Gradle: ${path.join(workingDirectory, gradle)} ${args.join(' ')}');
|
||||
print(File(path.join(workingDirectory, gradle)).readAsStringSync());
|
||||
|
@ -28,11 +28,12 @@ Future<TaskResult> analyzerBenchmarkTask() async {
|
||||
await dart(<String>['dev/tools/mega_gallery.dart', '--out=${_megaGalleryDirectory.path}']);
|
||||
});
|
||||
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data.addAll((await _run(_FlutterRepoBenchmark())).asMap('flutter_repo', 'batch'));
|
||||
data.addAll((await _run(_FlutterRepoBenchmark(watch: true))).asMap('flutter_repo', 'watch'));
|
||||
data.addAll((await _run(_MegaGalleryBenchmark())).asMap('mega_gallery', 'batch'));
|
||||
data.addAll((await _run(_MegaGalleryBenchmark(watch: true))).asMap('mega_gallery', 'watch'));
|
||||
final Map<String, dynamic> data = <String, dynamic>{
|
||||
...(await _run(_FlutterRepoBenchmark())).asMap('flutter_repo', 'batch'),
|
||||
...(await _run(_FlutterRepoBenchmark(watch: true))).asMap('flutter_repo', 'watch'),
|
||||
...(await _run(_MegaGalleryBenchmark())).asMap('mega_gallery', 'batch'),
|
||||
...(await _run(_MegaGalleryBenchmark(watch: true))).asMap('mega_gallery', 'watch'),
|
||||
};
|
||||
|
||||
return TaskResult.success(data, benchmarkScoreKeys: data.keys.toList());
|
||||
}
|
||||
|
@ -64,8 +64,8 @@ class GalleryTransitionTest {
|
||||
final Map<String, dynamic> data = <String, dynamic>{
|
||||
'transitions': transitions,
|
||||
'missed_transition_count': _countMissedTransitions(transitions),
|
||||
...summary,
|
||||
};
|
||||
data.addAll(summary);
|
||||
|
||||
return TaskResult.success(data, benchmarkScoreKeys: <String>[
|
||||
'missed_transition_count',
|
||||
|
@ -124,8 +124,8 @@ class DriverTest {
|
||||
testTarget,
|
||||
'-d',
|
||||
deviceId,
|
||||
...extraOptions,
|
||||
];
|
||||
options.addAll(extraOptions);
|
||||
await flutter('drive', options: options, environment: Map<String, String>.from(environment));
|
||||
|
||||
return TaskResult.success(null);
|
||||
|
@ -48,13 +48,14 @@ TaskFunction createMicrobenchmarkTask() {
|
||||
return _run();
|
||||
}
|
||||
|
||||
final Map<String, double> allResults = <String, double>{};
|
||||
allResults.addAll(await _runMicrobench('lib/stocks/layout_bench.dart'));
|
||||
allResults.addAll(await _runMicrobench('lib/stocks/build_bench.dart'));
|
||||
allResults.addAll(await _runMicrobench('lib/geometry/rrect_contains_bench.dart'));
|
||||
allResults.addAll(await _runMicrobench('lib/gestures/velocity_tracker_bench.dart'));
|
||||
allResults.addAll(await _runMicrobench('lib/gestures/gesture_detector_bench.dart'));
|
||||
allResults.addAll(await _runMicrobench('lib/stocks/animation_bench.dart'));
|
||||
final Map<String, double> allResults = <String, double>{
|
||||
...await _runMicrobench('lib/stocks/layout_bench.dart'),
|
||||
...await _runMicrobench('lib/stocks/build_bench.dart'),
|
||||
...await _runMicrobench('lib/geometry/rrect_contains_bench.dart'),
|
||||
...await _runMicrobench('lib/gestures/velocity_tracker_bench.dart'),
|
||||
...await _runMicrobench('lib/gestures/gesture_detector_bench.dart'),
|
||||
...await _runMicrobench('lib/stocks/animation_bench.dart'),
|
||||
};
|
||||
|
||||
return TaskResult.success(allResults, benchmarkScoreKeys: allResults.keys.toList());
|
||||
};
|
||||
|
@ -289,10 +289,11 @@ class CompileTest {
|
||||
await device.unlock();
|
||||
await flutter('packages', options: <String>['get']);
|
||||
|
||||
final Map<String, dynamic> metrics = <String, dynamic>{}
|
||||
..addAll(await _compileAot())
|
||||
..addAll(await _compileApp(reportPackageContentSizes: reportPackageContentSizes))
|
||||
..addAll(await _compileDebug());
|
||||
final Map<String, dynamic> metrics = <String, dynamic>{
|
||||
...await _compileAot(),
|
||||
...await _compileApp(reportPackageContentSizes: reportPackageContentSizes),
|
||||
...await _compileDebug(),
|
||||
};
|
||||
|
||||
return TaskResult.success(metrics, benchmarkScoreKeys: metrics.keys.toList());
|
||||
});
|
||||
@ -533,10 +534,11 @@ class MemoryTest {
|
||||
final ListStatistics endMemoryStatistics = ListStatistics(_endMemory);
|
||||
final ListStatistics diffMemoryStatistics = ListStatistics(_diffMemory);
|
||||
|
||||
final Map<String, dynamic> memoryUsage = <String, dynamic>{};
|
||||
memoryUsage.addAll(startMemoryStatistics.asMap('start'));
|
||||
memoryUsage.addAll(endMemoryStatistics.asMap('end'));
|
||||
memoryUsage.addAll(diffMemoryStatistics.asMap('diff'));
|
||||
final Map<String, dynamic> memoryUsage = <String, dynamic>{
|
||||
...startMemoryStatistics.asMap('start'),
|
||||
...endMemoryStatistics.asMap('end'),
|
||||
...diffMemoryStatistics.asMap('diff'),
|
||||
};
|
||||
|
||||
_device = null;
|
||||
_startMemory.clear();
|
||||
|
@ -15,14 +15,12 @@ void main() {
|
||||
|
||||
group('run.dart script', () {
|
||||
Future<ProcessResult> runScript(List<String> testNames) async {
|
||||
final List<String> options = <String>['bin/run.dart'];
|
||||
for (String testName in testNames) {
|
||||
options..addAll(<String>['-t', testName]);
|
||||
}
|
||||
final String dart = path.absolute(path.join('..', '..', 'bin', 'cache', 'dart-sdk', 'bin', 'dart'));
|
||||
final ProcessResult scriptProcess = processManager.runSync(
|
||||
<String>[dart, ...options]
|
||||
);
|
||||
final ProcessResult scriptProcess = processManager.runSync(<String>[
|
||||
dart,
|
||||
'bin/run.dart',
|
||||
for (String testName in testNames) ...<String>['-t', testName],
|
||||
]);
|
||||
return scriptProcess;
|
||||
}
|
||||
|
||||
|
@ -1401,8 +1401,7 @@ String zalgo(math.Random random, int targetLength, { bool includeSpacingCombinin
|
||||
}
|
||||
}
|
||||
base ??= String.fromCharCode(randomCharacter(random));
|
||||
final List<int> characters = <int>[];
|
||||
characters.addAll(these);
|
||||
final List<int> characters = these.toList();
|
||||
return base + String.fromCharCodes(characters);
|
||||
}
|
||||
|
||||
|
@ -127,15 +127,16 @@ class SnippetGenerator {
|
||||
'description': description,
|
||||
'code': htmlEscape.convert(result.join('\n')),
|
||||
'language': language ?? 'dart',
|
||||
}..addAll(type == SnippetType.application
|
||||
? <String, String>{
|
||||
'serial': metadata['serial'].toString() ?? '0',
|
||||
'id':
|
||||
injections.firstWhere((_ComponentTuple tuple) => tuple.name == 'id').mergedContent,
|
||||
'app':
|
||||
htmlEscape.convert(injections.firstWhere((_ComponentTuple tuple) => tuple.name == 'app').mergedContent),
|
||||
}
|
||||
: <String, String>{'serial': '', 'id': '', 'app': ''});
|
||||
'serial': '',
|
||||
'id': '',
|
||||
'app': '',
|
||||
};
|
||||
if (type == SnippetType.application) {
|
||||
substitutions
|
||||
..['serial'] = metadata['serial'].toString() ?? '0'
|
||||
..['id'] = injections.firstWhere((_ComponentTuple tuple) => tuple.name == 'id').mergedContent
|
||||
..['app'] = htmlEscape.convert(injections.firstWhere((_ComponentTuple tuple) => tuple.name == 'app').mergedContent);
|
||||
}
|
||||
return skeleton.replaceAllMapped(RegExp('{{(${substitutions.keys.join('|')})}}'), (Match match) {
|
||||
return substitutions[match[1]];
|
||||
});
|
||||
|
@ -99,26 +99,24 @@ class PaletteTabView extends StatelessWidget {
|
||||
final TextTheme textTheme = Theme.of(context).textTheme;
|
||||
final TextStyle whiteTextStyle = textTheme.body1.copyWith(color: Colors.white);
|
||||
final TextStyle blackTextStyle = textTheme.body1.copyWith(color: Colors.black);
|
||||
final List<Widget> colorItems = primaryKeys.map<Widget>((int index) {
|
||||
return DefaultTextStyle(
|
||||
style: index > colors.threshold ? whiteTextStyle : blackTextStyle,
|
||||
child: ColorItem(index: index, color: colors.primary[index]),
|
||||
);
|
||||
}).toList();
|
||||
|
||||
if (colors.accent != null) {
|
||||
colorItems.addAll(accentKeys.map<Widget>((int index) {
|
||||
return DefaultTextStyle(
|
||||
style: index > colors.threshold ? whiteTextStyle : blackTextStyle,
|
||||
child: ColorItem(index: index, color: colors.accent[index], prefix: 'A'),
|
||||
);
|
||||
}).toList());
|
||||
}
|
||||
|
||||
return Scrollbar(
|
||||
child: ListView(
|
||||
itemExtent: kColorItemHeight,
|
||||
children: colorItems,
|
||||
children: <Widget>[
|
||||
...primaryKeys.map<Widget>((int index) {
|
||||
return DefaultTextStyle(
|
||||
style: index > colors.threshold ? whiteTextStyle : blackTextStyle,
|
||||
child: ColorItem(index: index, color: colors.primary[index]),
|
||||
);
|
||||
}),
|
||||
if (colors.accent != null)
|
||||
...accentKeys.map<Widget>((int index) {
|
||||
return DefaultTextStyle(
|
||||
style: index > colors.threshold ? whiteTextStyle : blackTextStyle,
|
||||
child: ColorItem(index: index, color: colors.accent[index], prefix: 'A'),
|
||||
);
|
||||
}),
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -349,52 +349,42 @@ class _DemoBottomAppBar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final List<Widget> rowContents = <Widget> [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.menu, semanticLabel: 'Show bottom sheet'),
|
||||
onPressed: () {
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) => const _DemoDrawer(),
|
||||
);
|
||||
},
|
||||
),
|
||||
];
|
||||
|
||||
if (kCenterLocations.contains(fabLocation)) {
|
||||
rowContents.add(
|
||||
const Expanded(child: SizedBox()),
|
||||
);
|
||||
}
|
||||
|
||||
rowContents.addAll(<Widget> [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.search, semanticLabel: 'show search action',),
|
||||
onPressed: () {
|
||||
Scaffold.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('This is a dummy search action.')),
|
||||
);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Theme.of(context).platform == TargetPlatform.iOS
|
||||
? Icons.more_horiz
|
||||
: Icons.more_vert,
|
||||
semanticLabel: 'Show menu actions',
|
||||
),
|
||||
onPressed: () {
|
||||
Scaffold.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('This is a dummy menu action.')),
|
||||
);
|
||||
},
|
||||
),
|
||||
]);
|
||||
|
||||
return BottomAppBar(
|
||||
color: color,
|
||||
child: Row(children: rowContents),
|
||||
shape: shape,
|
||||
child: Row(children: <Widget>[
|
||||
IconButton(
|
||||
icon: const Icon(Icons.menu, semanticLabel: 'Show bottom sheet'),
|
||||
onPressed: () {
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) => const _DemoDrawer(),
|
||||
);
|
||||
},
|
||||
),
|
||||
if (kCenterLocations.contains(fabLocation)) const Expanded(child: SizedBox()),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.search, semanticLabel: 'show search action',),
|
||||
onPressed: () {
|
||||
Scaffold.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('This is a dummy search action.')),
|
||||
);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Theme.of(context).platform == TargetPlatform.iOS
|
||||
? Icons.more_horiz
|
||||
: Icons.more_vert,
|
||||
semanticLabel: 'Show menu actions',
|
||||
),
|
||||
onPressed: () {
|
||||
Scaffold.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('This is a dummy menu action.')),
|
||||
);
|
||||
},
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,8 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(title),
|
||||
actions: (actions ?? <Widget>[])..add(
|
||||
actions: <Widget>[
|
||||
...?actions,
|
||||
Builder(
|
||||
builder: (BuildContext context) {
|
||||
return IconButton(
|
||||
@ -106,17 +107,17 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
)..addAll(showExampleCodeAction ? <Widget>[
|
||||
Builder(
|
||||
builder: (BuildContext context) {
|
||||
return IconButton(
|
||||
icon: const Icon(Icons.code),
|
||||
tooltip: 'Show example code',
|
||||
onPressed: () => _showExampleCode(context),
|
||||
);
|
||||
},
|
||||
),
|
||||
] : <Widget>[]),
|
||||
if (showExampleCodeAction)
|
||||
Builder(
|
||||
builder: (BuildContext context) {
|
||||
return IconButton(
|
||||
icon: const Icon(Icons.code),
|
||||
tooltip: 'Show example code',
|
||||
onPressed: () => _showExampleCode(context),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
bottom: TabBar(
|
||||
isScrollable: isScrollable,
|
||||
tabs: demos.map<Widget>((ComponentDemoTabData data) => Tab(text: data.tabName)).toList(),
|
||||
|
@ -477,12 +477,10 @@ class FlutterError extends Error with DiagnosticableTreeMixin implements Asserti
|
||||
/// using [ErrorHint]s or other [DiagnosticsNode]s.
|
||||
factory FlutterError(String message) {
|
||||
final List<String> lines = message.split('\n');
|
||||
final List<DiagnosticsNode> parts = <DiagnosticsNode>[];
|
||||
parts.add(ErrorSummary(lines.first));
|
||||
if (lines.length > 1) {
|
||||
parts.addAll(lines.skip(1).map<DiagnosticsNode>((String line) => ErrorDescription(line)));
|
||||
}
|
||||
return FlutterError.fromParts(parts);
|
||||
return FlutterError.fromParts(<DiagnosticsNode>[
|
||||
ErrorSummary(lines.first),
|
||||
...lines.skip(1).map<DiagnosticsNode>((String line) => ErrorDescription(line)),
|
||||
]);
|
||||
}
|
||||
|
||||
/// Create an error message from a list of [DiagnosticsNode]s.
|
||||
|
@ -1541,61 +1541,46 @@ abstract class DiagnosticsNode {
|
||||
if (kReleaseMode) {
|
||||
return <String, Object>{};
|
||||
}
|
||||
final Map<String, Object> data = <String, Object>{
|
||||
final bool hasChildren = getChildren().isNotEmpty;
|
||||
return <String, Object>{
|
||||
'description': toDescription(),
|
||||
'type': runtimeType.toString(),
|
||||
if (name != null)
|
||||
'name': name,
|
||||
if (!showSeparator)
|
||||
'showSeparator': showSeparator,
|
||||
if (level != DiagnosticLevel.info)
|
||||
'level': describeEnum(level),
|
||||
if (showName == false)
|
||||
'showName': showName,
|
||||
if (emptyBodyDescription != null)
|
||||
'emptyBodyDescription': emptyBodyDescription,
|
||||
if (style != DiagnosticsTreeStyle.sparse)
|
||||
'style': describeEnum(style),
|
||||
if (allowTruncate)
|
||||
'allowTruncate': allowTruncate,
|
||||
if (hasChildren)
|
||||
'hasChildren': hasChildren,
|
||||
if (linePrefix?.isNotEmpty == true)
|
||||
'linePrefix': linePrefix,
|
||||
if (!allowWrap)
|
||||
'allowWrap': allowWrap,
|
||||
if (allowNameWrap)
|
||||
'allowNameWrap': allowNameWrap,
|
||||
...delegate.additionalNodeProperties(this),
|
||||
if (delegate.includeProperties)
|
||||
'properties': toJsonList(
|
||||
delegate.filterProperties(getProperties(), this),
|
||||
this,
|
||||
delegate,
|
||||
),
|
||||
if (delegate.subtreeDepth > 0)
|
||||
'children': toJsonList(
|
||||
delegate.filterChildren(getChildren(), this),
|
||||
this,
|
||||
delegate,
|
||||
),
|
||||
};
|
||||
if (name != null)
|
||||
data['name'] = name;
|
||||
|
||||
if (!showSeparator)
|
||||
data['showSeparator'] = showSeparator;
|
||||
if (level != DiagnosticLevel.info)
|
||||
data['level'] = describeEnum(level);
|
||||
if (showName == false)
|
||||
data['showName'] = showName;
|
||||
if (emptyBodyDescription != null)
|
||||
data['emptyBodyDescription'] = emptyBodyDescription;
|
||||
if (style != DiagnosticsTreeStyle.sparse)
|
||||
data['style'] = describeEnum(style);
|
||||
|
||||
if (allowTruncate)
|
||||
data['allowTruncate'] = allowTruncate;
|
||||
|
||||
final bool hasChildren = getChildren().isNotEmpty;
|
||||
if (hasChildren)
|
||||
data['hasChildren'] = hasChildren;
|
||||
|
||||
if (linePrefix?.isNotEmpty == true)
|
||||
data['linePrefix'] = linePrefix;
|
||||
|
||||
if (!allowWrap)
|
||||
data['allowWrap'] = allowWrap;
|
||||
|
||||
if (allowNameWrap)
|
||||
data['allowNameWrap'] = allowNameWrap;
|
||||
|
||||
data.addAll(delegate.additionalNodeProperties(this));
|
||||
|
||||
if (delegate.includeProperties) {
|
||||
final List<DiagnosticsNode> properties = getProperties();
|
||||
data['properties'] = toJsonList(
|
||||
delegate.filterProperties(properties, this),
|
||||
this,
|
||||
delegate,
|
||||
);
|
||||
}
|
||||
|
||||
if (delegate.subtreeDepth > 0) {
|
||||
final List<DiagnosticsNode> children = getChildren();
|
||||
data['children'] = toJsonList(
|
||||
delegate.filterChildren(children, this),
|
||||
this,
|
||||
delegate,
|
||||
);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// Serializes a [List] of [DiagnosticsNode]s to a JSON list according to
|
||||
|
@ -268,33 +268,32 @@ class AboutDialog extends StatelessWidget {
|
||||
final String name = applicationName ?? _defaultApplicationName(context);
|
||||
final String version = applicationVersion ?? _defaultApplicationVersion(context);
|
||||
final Widget icon = applicationIcon ?? _defaultApplicationIcon(context);
|
||||
List<Widget> body = <Widget>[];
|
||||
if (icon != null)
|
||||
body.add(IconTheme(data: const IconThemeData(size: 48.0), child: icon));
|
||||
body.add(Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||
child: ListBody(
|
||||
children: <Widget>[
|
||||
Text(name, style: Theme.of(context).textTheme.headline),
|
||||
Text(version, style: Theme.of(context).textTheme.body1),
|
||||
Container(height: 18.0),
|
||||
Text(applicationLegalese ?? '', style: Theme.of(context).textTheme.caption),
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
body = <Widget>[
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: body,
|
||||
),
|
||||
];
|
||||
if (children != null)
|
||||
body.addAll(children);
|
||||
return AlertDialog(
|
||||
content: SingleChildScrollView(
|
||||
child: ListBody(children: body),
|
||||
child: ListBody(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
if (icon != null) IconTheme(data: const IconThemeData(size: 48.0), child: icon),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||
child: ListBody(
|
||||
children: <Widget>[
|
||||
Text(name, style: Theme.of(context).textTheme.headline),
|
||||
Text(version, style: Theme.of(context).textTheme.body1),
|
||||
Container(height: 18.0),
|
||||
Text(applicationLegalese ?? '', style: Theme.of(context).textTheme.caption),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
...?children,
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
@ -457,24 +456,6 @@ class _LicensePageState extends State<LicensePage> {
|
||||
final String name = widget.applicationName ?? _defaultApplicationName(context);
|
||||
final String version = widget.applicationVersion ?? _defaultApplicationVersion(context);
|
||||
final MaterialLocalizations localizations = MaterialLocalizations.of(context);
|
||||
final List<Widget> contents = <Widget>[
|
||||
Text(name, style: Theme.of(context).textTheme.headline, textAlign: TextAlign.center),
|
||||
Text(version, style: Theme.of(context).textTheme.body1, textAlign: TextAlign.center),
|
||||
Container(height: 18.0),
|
||||
Text(widget.applicationLegalese ?? '', style: Theme.of(context).textTheme.caption, textAlign: TextAlign.center),
|
||||
Container(height: 18.0),
|
||||
Text('Powered by Flutter', style: Theme.of(context).textTheme.body1, textAlign: TextAlign.center),
|
||||
Container(height: 24.0),
|
||||
];
|
||||
contents.addAll(_licenses);
|
||||
if (!_loaded) {
|
||||
contents.add(const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 24.0),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
));
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(localizations.licensesPageTitle),
|
||||
@ -491,7 +472,23 @@ class _LicensePageState extends State<LicensePage> {
|
||||
child: Scrollbar(
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 12.0),
|
||||
children: contents,
|
||||
children: <Widget>[
|
||||
Text(name, style: Theme.of(context).textTheme.headline, textAlign: TextAlign.center),
|
||||
Text(version, style: Theme.of(context).textTheme.body1, textAlign: TextAlign.center),
|
||||
Container(height: 18.0),
|
||||
Text(widget.applicationLegalese ?? '', style: Theme.of(context).textTheme.caption, textAlign: TextAlign.center),
|
||||
Container(height: 18.0),
|
||||
Text('Powered by Flutter', style: Theme.of(context).textTheme.body1, textAlign: TextAlign.center),
|
||||
Container(height: 24.0),
|
||||
..._licenses,
|
||||
if (!_loaded)
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 24.0),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -392,8 +392,9 @@ class DayPicker extends StatelessWidget {
|
||||
final int month = displayedMonth.month;
|
||||
final int daysInMonth = getDaysInMonth(year, month);
|
||||
final int firstDayOffset = _computeFirstDayOffset(year, month, localizations);
|
||||
final List<Widget> labels = <Widget>[];
|
||||
labels.addAll(_getDayHeaders(themeData.textTheme.caption, localizations));
|
||||
final List<Widget> labels = <Widget>[
|
||||
..._getDayHeaders(themeData.textTheme.caption, localizations),
|
||||
];
|
||||
for (int i = 0; true; i += 1) {
|
||||
// 1-based day of month, e.g. 1-31 for January, and 1-29 for February on
|
||||
// a leap year.
|
||||
|
@ -2110,14 +2110,12 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
|
||||
}
|
||||
|
||||
if (_currentBottomSheet != null || _dismissedBottomSheets.isNotEmpty) {
|
||||
final List<Widget> bottomSheets = <Widget>[];
|
||||
if (_dismissedBottomSheets.isNotEmpty)
|
||||
bottomSheets.addAll(_dismissedBottomSheets);
|
||||
if (_currentBottomSheet != null)
|
||||
bottomSheets.add(_currentBottomSheet._widget);
|
||||
final Widget stack = Stack(
|
||||
children: bottomSheets,
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: <Widget>[
|
||||
..._dismissedBottomSheets,
|
||||
if (_currentBottomSheet != null) _currentBottomSheet._widget,
|
||||
],
|
||||
);
|
||||
_addIfNonNull(
|
||||
children,
|
||||
|
@ -528,22 +528,18 @@ class _CompoundBorder extends ShapeBorder {
|
||||
final ShapeBorder merged = ours.add(other, reversed: reversed)
|
||||
?? other.add(ours, reversed: !reversed);
|
||||
if (merged != null) {
|
||||
final List<ShapeBorder> result = <ShapeBorder>[];
|
||||
result.addAll(borders);
|
||||
final List<ShapeBorder> result = <ShapeBorder>[...borders];
|
||||
result[reversed ? result.length - 1 : 0] = merged;
|
||||
return _CompoundBorder(result);
|
||||
}
|
||||
}
|
||||
// We can't, so fall back to just adding the new border to the list.
|
||||
final List<ShapeBorder> mergedBorders = <ShapeBorder>[];
|
||||
if (reversed)
|
||||
mergedBorders.addAll(borders);
|
||||
if (other is _CompoundBorder)
|
||||
mergedBorders.addAll(other.borders);
|
||||
else
|
||||
mergedBorders.add(other);
|
||||
if (!reversed)
|
||||
mergedBorders.addAll(borders);
|
||||
final List<ShapeBorder> mergedBorders = <ShapeBorder>[
|
||||
if (reversed) ...borders,
|
||||
if (other is _CompoundBorder) ...other.borders
|
||||
else other,
|
||||
if (!reversed) ...borders,
|
||||
];
|
||||
return _CompoundBorder(mergedBorders);
|
||||
}
|
||||
|
||||
|
@ -498,13 +498,11 @@ class BoxConstraints extends Constraints {
|
||||
}) {
|
||||
assert(() {
|
||||
void throwError(DiagnosticsNode message) {
|
||||
final List<DiagnosticsNode> information = <DiagnosticsNode>[message];
|
||||
if (informationCollector != null) {
|
||||
information.addAll(informationCollector());
|
||||
}
|
||||
|
||||
information.add(DiagnosticsProperty<BoxConstraints>('The offending constraints were', this, style: DiagnosticsTreeStyle.errorProperty));
|
||||
throw FlutterError.fromParts(information);
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
message,
|
||||
if (informationCollector != null) ...informationCollector(),
|
||||
DiagnosticsProperty<BoxConstraints>('The offending constraints were', this, style: DiagnosticsTreeStyle.errorProperty),
|
||||
]);
|
||||
}
|
||||
if (minWidth.isNaN || maxWidth.isNaN || minHeight.isNaN || maxHeight.isNaN) {
|
||||
final List<String> affectedFieldsList = <String>[];
|
||||
@ -1952,12 +1950,12 @@ abstract class RenderBox extends RenderObject {
|
||||
|
||||
information.add(node.describeForError('The nearest ancestor providing an unbounded height constraint is'));
|
||||
}
|
||||
final List<DiagnosticsNode> errorParts = <DiagnosticsNode>[];
|
||||
errorParts.addAll(information);
|
||||
errorParts.add(DiagnosticsProperty<BoxConstraints>('The constraints that applied to the $runtimeType were', constraints, style: DiagnosticsTreeStyle.errorProperty));
|
||||
errorParts.add(DiagnosticsProperty<Size>('The exact size it was given was', _size, style: DiagnosticsTreeStyle.errorProperty));
|
||||
errorParts.add(ErrorHint('See https://flutter.dev/docs/development/ui/layout/box-constraints for more information.'));
|
||||
throw FlutterError.fromParts(errorParts);
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
...information,
|
||||
DiagnosticsProperty<BoxConstraints>('The constraints that applied to the $runtimeType were', constraints, style: DiagnosticsTreeStyle.errorProperty),
|
||||
DiagnosticsProperty<Size>('The exact size it was given was', _size, style: DiagnosticsTreeStyle.errorProperty),
|
||||
ErrorHint('See https://flutter.dev/docs/development/ui/layout/box-constraints for more information.'),
|
||||
]);
|
||||
}
|
||||
// verify that the size is within the constraints
|
||||
if (!constraints.isSatisfiedBy(_size)) {
|
||||
|
@ -628,12 +628,11 @@ class RenderCustomPaint extends RenderProxyBox {
|
||||
|
||||
final bool hasBackgroundSemantics = _backgroundSemanticsNodes != null && _backgroundSemanticsNodes.isNotEmpty;
|
||||
final bool hasForegroundSemantics = _foregroundSemanticsNodes != null && _foregroundSemanticsNodes.isNotEmpty;
|
||||
final List<SemanticsNode> finalChildren = <SemanticsNode>[];
|
||||
if (hasBackgroundSemantics)
|
||||
finalChildren.addAll(_backgroundSemanticsNodes);
|
||||
finalChildren.addAll(children);
|
||||
if (hasForegroundSemantics)
|
||||
finalChildren.addAll(_foregroundSemanticsNodes);
|
||||
final List<SemanticsNode> finalChildren = <SemanticsNode>[
|
||||
if (hasBackgroundSemantics) ..._backgroundSemanticsNodes,
|
||||
...children,
|
||||
if (hasForegroundSemantics) ..._foregroundSemanticsNodes,
|
||||
];
|
||||
super.assembleSemanticsNode(node, config, finalChildren);
|
||||
}
|
||||
|
||||
|
@ -3326,15 +3326,16 @@ class _RootSemanticsFragment extends _InterestingSemanticsFragment {
|
||||
|
||||
node.rect = owner.semanticBounds;
|
||||
|
||||
final List<SemanticsNode> children = <SemanticsNode>[];
|
||||
for (_InterestingSemanticsFragment fragment in _children) {
|
||||
assert(fragment.config == null);
|
||||
children.addAll(fragment.compileChildren(
|
||||
parentSemanticsClipRect: parentSemanticsClipRect,
|
||||
parentPaintClipRect: parentPaintClipRect,
|
||||
elevationAdjustment: 0.0,
|
||||
));
|
||||
}
|
||||
final List<SemanticsNode> children = _children
|
||||
.expand((_InterestingSemanticsFragment fragment) {
|
||||
assert(fragment.config == null);
|
||||
return fragment.compileChildren(
|
||||
parentSemanticsClipRect: parentSemanticsClipRect,
|
||||
parentPaintClipRect: parentPaintClipRect,
|
||||
elevationAdjustment: 0.0,
|
||||
);
|
||||
})
|
||||
.toList();
|
||||
node.updateWith(config: null, childrenInInversePaintOrder: children);
|
||||
|
||||
// The root node is the only semantics node allowed to be invisible. This
|
||||
@ -3447,14 +3448,13 @@ class _SwitchableSemanticsFragment extends _InterestingSemanticsFragment {
|
||||
}
|
||||
}
|
||||
|
||||
final List<SemanticsNode> children = <SemanticsNode>[];
|
||||
for (_InterestingSemanticsFragment fragment in _children) {
|
||||
children.addAll(fragment.compileChildren(
|
||||
final List<SemanticsNode> children = _children
|
||||
.expand((_InterestingSemanticsFragment fragment) => fragment.compileChildren(
|
||||
parentSemanticsClipRect: node.parentSemanticsClipRect,
|
||||
parentPaintClipRect: node.parentPaintClipRect,
|
||||
elevationAdjustment: 0.0,
|
||||
));
|
||||
}
|
||||
))
|
||||
.toList();
|
||||
|
||||
if (_config.isSemanticBoundary) {
|
||||
owner.assembleSemanticsNode(node, _config, children);
|
||||
|
@ -421,14 +421,12 @@ class SliverConstraints extends Constraints {
|
||||
void verify(bool check, String message) {
|
||||
if (check)
|
||||
return;
|
||||
final List<DiagnosticsNode> information = <DiagnosticsNode>[];
|
||||
information.add(ErrorSummary('$runtimeType is not valid: $message'));
|
||||
|
||||
if (informationCollector != null) {
|
||||
information.addAll(informationCollector());
|
||||
}
|
||||
information.add(DiagnosticsProperty<SliverConstraints>('The offending constraints were', this, style: DiagnosticsTreeStyle.errorProperty));
|
||||
throw FlutterError.fromParts(information);
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
ErrorSummary('$runtimeType is not valid: $message'),
|
||||
if (informationCollector != null)
|
||||
...informationCollector(),
|
||||
DiagnosticsProperty<SliverConstraints>('The offending constraints were', this, style: DiagnosticsTreeStyle.errorProperty)
|
||||
]);
|
||||
}
|
||||
verify(axis != null, 'The "axis" is null.');
|
||||
verify(growthDirection != null, 'The "growthDirection" is null.');
|
||||
@ -700,15 +698,12 @@ class SliverGeometry extends Diagnosticable {
|
||||
void verify(bool check, String summary, {List<DiagnosticsNode> details}) {
|
||||
if (check)
|
||||
return;
|
||||
final List<DiagnosticsNode> information = <DiagnosticsNode>[];
|
||||
information.add(ErrorSummary('$runtimeType is not valid: $summary'));
|
||||
if (details != null) {
|
||||
information.addAll(details);
|
||||
}
|
||||
if (informationCollector != null) {
|
||||
information.addAll(informationCollector());
|
||||
}
|
||||
throw FlutterError.fromParts(information);
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
ErrorSummary('$runtimeType is not valid: $summary'),
|
||||
...?details,
|
||||
if (informationCollector != null)
|
||||
...informationCollector(),
|
||||
]);
|
||||
}
|
||||
|
||||
verify(scrollExtent != null, 'The "scrollExtent" is null.');
|
||||
|
@ -2280,12 +2280,9 @@ class _SemanticsSortGroup extends Comparable<_SemanticsSortGroup> {
|
||||
horizontalGroups = horizontalGroups.reversed.toList();
|
||||
}
|
||||
|
||||
final List<SemanticsNode> result = <SemanticsNode>[];
|
||||
for (_SemanticsSortGroup group in horizontalGroups) {
|
||||
final List<SemanticsNode> sortedKnotNodes = group.sortedWithinKnot();
|
||||
result.addAll(sortedKnotNodes);
|
||||
}
|
||||
return result;
|
||||
return horizontalGroups
|
||||
.expand((_SemanticsSortGroup group) => group.sortedWithinKnot())
|
||||
.toList();
|
||||
}
|
||||
|
||||
/// Sorts [nodes] where nodes intersect both vertically and horizontally.
|
||||
@ -2423,12 +2420,9 @@ List<SemanticsNode> _childrenInDefaultOrder(List<SemanticsNode> children, TextDi
|
||||
}
|
||||
verticalGroups.sort();
|
||||
|
||||
final List<SemanticsNode> result = <SemanticsNode>[];
|
||||
for (_SemanticsSortGroup group in verticalGroups) {
|
||||
final List<SemanticsNode> sortedGroupNodes = group.sortedWithinVerticalGroup();
|
||||
result.addAll(sortedGroupNodes);
|
||||
}
|
||||
return result;
|
||||
return verticalGroups
|
||||
.expand((_SemanticsSortGroup group) => group.sortedWithinVerticalGroup())
|
||||
.toList();
|
||||
}
|
||||
|
||||
/// The implementation of [Comparable] that implements the ordering of
|
||||
|
@ -272,15 +272,15 @@ class NestedScrollView extends StatefulWidget {
|
||||
}
|
||||
|
||||
List<Widget> _buildSlivers(BuildContext context, ScrollController innerController, bool bodyIsScrolled) {
|
||||
final List<Widget> slivers = <Widget>[];
|
||||
slivers.addAll(headerSliverBuilder(context, bodyIsScrolled));
|
||||
slivers.add(SliverFillRemaining(
|
||||
child: PrimaryScrollController(
|
||||
controller: innerController,
|
||||
child: body,
|
||||
return <Widget>[
|
||||
...headerSliverBuilder(context, bodyIsScrolled),
|
||||
SliverFillRemaining(
|
||||
child: PrimaryScrollController(
|
||||
controller: innerController,
|
||||
child: body,
|
||||
),
|
||||
),
|
||||
));
|
||||
return slivers;
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -1534,14 +1534,13 @@ mixin WidgetInspectorService {
|
||||
List<DiagnosticsNode> nodes,
|
||||
_SerializationDelegate delegate,
|
||||
) {
|
||||
final List<DiagnosticsNode> children = <DiagnosticsNode>[];
|
||||
for (DiagnosticsNode child in nodes) {
|
||||
if (!delegate.summaryTree || _shouldShowInSummaryTree(child)) {
|
||||
children.add(child);
|
||||
} else {
|
||||
children.addAll(_getChildrenFiltered(child, delegate));
|
||||
}
|
||||
}
|
||||
final List<DiagnosticsNode> children = <DiagnosticsNode>[
|
||||
for (DiagnosticsNode child in nodes)
|
||||
if (!delegate.summaryTree || _shouldShowInSummaryTree(child))
|
||||
child
|
||||
else
|
||||
..._getChildrenFiltered(child, delegate),
|
||||
];
|
||||
return children;
|
||||
}
|
||||
|
||||
@ -2154,8 +2153,10 @@ class _WidgetInspectorState extends State<WidgetInspector>
|
||||
return size == null ? double.maxFinite : size.width * size.height;
|
||||
}
|
||||
regularHits.sort((RenderObject a, RenderObject b) => _area(a).compareTo(_area(b)));
|
||||
final Set<RenderObject> hits = <RenderObject>{};
|
||||
hits..addAll(edgeHits)..addAll(regularHits);
|
||||
final Set<RenderObject> hits = <RenderObject>{
|
||||
...edgeHits,
|
||||
...regularHits,
|
||||
};
|
||||
return hits.toList();
|
||||
}
|
||||
|
||||
|
@ -174,11 +174,7 @@ void main() {
|
||||
final Map<String, Object> result = testTree.toDiagnosticsNode().toJsonMap(TestDiagnosticsSerializationDelegate(
|
||||
subtreeDepth: 1,
|
||||
childFilter: (List<DiagnosticsNode> nodes, DiagnosticsNode owner) {
|
||||
final List<DiagnosticsNode> result = <DiagnosticsNode>[];
|
||||
for (DiagnosticsNode node in nodes) {
|
||||
result.addAll(node.getChildren());
|
||||
}
|
||||
return result;
|
||||
return nodes.expand((DiagnosticsNode node) => node.getChildren()).toList();
|
||||
}
|
||||
));
|
||||
final List<Map<String, Object>> children = result['children'];
|
||||
|
@ -260,13 +260,13 @@ void main() {
|
||||
expect(paragraph.size.height, 26.0);
|
||||
|
||||
// Test the sizes of nested spans.
|
||||
final List<ui.TextBox> boxes = <ui.TextBox>[];
|
||||
final String text = testSpan.toStringDeep();
|
||||
for (int i = 0; i < text.length; ++i) {
|
||||
boxes.addAll(paragraph.getBoxesForSelection(
|
||||
final List<ui.TextBox> boxes = <ui.TextBox>[
|
||||
for (int i = 0; i < text.length; ++i)
|
||||
...paragraph.getBoxesForSelection(
|
||||
TextSelection(baseOffset: i, extentOffset: i + 1)
|
||||
));
|
||||
}
|
||||
),
|
||||
];
|
||||
expect(boxes.length, equals(4));
|
||||
|
||||
// anyOf is needed here and below because Linux and Mac have different text
|
||||
|
@ -836,15 +836,11 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||
_allowedAssetKeys = <String>{};
|
||||
return;
|
||||
}
|
||||
final Map<String, dynamic> manifest = json.decode(
|
||||
manifestFile.readAsStringSync());
|
||||
final Map<String, dynamic> manifest = json.decode(manifestFile.readAsStringSync());
|
||||
_allowedAssetKeys = <String>{
|
||||
'AssetManifest.json',
|
||||
...manifest.values.cast<List<dynamic>>().expand<dynamic>((List<dynamic> e) => e).cast<String>(),
|
||||
};
|
||||
for (List<dynamic> value in manifest.values) {
|
||||
final List<String> strList = List<String>.from(value);
|
||||
_allowedAssetKeys.addAll(strList);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -2,7 +2,7 @@ name: flutter_test
|
||||
|
||||
environment:
|
||||
# The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite.
|
||||
sdk: ">=2.2.0 <3.0.0"
|
||||
sdk: ">=2.2.2 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
# To update these, use "flutter update-packages --force-upgrade".
|
||||
|
@ -72,6 +72,7 @@ Future<void> main(List<String> args) async {
|
||||
// Otherwise assume the package is flat.
|
||||
targetFile = entrypoint;
|
||||
}
|
||||
final String deviceName = argResults['device'];
|
||||
final List<String> command = <String>[
|
||||
'attach',
|
||||
'--module',
|
||||
@ -86,14 +87,9 @@ Future<void> main(List<String> args) async {
|
||||
outputDill,
|
||||
'--packages',
|
||||
packages,
|
||||
if (deviceName != null && deviceName.isNotEmpty) ...<String>['-d', deviceName],
|
||||
if (verbose) '--verbose',
|
||||
];
|
||||
final String deviceName = argResults['device'];
|
||||
if (deviceName != null && deviceName.isNotEmpty) {
|
||||
command.addAll(<String>['-d', deviceName]);
|
||||
}
|
||||
if (verbose) {
|
||||
command.add('--verbose');
|
||||
}
|
||||
Cache.disableLocking(); // ignore: invalid_use_of_visible_for_testing_member
|
||||
await runner.run(
|
||||
command,
|
||||
|
@ -520,40 +520,40 @@ class AndroidDevice extends Device {
|
||||
'-f', '0x20000000', // FLAG_ACTIVITY_SINGLE_TOP
|
||||
'--ez', 'enable-background-compilation', 'true',
|
||||
'--ez', 'enable-dart-profiling', 'true',
|
||||
if (traceStartup)
|
||||
...<String>['--ez', 'trace-startup', 'true'],
|
||||
if (route != null)
|
||||
...<String>['--es', 'route', route],
|
||||
if (debuggingOptions.enableSoftwareRendering)
|
||||
...<String>['--ez', 'enable-software-rendering', 'true'],
|
||||
if (debuggingOptions.skiaDeterministicRendering)
|
||||
...<String>['--ez', 'skia-deterministic-rendering', 'true'],
|
||||
if (debuggingOptions.traceSkia)
|
||||
...<String>['--ez', 'trace-skia', 'true'],
|
||||
if (debuggingOptions.traceSystrace)
|
||||
...<String>['--ez', 'trace-systrace', 'true'],
|
||||
if (debuggingOptions.dumpSkpOnShaderCompilation)
|
||||
...<String>['--ez', 'dump-skp-on-shader-compilation', 'true'],
|
||||
if (debuggingOptions.debuggingEnabled)
|
||||
...<String>[
|
||||
if (debuggingOptions.buildInfo.isDebug)
|
||||
...<String>[
|
||||
...<String>['--ez', 'enable-checked-mode', 'true'],
|
||||
...<String>['--ez', 'verify-entry-points', 'true'],
|
||||
],
|
||||
if (debuggingOptions.startPaused)
|
||||
...<String>['--ez', 'start-paused', 'true'],
|
||||
if (debuggingOptions.disableServiceAuthCodes)
|
||||
...<String>['--ez', 'disable-service-auth-codes', 'true'],
|
||||
if (debuggingOptions.dartFlags.isNotEmpty)
|
||||
...<String>['--es', 'dart-flags', debuggingOptions.dartFlags],
|
||||
if (debuggingOptions.useTestFonts)
|
||||
...<String>['--ez', 'use-test-fonts', 'true'],
|
||||
if (debuggingOptions.verboseSystemLogs)
|
||||
...<String>['--ez', 'verbose-logging', 'true'],
|
||||
],
|
||||
apk.launchActivity,
|
||||
];
|
||||
|
||||
if (traceStartup)
|
||||
cmd.addAll(<String>['--ez', 'trace-startup', 'true']);
|
||||
if (route != null)
|
||||
cmd.addAll(<String>['--es', 'route', route]);
|
||||
if (debuggingOptions.enableSoftwareRendering)
|
||||
cmd.addAll(<String>['--ez', 'enable-software-rendering', 'true']);
|
||||
if (debuggingOptions.skiaDeterministicRendering)
|
||||
cmd.addAll(<String>['--ez', 'skia-deterministic-rendering', 'true']);
|
||||
if (debuggingOptions.traceSkia)
|
||||
cmd.addAll(<String>['--ez', 'trace-skia', 'true']);
|
||||
if (debuggingOptions.traceSystrace)
|
||||
cmd.addAll(<String>['--ez', 'trace-systrace', 'true']);
|
||||
if (debuggingOptions.dumpSkpOnShaderCompilation)
|
||||
cmd.addAll(<String>['--ez', 'dump-skp-on-shader-compilation', 'true']);
|
||||
if (debuggingOptions.debuggingEnabled) {
|
||||
if (debuggingOptions.buildInfo.isDebug) {
|
||||
cmd.addAll(<String>['--ez', 'enable-checked-mode', 'true']);
|
||||
cmd.addAll(<String>['--ez', 'verify-entry-points', 'true']);
|
||||
}
|
||||
if (debuggingOptions.startPaused)
|
||||
cmd.addAll(<String>['--ez', 'start-paused', 'true']);
|
||||
if (debuggingOptions.disableServiceAuthCodes)
|
||||
cmd.addAll(<String>['--ez', 'disable-service-auth-codes', 'true']);
|
||||
if (debuggingOptions.dartFlags.isNotEmpty)
|
||||
cmd.addAll(<String>['--es', 'dart-flags', debuggingOptions.dartFlags]);
|
||||
if (debuggingOptions.useTestFonts)
|
||||
cmd.addAll(<String>['--ez', 'use-test-fonts', 'true']);
|
||||
if (debuggingOptions.verboseSystemLogs) {
|
||||
cmd.addAll(<String>['--ez', 'verbose-logging', 'true']);
|
||||
}
|
||||
}
|
||||
cmd.add(apk.launchActivity);
|
||||
final String result = (await runAdbCheckedAsync(cmd)).stdout;
|
||||
// This invocation returns 0 even when it fails.
|
||||
if (result.contains('Error: ')) {
|
||||
|
@ -17,15 +17,13 @@ class AndroidStudioValidator extends DoctorValidator {
|
||||
final AndroidStudio _studio;
|
||||
|
||||
static List<DoctorValidator> get allValidators {
|
||||
final List<DoctorValidator> validators = <DoctorValidator>[];
|
||||
final List<AndroidStudio> studios = AndroidStudio.allInstalled();
|
||||
if (studios.isEmpty) {
|
||||
validators.add(NoAndroidStudioValidator());
|
||||
} else {
|
||||
validators.addAll(studios
|
||||
.map<DoctorValidator>((AndroidStudio studio) => AndroidStudioValidator(studio)));
|
||||
}
|
||||
return validators;
|
||||
return <DoctorValidator>[
|
||||
if (studios.isEmpty)
|
||||
NoAndroidStudioValidator()
|
||||
else
|
||||
...studios.map<DoctorValidator>((AndroidStudio studio) => AndroidStudioValidator(studio))
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -216,10 +216,10 @@ class _ManifestAssetBundle implements AssetBundle {
|
||||
}
|
||||
}
|
||||
|
||||
final List<_Asset> materialAssets = <_Asset>[];
|
||||
if (flutterManifest.usesMaterialDesign && includeDefaultFonts) {
|
||||
materialAssets.addAll(_getMaterialAssets(_fontSetMaterial));
|
||||
}
|
||||
final List<_Asset> materialAssets = <_Asset>[
|
||||
if (flutterManifest.usesMaterialDesign && includeDefaultFonts)
|
||||
..._getMaterialAssets(_fontSetMaterial),
|
||||
];
|
||||
for (_Asset asset in materialAssets) {
|
||||
assert(asset.assetFileExists);
|
||||
entries[asset.entryUri.path] ??= DevFSFileContent(asset.assetFile);
|
||||
@ -421,20 +421,18 @@ List<Map<String, dynamic>> _parseFonts(
|
||||
PackageMap packageMap, {
|
||||
String packageName,
|
||||
}) {
|
||||
final List<Map<String, dynamic>> fonts = <Map<String, dynamic>>[];
|
||||
if (manifest.usesMaterialDesign && includeDefaultFonts) {
|
||||
fonts.addAll(_getMaterialFonts(_ManifestAssetBundle._fontSetMaterial));
|
||||
}
|
||||
if (packageName == null) {
|
||||
fonts.addAll(manifest.fontsDescriptor);
|
||||
} else {
|
||||
fonts.addAll(_createFontsDescriptor(_parsePackageFonts(
|
||||
manifest,
|
||||
packageName,
|
||||
packageMap,
|
||||
)));
|
||||
}
|
||||
return fonts;
|
||||
return <Map<String, dynamic>>[
|
||||
if (manifest.usesMaterialDesign && includeDefaultFonts)
|
||||
..._getMaterialFonts(_ManifestAssetBundle._fontSetMaterial),
|
||||
if (packageName == null)
|
||||
...manifest.fontsDescriptor
|
||||
else
|
||||
..._createFontsDescriptor(_parsePackageFonts(
|
||||
manifest,
|
||||
packageName,
|
||||
packageMap,
|
||||
)),
|
||||
];
|
||||
}
|
||||
|
||||
/// Prefixes family names and asset paths of fonts included from packages with
|
||||
|
@ -228,7 +228,7 @@ class AOTSnapshotter {
|
||||
final List<String> commonBuildOptions = <String>['-arch', targetArch, '-miphoneos-version-min=8.0'];
|
||||
|
||||
final String assemblyO = fs.path.join(outputPath, 'snapshot_assembly.o');
|
||||
final RunResult compileResult = await xcode.cc(commonBuildOptions.toList()..addAll(<String>['-c', assemblyPath, '-o', assemblyO]));
|
||||
final RunResult compileResult = await xcode.cc(<String>[...commonBuildOptions, '-c', assemblyPath, '-o', assemblyO]);
|
||||
if (compileResult.exitCode != 0) {
|
||||
printError('Failed to compile AOT snapshot. Compiler terminated with exit code ${compileResult.exitCode}');
|
||||
return compileResult;
|
||||
@ -237,14 +237,15 @@ class AOTSnapshotter {
|
||||
final String frameworkDir = fs.path.join(outputPath, 'App.framework');
|
||||
fs.directory(frameworkDir).createSync(recursive: true);
|
||||
final String appLib = fs.path.join(frameworkDir, 'App');
|
||||
final List<String> linkArgs = commonBuildOptions.toList()..addAll(<String>[
|
||||
'-dynamiclib',
|
||||
'-Xlinker', '-rpath', '-Xlinker', '@executable_path/Frameworks',
|
||||
'-Xlinker', '-rpath', '-Xlinker', '@loader_path/Frameworks',
|
||||
'-install_name', '@rpath/App.framework/App',
|
||||
'-o', appLib,
|
||||
assemblyO,
|
||||
]);
|
||||
final List<String> linkArgs = <String>[
|
||||
...commonBuildOptions,
|
||||
'-dynamiclib',
|
||||
'-Xlinker', '-rpath', '-Xlinker', '@executable_path/Frameworks',
|
||||
'-Xlinker', '-rpath', '-Xlinker', '@loader_path/Frameworks',
|
||||
'-install_name', '@rpath/App.framework/App',
|
||||
'-o', appLib,
|
||||
assemblyO,
|
||||
];
|
||||
final RunResult linkResult = await xcode.clang(linkArgs);
|
||||
if (linkResult.exitCode != 0) {
|
||||
printError('Failed to link AOT snapshot. Linker terminated with exit code ${compileResult.exitCode}');
|
||||
@ -371,8 +372,10 @@ class JITSnapshotter {
|
||||
genSnapshotArgs.addAll(extraGenSnapshotOptions);
|
||||
}
|
||||
|
||||
final Set<String> outputPaths = <String>{};
|
||||
outputPaths.addAll(<String>[isolateSnapshotData, isolateSnapshotInstructions]);
|
||||
final Set<String> outputPaths = <String>{
|
||||
isolateSnapshotData,
|
||||
isolateSnapshotInstructions,
|
||||
};
|
||||
|
||||
// There are a couple special cases below where we create a snapshot
|
||||
// with only the data section, which only contains interpreted code.
|
||||
|
@ -94,9 +94,11 @@ class Fingerprinter {
|
||||
}
|
||||
|
||||
Future<List<String>> _getPaths() async {
|
||||
final Set<String> paths = _paths.toSet();
|
||||
for (String depfilePath in _depfilePaths)
|
||||
paths.addAll(await readDepfile(depfilePath));
|
||||
final Set<String> paths = <String>{
|
||||
..._paths,
|
||||
for (String depfilePath in _depfilePaths)
|
||||
...await readDepfile(depfilePath),
|
||||
};
|
||||
final FingerprintPathFilter filter = _pathFilter ?? (String path) => true;
|
||||
return paths.where(filter).toList()..sort();
|
||||
}
|
||||
@ -118,7 +120,7 @@ class Fingerprint {
|
||||
final List<int> bytes = file.readAsBytesSync();
|
||||
_checksums[file.path] = md5.convert(bytes).toString();
|
||||
}
|
||||
_properties = <String, String>{}..addAll(properties);
|
||||
_properties = <String, String>{...properties};
|
||||
}
|
||||
|
||||
/// Creates a Fingerprint from serialized JSON.
|
||||
|
@ -637,30 +637,22 @@ class FlutterSdk extends EngineCachedArtifact {
|
||||
|
||||
@override
|
||||
List<List<String>> getBinaryDirs() {
|
||||
final List<List<String>> binaryDirs = <List<String>>[
|
||||
return <List<String>>[
|
||||
<String>['common', 'flutter_patched_sdk.zip'],
|
||||
<String>['common', 'flutter_patched_sdk_product.zip'],
|
||||
if (cache.includeAllPlatforms)
|
||||
...<List<String>>[
|
||||
<String>['windows-x64', 'windows-x64/artifacts.zip'],
|
||||
<String>['linux-x64', 'linux-x64/artifacts.zip'],
|
||||
<String>['darwin-x64', 'darwin-x64/artifacts.zip'],
|
||||
]
|
||||
else if (platform.isWindows)
|
||||
<String>['windows-x64', 'windows-x64/artifacts.zip']
|
||||
else if (platform.isMacOS)
|
||||
<String>['darwin-x64', 'darwin-x64/artifacts.zip']
|
||||
else if (platform.isLinux)
|
||||
<String>['linux-x64', 'linux-x64/artifacts.zip'],
|
||||
];
|
||||
if (cache.includeAllPlatforms) {
|
||||
binaryDirs.addAll(<List<String>>[
|
||||
<String>['windows-x64', 'windows-x64/artifacts.zip'],
|
||||
<String>['linux-x64', 'linux-x64/artifacts.zip'],
|
||||
<String>['darwin-x64', 'darwin-x64/artifacts.zip'],
|
||||
]);
|
||||
} else if (platform.isWindows) {
|
||||
binaryDirs.addAll(<List<String>>[
|
||||
<String>['windows-x64', 'windows-x64/artifacts.zip'],
|
||||
]);
|
||||
} else if (platform.isMacOS) {
|
||||
binaryDirs.addAll(<List<String>>[
|
||||
<String>['darwin-x64', 'darwin-x64/artifacts.zip'],
|
||||
]);
|
||||
} else if (platform.isLinux) {
|
||||
binaryDirs.addAll(<List<String>>[
|
||||
<String>['linux-x64', 'linux-x64/artifacts.zip'],
|
||||
]);
|
||||
}
|
||||
return binaryDirs;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -745,28 +737,31 @@ class AndroidEngineArtifacts extends EngineCachedArtifact {
|
||||
|
||||
@override
|
||||
List<List<String>> getBinaryDirs() {
|
||||
final List<List<String>> binaryDirs = <List<String>>[];
|
||||
if (cache.includeAllPlatforms) {
|
||||
binaryDirs
|
||||
..addAll(_osxBinaryDirs)
|
||||
..addAll(_linuxBinaryDirs)
|
||||
..addAll(_windowsBinaryDirs)
|
||||
..addAll(_androidBinaryDirs)
|
||||
..addAll(_dartSdks);
|
||||
} else if (platform.isWindows) {
|
||||
binaryDirs
|
||||
..addAll(_windowsBinaryDirs)
|
||||
..addAll(_androidBinaryDirs);
|
||||
} else if (platform.isMacOS) {
|
||||
binaryDirs
|
||||
..addAll(_osxBinaryDirs)
|
||||
..addAll(_androidBinaryDirs);
|
||||
} else if (platform.isLinux) {
|
||||
binaryDirs
|
||||
..addAll(_linuxBinaryDirs)
|
||||
..addAll(_androidBinaryDirs);
|
||||
}
|
||||
return binaryDirs;
|
||||
return <List<String>>[
|
||||
if (cache.includeAllPlatforms)
|
||||
...<List<String>>[
|
||||
..._osxBinaryDirs,
|
||||
..._linuxBinaryDirs,
|
||||
..._windowsBinaryDirs,
|
||||
..._androidBinaryDirs,
|
||||
..._dartSdks,
|
||||
]
|
||||
else if (platform.isWindows)
|
||||
...<List<String>>[
|
||||
..._windowsBinaryDirs,
|
||||
..._androidBinaryDirs,
|
||||
]
|
||||
else if (platform.isMacOS)
|
||||
...<List<String>>[
|
||||
..._osxBinaryDirs,
|
||||
..._androidBinaryDirs,
|
||||
]
|
||||
else if (platform.isLinux)
|
||||
...<List<String>>[
|
||||
..._linuxBinaryDirs,
|
||||
..._androidBinaryDirs,
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
@ -782,11 +777,10 @@ class IOSEngineArtifacts extends EngineCachedArtifact {
|
||||
|
||||
@override
|
||||
List<List<String>> getBinaryDirs() {
|
||||
final List<List<String>> binaryDirs = <List<String>>[];
|
||||
if (platform.isMacOS || cache.includeAllPlatforms) {
|
||||
binaryDirs.addAll(_iosBinaryDirs);
|
||||
}
|
||||
return binaryDirs;
|
||||
return <List<String>>[
|
||||
if (platform.isMacOS || cache.includeAllPlatforms)
|
||||
..._iosBinaryDirs,
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
@ -914,10 +908,10 @@ final Map<int, List<int>> _flattenNameSubstitutions = <int, List<int>>{
|
||||
/// Given a name containing slashes, colons, and backslashes, expand it into
|
||||
/// something that doesn't.
|
||||
String _flattenNameNoSubdirs(String fileName) {
|
||||
final List<int> replacedCodeUnits = <int>[];
|
||||
for (int codeUnit in fileName.codeUnits) {
|
||||
replacedCodeUnits.addAll(_flattenNameSubstitutions[codeUnit] ?? <int>[codeUnit]);
|
||||
}
|
||||
final List<int> replacedCodeUnits = <int>[
|
||||
for (int codeUnit in fileName.codeUnits)
|
||||
..._flattenNameSubstitutions[codeUnit] ?? <int>[codeUnit],
|
||||
];
|
||||
return String.fromCharCodes(replacedCodeUnits);
|
||||
}
|
||||
|
||||
|
@ -618,10 +618,10 @@ class AppDomain extends Domain {
|
||||
}
|
||||
|
||||
void _sendAppEvent(AppInstance app, String name, [ Map<String, dynamic> args ]) {
|
||||
final Map<String, dynamic> eventArgs = <String, dynamic>{'appId': app.id};
|
||||
if (args != null)
|
||||
eventArgs.addAll(args);
|
||||
sendEvent('app.$name', eventArgs);
|
||||
sendEvent('app.$name', <String, dynamic>{
|
||||
'appId': app.id,
|
||||
...?args,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,23 +61,14 @@ class FormatCommand extends FlutterCommand {
|
||||
}
|
||||
|
||||
final String dartfmt = sdkBinaryName('dartfmt');
|
||||
final List<String> command = <String>[dartfmt];
|
||||
|
||||
if (argResults['dry-run']) {
|
||||
command.add('-n');
|
||||
}
|
||||
if (argResults['machine']) {
|
||||
command.add('-m');
|
||||
}
|
||||
if (!argResults['dry-run'] && !argResults['machine']) {
|
||||
command.add('-w');
|
||||
}
|
||||
|
||||
if (argResults['set-exit-if-changed']) {
|
||||
command.add('--set-exit-if-changed');
|
||||
}
|
||||
|
||||
command..addAll(argResults.rest);
|
||||
final List<String> command = <String>[
|
||||
dartfmt,
|
||||
if (argResults['dry-run']) '-n',
|
||||
if (argResults['machine']) '-m',
|
||||
if (!argResults['dry-run'] && !argResults['machine']) '-w',
|
||||
if (argResults['set-exit-if-changed']) '--set-exit-if-changed',
|
||||
...argResults.rest,
|
||||
];
|
||||
|
||||
final int result = await runCommandAndStreamOutput(command);
|
||||
if (result != 0)
|
||||
|
@ -179,15 +179,13 @@ class TestCommand extends FastFlutterCommand {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
final List<String> fileCopy = <String>[];
|
||||
for (String file in files) {
|
||||
if (file.endsWith(platform.pathSeparator)) {
|
||||
fileCopy.addAll(_findTests(fs.directory(file)));
|
||||
} else {
|
||||
fileCopy.add(file);
|
||||
}
|
||||
}
|
||||
files = fileCopy;
|
||||
files = <String>[
|
||||
for (String file in files)
|
||||
if (file.endsWith(platform.pathSeparator))
|
||||
..._findTests(fs.directory(file))
|
||||
else
|
||||
file
|
||||
];
|
||||
}
|
||||
|
||||
CoverageCollector collector;
|
||||
|
@ -728,9 +728,11 @@ class PubspecYaml {
|
||||
// Merge the lists of dependencies we've seen in this file from dependencies, dev dependencies,
|
||||
// and the dependencies we know this file mentions that are already pinned
|
||||
// (and which didn't get special processing above).
|
||||
final Set<String> implied = Set<String>.from(directDependencies)
|
||||
..addAll(specialDependencies)
|
||||
..addAll(devDependencies);
|
||||
final Set<String> implied = <String>{
|
||||
...directDependencies,
|
||||
...specialDependencies,
|
||||
...devDependencies,
|
||||
};
|
||||
|
||||
// Create a new set to hold the list of packages we've already processed, so
|
||||
// that we don't redundantly process them multiple times.
|
||||
@ -751,12 +753,12 @@ class PubspecYaml {
|
||||
transitiveDevDependencyOutput.add(' $package: ${versions.versionFor(package)} $kTransitiveMagicString');
|
||||
|
||||
// Build a sorted list of all dependencies for the checksum.
|
||||
final Set<String> checksumDependencies = <String>{}
|
||||
..addAll(directDependencies)
|
||||
..addAll(devDependencies)
|
||||
..addAll(transitiveDependenciesAsList)
|
||||
..addAll(transitiveDevDependenciesAsList);
|
||||
checksumDependencies.removeAll(specialDependencies);
|
||||
final Set<String> checksumDependencies = <String>{
|
||||
...directDependencies,
|
||||
...devDependencies,
|
||||
...transitiveDependenciesAsList,
|
||||
...transitiveDevDependenciesAsList,
|
||||
}..removeAll(specialDependencies);
|
||||
|
||||
// Add a blank line before and after each section to keep the resulting output clean.
|
||||
transitiveDependencyOutput
|
||||
|
@ -96,12 +96,12 @@ Future<void> pubGet({
|
||||
'Running "flutter pub $command" in ${fs.path.basename(directory)}...',
|
||||
timeout: timeoutConfiguration.slowOperation,
|
||||
);
|
||||
final List<String> args = <String>['--verbosity=warning'];
|
||||
if (FlutterCommand.current != null && FlutterCommand.current.globalResults['verbose'])
|
||||
args.add('--verbose');
|
||||
args.addAll(<String>[command, '--no-precompile']);
|
||||
if (offline)
|
||||
args.add('--offline');
|
||||
final List<String> args = <String>[
|
||||
'--verbosity=warning',
|
||||
if (FlutterCommand.current != null && FlutterCommand.current.globalResults['verbose']) '--verbose',
|
||||
...<String>[command, '--no-precompile'],
|
||||
if (offline) '--offline',
|
||||
];
|
||||
try {
|
||||
await pub(
|
||||
args,
|
||||
@ -228,21 +228,13 @@ const String _pubCacheEnvironmentKey = 'PUB_CACHE';
|
||||
String _getPubEnvironmentValue(PubContext pubContext) {
|
||||
// DO NOT update this function without contacting kevmoo.
|
||||
// We have server-side tooling that assumes the values are consistent.
|
||||
final List<String> values = <String>[];
|
||||
|
||||
final String existing = platform.environment[_pubEnvironmentKey];
|
||||
|
||||
if ((existing != null) && existing.isNotEmpty) {
|
||||
values.add(existing);
|
||||
}
|
||||
|
||||
if (isRunningOnBot) {
|
||||
values.add('flutter_bot');
|
||||
}
|
||||
|
||||
values.add('flutter_cli');
|
||||
values.addAll(pubContext._values);
|
||||
|
||||
final List<String> values = <String>[
|
||||
if (existing != null && existing.isNotEmpty) existing,
|
||||
if (isRunningOnBot) 'flutter_bot',
|
||||
'flutter_cli',
|
||||
...pubContext._values,
|
||||
];
|
||||
return values.join(':');
|
||||
}
|
||||
|
||||
|
@ -161,11 +161,10 @@ class DeviceManager {
|
||||
|
||||
/// Get diagnostics about issues with any connected devices.
|
||||
Future<List<String>> getDeviceDiagnostics() async {
|
||||
final List<String> diagnostics = <String>[];
|
||||
for (DeviceDiscovery discoverer in _platformDiscoverers) {
|
||||
diagnostics.addAll(await discoverer.getDiagnostics());
|
||||
}
|
||||
return diagnostics;
|
||||
return <String>[
|
||||
for (DeviceDiscovery discoverer in _platformDiscoverers)
|
||||
...await discoverer.getDiagnostics(),
|
||||
];
|
||||
}
|
||||
|
||||
/// Find and return a list of devices based on the current project and environment.
|
||||
|
@ -60,45 +60,37 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
|
||||
@override
|
||||
List<DoctorValidator> get validators {
|
||||
if (_validators == null) {
|
||||
_validators = <DoctorValidator>[];
|
||||
_validators.add(FlutterValidator());
|
||||
final List<DoctorValidator> ideValidators = <DoctorValidator>[
|
||||
...AndroidStudioValidator.allValidators,
|
||||
...IntelliJValidator.installedValidators,
|
||||
...VsCodeValidator.installedValidators,
|
||||
];
|
||||
|
||||
if (androidWorkflow.appliesToHostPlatform)
|
||||
_validators.add(GroupedValidator(<DoctorValidator>[androidValidator, androidLicenseValidator]));
|
||||
|
||||
if (iosWorkflow.appliesToHostPlatform || macOSWorkflow.appliesToHostPlatform)
|
||||
_validators.add(GroupedValidator(<DoctorValidator>[xcodeValidator, cocoapodsValidator]));
|
||||
|
||||
if (iosWorkflow.appliesToHostPlatform)
|
||||
_validators.add(iosValidator);
|
||||
|
||||
if (webWorkflow.appliesToHostPlatform)
|
||||
_validators.add(const WebValidator());
|
||||
|
||||
// Add desktop doctors to workflow if the flag is enabled.
|
||||
if (flutterDesktopEnabled) {
|
||||
if (linuxWorkflow.appliesToHostPlatform) {
|
||||
_validators.add(LinuxDoctorValidator());
|
||||
}
|
||||
if (windowsWorkflow.appliesToHostPlatform) {
|
||||
_validators.add(visualStudioValidator);
|
||||
}
|
||||
}
|
||||
|
||||
final List<DoctorValidator> ideValidators = <DoctorValidator>[];
|
||||
ideValidators.addAll(AndroidStudioValidator.allValidators);
|
||||
ideValidators.addAll(IntelliJValidator.installedValidators);
|
||||
ideValidators.addAll(VsCodeValidator.installedValidators);
|
||||
if (ideValidators.isNotEmpty)
|
||||
_validators.addAll(ideValidators);
|
||||
else
|
||||
_validators.add(NoIdeValidator());
|
||||
|
||||
if (ProxyValidator.shouldShow)
|
||||
_validators.add(ProxyValidator());
|
||||
|
||||
if (deviceManager.canListAnything)
|
||||
_validators.add(DeviceValidator());
|
||||
_validators = <DoctorValidator>[
|
||||
FlutterValidator(),
|
||||
if (androidWorkflow.appliesToHostPlatform)
|
||||
GroupedValidator(<DoctorValidator>[androidValidator, androidLicenseValidator]),
|
||||
if (iosWorkflow.appliesToHostPlatform || macOSWorkflow.appliesToHostPlatform)
|
||||
GroupedValidator(<DoctorValidator>[xcodeValidator, cocoapodsValidator]),
|
||||
if (iosWorkflow.appliesToHostPlatform)
|
||||
iosValidator,
|
||||
if (webWorkflow.appliesToHostPlatform)
|
||||
const WebValidator(),
|
||||
// Add desktop doctors to workflow if the flag is enabled.
|
||||
if (flutterDesktopEnabled)
|
||||
...<DoctorValidator>[
|
||||
if (linuxWorkflow.appliesToHostPlatform) LinuxDoctorValidator(),
|
||||
if (windowsWorkflow.appliesToHostPlatform) visualStudioValidator,
|
||||
],
|
||||
if (ideValidators.isNotEmpty)
|
||||
...ideValidators
|
||||
else
|
||||
NoIdeValidator(),
|
||||
if (ProxyValidator.shouldShow)
|
||||
ProxyValidator(),
|
||||
if (deviceManager.canListAnything)
|
||||
DeviceValidator(),
|
||||
];
|
||||
}
|
||||
return _validators;
|
||||
}
|
||||
|
@ -144,12 +144,16 @@ class SimControl {
|
||||
}
|
||||
|
||||
Future<RunResult> launch(String deviceId, String appIdentifier, [ List<String> launchArgs ]) {
|
||||
final List<String> args = <String>[_xcrunPath, 'simctl', 'launch', deviceId, appIdentifier];
|
||||
if (launchArgs != null)
|
||||
args.addAll(launchArgs);
|
||||
Future<RunResult> result;
|
||||
try {
|
||||
result = runCheckedAsync(args);
|
||||
result = runCheckedAsync(<String>[
|
||||
_xcrunPath,
|
||||
'simctl',
|
||||
'launch',
|
||||
deviceId,
|
||||
appIdentifier,
|
||||
...?launchArgs,
|
||||
]);
|
||||
} on ProcessException catch (exception) {
|
||||
throwToolExit('Unable to launch $appIdentifier on $deviceId:\n$exception');
|
||||
}
|
||||
|
@ -407,12 +407,10 @@ abstract class FlutterCommand extends Command<void> {
|
||||
}
|
||||
|
||||
// Send screen.
|
||||
final Map<String, String> additionalUsageValues = <String, String>{};
|
||||
final Map<String, String> currentUsageValues = await usageValues;
|
||||
|
||||
if (currentUsageValues != null) {
|
||||
additionalUsageValues.addAll(currentUsageValues);
|
||||
}
|
||||
final Map<String, String> additionalUsageValues = <String, String>{
|
||||
...?currentUsageValues,
|
||||
};
|
||||
if (commandResult != null) {
|
||||
switch (commandResult.exitStatus) {
|
||||
case ExitStatus.success:
|
||||
@ -429,11 +427,12 @@ abstract class FlutterCommand extends Command<void> {
|
||||
flutterUsage.sendCommand(commandPath, parameters: additionalUsageValues);
|
||||
|
||||
// Send timing.
|
||||
final List<String> labels = <String>[];
|
||||
if (commandResult?.exitStatus != null)
|
||||
labels.add(getEnumName(commandResult.exitStatus));
|
||||
if (commandResult?.timingLabelParts?.isNotEmpty ?? false)
|
||||
labels.addAll(commandResult.timingLabelParts);
|
||||
final List<String> labels = <String>[
|
||||
if (commandResult?.exitStatus != null)
|
||||
getEnumName(commandResult.exitStatus),
|
||||
if (commandResult?.timingLabelParts?.isNotEmpty ?? false)
|
||||
...commandResult.timingLabelParts,
|
||||
];
|
||||
|
||||
final String label = labels
|
||||
.where((String label) => !isBlank(label))
|
||||
|
@ -47,26 +47,19 @@ Future<int> runTests(
|
||||
bool web = false,
|
||||
}) async {
|
||||
// Compute the command-line arguments for package:test.
|
||||
final List<String> testArgs = <String>[];
|
||||
if (!terminal.supportsColor) {
|
||||
testArgs.addAll(<String>['--no-color']);
|
||||
}
|
||||
|
||||
if (machine) {
|
||||
testArgs.addAll(<String>['-r', 'json']);
|
||||
} else {
|
||||
testArgs.addAll(<String>['-r', 'compact']);
|
||||
}
|
||||
|
||||
testArgs.add('--concurrency=$concurrency');
|
||||
|
||||
for (String name in names) {
|
||||
testArgs..add('--name')..add(name);
|
||||
}
|
||||
|
||||
for (String plainName in plainNames) {
|
||||
testArgs..add('--plain-name')..add(plainName);
|
||||
}
|
||||
final List<String> testArgs = <String>[
|
||||
if (!terminal.supportsColor)
|
||||
'--no-color',
|
||||
if (machine)
|
||||
...<String>['-r', 'json']
|
||||
else
|
||||
...<String>['-r', 'compact'],
|
||||
'--concurrency=$concurrency',
|
||||
for (String name in names)
|
||||
...<String>['--name', name],
|
||||
for (String plainName in plainNames)
|
||||
...<String>['--plain-name', plainName],
|
||||
];
|
||||
if (web) {
|
||||
final String tempBuildDir = fs.systemTempDirectory
|
||||
.createTempSync('_flutter_test')
|
||||
@ -80,10 +73,11 @@ Future<int> runTests(
|
||||
if (!result) {
|
||||
throwToolExit('Failed to compile tests');
|
||||
}
|
||||
testArgs.add('--platform=chrome');
|
||||
testArgs.add('--precompiled=$tempBuildDir');
|
||||
testArgs.add('--');
|
||||
testArgs.addAll(testFiles);
|
||||
testArgs
|
||||
..add('--platform=chrome')
|
||||
..add('--precompiled=$tempBuildDir')
|
||||
..add('--')
|
||||
..addAll(testFiles);
|
||||
hack.registerPlatformPlugin(
|
||||
<Runtime>[Runtime.chrome],
|
||||
() {
|
||||
@ -94,8 +88,9 @@ Future<int> runTests(
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
testArgs.add('--');
|
||||
testArgs.addAll(testFiles);
|
||||
testArgs
|
||||
..add('--')
|
||||
..addAll(testFiles);
|
||||
|
||||
// Configure package:test to use the Flutter engine for child processes.
|
||||
final String shellPath = artifacts.getArtifactPath(Artifact.flutterTester);
|
||||
|
@ -133,12 +133,15 @@ class FlutterVersion {
|
||||
String get frameworkCommitDate => _latestGitCommitDate();
|
||||
|
||||
static String _latestGitCommitDate([ String branch ]) {
|
||||
final List<String> args = <String>['git', 'log'];
|
||||
|
||||
if (branch != null)
|
||||
args.add(branch);
|
||||
|
||||
args.addAll(<String>['-n', '1', '--pretty=format:%ad', '--date=iso']);
|
||||
final List<String> args = <String>[
|
||||
'git',
|
||||
'log',
|
||||
if (branch != null) branch,
|
||||
'-n',
|
||||
'1',
|
||||
'--pretty=format:%ad',
|
||||
'--date=iso',
|
||||
];
|
||||
return _runSync(args, lenient: false);
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,8 @@ void main() {
|
||||
expect(await fingerprinter.doesFingerprintMatch(), isFalse);
|
||||
}, overrides: <Type, Generator>{
|
||||
Platform: () => mockPlatformDisabledCache,
|
||||
}..addAll(contextOverrides));
|
||||
...contextOverrides,
|
||||
});
|
||||
|
||||
final Platform mockPlatformEnabledCache = MockPlatform();
|
||||
mockPlatformEnabledCache.environment['DISABLE_FLUTTER_BUILD_CACHE'] = 'false';
|
||||
@ -231,7 +232,8 @@ void main() {
|
||||
expect(await fingerprinter.doesFingerprintMatch(), isTrue);
|
||||
}, overrides: <Type, Generator>{
|
||||
Platform: () => mockPlatformEnabledCache,
|
||||
}..addAll(contextOverrides));
|
||||
...contextOverrides,
|
||||
});
|
||||
|
||||
testUsingContext('fails to write fingerprint if inputs are missing', () async {
|
||||
final Fingerprinter fingerprinter = Fingerprinter(
|
||||
|
@ -53,13 +53,11 @@ void main() {
|
||||
Future<BuildBundleCommand> runCommandIn(String projectPath, { List<String> arguments }) async {
|
||||
final BuildBundleCommand command = BuildBundleCommand(bundleBuilder: mockBundleBuilder);
|
||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||
|
||||
final List<String> commandArgs = <String>['bundle'];
|
||||
if (arguments != null)
|
||||
commandArgs.addAll(arguments);
|
||||
commandArgs.add('--target=$projectPath/lib/main.dart');
|
||||
|
||||
await runner.run(commandArgs);
|
||||
await runner.run(<String>[
|
||||
'bundle',
|
||||
...?arguments,
|
||||
'--target=$projectPath/lib/main.dart',
|
||||
]);
|
||||
return command;
|
||||
}
|
||||
|
||||
|
@ -1129,10 +1129,11 @@ Future<void> _createProject(
|
||||
Cache.flutterRoot = '../..';
|
||||
final CreateCommand command = CreateCommand();
|
||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||
final List<String> args = <String>['create'];
|
||||
args.addAll(createArgs);
|
||||
args.add(dir.path);
|
||||
await runner.run(args);
|
||||
await runner.run(<String>[
|
||||
'create',
|
||||
...createArgs,
|
||||
dir.path,
|
||||
]);
|
||||
|
||||
bool pathExists(String path) {
|
||||
final String fullPath = fs.path.join(dir.path, path);
|
||||
|
@ -85,9 +85,11 @@ void main() {
|
||||
dir ??= tempDir;
|
||||
final IdeConfigCommand command = IdeConfigCommand();
|
||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||
final List<String> finalArgs = <String>['--flutter-root=${tempDir.absolute.path}', 'ide-config'];
|
||||
finalArgs.addAll(args);
|
||||
await runner.run(finalArgs);
|
||||
await runner.run(<String>[
|
||||
'--flutter-root=${tempDir.absolute.path}',
|
||||
'ide-config',
|
||||
...args,
|
||||
]);
|
||||
|
||||
for (String path in expectedContents.keys) {
|
||||
final String absPath = fs.path.join(tempDir.absolute.path, path);
|
||||
@ -148,8 +150,10 @@ void main() {
|
||||
'template',
|
||||
);
|
||||
_populateDir(templateManifest);
|
||||
final Map<String, String> expectedContents = templateManifest;
|
||||
expectedContents.addAll(flutterManifest);
|
||||
final Map<String, String> expectedContents = <String, String>{
|
||||
...templateManifest,
|
||||
...flutterManifest,
|
||||
};
|
||||
return _updateIdeConfig(
|
||||
expectedContents: expectedContents,
|
||||
);
|
||||
@ -171,8 +175,10 @@ void main() {
|
||||
tempDir,
|
||||
'template',
|
||||
);
|
||||
final Map<String, String> expectedContents = templateManifest;
|
||||
expectedContents.addAll(overwrittenManifest);
|
||||
final Map<String, String> expectedContents = <String, String>{
|
||||
...templateManifest,
|
||||
...overwrittenManifest,
|
||||
};
|
||||
return _updateIdeConfig(
|
||||
args: <String>['--overwrite'],
|
||||
expectedContents: expectedContents,
|
||||
@ -200,8 +206,10 @@ void main() {
|
||||
'existing',
|
||||
);
|
||||
_populateDir(flutterManifest);
|
||||
final Map<String, String> expectedContents = flutterManifest;
|
||||
expectedContents.addAll(templateManifest);
|
||||
final Map<String, String> expectedContents = <String, String>{
|
||||
...flutterManifest,
|
||||
...templateManifest,
|
||||
};
|
||||
return _updateIdeConfig(
|
||||
args: <String>['--update-templates'],
|
||||
expectedContents: expectedContents,
|
||||
@ -225,8 +233,10 @@ void main() {
|
||||
'existing',
|
||||
isTemplate: true,
|
||||
);
|
||||
final Map<String, String> expectedContents = flutterManifest;
|
||||
expectedContents.addAll(updatedTemplates);
|
||||
final Map<String, String> expectedContents = <String, String>{
|
||||
...flutterManifest,
|
||||
...updatedTemplates,
|
||||
};
|
||||
return _updateIdeConfig(
|
||||
args: <String>['--update-templates', '--overwrite'],
|
||||
expectedContents: expectedContents,
|
||||
@ -259,8 +269,10 @@ void main() {
|
||||
'flutter.iml${Template.copyTemplateExtension}',
|
||||
);
|
||||
updatedTemplates.remove(flutterIml);
|
||||
final Map<String, String> expectedContents = flutterManifest;
|
||||
expectedContents.addAll(updatedTemplates);
|
||||
final Map<String, String> expectedContents = <String, String>{
|
||||
...flutterManifest,
|
||||
...updatedTemplates,
|
||||
};
|
||||
return _updateIdeConfig(
|
||||
args: <String>['--update-templates', '--overwrite'],
|
||||
expectedContents: expectedContents,
|
||||
@ -298,8 +310,10 @@ void main() {
|
||||
updatedTemplates.remove(deepIml);
|
||||
deepIml = fs.path.join(deepIml, 'deep.iml');
|
||||
updatedTemplates.remove(deepIml);
|
||||
final Map<String, String> expectedContents = flutterManifest;
|
||||
expectedContents.addAll(updatedTemplates);
|
||||
final Map<String, String> expectedContents = <String, String>{
|
||||
...flutterManifest,
|
||||
...updatedTemplates,
|
||||
};
|
||||
return _updateIdeConfig(
|
||||
args: <String>['--update-templates', '--overwrite'],
|
||||
expectedContents: expectedContents,
|
||||
|
@ -61,13 +61,12 @@ void main() {
|
||||
Future<PackagesCommand> runCommandIn(String projectPath, String verb, { List<String> args }) async {
|
||||
final PackagesCommand command = PackagesCommand();
|
||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||
|
||||
final List<String> commandArgs = <String>['packages', verb];
|
||||
if (args != null)
|
||||
commandArgs.addAll(args);
|
||||
commandArgs.add(projectPath);
|
||||
|
||||
await runner.run(commandArgs);
|
||||
await runner.run(<String>[
|
||||
'packages',
|
||||
verb,
|
||||
...?args,
|
||||
projectPath,
|
||||
]);
|
||||
return command;
|
||||
}
|
||||
|
||||
|
@ -77,15 +77,13 @@ class Testbed {
|
||||
/// `overrides` may be used to provide new context values for the single test
|
||||
/// case or override any context values from the setup.
|
||||
FutureOr<T> run<T>(FutureOr<T> Function() test, {Map<Type, Generator> overrides}) {
|
||||
final Map<Type, Generator> testOverrides = Map<Type, Generator>.from(_testbedDefaults);
|
||||
// Add the initial setUp overrides
|
||||
if (_overrides != null) {
|
||||
testOverrides.addAll(_overrides);
|
||||
}
|
||||
// Add the test-specific overrides
|
||||
if (overrides != null) {
|
||||
testOverrides.addAll(overrides);
|
||||
}
|
||||
final Map<Type, Generator> testOverrides = <Type, Generator>{
|
||||
..._testbedDefaults,
|
||||
// Add the initial setUp overrides
|
||||
...?_overrides,
|
||||
// Add the test-specific overrides
|
||||
...?overrides,
|
||||
};
|
||||
// Cache the original flutter root to restore after the test case.
|
||||
final String originalFlutterRoot = Cache.flutterRoot;
|
||||
return runInContext<T>(() {
|
||||
|
@ -606,24 +606,21 @@ class _SshPortForwarder implements PortForwarder {
|
||||
// IPv6 interface, it cannot be used to connect to a websocket.
|
||||
final String formattedForwardingUrl =
|
||||
'${localSocket.port}:$_ipv4Loopback:$remotePort';
|
||||
final List<String> command = <String>['ssh'];
|
||||
if (isIpV6) {
|
||||
command.add('-6');
|
||||
}
|
||||
if (sshConfigPath != null) {
|
||||
command.addAll(<String>['-F', sshConfigPath]);
|
||||
}
|
||||
final String targetAddress =
|
||||
isIpV6 && interface.isNotEmpty ? '$address%$interface' : address;
|
||||
const String dummyRemoteCommand = 'true';
|
||||
command.addAll(<String>[
|
||||
final List<String> command = <String>[
|
||||
'ssh',
|
||||
if (isIpV6) '-6',
|
||||
if (sshConfigPath != null)
|
||||
...<String>['-F', sshConfigPath],
|
||||
'-nNT',
|
||||
'-f',
|
||||
'-L',
|
||||
formattedForwardingUrl,
|
||||
targetAddress,
|
||||
dummyRemoteCommand,
|
||||
]);
|
||||
];
|
||||
_log.fine("_SshPortForwarder running '${command.join(' ')}'");
|
||||
// Must await for the port forwarding function to completer here, as
|
||||
// forwarding must be completed before surfacing VM events (as the user may
|
||||
@ -649,20 +646,19 @@ class _SshPortForwarder implements PortForwarder {
|
||||
// uses the IPv4 loopback.
|
||||
final String formattedForwardingUrl =
|
||||
'${_localSocket.port}:$_ipv4Loopback:$_remotePort';
|
||||
final List<String> command = <String>['ssh'];
|
||||
final String targetAddress = _ipV6 && _interface.isNotEmpty
|
||||
? '$_remoteAddress%$_interface'
|
||||
: _remoteAddress;
|
||||
if (_sshConfigPath != null) {
|
||||
command.addAll(<String>['-F', _sshConfigPath]);
|
||||
}
|
||||
command.addAll(<String>[
|
||||
final List<String> command = <String>[
|
||||
'ssh',
|
||||
if (_sshConfigPath != null)
|
||||
...<String>['-F', _sshConfigPath],
|
||||
'-O',
|
||||
'cancel',
|
||||
'-L',
|
||||
formattedForwardingUrl,
|
||||
targetAddress,
|
||||
]);
|
||||
];
|
||||
_log.fine(
|
||||
'Shutting down SSH forwarding with command: ${command.join(' ')}');
|
||||
final ProcessResult result = await _processManager.run(command);
|
||||
|
@ -82,18 +82,16 @@ class SshCommandRunner {
|
||||
/// If the subprocess creating the SSH tunnel returns a nonzero exit status,
|
||||
/// then an [SshCommandError] is raised.
|
||||
Future<List<String>> run(String command) async {
|
||||
final List<String> args = <String>['ssh'];
|
||||
if (sshConfigPath != null) {
|
||||
args.addAll(<String>['-F', sshConfigPath]);
|
||||
}
|
||||
if (isIpV6Address(address)) {
|
||||
final String fullAddress =
|
||||
interface.isEmpty ? address : '$address%$interface';
|
||||
args.addAll(<String>['-6', fullAddress]);
|
||||
} else {
|
||||
args.add(address);
|
||||
}
|
||||
args.add(command);
|
||||
final List<String> args = <String>[
|
||||
'ssh',
|
||||
if (sshConfigPath != null)
|
||||
...<String>['-F', sshConfigPath],
|
||||
if (isIpV6Address(address))
|
||||
...<String>['-6', interface.isEmpty ? address : '$address%$interface']
|
||||
else
|
||||
address,
|
||||
command,
|
||||
];
|
||||
_log.fine('Running command through SSH: ${args.join(' ')}');
|
||||
final ProcessResult result = await _processManager.run(args);
|
||||
if (result.exitCode != 0) {
|
||||
|
@ -5,7 +5,7 @@ author: Flutter Authors <flutter-dev@googlegroups.com>
|
||||
|
||||
environment:
|
||||
# The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite.
|
||||
sdk: ">=2.2.0 <3.0.0"
|
||||
sdk: ">=2.2.2 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
json_rpc_2: 2.1.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user