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
4ba26191
Unverified
Commit
4ba26191
authored
Feb 02, 2021
by
Vyacheslav Egorov
Committed by
GitHub
Feb 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for producing unstripped AOT snapshots. (#75243)
parent
44d5950d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
3 deletions
+84
-3
build.dart
packages/flutter_tools/lib/src/base/build.dart
+16
-3
build_test.dart
...ges/flutter_tools/test/general.shard/base/build_test.dart
+27
-0
android_test.dart
...test/general.shard/build_system/targets/android_test.dart
+41
-0
No files found.
packages/flutter_tools/lib/src/base/build.dart
View file @
4ba26191
...
...
@@ -137,9 +137,20 @@ class AOTSnapshotter {
final
List
<
String
>
genSnapshotArgs
=
<
String
>[
'--deterministic'
,
];
// We strip snapshot by default, but allow to suppress this behavior
// by supplying --no-strip in extraGenSnapshotOptions.
bool
shouldStrip
=
true
;
if
(
extraGenSnapshotOptions
!=
null
&&
extraGenSnapshotOptions
.
isNotEmpty
)
{
_logger
.
printTrace
(
'Extra gen_snapshot options:
$extraGenSnapshotOptions
'
);
genSnapshotArgs
.
addAll
(
extraGenSnapshotOptions
);
for
(
final
String
option
in
extraGenSnapshotOptions
)
{
if
(
option
==
'--no-strip'
)
{
shouldStrip
=
false
;
continue
;
}
genSnapshotArgs
.
add
(
option
);
}
}
final
String
assembly
=
_fileSystem
.
path
.
join
(
outputDir
.
path
,
'snapshot_assembly.S'
);
...
...
@@ -147,17 +158,19 @@ class AOTSnapshotter {
genSnapshotArgs
.
addAll
(<
String
>[
'--snapshot_kind=app-aot-assembly'
,
'--assembly=
$assembly
'
,
'--strip'
]);
}
else
{
final
String
aotSharedLibrary
=
_fileSystem
.
path
.
join
(
outputDir
.
path
,
'app.so'
);
genSnapshotArgs
.
addAll
(<
String
>[
'--snapshot_kind=app-aot-elf'
,
'--elf=
$aotSharedLibrary
'
,
'--strip'
]);
}
if
(
shouldStrip
)
{
genSnapshotArgs
.
add
(
'--strip'
);
}
if
(
platform
==
TargetPlatform
.
android_arm
||
darwinArch
==
DarwinArch
.
armv7
)
{
// Use softfp for Android armv7 devices.
// This is the default for armv7 iOS builds, but harmless to set.
...
...
packages/flutter_tools/test/general.shard/base/build_test.dart
View file @
4ba26191
...
...
@@ -666,5 +666,32 @@ void main() {
expect
(
genSnapshotExitCode
,
0
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
});
testWithoutContext
(
'--no-strip in extraGenSnapshotOptions suppresses --strip'
,
()
async
{
final
String
outputPath
=
fileSystem
.
path
.
join
(
'build'
,
'foo'
);
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
android_arm64
,
mode:
BuildMode
.
release
),
'--deterministic'
,
'--snapshot_kind=app-aot-elf'
,
'--elf=build/foo/app.so'
,
'main.dill'
,
]
));
final
int
genSnapshotExitCode
=
await
snapshotter
.
build
(
platform:
TargetPlatform
.
android_arm64
,
buildMode:
BuildMode
.
release
,
mainPath:
'main.dill'
,
outputPath:
outputPath
,
bitcode:
false
,
splitDebugInfo:
null
,
dartObfuscation:
false
,
extraGenSnapshotOptions:
const
<
String
>[
'--no-strip'
],
);
expect
(
genSnapshotExitCode
,
0
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
});
});
}
packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart
View file @
4ba26191
...
...
@@ -294,6 +294,47 @@ void main() {
ProcessManager:
()
=>
processManager
,
});
testUsingContext
(
'--no-strip in kExtraGenSnapshotOptions suppresses --strip gen_snapshot flag'
,
()
async
{
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[]);
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
outputDir:
fileSystem
.
directory
(
'out'
)..
createSync
(),
defines:
<
String
,
String
>{
kBuildMode:
'release'
,
kExtraGenSnapshotOptions:
'foo,--no-strip,bar'
,
kTargetPlatform:
'android-arm'
,
},
processManager:
processManager
,
artifacts:
artifacts
,
fileSystem:
fileSystem
,
logger:
logger
,
);
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
android_arm64
,
mode:
BuildMode
.
release
,
),
'--deterministic'
,
'foo'
,
'bar'
,
'--snapshot_kind=app-aot-elf'
,
'--elf=
${environment.buildDir.childDirectory('arm64-v8a').childFile('app.so').path}
'
,
environment
.
buildDir
.
childFile
(
'app.dill'
).
path
],
));
environment
.
buildDir
.
createSync
(
recursive:
true
);
environment
.
buildDir
.
childFile
(
'app.dill'
).
createSync
();
environment
.
projectDir
.
childFile
(
'.packages'
).
writeAsStringSync
(
'
\n
'
);
await
const
AndroidAot
(
TargetPlatform
.
android_arm64
,
BuildMode
.
release
)
.
build
(
environment
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
testWithoutContext
(
'android aot bundle copies so from abi directory'
,
()
async
{
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
...
...
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