mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
switch tool tests to build runner (#28759)
This commit is contained in:
parent
778e95a39b
commit
d91cfffa50
@ -143,8 +143,9 @@ Future<void> _runSmokeTests() async {
|
||||
Future<void> _runToolTests() async {
|
||||
await _runSmokeTests();
|
||||
|
||||
await _pubRunTest(
|
||||
await _buildRunnerTest(
|
||||
path.join(flutterRoot, 'packages', 'flutter_tools'),
|
||||
flutterRoot,
|
||||
enableFlutterToolAsserts: true,
|
||||
);
|
||||
|
||||
@ -306,6 +307,41 @@ Future<void> _runCoverage() async {
|
||||
print('${bold}DONE: Coverage collection successful.$reset');
|
||||
}
|
||||
|
||||
Future<void> _buildRunnerTest(
|
||||
String workingDirectory,
|
||||
String flutterRoot, {
|
||||
String testPath,
|
||||
bool enableFlutterToolAsserts = false,
|
||||
}
|
||||
) {
|
||||
final List<String> args = <String>['run', 'build_runner', 'test', '--', '-rcompact', '-j1'];
|
||||
if (!hasColor) {
|
||||
args.add('--no-color');
|
||||
}
|
||||
if (testPath != null) {
|
||||
args.add(testPath);
|
||||
}
|
||||
final Map<String, String> pubEnvironment = <String, String>{
|
||||
'FLUTTER_ROOT': flutterRoot,
|
||||
};
|
||||
if (Directory(pubCache).existsSync()) {
|
||||
pubEnvironment['PUB_CACHE'] = pubCache;
|
||||
}
|
||||
if (enableFlutterToolAsserts) {
|
||||
// If an existing env variable exists append to it, but only if
|
||||
// it doesn't appear to already include enable-asserts.
|
||||
String toolsArgs = Platform.environment['FLUTTER_TOOL_ARGS'] ?? '';
|
||||
if (!toolsArgs.contains('--enable-asserts'))
|
||||
toolsArgs += ' --enable-asserts';
|
||||
pubEnvironment['FLUTTER_TOOL_ARGS'] = toolsArgs.trim();
|
||||
}
|
||||
return runCommand(
|
||||
pub, args,
|
||||
workingDirectory: workingDirectory,
|
||||
environment: pubEnvironment,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _pubRunTest(
|
||||
String workingDirectory, {
|
||||
String testPath,
|
||||
|
Loading…
Reference in New Issue
Block a user