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
590f22ce
Unverified
Commit
590f22ce
authored
Mar 20, 2020
by
Jonah Williams
Committed by
GitHub
Mar 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] restore report timings functionality to build aot (#52918)
parent
a0d93f96
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
102 additions
and
3 deletions
+102
-3
aot.dart
packages/flutter_tools/lib/src/aot.dart
+16
-0
build_system.dart
...ages/flutter_tools/lib/src/build_system/build_system.dart
+23
-2
dart.dart
...ages/flutter_tools/lib/src/build_system/targets/dart.dart
+3
-0
ios.dart
packages/flutter_tools/lib/src/build_system/targets/ios.dart
+3
-0
build_aot.dart
packages/flutter_tools/lib/src/commands/build_aot.dart
+3
-1
android_test.dart
...test/general.shard/build_system/targets/android_test.dart
+4
-0
ios_test.dart
...ols/test/general.shard/build_system/targets/ios_test.dart
+5
-0
build_aot_test.dart
...ter_tools/test/general.shard/commands/build_aot_test.dart
+45
-0
No files found.
packages/flutter_tools/lib/src/aot.dart
View file @
590f22ce
...
...
@@ -30,6 +30,7 @@ class AotBuilder {
bool
bitcode
=
kBitcodeEnabledDefault
,
bool
quiet
=
true
,
Iterable
<
DarwinArch
>
iosBuildArchs
=
defaultIOSArchs
,
bool
reportTimings
,
})
async
{
if
(
platform
==
null
)
{
throwToolExit
(
'No AOT build platform specified'
);
...
...
@@ -106,6 +107,21 @@ class AotBuilder {
throwToolExit
(
'The aot build failed.'
);
}
// This print output is used by the dart team for build benchmarks.
if
(
reportTimings
)
{
final
PerformanceMeasurement
kernel
=
result
.
performance
[
'kernel_snapshot'
];
PerformanceMeasurement
aot
;
if
(
expectSo
)
{
aot
=
result
.
performance
.
values
.
firstWhere
(
(
PerformanceMeasurement
measurement
)
=>
measurement
.
analyicsName
==
'android_aot'
);
}
else
{
aot
=
result
.
performance
.
values
.
firstWhere
(
(
PerformanceMeasurement
measurement
)
=>
measurement
.
analyicsName
==
'ios_aot'
);
}
globals
.
printStatus
(
'frontend(CompileTime):
${kernel.elapsedMilliseconds}
ms.'
);
globals
.
printStatus
(
'snapshot(CompileTime):
${aot.elapsedMilliseconds}
ms.'
);
}
if
(
expectSo
)
{
environment
.
buildDir
.
childFile
(
'app.so'
)
.
copySync
(
globals
.
fs
.
path
.
join
(
outputPath
,
'app.so'
));
...
...
packages/flutter_tools/lib/src/build_system/build_system.dart
View file @
590f22ce
...
...
@@ -114,6 +114,14 @@ abstract class Target {
/// argument to build a particular target.
String
get
name
;
/// A name that measurements can be categorized under for this [Target].
///
/// Unlike [name], this is not expected to be unique, so multiple targets
/// that are conceptually the same can share an analytics name.
///
/// If not provided, defaults to [name]
String
get
analyticsName
=>
name
;
/// The dependencies of this target.
List
<
Target
>
get
dependencies
;
...
...
@@ -594,7 +602,12 @@ class _BuildInstance {
resource
.
release
();
stopwatch
.
stop
();
stepTimings
[
node
.
target
.
name
]
=
PerformanceMeasurement
(
node
.
target
.
name
,
stopwatch
.
elapsedMilliseconds
,
skipped
,
passed
);
target:
node
.
target
.
name
,
elapsedMilliseconds:
stopwatch
.
elapsedMilliseconds
,
skipped:
skipped
,
passed:
passed
,
analyicsName:
node
.
target
.
analyticsName
,
);
}
return
passed
;
}
...
...
@@ -617,11 +630,19 @@ class ExceptionMeasurement {
/// Helper class to collect measurement data.
class
PerformanceMeasurement
{
PerformanceMeasurement
(
this
.
target
,
this
.
elapsedMilliseconds
,
this
.
skipped
,
this
.
passed
);
PerformanceMeasurement
({
@required
this
.
target
,
@required
this
.
elapsedMilliseconds
,
@required
this
.
skipped
,
@required
this
.
passed
,
@required
this
.
analyicsName
,
});
final
int
elapsedMilliseconds
;
final
String
target
;
final
bool
skipped
;
final
bool
passed
;
final
String
analyicsName
;
}
/// Check if there are any dependency cycles in the target.
...
...
packages/flutter_tools/lib/src/build_system/targets/dart.dart
View file @
590f22ce
...
...
@@ -257,6 +257,9 @@ class KernelSnapshot extends Target {
abstract
class
AotElfBase
extends
Target
{
const
AotElfBase
();
@override
String
get
analyticsName
=>
'android_aot'
;
@override
Future
<
void
>
build
(
Environment
environment
)
async
{
final
AOTSnapshotter
snapshotter
=
AOTSnapshotter
(
...
...
packages/flutter_tools/lib/src/build_system/targets/ios.dart
View file @
590f22ce
...
...
@@ -26,6 +26,9 @@ import 'icon_tree_shaker.dart';
abstract
class
AotAssemblyBase
extends
Target
{
const
AotAssemblyBase
();
@override
String
get
analyticsName
=>
'ios_aot'
;
@override
Future
<
void
>
build
(
Environment
environment
)
async
{
final
AOTSnapshotter
snapshotter
=
AOTSnapshotter
(
...
...
packages/flutter_tools/lib/src/commands/build_aot.dart
View file @
590f22ce
...
...
@@ -45,7 +45,8 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
defaultsTo:
kBitcodeEnabledDefault
,
help:
'Build the AOT bundle with bitcode. Requires a compatible bitcode engine.'
,
hide:
true
,
);
)
..
addFlag
(
'report-timings'
,
hide:
true
);
}
AotBuilder
aotBuilder
;
...
...
@@ -76,6 +77,7 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
bitcode:
boolArg
(
'bitcode'
),
quiet:
boolArg
(
'quiet'
),
iosBuildArchs:
stringsArg
(
'ios-arch'
).
map
<
DarwinArch
>(
getIOSArchForName
),
reportTimings:
boolArg
(
'report-timings'
),
);
return
FlutterCommandResult
.
success
();
}
...
...
packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart
View file @
590f22ce
...
...
@@ -22,6 +22,10 @@ void main() {
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
,
environment:
const
<
String
,
String
>{}),
});
test
(
'Android AOT targets has analyicsName'
,
()
{
expect
(
androidArmProfile
.
analyticsName
,
'android_aot'
);
});
testbed
.
test
(
'debug bundle contains expected resources'
,
()
async
{
final
Environment
environment
=
Environment
.
test
(
globals
.
fs
.
currentDirectory
,
...
...
packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart
View file @
590f22ce
...
...
@@ -45,6 +45,11 @@ void main() {
});
});
test
(
'iOS AOT targets has analyicsName'
,
()
{
expect
(
const
AotAssemblyRelease
().
analyticsName
,
'ios_aot'
);
expect
(
const
AotAssemblyProfile
().
analyticsName
,
'ios_aot'
);
});
test
(
'DebugUniveralFramework creates expected binary with arm64 only arch'
,
()
=>
testbed
.
run
(()
async
{
environment
.
defines
[
kIosArchs
]
=
'arm64'
;
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
...
...
packages/flutter_tools/test/general.shard/commands/build_aot_test.dart
View file @
590f22ce
...
...
@@ -3,10 +3,12 @@
// found in the LICENSE file.
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/aot.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/process.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/build_system/build_system.dart'
;
import
'package:flutter_tools/src/ios/bitcode.dart'
;
import
'package:flutter_tools/src/ios/plist_parser.dart'
;
import
'package:flutter_tools/src/macos/xcode.dart'
;
...
...
@@ -106,6 +108,48 @@ void main() {
PlistParser:
()
=>
mockPlistUtils
,
});
testUsingContext
(
'build aot outputs timing info'
,
()
async
{
globals
.
fs
.
file
(
'.dart_tool/flutter_build/cce09742720db17ffec62331bd7e42d5/app.so'
)
.
createSync
(
recursive:
true
);
when
(
buildSystem
.
build
(
any
,
any
))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
BuildResult
(
success:
true
,
performance:
<
String
,
PerformanceMeasurement
>{
'kernel_snapshot'
:
PerformanceMeasurement
(
analyicsName:
'kernel_snapshot'
,
target:
'kernel_snapshot'
,
elapsedMilliseconds:
1000
,
passed:
true
,
skipped:
false
,
),
'anything'
:
PerformanceMeasurement
(
analyicsName:
'android_aot'
,
target:
'anything'
,
elapsedMilliseconds:
1000
,
passed:
true
,
skipped:
false
,
),
});
});
await
AotBuilder
().
build
(
platform:
TargetPlatform
.
android_arm64
,
outputPath:
'/'
,
buildInfo:
BuildInfo
.
release
,
mainDartFile:
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
),
reportTimings:
true
,
);
expect
(
testLogger
.
statusText
,
allOf
(
contains
(
'frontend(CompileTime): 1000 ms.'
),
contains
(
'snapshot(CompileTime): 1000 ms.'
),
));
},
overrides:
<
Type
,
Generator
>{
BuildSystem:
()
=>
MockBuildSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'build aot can parse valid Xcode Clang version (11)'
,
()
async
{
final
Directory
flutterFramework
=
memoryFileSystem
.
directory
(
'ios_profile/Flutter.framework'
)
..
createSync
(
recursive:
true
);
...
...
@@ -227,3 +271,4 @@ void main() {
class
MockXcode
extends
Mock
implements
Xcode
{}
class
MockPlistUtils
extends
Mock
implements
PlistParser
{}
class
MockBuildSystem
extends
Mock
implements
BuildSystem
{}
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