Unverified Commit 6beafa7b authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Apply style guide regarding createTempSync pattern (#81090)

parent a7eb2c8a
......@@ -41,7 +41,7 @@ Future<String> evalTestAppInChrome({
})
.add(createStaticHandler(appDirectory));
shelf_io.serveRequests(server, cascade.handler);
final io.Directory userDataDirectory = io.Directory.systemTemp.createTempSync('chrome_user_data_');
final io.Directory userDataDirectory = io.Directory.systemTemp.createTempSync('flutter_chrome_user_data.');
chrome = await Chrome.launch(ChromeOptions(
headless: true,
debugPort: browserDebugPort,
......@@ -88,7 +88,7 @@ class AppServer {
});
});
shelf_io.serveRequests(server, cascade.handler);
final io.Directory userDataDirectory = io.Directory.systemTemp.createTempSync('chrome_user_data_');
final io.Directory userDataDirectory = io.Directory.systemTemp.createTempSync('flutter_chrome_user_data.');
final Completer<String> chromeErrorCompleter = Completer<String>();
chrome = await Chrome.launch(ChromeOptions(
headless: headless,
......
......@@ -38,7 +38,7 @@ class NewGalleryChromeRunTest {
/// Runs the test.
Future<TaskResult> run() async {
final Directory galleryParentDir =
Directory.systemTemp.createTempSync('temp');
Directory.systemTemp.createTempSync('flutter_gallery_v2_chrome_run.');
final Directory galleryDir =
Directory(path.join(galleryParentDir.path, 'gallery'));
......
......@@ -25,7 +25,7 @@ class NewGalleryWebCompileTest {
/// Runs the test.
Future<TaskResult> run() async {
final Directory galleryParentDir =
Directory.systemTemp.createTempSync('temp');
Directory.systemTemp.createTempSync('flutter_gallery_v2_web_compile.');
final Directory galleryDir =
Directory(path.join(galleryParentDir.path, 'gallery'));
......
......@@ -19,7 +19,7 @@ Future<void> main() async {
String watchDeviceID;
String phoneDeviceID;
final Directory tempDir = Directory.systemTemp
.createTempSync('ios_app_with_extensions_test');
.createTempSync('flutter_ios_app_with_extensions_test.');
final Directory projectDir =
Directory(path.join(tempDir.path, 'app_with_extensions'));
try {
......
......@@ -320,7 +320,7 @@ Future<void> main() async {
section('Run platform unit tests');
final String resultBundleTemp = Directory.systemTemp.createTempSync('module_test_ios_xcresult.').path;
final String resultBundleTemp = Directory.systemTemp.createTempSync('flutter_module_test_ios_xcresult.').path;
await testWithNewIOSSimulator('TestAdd2AppSim', (String deviceId) async {
simulatorDeviceId = deviceId;
final String resultBundlePath = path.join(resultBundleTemp, 'result');
......
......@@ -44,7 +44,7 @@ Future<void> main() async {
final String codeSignStyle = environment['FLUTTER_XCODE_CODE_SIGN_STYLE'];
final String provisioningProfile = environment['FLUTTER_XCODE_PROVISIONING_PROFILE_SPECIFIER'];
final String resultBundleTemp = Directory.systemTemp.createTempSync('native_ui_tests_ios32_xcresult.').path;
final String resultBundleTemp = Directory.systemTemp.createTempSync('flutter_native_ui_tests_ios32_xcresult.').path;
final String resultBundlePath = path.join(resultBundleTemp, 'result');
final int testResultExit = await exec(
'xcodebuild',
......
......@@ -14,7 +14,7 @@ Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android;
final Directory galleryParentDir =
Directory.systemTemp.createTempSync('new_gallery_test');
Directory.systemTemp.createTempSync('flutter_new_gallery_test.');
final Directory galleryDir =
Directory(path.join(galleryParentDir.path, 'gallery'));
......
......@@ -13,7 +13,7 @@ import 'package:path/path.dart' as path;
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android;
final Directory galleryParentDir = Directory.systemTemp.createTempSync('new_gallery_test');
final Directory galleryParentDir = Directory.systemTemp.createTempSync('flutter_new_gallery_test.');
final Directory galleryDir = Directory(path.join(galleryParentDir.path, 'gallery'));
try {
......
......@@ -13,7 +13,7 @@ import 'package:path/path.dart' as path;
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios;
final Directory galleryParentDir = Directory.systemTemp.createTempSync('new_gallery_test');
final Directory galleryParentDir = Directory.systemTemp.createTempSync('flutter_new_gallery_test.');
final Directory galleryDir = Directory(path.join(galleryParentDir.path, 'gallery'));
try {
......
......@@ -121,7 +121,7 @@ Future<TaskResult> runWebBenchmark({ @required bool useCanvasKit }) async {
shelf_io.serveRequests(server, cascade.handler);
final String dartToolDirectory = path.join('$macrobenchmarksDirectory/.dart_tool');
final String userDataDir = io.Directory(dartToolDirectory).createTempSync('chrome_user_data_').path;
final String userDataDir = io.Directory(dartToolDirectory).createTempSync('flutter_chrome_user_data.').path;
// TODO(yjbanov): temporarily disables headful Chrome until we get
// devicelab hardware that is able to run it. Our current
......
......@@ -20,9 +20,7 @@ void main() {
() async {
const Platform platform = LocalPlatform();
const FileSystem fileSystem = LocalFileSystem();
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync(
'conductor_integration_test',
);
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_conductor_integration_test.');
const ProcessManager processManager = LocalProcessManager();
final TestStdio stdio = TestStdio(verbose: true);
final Checkouts checkouts = Checkouts(
......
......@@ -30,7 +30,7 @@ void main() {
fileSystem = const LocalFileSystem();
processManager = const LocalProcessManager();
stdio = TestStdio(verbose: true);
tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_conductor_checkouts');
tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_conductor_checkouts.');
checkouts = Checkouts(
fileSystem: fileSystem,
parentDirectory: tempDir,
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment