mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Reapply "Don't link the core snapshot in the Android engine." (flutter/engine#5353)
Add back the core snapshot to runtime_unittests and embedder_unittests.
This commit is contained in:
parent
4537391c78
commit
8e2bc7b70e
@ -104,14 +104,6 @@ source_set("runtime") {
|
||||
|
||||
public_configs = [ "$flutter_root:config" ]
|
||||
|
||||
# In AOT mode, precompiled snapshots contain the instruction buffer.
|
||||
# Generation of the same requires all application specific script code to be
|
||||
# specified up front. In such cases, there can be no generic snapshot.
|
||||
# In Fuchsia, we load from a file instead of linking.
|
||||
if (!flutter_aot && !is_fuchsia) {
|
||||
deps += [ "$flutter_root/lib/snapshot" ]
|
||||
}
|
||||
|
||||
if (flutter_runtime_mode != "release" && !is_fuchsia) {
|
||||
# Only link in Observatory in non-release modes on non-Fuchsia. Fuchsia
|
||||
# instead puts Observatory into the runner's package.
|
||||
|
||||
@ -94,7 +94,7 @@ public class FlutterMain {
|
||||
|
||||
private static boolean sInitialized = false;
|
||||
private static ResourceExtractor sResourceExtractor;
|
||||
private static boolean sIsPrecompiled;
|
||||
private static boolean sIsPrecompiledAsBlobs;
|
||||
private static boolean sIsPrecompiledAsSharedLibrary;
|
||||
private static Settings sSettings;
|
||||
|
||||
@ -201,19 +201,24 @@ public class FlutterMain {
|
||||
if (args != null) {
|
||||
Collections.addAll(shellArgs, args);
|
||||
}
|
||||
if (sIsPrecompiled) {
|
||||
shellArgs.add("--" + AOT_SNAPSHOT_PATH_KEY + "=" +
|
||||
PathUtils.getDataDirectory(applicationContext));
|
||||
if (sIsPrecompiledAsSharedLibrary) {
|
||||
shellArgs.add("--" + AOT_SHARED_LIBRARY_PATH + "=" +
|
||||
new File(PathUtils.getDataDirectory(applicationContext), sAotSharedLibraryPath));
|
||||
} else {
|
||||
if (sIsPrecompiledAsBlobs) {
|
||||
shellArgs.add("--" + AOT_SNAPSHOT_PATH_KEY + "=" +
|
||||
PathUtils.getDataDirectory(applicationContext));
|
||||
} else {
|
||||
shellArgs.add("--cache-dir-path=" +
|
||||
PathUtils.getCacheDirectory(applicationContext));
|
||||
|
||||
shellArgs.add("--" + AOT_SNAPSHOT_PATH_KEY + "=" +
|
||||
PathUtils.getDataDirectory(applicationContext) + "/" + sFlutterAssetsDir);
|
||||
}
|
||||
shellArgs.add("--" + AOT_VM_SNAPSHOT_DATA_KEY + "=" + sAotVmSnapshotData);
|
||||
shellArgs.add("--" + AOT_VM_SNAPSHOT_INSTR_KEY + "=" + sAotVmSnapshotInstr);
|
||||
shellArgs.add("--" + AOT_ISOLATE_SNAPSHOT_DATA_KEY + "=" + sAotIsolateSnapshotData);
|
||||
shellArgs.add("--" + AOT_ISOLATE_SNAPSHOT_INSTR_KEY + "=" + sAotIsolateSnapshotInstr);
|
||||
} else if (sIsPrecompiledAsSharedLibrary) {
|
||||
shellArgs.add("--" + AOT_SHARED_LIBRARY_PATH + "=" +
|
||||
new File(PathUtils.getDataDirectory(applicationContext), sAotSharedLibraryPath));
|
||||
} else {
|
||||
shellArgs.add("--cache-dir-path=" +
|
||||
PathUtils.getCacheDirectory(applicationContext));
|
||||
}
|
||||
|
||||
if (sSettings.getLogTag() != null) {
|
||||
@ -264,6 +269,10 @@ public class FlutterMain {
|
||||
.addResources(SKY_RESOURCES)
|
||||
.addResource(fromFlutterAssets(sFlx))
|
||||
.addResource(fromFlutterAssets(sSnapshotBlob))
|
||||
.addResource(fromFlutterAssets(sAotVmSnapshotData))
|
||||
.addResource(fromFlutterAssets(sAotVmSnapshotInstr))
|
||||
.addResource(fromFlutterAssets(sAotIsolateSnapshotData))
|
||||
.addResource(fromFlutterAssets(sAotIsolateSnapshotInstr))
|
||||
.addResource(fromFlutterAssets(DEFAULT_KERNEL_BLOB))
|
||||
.addResource(fromFlutterAssets(DEFAULT_PLATFORM_DILL));
|
||||
if (sIsPrecompiledAsSharedLibrary) {
|
||||
@ -298,21 +307,21 @@ public class FlutterMain {
|
||||
|
||||
private static void initAot(Context applicationContext) {
|
||||
Set<String> assets = listRootAssets(applicationContext);
|
||||
sIsPrecompiled = assets.containsAll(Arrays.asList(
|
||||
sIsPrecompiledAsBlobs = assets.containsAll(Arrays.asList(
|
||||
sAotVmSnapshotData,
|
||||
sAotVmSnapshotInstr,
|
||||
sAotIsolateSnapshotData,
|
||||
sAotIsolateSnapshotInstr
|
||||
));
|
||||
sIsPrecompiledAsSharedLibrary = assets.contains(sAotSharedLibraryPath);
|
||||
if (sIsPrecompiled && sIsPrecompiledAsSharedLibrary) {
|
||||
if (sIsPrecompiledAsBlobs && sIsPrecompiledAsSharedLibrary) {
|
||||
throw new RuntimeException(
|
||||
"Found precompiled app as shared library and as Dart VM snapshots.");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isRunningPrecompiledCode() {
|
||||
return sIsPrecompiled || sIsPrecompiledAsSharedLibrary;
|
||||
return sIsPrecompiledAsBlobs || sIsPrecompiledAsSharedLibrary;
|
||||
}
|
||||
|
||||
public static String findAppBundlePath(Context applicationContext) {
|
||||
|
||||
@ -48,6 +48,7 @@ executable("embedder_unittests") {
|
||||
deps = [
|
||||
":embedder",
|
||||
":fixtures",
|
||||
"$flutter_root/lib/snapshot",
|
||||
"$flutter_root/testing",
|
||||
]
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@ executable("testing") {
|
||||
"$flutter_root/assets",
|
||||
"$flutter_root/common",
|
||||
"$flutter_root/fml",
|
||||
"$flutter_root/lib/snapshot",
|
||||
"$flutter_root/shell/common",
|
||||
"//garnet/public/lib/fxl",
|
||||
"//third_party/dart/runtime:libdart_jit",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user