Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
4cd0a325
Unverified
Commit
4cd0a325
authored
Jan 17, 2024
by
Christopher Fujino
Committed by
GitHub
Jan 17, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Fix analyze size on arm64 (#141317)
Fixes
https://github.com/flutter/flutter/issues/140659
parent
0c66636a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
24 deletions
+82
-24
macos.dart
...ges/flutter_tools/lib/src/build_system/targets/macos.dart
+16
-16
build_macos.dart
packages/flutter_tools/lib/src/macos/build_macos.dart
+19
-5
build_macos_test.dart
..._tools/test/commands.shard/hermetic/build_macos_test.dart
+47
-3
No files found.
packages/flutter_tools/lib/src/build_system/targets/macos.dart
View file @
4cd0a325
...
@@ -455,22 +455,22 @@ abstract class MacOSBundleFlutterAssets extends Target {
...
@@ -455,22 +455,22 @@ abstract class MacOSBundleFlutterAssets extends Target {
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<plist version="1.0">
<dict>
<dict>
<key>CFBundleDevelopmentRegion</key>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<string>en</string>
<key>CFBundleExecutable</key>
<key>CFBundleExecutable</key>
<string>App</string>
<string>App</string>
<key>CFBundleIdentifier</key>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<string>6.0</string>
<key>CFBundleName</key>
<key>CFBundleName</key>
<string>App</string>
<string>App</string>
<key>CFBundlePackageType</key>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0</string>
<key>CFBundleVersion</key>
<key>CFBundleVersion</key>
<string>1.0</string>
<string>1.0</string>
</dict>
</dict>
</plist>
</plist>
...
...
packages/flutter_tools/lib/src/macos/build_macos.dart
View file @
4cd0a325
...
@@ -181,11 +181,25 @@ Future<void> _writeCodeSizeAnalysis(BuildInfo buildInfo, SizeAnalyzer? sizeAnaly
...
@@ -181,11 +181,25 @@ Future<void> _writeCodeSizeAnalysis(BuildInfo buildInfo, SizeAnalyzer? sizeAnaly
if
(
buildInfo
.
codeSizeDirectory
==
null
||
sizeAnalyzer
==
null
)
{
if
(
buildInfo
.
codeSizeDirectory
==
null
||
sizeAnalyzer
==
null
)
{
return
;
return
;
}
}
final
String
arch
=
DarwinArch
.
x86_64
.
name
;
final
File
?
aotSnapshot
=
DarwinArch
.
values
.
map
<
File
?>((
DarwinArch
arch
)
{
final
File
aotSnapshot
=
globals
.
fs
.
directory
(
buildInfo
.
codeSizeDirectory
)
return
globals
.
fs
.
directory
(
buildInfo
.
codeSizeDirectory
).
childFile
(
'snapshot.
${arch.name}
.json'
);
.
childFile
(
'snapshot.
$arch
.json'
);
// Pick the first if there are multiple for simplicity
final
File
precompilerTrace
=
globals
.
fs
.
directory
(
buildInfo
.
codeSizeDirectory
)
}).
firstWhere
(
.
childFile
(
'trace.
$arch
.json'
);
(
File
?
file
)
=>
file
!.
existsSync
(),
orElse:
()
=>
null
,
);
if
(
aotSnapshot
==
null
)
{
throw
StateError
(
'No code size snapshot file (snapshot.<ARCH>.json) found in
${buildInfo.codeSizeDirectory}
'
);
}
final
File
?
precompilerTrace
=
DarwinArch
.
values
.
map
<
File
?>((
DarwinArch
arch
)
{
return
globals
.
fs
.
directory
(
buildInfo
.
codeSizeDirectory
).
childFile
(
'trace.
${arch.name}
.json'
);
}).
firstWhere
(
(
File
?
file
)
=>
file
!.
existsSync
(),
orElse:
()
=>
null
,
);
if
(
precompilerTrace
==
null
)
{
throw
StateError
(
'No precompiler trace file (trace.<ARCH>.json) found in
${buildInfo.codeSizeDirectory}
'
);
}
// This analysis is only supported for release builds.
// This analysis is only supported for release builds.
// Attempt to guess the correct .app by picking the first one.
// Attempt to guess the correct .app by picking the first one.
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart
View file @
4cd0a325
...
@@ -585,7 +585,49 @@ STDERR STUFF
...
@@ -585,7 +585,49 @@ STDERR STUFF
Platform:
()
=>
macosPlatform
,
Platform:
()
=>
macosPlatform
,
});
});
testUsingContext
(
'Performs code size analysis and sends analytics'
,
()
async
{
testUsingContext
(
'code size analysis throws StateError if no code size snapshot generated by gen_snapshot'
,
()
async
{
final
BuildCommand
command
=
BuildCommand
(
artifacts:
artifacts
,
androidSdk:
FakeAndroidSdk
(),
buildSystem:
TestBuildSystem
.
all
(
BuildResult
(
success:
true
)),
fileSystem:
fileSystem
,
logger:
logger
,
processUtils:
processUtils
,
osUtils:
FakeOperatingSystemUtils
(),
);
createMinimalMockProjectFiles
();
fileSystem
.
file
(
'build/macos/Build/Products/Release/Runner.app/App'
)
..
createSync
(
recursive:
true
)
..
writeAsBytesSync
(
List
<
int
>.
generate
(
10000
,
(
int
index
)
=>
0
));
expect
(
()
=>
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'build'
,
'macos'
,
'--no-pub'
,
'--analyze-size'
]
),
throwsA
(
isA
<
StateError
>().
having
(
(
StateError
err
)
=>
err
.
message
,
'message'
,
'No code size snapshot file (snapshot.<ARCH>.json) found in build/flutter_size_01'
,
),
),
);
expect
(
testLogger
.
statusText
,
isEmpty
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
list
(<
FakeCommand
>[
// we never generate code size snapshot here
setUpFakeXcodeBuildHandler
(
'Release'
),
]),
Platform:
()
=>
macosPlatform
,
FeatureFlags:
()
=>
TestFeatureFlags
(
isMacOSEnabled:
true
),
FileSystemUtils:
()
=>
FileSystemUtils
(
fileSystem:
fileSystem
,
platform:
macosPlatform
),
Usage:
()
=>
usage
,
Analytics:
()
=>
fakeAnalytics
,
});
testUsingContext
(
'Performs code size analysis and sends analytics from arm64 host'
,
()
async
{
final
BuildCommand
command
=
BuildCommand
(
final
BuildCommand
command
=
BuildCommand
(
artifacts:
artifacts
,
artifacts:
artifacts
,
androidSdk:
FakeAndroidSdk
(),
androidSdk:
FakeAndroidSdk
(),
...
@@ -614,8 +656,10 @@ STDERR STUFF
...
@@ -614,8 +656,10 @@ STDERR STUFF
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
list
(<
FakeCommand
>[
ProcessManager:
()
=>
FakeProcessManager
.
list
(<
FakeCommand
>[
// These are generated by gen_snapshot because flutter assemble passes
// extra flags specifying this output path
setUpFakeXcodeBuildHandler
(
'Release'
,
onRun:
()
{
setUpFakeXcodeBuildHandler
(
'Release'
,
onRun:
()
{
fileSystem
.
file
(
'build/flutter_size_01/snapshot.
x86_
64.json'
)
fileSystem
.
file
(
'build/flutter_size_01/snapshot.
arm
64.json'
)
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'''
..
writeAsStringSync
(
'''
[
[
...
@@ -626,7 +670,7 @@ STDERR STUFF
...
@@ -626,7 +670,7 @@ STDERR STUFF
"s": 2400
"s": 2400
}
}
]'''
);
]'''
);
fileSystem
.
file
(
'build/flutter_size_01/trace.
x86_
64.json'
)
fileSystem
.
file
(
'build/flutter_size_01/trace.
arm
64.json'
)
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'{}'
);
..
writeAsStringSync
(
'{}'
);
}),
}),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment