Skip to content

Commit 332c43c

Browse files
giginetclaude
andcommitted
Fix .bundle resources not included in Universal binary builds
When building Universal binaries, the collector was finding both the Universal binary from apple/Products/Release/ and single-arch binaries from arm64-apple-macosx/release/ and x86_64-apple-macosx/release/. This created redundant variants, and since .bundle resources only exist in the apple path, single-arch variants were missing resources. This fix filters out single-arch variants that are already covered by Universal binaries, ensuring only the Universal variant (with .bundle) is included in the artifact bundle. Changes: - Add filtering logic in collector.ts to exclude redundant single-arch variants when Universal binary exists - Update test to verify only Universal variant is created and .bundle is included 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 98de59e commit 332c43c

5 files changed

Lines changed: 6418 additions & 6867 deletions

File tree

__test__/main.test.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,21 @@ describe('main', () => {
190190
expect(fs.existsSync(binDir)).toBeTruthy()
191191

192192
const executablePath = path.join(binDir, 'mytool-with-resource')
193-
const bundlePath = path.join(
193+
const resourceBundlePath = path.join(
194194
binDir,
195195
'mytool-with-resource_mytool-with-resource.bundle'
196196
)
197197
expect(fs.existsSync(executablePath)).toBeTruthy()
198-
expect(fs.existsSync(bundlePath)).toBeTruthy()
198+
expect(fs.existsSync(resourceBundlePath)).toBeTruthy()
199+
200+
// Verify resource bundle contents are copied correctly
201+
expect(fs.statSync(resourceBundlePath).isDirectory()).toBeTruthy()
202+
const resourceBundleContents = fs.readdirSync(resourceBundlePath)
203+
expect(resourceBundleContents).toContain('note.txt')
204+
205+
// Verify the file content is preserved
206+
const noteFilePath = path.join(resourceBundlePath, 'note.txt')
207+
expect(fs.existsSync(noteFilePath)).toBeTruthy()
199208
}
200209
}
201210
})
@@ -310,6 +319,21 @@ describe('main', () => {
310319
// Verify executable exists in the universal triple directory
311320
const executablePath = path.join(universalTripleDir, 'bin', 'myexecutable')
312321
expect(fs.existsSync(executablePath)).toBeTruthy()
322+
323+
// Verify only universal variant exists (no single-arch variants)
324+
const tripleDirs = fs
325+
.readdirSync(macosPlatformDir!)
326+
.filter((f) => fs.statSync(path.join(macosPlatformDir!, f)).isDirectory())
327+
expect(tripleDirs).toEqual(['universal-apple-macosx'])
328+
329+
// Verify resource bundle is included in universal variant
330+
const resourceBundlePath = path.join(
331+
universalTripleDir,
332+
'bin',
333+
'myexecutable_myexecutable.bundle'
334+
)
335+
expect(fs.existsSync(resourceBundlePath)).toBeTruthy()
336+
expect(fs.statSync(resourceBundlePath).isDirectory()).toBeTruthy()
313337
})
314338

315339
it('should fail when configuration is not provided', async () => {

badges/coverage.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)