Skip to content
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

feat(plugman): support framework link attribute #1266

Merged
merged 2 commits into from
Apr 14, 2023

Conversation

TylerBreau
Copy link
Contributor

@TylerBreau TylerBreau commented Oct 13, 2022

Update is backwards compatible with previous embed behaviour.

Platforms affected

iOS

Motivation and Context

Currently, the framework tag does not support both linking and embedding a framework. Comments in the code suggest this was a limitation in Apple's code.

This limitation no longer exists. The current default behaviour of XCode (version 14) when dragging and dropping an XCFramework into General -> "Frameworks, Libraries, and Embedded Content" is to both embed and link the XCFramework.
I have only tested this with XCFramework but I assume other kinds of frameworks are the same.

This change allows the framework tag to both link and embed a framework.

In my real-world use case, I am using custom XCFrameworks to get c binaries into my cordova app.
If the XCFramework is not embedded then the App will crash during runtime because it can not find the binaries. This is expected because the binaries were not embedded into the app.
If the XCFramework is not linked then the App can not be built due to linker errors. This is expected because the binaries are not being linked to the app.

cordova-ios unit tests use cordova-common directly. As a result, this PR depends on apache/cordova-common#181 (cordova-common 4.1.0).
In actual usage, cordova-cli parses the framework attributes and gives them to cordova-ios. As a result, this PR also depends on a cordova-cli that is using apache/cordova-common#181 (cordova-common 4.1.0)

cordova-docs pr: apache/cordova-docs#1267

Description

Add code that checks for new framework attribute "link".
If link is not explicitly set, fallback to the previous behaviour (link = !embed).

Testing

I've ran npm test.

Tested various combinations of framework tag's embed and link attributes by installing a plugin using these attributes. I would observe how the XCFramework is added to the the XCode project with the following focuses:
-Is the XCFramework embedded (or not embedded) in Build Phrases?
-Is the XCFramework linked (or not linked) in Build Phrases?
-Is the XCFramework set to "Embed and Sign" in General?

I have ran my company's app using these changes.

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@codecov-commenter
Copy link

codecov-commenter commented Oct 13, 2022

Codecov Report

Merging #1266 (9b0dc61) into master (ad60924) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1266      +/-   ##
==========================================
+ Coverage   78.25%   78.27%   +0.02%     
==========================================
  Files          15       15              
  Lines        1761     1763       +2     
==========================================
+ Hits         1378     1380       +2     
  Misses        383      383              
Impacted Files Coverage Δ
lib/plugman/pluginHandlers.js 90.15% <100.00%> (+0.10%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@TylerBreau TylerBreau changed the title Updated plugman pluginHandlers to support framework link attribute. WIP: Updated plugman pluginHandlers to support framework link attribute. Oct 14, 2022
@msmtamburro
Copy link
Contributor

Nice, thank you.

@TylerBreau
Copy link
Contributor Author

Nice, thank you.

Your welcome. BTW, this PR is still in draft mode as cordova-common, cordova-lib, and cordova-cli PRs will likely become obselete as a result of apache/cordova-common#181.

package.json Outdated Show resolved Hide resolved
@TylerBreau
Copy link
Contributor Author

Opening PR for review.

Noting again, this PR requires a cordova-cli that is using [email protected]. If your environment does not contain this, cordova-ios will not receive the link attribute in an actual cordova project.
Unit tests will work regardless because they use cordova-common directly.

@TylerBreau TylerBreau marked this pull request as ready for review November 22, 2022 16:00
@TylerBreau TylerBreau changed the title WIP: Updated plugman pluginHandlers to support framework link attribute. Updated plugman pluginHandlers to support framework link attribute. Nov 22, 2022
@erisu erisu changed the title Updated plugman pluginHandlers to support framework link attribute. feat(plugman): support framework link attribute Nov 22, 2022
@TylerBreau
Copy link
Contributor Author

Forced-push to update branch with master.

@breautek
Copy link
Contributor

The failing test does not appear to be related to this PR.

We've investigated and determined that issue happens in current master on NodeJS 18. I've created a bug ticket with further details: #1290

@breautek
Copy link
Contributor

Waiting on #1302 so that we can confirm if all test passes.

@breautek breautek force-pushed the addlinkproperty branch 2 times, most recently from 9b0dc61 to 7e10b30 Compare April 14, 2023 17:24
@breautek breautek merged commit 3d6c71a into apache:master Apr 14, 2023
@breautek breautek deleted the addlinkproperty branch April 14, 2023 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants