Switch ios-swift-support.js hook to before_build
#786
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
We had a problem using
cordova-plugin-iosrtc
in our project.Our project is based on Meteor 3, which had an update from Meteor 2, previously, where the plugin worked without a hitch.
Now Meteor is a special fellow in how it uses cordova; it doesn't utilize the command line tools, but instead manages the build process by itself, using the cordova library to do the project composition and build steps.
Which makes it a bit out of the norm I guess.
But yeah! With Meteor 3, which also brought a big jump in the Node.js version from 14.x to 20+, suddenly this plugin wouldn't build on iOS anymore, because this one hook file for iOS (
extra/hooks/iosrtc-swift-support.js
) would get executed before this plugins' npm dependencies had been installed.It took a bit for us to figure that one out...
We still don't fully understand why the order of the execution has changed between the Node.js & Meteor versions switch; we just know it did.
Looking at the Cordova hooks documentation: https://cordova.apache.org/docs/en/latest/guide/appdev/hooks/ , the hook
after_prepare
gets run a lot:(eg. after the prepare step, after the platform add step...) but which then apparently would lead it to be run even before all the deps were installed.
Switching to the
before_build
hook sounded promising, so we gave it a shot, and - it seems to work for us:Of course we don't know how this might impact other setups; I am not versed too well in the cordova plugin hooks system, unfortunately. But if this would continue to work for everybody and doesn't bring any downsides it'd be cool if this could be merged, of course, so we wouldn't have to maintain our own fork (and it might of course even help others too, in the future).
Thank you and best wishes everyone!