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