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
0b653301
Unverified
Commit
0b653301
authored
Apr 13, 2021
by
Dan Field
Committed by
GitHub
Apr 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an option to specify the output for code size intermediate files (#80310)
parent
b7214a9a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
2 deletions
+38
-2
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+13
-1
analyze_size_test.dart
...utter_tools/test/integration.shard/analyze_size_test.dart
+24
-0
common.dart
packages/flutter_tools/test/src/common.dart
+1
-1
No files found.
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
0b653301
...
...
@@ -115,6 +115,7 @@ class FlutterOptions {
static
const
String
kDeviceUser
=
'device-user'
;
static
const
String
kDeviceTimeout
=
'device-timeout'
;
static
const
String
kAnalyzeSize
=
'analyze-size'
;
static
const
String
kCodeSizeDirectory
=
'code-size-directory'
;
static
const
String
kNullAssertions
=
'null-assertions'
;
static
const
String
kAndroidGradleDaemon
=
'android-gradle-daemon'
;
static
const
String
kDeferredComponents
=
'deferred-components'
;
...
...
@@ -831,8 +832,16 @@ abstract class FlutterCommand extends Command<void> {
'This flag is only supported on "--release" builds. When building for Android, a single '
'ABI must be specified at a time with the "--target-platform" flag. When building for iOS, '
'only the symbols from the arm64 architecture are used to analyze code size.
\n
'
'By default, the intermediate output files will be placed in a transient directory in the '
'build directory. This can be overriden with the "--
${FlutterOptions.kCodeSizeDirectory}
" option.
\n
'
'This flag cannot be combined with "--
${FlutterOptions.kSplitDebugInfoOption}
".'
);
argParser
.
addOption
(
FlutterOptions
.
kCodeSizeDirectory
,
help:
'The location to write code size analysis files. If this is not specified, files '
'are written to a temporary directory under the build directory.'
);
}
/// Compute the [BuildInfo] for the current flutter command.
...
...
@@ -877,10 +886,13 @@ abstract class FlutterCommand extends Command<void> {
String
codeSizeDirectory
;
if
(
argParser
.
options
.
containsKey
(
FlutterOptions
.
kAnalyzeSize
)
&&
boolArg
(
FlutterOptions
.
kAnalyzeSize
))
{
final
Directory
directory
=
globals
.
fsUtils
.
getUniqueDirectory
(
Directory
directory
=
globals
.
fsUtils
.
getUniqueDirectory
(
globals
.
fs
.
directory
(
getBuildDirectory
()),
'flutter_size'
,
);
if
(
argParser
.
options
.
containsKey
(
FlutterOptions
.
kCodeSizeDirectory
)
&&
stringArg
(
FlutterOptions
.
kCodeSizeDirectory
)
!=
null
)
{
directory
=
globals
.
fs
.
directory
(
stringArg
(
FlutterOptions
.
kCodeSizeDirectory
));
}
directory
.
createSync
(
recursive:
true
);
codeSizeDirectory
=
directory
.
path
;
}
...
...
packages/flutter_tools/test/integration.shard/analyze_size_test.dart
View file @
0b653301
...
...
@@ -4,6 +4,7 @@
// @dart = 2.8
import
'package:file/file.dart'
;
import
'package:file_testing/file_testing.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
...
...
@@ -117,4 +118,27 @@ void main() {
expect
(
result
.
exitCode
,
1
);
});
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
ProcessResult
result
=
await
processManager
.
run
(<
String
>[
flutterBin
,
...
getLocalEngineArguments
(),
'build'
,
'apk'
,
'--analyze-size'
,
'--code-size-directory=
${tempDir.path}
'
,
'--target-platform=android-arm64'
,
'--release'
,
],
workingDirectory:
fileSystem
.
path
.
join
(
getFlutterRoot
(),
'examples'
,
'hello_world'
));
expect
(
result
.
exitCode
,
0
);
expect
(
tempDir
.
existsSync
(),
true
);
expect
(
tempDir
.
childFile
(
'snapshot.arm64-v8a.json'
).
existsSync
(),
true
);
expect
(
tempDir
.
childFile
(
'trace.arm64-v8a.json'
).
existsSync
(),
true
);
tempDir
.
deleteSync
(
recursive:
true
);
});
}
packages/flutter_tools/test/src/common.dart
View file @
0b653301
...
...
@@ -164,7 +164,7 @@ void test(String description, FutureOr<void> Function() body, {
/// Executes a test body in zone that does not allow context-based injection.
///
/// For classes which have been refactored to exclude
d
context-based injection
/// For classes which have been refactored to exclude context-based injection
/// or globals like [fs] or [platform], prefer using this test method as it
/// will prevent accidentally including these context getters in future code
/// changes.
...
...
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