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
d19bdc43
Unverified
Commit
d19bdc43
authored
May 01, 2018
by
Chris Bracken
Committed by
GitHub
May 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Improve AOT snapshot input verification + cleanup (#17136)" (#17142)
This reverts commit
100be23a
.
parent
709b0cb2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
62 deletions
+67
-62
build.dart
packages/flutter_tools/lib/src/base/build.dart
+57
-52
build_test.dart
packages/flutter_tools/test/base/build_test.dart
+10
-10
No files found.
packages/flutter_tools/lib/src/base/build.dart
View file @
d19bdc43
...
...
@@ -264,16 +264,36 @@ class Snapshotter {
@required
bool
preferSharedLibrary
,
List
<
String
>
extraGenSnapshotOptions:
const
<
String
>[],
})
async
{
if
(!
_isValidAotPlatform
(
platform
))
{
if
(!(
platform
==
TargetPlatform
.
android_arm
||
platform
==
TargetPlatform
.
android_arm64
||
platform
==
TargetPlatform
.
ios
))
{
printError
(
'
${getNameForTargetPlatform(platform)}
does not support AOT compilation.'
);
return
-
2
;
}
final
bool
compileToSharedLibrary
=
preferSharedLibrary
&&
androidSdk
.
ndkCompiler
!=
null
;
final
Directory
outputDir
=
fs
.
directory
(
outputPath
);
outputDir
.
createSync
(
recursive:
true
);
final
String
vmSnapshotData
=
fs
.
path
.
join
(
outputDir
.
path
,
'vm_snapshot_data'
);
final
String
isolateSnapshotData
=
fs
.
path
.
join
(
outputDir
.
path
,
'isolate_snapshot_data'
);
final
String
depfilePath
=
fs
.
path
.
join
(
outputDir
.
path
,
'snapshot.d'
);
final
String
assembly
=
fs
.
path
.
join
(
outputDir
.
path
,
'snapshot_assembly.S'
);
final
String
assemblyO
=
fs
.
path
.
join
(
outputDir
.
path
,
'snapshot_assembly.o'
);
final
String
assemblySo
=
fs
.
path
.
join
(
outputDir
.
path
,
'app.so'
);
final
bool
compileToSharedLibrary
=
preferSharedLibrary
&&
androidSdk
.
ndkCompiler
!=
null
;
if
(
preferSharedLibrary
&&
!
compileToSharedLibrary
)
{
printStatus
(
'Could not find NDK compiler. Not building in shared library mode.'
);
printStatus
(
'Could not find NDK compiler. Not building in shared library mode'
);
}
final
String
vmEntryPoints
=
artifacts
.
getArtifactPath
(
Artifact
.
dartVmEntryPointsTxt
,
platform
,
buildMode
);
assert
(
vmEntryPoints
!=
null
);
final
String
ioEntryPoints
=
artifacts
.
getArtifactPath
(
Artifact
.
dartIoEntriesTxt
,
platform
,
buildMode
);
assert
(
ioEntryPoints
!=
null
);
final
PackageMap
packageMap
=
new
PackageMap
(
packagesPath
);
final
String
packageMapError
=
packageMap
.
checkValid
();
if
(
packageMapError
!=
null
)
{
...
...
@@ -281,19 +301,19 @@ class Snapshotter {
return
-
3
;
}
final
Directory
outputDir
=
fs
.
directory
(
outputPath
);
outputDir
.
createSync
(
recursive:
true
);
final
String
skyEnginePkg
=
_getPackagePath
(
packageMap
,
'sky_engine'
);
final
String
uiPath
=
fs
.
path
.
join
(
skyEnginePkg
,
'lib'
,
'ui'
,
'ui.dart'
);
final
String
vmServicePath
=
fs
.
path
.
join
(
skyEnginePkg
,
'sdk_ext'
,
'vmservice_io.dart'
);
final
List
<
String
>
inputPaths
=
<
String
>[
uiPath
,
vmServicePath
,
mainPath
];
final
List
<
String
>
inputPaths
=
<
String
>[
vmEntryPoints
,
ioEntryPoints
,
uiPath
,
vmServicePath
,
mainPath
];
final
Set
<
String
>
outputPaths
=
new
Set
<
String
>();
final
String
vmSnapshotData
=
fs
.
path
.
join
(
outputDir
.
path
,
'vm_snapshot_data'
);
final
String
isolateSnapshotData
=
fs
.
path
.
join
(
outputDir
.
path
,
'isolate_snapshot_data'
);
final
String
depfilePath
=
fs
.
path
.
join
(
outputDir
.
path
,
'snapshot.d'
);
final
Iterable
<
String
>
missingInputs
=
inputPaths
.
where
((
String
p
)
=>
!
fs
.
isFileSync
(
p
));
if
(
missingInputs
.
isNotEmpty
)
{
printError
(
'Missing input files:
$missingInputs
'
);
return
-
4
;
}
final
List
<
String
>
genSnapshotArgs
=
<
String
>[
'--vm_snapshot_data=
$vmSnapshotData
'
,
'--isolate_snapshot_data=
$isolateSnapshotData
'
,
...
...
@@ -301,56 +321,42 @@ class Snapshotter {
'--url_mapping=dart:vmservice_io,
$vmServicePath
'
,
'--dependencies=
$depfilePath
'
,
];
if
(
previewDart2
)
{
genSnapshotArgs
.
addAll
(<
String
>[
'--reify-generic-functions'
,
'--strong'
,
]);
}
if
(
buildMode
!=
BuildMode
.
release
)
{
genSnapshotArgs
.
addAll
(<
String
>[
'--no-checked'
,
'--conditional_directives'
,
]);
}
if
(
extraGenSnapshotOptions
!=
null
&&
extraGenSnapshotOptions
.
isNotEmpty
)
{
printTrace
(
'Extra gen_snapshot options:
$extraGenSnapshotOptions
'
);
if
((
extraGenSnapshotOptions
!=
null
)
&&
extraGenSnapshotOptions
.
isNotEmpty
)
{
printTrace
(
'Extra gen-snapshot options:
$extraGenSnapshotOptions
'
);
genSnapshotArgs
.
addAll
(
extraGenSnapshotOptions
);
}
final
bool
interpreter
=
_isInterpreted
(
platform
,
buildMode
);
if
(!
interpreter
)
{
final
String
vmEntryPoints
=
artifacts
.
getArtifactPath
(
Artifact
.
dartVmEntryPointsTxt
,
platform
,
buildMode
);
final
String
ioEntryPoints
=
artifacts
.
getArtifactPath
(
Artifact
.
dartIoEntriesTxt
,
platform
,
buildMode
);
genSnapshotArgs
.
add
(
'--embedder_entry_points_manifest=
$vmEntryPoints
'
);
genSnapshotArgs
.
add
(
'--embedder_entry_points_manifest=
$ioEntryPoints
'
);
inputPaths
..
addAll
(<
String
>[
vmEntryPoints
,
ioEntryPoints
]);
}
// iOS s
napshot generated files, compiled object files
.
// iOS s
ymbols used to load snapshot data in the engine
.
const
String
kVmSnapshotData
=
'kDartVmSnapshotData'
;
const
String
kIsolateSnapshotData
=
'kDartIsolateSnapshotData'
;
// iOS snapshot generated files, compiled object files.
final
String
kVmSnapshotDataO
=
fs
.
path
.
join
(
outputDir
.
path
,
'
$kVmSnapshotData
.o'
);
final
String
kIsolateSnapshotDataO
=
fs
.
path
.
join
(
outputDir
.
path
,
'
$kIsolateSnapshotData
.o'
);
// Compile-to-assembly outputs.
final
String
assembly
=
fs
.
path
.
join
(
outputDir
.
path
,
'snapshot_assembly.S'
);
final
String
assemblyO
=
fs
.
path
.
join
(
outputDir
.
path
,
'snapshot_assembly.o'
);
final
String
assemblySo
=
fs
.
path
.
join
(
outputDir
.
path
,
'app.so'
);
switch
(
platform
)
{
case
TargetPlatform
.
android_arm
:
case
TargetPlatform
.
android_arm64
:
case
TargetPlatform
.
android_x64
:
case
TargetPlatform
.
android_x86
:
final
String
vmSnapshotInstructions
=
fs
.
path
.
join
(
outputDir
.
path
,
'vm_snapshot_instr'
);
final
String
isolateSnapshotInstructions
=
fs
.
path
.
join
(
outputDir
.
path
,
'isolate_snapshot_instr'
);
if
(
compileToSharedLibrary
)
{
outputPaths
.
add
(
assemblySo
);
genSnapshotArgs
.
add
(
'--snapshot_kind=app-aot-assembly'
);
genSnapshotArgs
.
add
(
'--assembly=
$assembly
'
);
}
else
{
final
String
vmSnapshotInstructions
=
fs
.
path
.
join
(
outputDir
.
path
,
'vm_snapshot_instr'
);
final
String
isolateSnapshotInstructions
=
fs
.
path
.
join
(
outputDir
.
path
,
'isolate_snapshot_instr'
);
outputPaths
.
addAll
(<
String
>[
vmSnapshotData
,
isolateSnapshotData
]);
outputPaths
.
addAll
(<
String
>[
vmSnapshotData
,
isolateSnapshotData
,
]);
genSnapshotArgs
.
addAll
(<
String
>[
'--snapshot_kind=app-aot-blobs'
,
'--vm_snapshot_instructions=
$vmSnapshotInstructions
'
,
...
...
@@ -388,14 +394,13 @@ class Snapshotter {
assert
(
false
);
}
// Verify that all required inputs exist.
final
Iterable
<
String
>
missingInputs
=
inputPaths
.
where
((
String
p
)
=>
!
fs
.
isFileSync
(
p
));
if
(
missingInputs
.
isNotEmpty
)
{
printError
(
'Missing input files:
$missingInputs
from
$inputPaths
'
);
return
-
4
;
if
(
buildMode
!=
BuildMode
.
release
)
{
genSnapshotArgs
.
addAll
(<
String
>[
'--no-checked'
,
'--conditional_directives'
,
])
;
}
// If inputs and outputs have not changed since last run, skip the build.
final
String
fingerprintPath
=
'
$depfilePath
.fingerprint'
;
final
SnapshotType
snapshotType
=
new
SnapshotType
(
platform
,
buildMode
);
if
(!
await
_isBuildRequired
(
snapshotType
,
outputPaths
,
depfilePath
,
mainPath
,
fingerprintPath
))
{
...
...
@@ -403,6 +408,12 @@ class Snapshotter {
return
0
;
}
if
(
previewDart2
)
{
genSnapshotArgs
.
addAll
(<
String
>[
'--reify-generic-functions'
,
'--strong'
,
]);
}
genSnapshotArgs
.
add
(
mainPath
);
final
int
genSnapshotExitCode
=
await
genSnapshot
.
run
(
...
...
@@ -425,10 +436,12 @@ class Snapshotter {
if
(
platform
==
TargetPlatform
.
ios
)
{
printStatus
(
'Building App.framework...'
);
final
String
kVmSnapshotDataC
=
fs
.
path
.
join
(
outputDir
.
path
,
'
$kVmSnapshotData
.c'
);
final
String
kIsolateSnapshotDataC
=
fs
.
path
.
join
(
outputDir
.
path
,
'
$kIsolateSnapshotData
.c'
);
const
List
<
String
>
commonBuildOptions
=
const
<
String
>[
'-arch'
,
'arm64'
,
'-miphoneos-version-min=8.0'
];
if
(
interpreter
)
{
final
String
kVmSnapshotDataC
=
fs
.
path
.
join
(
outputDir
.
path
,
'
$kVmSnapshotData
.c'
);
final
String
kIsolateSnapshotDataC
=
fs
.
path
.
join
(
outputDir
.
path
,
'
$kIsolateSnapshotData
.c'
);
await
fs
.
file
(
vmSnapshotData
).
rename
(
fs
.
path
.
join
(
outputDir
.
path
,
kVmSnapshotData
));
await
fs
.
file
(
isolateSnapshotData
).
rename
(
fs
.
path
.
join
(
outputDir
.
path
,
kIsolateSnapshotData
));
...
...
@@ -484,14 +497,6 @@ class Snapshotter {
return
0
;
}
bool
_isValidAotPlatform
(
TargetPlatform
platform
)
{
return
const
<
TargetPlatform
>[
TargetPlatform
.
android_arm
,
TargetPlatform
.
android_arm64
,
TargetPlatform
.
ios
,
].
contains
(
platform
);
}
/// Returns true if the specified platform and build mode require running in interpreted mode.
bool
_isInterpreted
(
TargetPlatform
platform
,
BuildMode
buildMode
)
{
return
platform
==
TargetPlatform
.
ios
&&
buildMode
==
BuildMode
.
debug
;
...
...
packages/flutter_tools/test/base/build_test.dart
View file @
d19bdc43
...
...
@@ -662,12 +662,12 @@ void main() {
'--url_mapping=dart:ui,
${fs.path.join(skyEnginePath, 'lib', 'ui', 'ui.dart')}
'
,
'--url_mapping=dart:vmservice_io,
${fs.path.join(skyEnginePath, 'sdk_ext', 'vmservice_io.dart')}
'
,
'--dependencies=
${fs.path.join(outputPath, 'snapshot.d')}
'
,
'--reify-generic-functions'
,
'--strong'
,
'--no-checked'
,
'--conditional_directives'
,
'--snapshot_kind=core'
,
'snapshot.dart'
,
'--no-checked'
,
'--conditional_directives'
,
'--reify-generic-functions'
,
'--strong'
,
'main.dill'
,
]);
},
overrides:
contextOverrides
);
...
...
@@ -704,14 +704,14 @@ void main() {
'--url_mapping=dart:ui,
${fs.path.join(skyEnginePath, 'lib', 'ui', 'ui.dart')}
'
,
'--url_mapping=dart:vmservice_io,
${fs.path.join(skyEnginePath, 'sdk_ext', 'vmservice_io.dart')}
'
,
'--dependencies=
${fs.path.join(outputPath, 'snapshot.d')}
'
,
'--reify-generic-functions'
,
'--strong'
,
'--no-checked'
,
'--conditional_directives'
,
'--embedder_entry_points_manifest=
$kVmEntrypoints
'
,
'--embedder_entry_points_manifest=
$kIoEntries
'
,
'--snapshot_kind=app-aot-assembly'
,
'--assembly=
${fs.path.join(outputPath, 'snapshot_assembly.S')}
'
,
'--no-checked'
,
'--conditional_directives'
,
'--reify-generic-functions'
,
'--strong'
,
'main.dill'
,
]);
},
overrides:
contextOverrides
);
...
...
@@ -748,12 +748,12 @@ void main() {
'--url_mapping=dart:ui,
${fs.path.join(skyEnginePath, 'lib', 'ui', 'ui.dart')}
'
,
'--url_mapping=dart:vmservice_io,
${fs.path.join(skyEnginePath, 'sdk_ext', 'vmservice_io.dart')}
'
,
'--dependencies=
${fs.path.join(outputPath, 'snapshot.d')}
'
,
'--reify-generic-functions'
,
'--strong'
,
'--embedder_entry_points_manifest=
$kVmEntrypoints
'
,
'--embedder_entry_points_manifest=
$kIoEntries
'
,
'--snapshot_kind=app-aot-assembly'
,
'--assembly=
${fs.path.join(outputPath, 'snapshot_assembly.S')}
'
,
'--reify-generic-functions'
,
'--strong'
,
'main.dill'
,
]);
},
overrides:
contextOverrides
);
...
...
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