Apply style guide regarding createTempSync pattern (#81090)
This commit is contained in:
@@ -218,9 +218,8 @@ class LocalFileSystem extends local_fs.LocalFileSystem {
|
||||
@override
|
||||
Directory get systemTempDirectory {
|
||||
if (_systemTemp == null) {
|
||||
_systemTemp = super.systemTempDirectory.createTempSync(
|
||||
'flutter_tools.',
|
||||
)..createSync(recursive: true);
|
||||
_systemTemp = super.systemTempDirectory.createTempSync('flutter_tools.')
|
||||
..createSync(recursive: true);
|
||||
// Make sure that the temporary directory is cleaned up if the tool is
|
||||
// killed by a signal.
|
||||
for (final ProcessSignal signal in _fatalSignals) {
|
||||
|
||||
@@ -419,9 +419,7 @@ class AndroidMavenArtifacts extends ArtifactSet {
|
||||
if (globals.androidSdk == null) {
|
||||
return;
|
||||
}
|
||||
final Directory tempDir = cache.getRoot().createTempSync(
|
||||
'flutter_gradle_wrapper.',
|
||||
);
|
||||
final Directory tempDir = cache.getRoot().createTempSync('flutter_gradle_wrapper.');
|
||||
globals.gradleUtils.injectGradleWrapperIfNeeded(tempDir);
|
||||
|
||||
final Status status = logger.startProgress('Downloading Android Maven dependencies...');
|
||||
|
||||
@@ -156,7 +156,7 @@ class FlutterTesterDevice extends Device {
|
||||
}
|
||||
|
||||
final Directory assetDirectory = _fileSystem.systemTempDirectory
|
||||
.createTempSync('flutter-tester');
|
||||
.createTempSync('flutter_tester.');
|
||||
final String applicationKernelFilePath = getKernelPathForTransformerOptions(
|
||||
_fileSystem.path.join(assetDirectory.path, 'flutter-tester-app.dill'),
|
||||
trackWidgetCreation: buildInfo.trackWidgetCreation,
|
||||
|
||||
@@ -139,9 +139,7 @@ void main() {
|
||||
});
|
||||
|
||||
setUp(() {
|
||||
tempDir = fileSystem.systemTempDirectory.createTempSync(
|
||||
'flutter_analyze_once_test_1.',
|
||||
).absolute;
|
||||
tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_analyze_once_test_1.').absolute;
|
||||
projectPath = fileSystem.path.join(tempDir.path, 'flutter_project');
|
||||
fileSystem.file(fileSystem.path.join(projectPath, 'pubspec.yaml'))
|
||||
..createSync(recursive: true)
|
||||
@@ -387,8 +385,7 @@ StringBuffer bar = StringBuffer('baz');
|
||||
});
|
||||
|
||||
testUsingContext('analyze once with default options has info issue finally exit code 1.', () async {
|
||||
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync(
|
||||
'flutter_analyze_once_default_options_info_issue_exit_code_1.');
|
||||
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_analyze_once_default_options_info_issue_exit_code_1.');
|
||||
_createDotPackages(tempDir.path);
|
||||
|
||||
const String infoSourceCode = '''
|
||||
@@ -422,8 +419,7 @@ int analyze() {}
|
||||
});
|
||||
|
||||
testUsingContext('analyze once with no-fatal-infos has info issue finally exit code 0.', () async {
|
||||
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync(
|
||||
'flutter_analyze_once_no_fatal_infos_info_issue_exit_code_0.');
|
||||
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_analyze_once_no_fatal_infos_info_issue_exit_code_0.');
|
||||
_createDotPackages(tempDir.path);
|
||||
|
||||
const String infoSourceCode = '''
|
||||
@@ -457,8 +453,7 @@ int analyze() {}
|
||||
});
|
||||
|
||||
testUsingContext('analyze once only fatal-warnings has info issue finally exit code 0.', () async {
|
||||
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync(
|
||||
'flutter_analyze_once_only_fatal_warnings_info_issue_exit_code_0.');
|
||||
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_analyze_once_only_fatal_warnings_info_issue_exit_code_0.');
|
||||
_createDotPackages(tempDir.path);
|
||||
|
||||
const String infoSourceCode = '''
|
||||
@@ -492,8 +487,7 @@ int analyze() {}
|
||||
});
|
||||
|
||||
testUsingContext('analyze once only fatal-infos has warning issue finally exit code 1.', () async {
|
||||
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync(
|
||||
'flutter_analyze_once_only_fatal_infos_warning_issue_exit_code_1.');
|
||||
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_analyze_once_only_fatal_infos_warning_issue_exit_code_1.');
|
||||
_createDotPackages(tempDir.path);
|
||||
|
||||
const String warningSourceCode = '''
|
||||
|
||||
@@ -286,9 +286,7 @@ void main() {
|
||||
Directory tempDir;
|
||||
|
||||
setUp(() {
|
||||
tempDir = globals.fs.systemTempDirectory.createTempSync(
|
||||
'flutter_tools_analytics_bots_test.',
|
||||
);
|
||||
tempDir = globals.fs.systemTempDirectory.createTempSync('flutter_tools_analytics_bots_test.');
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
|
||||
@@ -134,7 +134,7 @@ void main() {
|
||||
};
|
||||
|
||||
for (final MapEntry<String, String> entry in testCases.entries) {
|
||||
final Directory sampleAppAndroid = fileSystem.systemTempDirectory.createTempSync('android');
|
||||
final Directory sampleAppAndroid = fileSystem.systemTempDirectory.createTempSync('flutter_android.');
|
||||
sampleAppAndroid
|
||||
.childFile('build.gradle')
|
||||
.writeAsStringSync('''
|
||||
|
||||
@@ -28,7 +28,7 @@ void main() {
|
||||
logger = BufferLogger.test();
|
||||
platform = FakePlatform(environment: <String, String>{});
|
||||
|
||||
final Directory tempDir = globals.fs.systemTempDirectory.createTempSync('devtools_launcher_test');
|
||||
final Directory tempDir = globals.fs.systemTempDirectory.createTempSync('flutter_devtools_launcher_test.');
|
||||
persistentToolState = PersistentToolState.test(
|
||||
directory: tempDir,
|
||||
logger: logger,
|
||||
|
||||
@@ -341,7 +341,7 @@ flutter:
|
||||
assert(name != null);
|
||||
assert(dependencies != null);
|
||||
|
||||
final Directory pluginDirectory = fs.systemTempDirectory.createTempSync('plugin.');
|
||||
final Directory pluginDirectory = fs.systemTempDirectory.createTempSync('flutter_plugin.');
|
||||
pluginDirectory
|
||||
.childFile('pubspec.yaml')
|
||||
.writeAsStringSync('''
|
||||
@@ -874,7 +874,7 @@ dependencies:
|
||||
testUsingContext("Registrant for web doesn't escape slashes in imports", () async {
|
||||
when(flutterProject.isModule).thenReturn(true);
|
||||
final Directory webPluginWithNestedFile =
|
||||
fs.systemTempDirectory.createTempSync('web_plugin_with_nested');
|
||||
fs.systemTempDirectory.createTempSync('flutter_web_plugin_with_nested.');
|
||||
webPluginWithNestedFile.childFile('pubspec.yaml').writeAsStringSync('''
|
||||
flutter:
|
||||
plugin:
|
||||
@@ -1329,7 +1329,7 @@ flutter:
|
||||
Directory projectDir;
|
||||
Directory tempDir;
|
||||
setUp(() {
|
||||
tempDir = globals.fs.systemTempDirectory.createTempSync('plugin_test.');
|
||||
tempDir = globals.fs.systemTempDirectory.createTempSync('flutter_plugin_test.');
|
||||
projectDir = tempDir.childDirectory('flutter_project');
|
||||
});
|
||||
|
||||
|
||||
@@ -151,8 +151,8 @@ void main() {
|
||||
'--non-interactive',
|
||||
'--enable-dart-profiling',
|
||||
'--packages=.packages',
|
||||
'--flutter-assets-dir=/.tmp_rand0/flutter-testerrand0',
|
||||
'/.tmp_rand0/flutter-testerrand0/flutter-tester-app.dill',
|
||||
'--flutter-assets-dir=/.tmp_rand0/flutter_tester.rand0',
|
||||
'/.tmp_rand0/flutter_tester.rand0/flutter-tester-app.dill',
|
||||
],
|
||||
completer: completer,
|
||||
stdout:
|
||||
|
||||
@@ -122,7 +122,7 @@ void main() {
|
||||
|
||||
testWithoutContext('--analyze-size allows overriding the directory for code size files', () async {
|
||||
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
|
||||
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync('size_test');
|
||||
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_size_test.');
|
||||
|
||||
final ProcessResult result = await processManager.run(<String>[
|
||||
flutterBin,
|
||||
|
||||
@@ -87,9 +87,7 @@ void testUsingContext(
|
||||
}
|
||||
});
|
||||
Config buildConfig(FileSystem fs) {
|
||||
configDir ??= globals.fs.systemTempDirectory.createTempSync(
|
||||
'flutter_config_dir_test.',
|
||||
);
|
||||
configDir ??= globals.fs.systemTempDirectory.createTempSync('flutter_config_dir_test.');
|
||||
return Config.test(
|
||||
name: Config.kFlutterSettings,
|
||||
directory: configDir,
|
||||
@@ -97,9 +95,7 @@ void testUsingContext(
|
||||
);
|
||||
}
|
||||
PersistentToolState buildPersistentToolState(FileSystem fs) {
|
||||
configDir ??= globals.fs.systemTempDirectory.createTempSync(
|
||||
'flutter_config_dir_test.',
|
||||
);
|
||||
configDir ??= globals.fs.systemTempDirectory.createTempSync('flutter_config_dir_test.');
|
||||
return PersistentToolState.test(
|
||||
directory: configDir,
|
||||
logger: globals.logger,
|
||||
|
||||
Reference in New Issue
Block a user