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
a3221667
Unverified
Commit
a3221667
authored
Aug 16, 2019
by
Dan Field
Committed by
GitHub
Aug 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Kill dead code (#38652)
parent
13844aa6
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
441 deletions
+0
-441
build.dart
packages/flutter_tools/lib/src/base/build.dart
+0
-140
build_test.dart
...ges/flutter_tools/test/general.shard/base/build_test.dart
+0
-301
No files found.
packages/flutter_tools/lib/src/base/build.dart
View file @
a3221667
...
...
@@ -18,7 +18,6 @@ import '../reporting/reporting.dart';
import
'context.dart'
;
import
'file_system.dart'
;
import
'fingerprint.dart'
;
import
'process.dart'
;
GenSnapshot
get
genSnapshot
=>
context
.
get
<
GenSnapshot
>();
...
...
@@ -349,142 +348,3 @@ class AOTSnapshotter {
return
value
;
}
}
class
JITSnapshotter
{
/// Builds a JIT VM snapshot of the specified kernel. This snapshot includes
/// data as well as either machine code or DBC, depending on build configuration.
Future
<
int
>
build
({
@required
TargetPlatform
platform
,
@required
BuildMode
buildMode
,
@required
String
mainPath
,
@required
String
packagesPath
,
@required
String
outputPath
,
@required
String
compilationTraceFilePath
,
List
<
String
>
extraGenSnapshotOptions
=
const
<
String
>[],
})
async
{
if
(!
_isValidJitPlatform
(
platform
))
{
printError
(
'
${getNameForTargetPlatform(platform)}
does not support JIT snapshotting.'
);
return
1
;
}
final
Directory
outputDir
=
fs
.
directory
(
outputPath
);
outputDir
.
createSync
(
recursive:
true
);
final
String
engineVmSnapshotData
=
artifacts
.
getArtifactPath
(
Artifact
.
vmSnapshotData
,
mode:
buildMode
);
final
String
engineIsolateSnapshotData
=
artifacts
.
getArtifactPath
(
Artifact
.
isolateSnapshotData
,
mode:
buildMode
);
final
String
isolateSnapshotData
=
fs
.
path
.
join
(
outputDir
.
path
,
'isolate_snapshot_data'
);
final
String
isolateSnapshotInstructions
=
fs
.
path
.
join
(
outputDir
.
path
,
'isolate_snapshot_instr'
);
final
List
<
String
>
inputPaths
=
<
String
>[
mainPath
,
compilationTraceFilePath
,
engineVmSnapshotData
,
engineIsolateSnapshotData
,
];
final
String
depfilePath
=
fs
.
path
.
join
(
outputDir
.
path
,
'snapshot.d'
);
final
List
<
String
>
genSnapshotArgs
=
<
String
>[
'--deterministic'
,
];
if
(
buildMode
==
BuildMode
.
debug
)
{
genSnapshotArgs
.
add
(
'--enable_asserts'
);
}
if
(
extraGenSnapshotOptions
!=
null
&&
extraGenSnapshotOptions
.
isNotEmpty
)
{
printTrace
(
'Extra gen_snapshot options:
$extraGenSnapshotOptions
'
);
genSnapshotArgs
.
addAll
(
extraGenSnapshotOptions
);
}
final
Set
<
String
>
outputPaths
=
<
String
>{
isolateSnapshotData
,
isolateSnapshotInstructions
,
};
// There are a couple special cases below where we create a snapshot
// with only the data section, which only contains interpreted code.
bool
supportsAppJit
=
true
;
if
(
platform
==
TargetPlatform
.
android_x64
&&
getCurrentHostPlatform
()
==
HostPlatform
.
windows_x64
)
{
supportsAppJit
=
false
;
printStatus
(
'Android x64 dynamic build on Windows x64 will use purely interpreted '
'code for now (see https://github.com/flutter/flutter/issues/17489).'
);
}
if
(
platform
==
TargetPlatform
.
android_x86
)
{
supportsAppJit
=
false
;
printStatus
(
'Android x86 dynamic build will use purely interpreted code for now. '
'To optimize performance, consider using --target-platform=android-x64.'
);
}
genSnapshotArgs
.
addAll
(<
String
>[
'--snapshot_kind=
${supportsAppJit ? 'app-jit' : 'app'}
'
,
'--load_compilation_trace=
$compilationTraceFilePath
'
,
'--load_vm_snapshot_data=
$engineVmSnapshotData
'
,
'--load_isolate_snapshot_data=
$engineIsolateSnapshotData
'
,
'--isolate_snapshot_data=
$isolateSnapshotData
'
,
]);
genSnapshotArgs
.
add
(
'--isolate_snapshot_instructions=
$isolateSnapshotInstructions
'
);
if
(
platform
==
TargetPlatform
.
android_arm
)
{
// Use softfp for Android armv7 devices.
// TODO(cbracken): eliminate this when we fix https://github.com/flutter/flutter/issues/17489
genSnapshotArgs
.
add
(
'--no-sim-use-hardfp'
);
// Not supported by the Pixel in 32-bit mode.
genSnapshotArgs
.
add
(
'--no-use-integer-division'
);
}
genSnapshotArgs
.
add
(
mainPath
);
// 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
1
;
}
// If inputs and outputs have not changed since last run, skip the build.
final
Fingerprinter
fingerprinter
=
Fingerprinter
(
fingerprintPath:
'
$depfilePath
.fingerprint'
,
paths:
<
String
>[
mainPath
,
...
inputPaths
,
...
outputPaths
],
properties:
<
String
,
String
>{
'buildMode'
:
buildMode
.
toString
(),
'targetPlatform'
:
platform
.
toString
(),
'entryPoint'
:
mainPath
,
'extraGenSnapshotOptions'
:
extraGenSnapshotOptions
.
join
(
' '
),
},
depfilePaths:
<
String
>[],
);
// TODO(jonahwilliams): re-enable once this can be proved correct.
// if (await fingerprinter.doesFingerprintMatch()) {
// printTrace('Skipping JIT snapshot build. Fingerprint match.');
// return 0;
// }
final
SnapshotType
snapshotType
=
SnapshotType
(
platform
,
buildMode
);
final
int
genSnapshotExitCode
=
await
genSnapshot
.
run
(
snapshotType:
snapshotType
,
additionalArgs:
genSnapshotArgs
,
);
if
(
genSnapshotExitCode
!=
0
)
{
printError
(
'Dart snapshot generator failed with exit code
$genSnapshotExitCode
'
);
return
genSnapshotExitCode
;
}
// Write path to gen_snapshot, since snapshots have to be re-generated when we roll
// the Dart SDK.
final
String
genSnapshotPath
=
GenSnapshot
.
getSnapshotterPath
(
snapshotType
);
await
outputDir
.
childFile
(
'gen_snapshot.d'
).
writeAsString
(
'gen_snapshot.d:
$genSnapshotPath
\n
'
);
// Compute and record build fingerprint.
await
fingerprinter
.
writeFingerprint
();
return
0
;
}
bool
_isValidJitPlatform
(
TargetPlatform
platform
)
{
return
const
<
TargetPlatform
>[
TargetPlatform
.
android_arm
,
TargetPlatform
.
android_arm64
,
TargetPlatform
.
android_x86
,
TargetPlatform
.
android_x64
,
].
contains
(
platform
);
}
}
packages/flutter_tools/test/general.shard/base/build_test.dart
View file @
a3221667
This diff is collapsed.
Click to expand it.
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