fix(artifacts): align projection provider targets
This commit is contained in:
@@ -129,7 +129,10 @@ export const projectAppleApplication = (
|
||||
const runtimeFamilies = identifyRuntimeFamilies(all);
|
||||
const bridgeProjection = identifyBridgeCandidates(
|
||||
retained.javascript,
|
||||
[...retained.frameworks, ...retained.native_libraries],
|
||||
deduplicateComponents([
|
||||
...retained.executables,
|
||||
...retained.native_libraries,
|
||||
]),
|
||||
parsed.limits.max_components,
|
||||
);
|
||||
const limitations = projectionLimitations(
|
||||
@@ -212,6 +215,11 @@ const retainComponents = <Groups extends Record<string, readonly Component[]>>(
|
||||
const componentCount = (groups: Record<string, readonly Component[]>): number =>
|
||||
Object.values(groups).reduce((total, values) => total + values.length, 0);
|
||||
|
||||
const deduplicateComponents = (values: readonly Component[]): Component[] =>
|
||||
[...new Map(values.map((value) => [value.path, value])).values()].sort(
|
||||
(left, right) => compare(left.path, right.path),
|
||||
);
|
||||
|
||||
const identifyRuntimeFamilies = (all: readonly Component[]) => {
|
||||
const paths = all.map(({ path }) => path.toLowerCase());
|
||||
const families = new Set<
|
||||
|
||||
@@ -161,7 +161,7 @@ export const identifyRuntimes = (
|
||||
remaining -= observations.length;
|
||||
const omittedObservations = unique.length - observations.length;
|
||||
omitted += omittedObservations;
|
||||
const provider = PROVIDERS[family];
|
||||
const provider = providerFor(family, inventory.manifest.root_format);
|
||||
return {
|
||||
family,
|
||||
inspection: provider.inspection,
|
||||
@@ -208,11 +208,25 @@ export const identifyRuntimes = (
|
||||
});
|
||||
};
|
||||
|
||||
const providerFor = (
|
||||
family: RuntimeFamily,
|
||||
rootFormat: string,
|
||||
): RuntimeProvider =>
|
||||
family === "android" && rootFormat !== "apk"
|
||||
? {
|
||||
inspection: "provider-selection-required",
|
||||
id: null,
|
||||
reason:
|
||||
"Extract or select an APK root before using the Android application provider.",
|
||||
}
|
||||
: PROVIDERS[family];
|
||||
|
||||
const familiesFor = (format: string, path: string): RuntimeFamily[] => {
|
||||
const families = new Set<RuntimeFamily>();
|
||||
if (
|
||||
format === "apk" ||
|
||||
format === "dex" ||
|
||||
/(?:^|\/)[^/]+\.dex$/iu.test(path) ||
|
||||
/(?:^|\/)AndroidManifest\.xml$/u.test(path)
|
||||
)
|
||||
families.add("android");
|
||||
|
||||
Reference in New Issue
Block a user