Unverified Commit 81e1f7d1 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] mode code size output to ~/.flutter-devtools (#71601)

parent ece72384
...@@ -532,7 +532,9 @@ Future<void> _performCodeSizeAnalysis( ...@@ -532,7 +532,9 @@ Future<void> _performCodeSizeAnalysis(
kind: kind, kind: kind,
); );
final File outputFile = globals.fsUtils.getUniqueFile( final File outputFile = globals.fsUtils.getUniqueFile(
globals.fs.directory(getBuildDirectory()),'$kind-code-size-analysis', 'json', globals.fs
.directory(globals.fsUtils.homeDirPath)
.childDirectory('.flutter-devtools'), '$kind-code-size-analysis', 'json',
)..writeAsStringSync(jsonEncode(output)); )..writeAsStringSync(jsonEncode(output));
// This message is used as a sentinel in analyze_apk_size_test.dart // This message is used as a sentinel in analyze_apk_size_test.dart
globals.printStatus( globals.printStatus(
......
...@@ -103,6 +103,7 @@ class FileSystemUtils { ...@@ -103,6 +103,7 @@ class FileSystemUtils {
final String name = '${baseName}_${i.toString().padLeft(2, '0')}.$ext'; final String name = '${baseName}_${i.toString().padLeft(2, '0')}.$ext';
final File file = fs.file(_fileSystem.path.join(dir.path, name)); final File file = fs.file(_fileSystem.path.join(dir.path, name));
if (!file.existsSync()) { if (!file.existsSync()) {
file.createSync(recursive: true);
return file; return file;
} }
i += 1; i += 1;
......
...@@ -286,7 +286,9 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand { ...@@ -286,7 +286,9 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
type: 'ios', type: 'ios',
); );
final File outputFile = globals.fsUtils.getUniqueFile( final File outputFile = globals.fsUtils.getUniqueFile(
globals.fs.directory(getBuildDirectory()),'ios-code-size-analysis', 'json', globals.fs
.directory(globals.fsUtils.homeDirPath)
.childDirectory('.flutter-devtools'), 'ios-code-size-analysis', 'json',
)..writeAsStringSync(jsonEncode(output)); )..writeAsStringSync(jsonEncode(output));
// This message is used as a sentinel in analyze_apk_size_test.dart // This message is used as a sentinel in analyze_apk_size_test.dart
globals.printStatus( globals.printStatus(
......
...@@ -70,7 +70,9 @@ Future<void> buildLinux( ...@@ -70,7 +70,9 @@ Future<void> buildLinux(
type: 'linux', type: 'linux',
); );
final File outputFile = globals.fsUtils.getUniqueFile( final File outputFile = globals.fsUtils.getUniqueFile(
globals.fs.directory(getBuildDirectory()),'linux-code-size-analysis', 'json', globals.fs
.directory(globals.fsUtils.homeDirPath)
.childDirectory('.flutter-devtools'), 'linux-code-size-analysis', 'json',
)..writeAsStringSync(jsonEncode(output)); )..writeAsStringSync(jsonEncode(output));
// This message is used as a sentinel in analyze_apk_size_test.dart // This message is used as a sentinel in analyze_apk_size_test.dart
globals.printStatus( globals.printStatus(
......
...@@ -133,7 +133,9 @@ Future<void> buildMacOS({ ...@@ -133,7 +133,9 @@ Future<void> buildMacOS({
excludePath: 'Versions', // Avoid double counting caused by symlinks excludePath: 'Versions', // Avoid double counting caused by symlinks
); );
final File outputFile = globals.fsUtils.getUniqueFile( final File outputFile = globals.fsUtils.getUniqueFile(
globals.fs.directory(getBuildDirectory()), 'macos-code-size-analysis', 'json', globals.fs
.directory(globals.fsUtils.homeDirPath)
.childDirectory('.flutter-devtools'), 'macos-code-size-analysis', 'json',
)..writeAsStringSync(jsonEncode(output)); )..writeAsStringSync(jsonEncode(output));
// This message is used as a sentinel in analyze_apk_size_test.dart // This message is used as a sentinel in analyze_apk_size_test.dart
globals.printStatus( globals.printStatus(
......
...@@ -78,7 +78,9 @@ Future<void> buildWindows(WindowsProject windowsProject, BuildInfo buildInfo, { ...@@ -78,7 +78,9 @@ Future<void> buildWindows(WindowsProject windowsProject, BuildInfo buildInfo, {
type: 'windows', type: 'windows',
); );
final File outputFile = globals.fsUtils.getUniqueFile( final File outputFile = globals.fsUtils.getUniqueFile(
globals.fs.directory(getBuildDirectory()),'windows-code-size-analysis', 'json', globals.fs
.directory(globals.fsUtils.homeDirPath)
.childDirectory('.flutter-devtools'), 'windows-code-size-analysis', 'json',
)..writeAsStringSync(jsonEncode(output)); )..writeAsStringSync(jsonEncode(output));
// This message is used as a sentinel in analyze_apk_size_test.dart // This message is used as a sentinel in analyze_apk_size_test.dart
globals.printStatus( globals.printStatus(
......
...@@ -34,6 +34,7 @@ final Platform macosPlatform = FakePlatform( ...@@ -34,6 +34,7 @@ final Platform macosPlatform = FakePlatform(
operatingSystem: 'macos', operatingSystem: 'macos',
environment: <String, String>{ environment: <String, String>{
'FLUTTER_ROOT': '/', 'FLUTTER_ROOT': '/',
'HOME': '/',
} }
); );
final Platform notMacosPlatform = FakePlatform( final Platform notMacosPlatform = FakePlatform(
......
...@@ -26,7 +26,8 @@ const String _kTestFlutterRoot = '/flutter'; ...@@ -26,7 +26,8 @@ const String _kTestFlutterRoot = '/flutter';
final Platform linuxPlatform = FakePlatform( final Platform linuxPlatform = FakePlatform(
operatingSystem: 'linux', operatingSystem: 'linux',
environment: <String, String>{ environment: <String, String>{
'FLUTTER_ROOT': _kTestFlutterRoot 'FLUTTER_ROOT': _kTestFlutterRoot,
'HOME': '/',
} }
); );
final Platform notLinuxPlatform = FakePlatform( final Platform notLinuxPlatform = FakePlatform(
......
...@@ -26,7 +26,7 @@ import '../../src/testbed.dart'; ...@@ -26,7 +26,7 @@ import '../../src/testbed.dart';
class FakeXcodeProjectInterpreterWithProfile extends FakeXcodeProjectInterpreter { class FakeXcodeProjectInterpreterWithProfile extends FakeXcodeProjectInterpreter {
@override @override
Future<XcodeProjectInfo> getInfo(String projectPath, {String projectFilename}) async { Future<XcodeProjectInfo> getInfo(String projectPath, { String projectFilename }) async {
return XcodeProjectInfo( return XcodeProjectInfo(
<String>['Runner'], <String>['Runner'],
<String>['Debug', 'Profile', 'Release'], <String>['Debug', 'Profile', 'Release'],
...@@ -40,6 +40,7 @@ final Platform macosPlatform = FakePlatform( ...@@ -40,6 +40,7 @@ final Platform macosPlatform = FakePlatform(
operatingSystem: 'macos', operatingSystem: 'macos',
environment: <String, String>{ environment: <String, String>{
'FLUTTER_ROOT': '/', 'FLUTTER_ROOT': '/',
'HOME': '/',
} }
); );
final Platform notMacosPlatform = FakePlatform( final Platform notMacosPlatform = FakePlatform(
......
...@@ -28,6 +28,7 @@ final Platform windowsPlatform = FakePlatform( ...@@ -28,6 +28,7 @@ final Platform windowsPlatform = FakePlatform(
environment: <String, String>{ environment: <String, String>{
'PROGRAMFILES(X86)': r'C:\Program Files (x86)\', 'PROGRAMFILES(X86)': r'C:\Program Files (x86)\',
'FLUTTER_ROOT': flutterRoot, 'FLUTTER_ROOT': flutterRoot,
'USERPROFILE': '/',
} }
); );
final Platform notWindowsPlatform = FakePlatform( final Platform notWindowsPlatform = FakePlatform(
......
...@@ -34,6 +34,7 @@ void main() { ...@@ -34,6 +34,7 @@ void main() {
final String outputFilePath = line.split(apkDebugMessage).last.trim(); final String outputFilePath = line.split(apkDebugMessage).last.trim();
expect(fileSystem.file(fileSystem.path.join(woringDirectory, outputFilePath)), exists); expect(fileSystem.file(fileSystem.path.join(woringDirectory, outputFilePath)), exists);
expect(outputFilePath, contains('.flutter-devtools'));
expect(result.exitCode, 0); expect(result.exitCode, 0);
}); });
......
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