fix(apple): attribute only application-root components in macOS inventories
Directory, ZIP, and DMG inventories can hold installers, disk-image extras, and AppleDouble sidecars beside the app. Those components were classified as the application's frameworks, libraries, JavaScript, and metadata, and fed runtime families and bridge candidates. For these formats, components outside every application root are now left out, with a limitation that counts them. IPA projection is unchanged. A selected directory whose name ends in .app is now its own root by identity, so an empty or partial inventory still reports it. iOS is claimed only for shallow roots that have an Info.plist, so an empty root reports no platform. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b956bd589f
commit
55249704c5
@@ -350,9 +350,14 @@ describe("Apple bundle layouts and containers", () => {
|
||||
macho("Payload/Fixture.app/Fixture"),
|
||||
{ path: "Payload/Fixture.app/embedded.mobileprovision" },
|
||||
macho("Payload/Fixture.app/PlugIns/Share.appex/Share"),
|
||||
macho("SwiftSupport/iphoneos/libswiftCore.dylib"),
|
||||
]),
|
||||
);
|
||||
expect(result.platforms).toEqual(["ios"]);
|
||||
// IPA projection still lists archive components outside Payload/.
|
||||
expect(result.components.native_libraries.map(({ path }) => path)).toEqual([
|
||||
"SwiftSupport/iphoneos/libswiftCore.dylib",
|
||||
]);
|
||||
expect(
|
||||
result.bundles.map(({ path, role, layout }) => [path, role, layout]),
|
||||
).toEqual([
|
||||
@@ -370,3 +375,66 @@ describe("Apple bundle layouts and containers", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("macOS application scope", () => {
|
||||
it("attributes only components inside the application roots", () => {
|
||||
const result = project(
|
||||
inventoryEvidence("zip", "Distribution.zip", [
|
||||
macho("Fixture.app/Contents/MacOS/Fixture"),
|
||||
macho("Fixture.app/Contents/Frameworks/Core.framework/Versions/A/Core"),
|
||||
{
|
||||
path: "Fixture.app/Contents/Resources/app.js",
|
||||
format: "javascript-bundle",
|
||||
},
|
||||
macho("Extras/Plugin.framework/Versions/A/Plugin"),
|
||||
macho("Extras/libextra.dylib"),
|
||||
{ path: "Extras/installer.js", format: "javascript-bundle" },
|
||||
{ path: "Extras/Info.plist" },
|
||||
]),
|
||||
);
|
||||
const paths = (components: readonly { readonly path: string }[]) =>
|
||||
components.map(({ path }) => path);
|
||||
expect(paths(result.components.frameworks)).toEqual([
|
||||
"Fixture.app/Contents/Frameworks/Core.framework/Versions/A/Core",
|
||||
]);
|
||||
expect(paths(result.components.native_libraries)).toEqual([]);
|
||||
expect(paths(result.components.javascript)).toEqual([
|
||||
"Fixture.app/Contents/Resources/app.js",
|
||||
]);
|
||||
expect(paths(result.components.bundle_metadata)).toEqual([]);
|
||||
expect(
|
||||
result.bridge_candidates.every(
|
||||
({ source_path: source, native_path: target }) =>
|
||||
[source, target].every((path) => path.startsWith("Fixture.app/")),
|
||||
),
|
||||
).toBe(true);
|
||||
expect(result.limitations).toContain(
|
||||
"4 inventoried entries outside every application root are not attributed to the application.",
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps a selected .app directory as the root when its contents are missing", () => {
|
||||
const empty = project(inventoryEvidence("directory", "Fixture.app", []));
|
||||
expect(empty).toMatchObject({
|
||||
application_roots: ["."],
|
||||
platforms: [],
|
||||
bundles: [
|
||||
{
|
||||
path: ".",
|
||||
role: "application",
|
||||
layout: "shallow",
|
||||
info_plist_path: null,
|
||||
},
|
||||
],
|
||||
});
|
||||
const partial = project(
|
||||
inventoryEvidence("directory", "Fixture.app", [
|
||||
{ path: "Contents/Resources/Localizable.strings" },
|
||||
]),
|
||||
);
|
||||
expect(partial).toMatchObject({
|
||||
application_roots: ["."],
|
||||
platforms: ["macos"],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user