mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 22:11:12 +00:00
refactor(android): classify runtime families with components (#16630)
This commit is contained in:
1 parent
2cb23ab6fc
commit
dbd14959ca
1 file changed
+23
-27
@@ -84,7 +84,7 @@ export const projectAndroidInventory = (
|
||||
const unavailable = entries.flatMap(({ unavailable }) =>
|
||||
unavailable === undefined ? [] : [unavailable],
|
||||
);
|
||||
const components = classify(all);
|
||||
const { components, runtimeFamilies } = classify(all);
|
||||
const bridgeProjection = projectManagedNativeCandidates(
|
||||
[...components.dex, ...components.jvm_classes],
|
||||
components.native_libraries,
|
||||
@@ -127,7 +127,7 @@ export const projectAndroidInventory = (
|
||||
.sort(compareUnicodeCodePoints),
|
||||
components,
|
||||
unavailable_components: unavailable,
|
||||
runtime_families: runtimeFamilies(components),
|
||||
runtime_families: runtimeFamilies,
|
||||
bridge_candidates: bridgeProjection.candidates,
|
||||
bridge_candidate_coverage: bridgeProjection.coverage,
|
||||
coverage,
|
||||
@@ -155,45 +155,41 @@ const classify = (all: readonly Component[]) => {
|
||||
const native_libraries: Component[] = [];
|
||||
const javascript: Component[] = [];
|
||||
const signing: Component[] = [];
|
||||
const families = new Set<
|
||||
AndroidApplicationProjectionResult["runtime_families"][number]
|
||||
>();
|
||||
for (const component of all) {
|
||||
const { path, format } = component;
|
||||
if (ANDROID_MANIFEST_RE.test(path)) manifests.push(component);
|
||||
if (ANDROID_RESOURCES_RE.test(path)) resources.push(component);
|
||||
if (ANDROID_DEX_RE.test(path)) dex.push(component);
|
||||
if (ANDROID_JVM_CLASS_RE.test(path)) jvm_classes.push(component);
|
||||
if (format === "elf" || ANDROID_NATIVE_LIB_RE.test(path))
|
||||
if (format === "elf" || ANDROID_NATIVE_LIB_RE.test(path)) {
|
||||
native_libraries.push(component);
|
||||
if (format === "elf") families.add("native");
|
||||
const convention = nativeRuntimeConvention(path);
|
||||
if (convention !== null) families.add(convention);
|
||||
}
|
||||
if (format === "javascript-bundle") javascript.push(component);
|
||||
if (isV1SignatureMetadataName(path)) signing.push(component);
|
||||
}
|
||||
if (dex.length > 0) families.add("dalvik-art");
|
||||
if (jvm_classes.length > 0) families.add("java-kotlin");
|
||||
if (javascript.length > 0) families.add("javascript");
|
||||
return {
|
||||
manifests,
|
||||
resources,
|
||||
dex,
|
||||
jvm_classes,
|
||||
native_libraries,
|
||||
javascript,
|
||||
signing,
|
||||
components: {
|
||||
manifests,
|
||||
resources,
|
||||
dex,
|
||||
jvm_classes,
|
||||
native_libraries,
|
||||
javascript,
|
||||
signing,
|
||||
},
|
||||
runtimeFamilies: [...families].sort(compareUnicodeCodePoints),
|
||||
};
|
||||
};
|
||||
|
||||
const runtimeFamilies = (
|
||||
components: AndroidApplicationProjectionResult["components"],
|
||||
) => {
|
||||
const families = new Set<
|
||||
AndroidApplicationProjectionResult["runtime_families"][number]
|
||||
>();
|
||||
if (components.dex.length > 0) families.add("dalvik-art");
|
||||
if (components.jvm_classes.length > 0) families.add("java-kotlin");
|
||||
if (components.javascript.length > 0) families.add("javascript");
|
||||
for (const { path, format } of components.native_libraries) {
|
||||
if (format === "elf") families.add("native");
|
||||
const convention = nativeRuntimeConvention(path);
|
||||
if (convention !== null) families.add(convention);
|
||||
}
|
||||
return [...families].sort(compareUnicodeCodePoints);
|
||||
};
|
||||
|
||||
const bridgeBasis = (
|
||||
path: string,
|
||||
): AndroidApplicationProjectionResult["bridge_candidates"][number]["basis"] => {
|
||||
|
||||
Reference in new issue
Block a user