-
Notifications
You must be signed in to change notification settings - Fork 44
fix: Skip lipo
if native module is already universal. Add native module fixtures for lipo
tests
#126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…e-mac-permissions` fixture from https://github.com/codebytere/node-mac-permissions and resolves 3 `it.todo` test cases
lipo
if native module is already universal. Add native module tests for lipo
testslipo
if native module is already universal. Add native module fixtures for lipo
tests
…ve-module-tests # Conflicts: # test/index.spec.ts
…g into asar to leverage `unpack: "**/*.node"` properly.
…ve-module-tests # Conflicts: # src/index.ts # test/util.ts
Quick update: Well this is interesting. Now I'm receiving this in the debug logs:
It's almost like The Buffer for x64 is basically twice the size of the arm64, so something else is happening that is unexpected. Moving this back into Draft state [UPDATE] Debugging it was straightforward, but I could use some of your guidance @erikian . The x64 Lines 190 to 196 in 2b67c90
It outputs the universal It looks like the arm64 app may need to be copied as well to a tmp directory, which then also has the |
@mmaietta all tests pass for me after changing this... Lines 155 to 157 in 7e3167b
...into this: if (isUniversalMachO(x64Content)) {
continue;
} From what I could gather, since we're already joining the single-arch Mach-O files into one universal file in... Lines 190 to 196 in 2b67c90
x64Content (which comes from the .asar that we're generating in... Lines 255 to 258 in 7e3167b
.asar ) is a universal Mach-O file in mergeASARs , we should skip that file, otherwise we'd try to join the already-universal "x64" Mach-O file and the arm64 version into another universal file in...Lines 197 to 200 in 7e3167b
Notice that we never touch the arm64 version in the last snippet — we only use it as one of the inputs for generating a new universal file —, so it's safe to remove the The naming is a bit confusing throughout the project because we start out by copying the x64 app into a temp folder that will eventually become our final universal bundle, so in a lot of places where we use Hope that helps! |
That's amazing, thank you for the advice and investigation! That makes perfect sense.
Would you like me to add some |
47c0921
to
24d5d2c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Left some minor non-blocking comments, but this should be good to land.
Co-authored-by: Erik Moura <[email protected]>
Co-authored-by: Erik Moura <[email protected]>
🎉 This PR is included in version 2.0.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Leveraged TDD from
it.todo
to discover issue of build failing due to universal file not being added toknownMergedMachOFiles
Detected file "Contents/Resources/app/node-mac-permissions.node" that's the same in both x64 and arm64 builds and not covered by the x64ArchFiles rule: "undefined"
lipo
attempting to merge universal filesFixes #130
Functionality added:
lipo
stepisUniversalMachO(buffer: Buffer)
to leverage MachO magic header validation in multiple locationsTestability:
it.todo
test cases and adds some more 💪identical app dirs with universal macho files (e.g., do not shim, just copy x64 dir)
different app dirs with universal macho files (e.g. shim but don't lipo)
identical app dirs with different macho files (e.g. do not shim, but still lipo)
different app dirs with different macho files (e.g. shim and lipo)
works for lipo binary resources
Fixtures added:
hello-world.c
is generated into macho files at test runtime (~1 second added in global test setup) and lipo'd together for a universal fixture.