committed by
GitHub
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]];
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user