akofman / cordova-plugin-add-swift-support

:hammer: Swiftify your Cordova app !
MIT License
117 stars 110 forks source link

Fix irregular ios version by using getPlatformVersionsFromFileSystem #36

Closed knight9999 closed 6 years ago

knight9999 commented 7 years ago

This PR is like https://github.com/akofman/cordova-plugin-add-swift-support/pull/35.

Instead of the webpack dependent method __non_webpack_require__, This PR uses the getPlatVersionsFromFileSystem method which is same as the one defined in cordova-lib/platform_metadata.js.


PR #35 is the following.

iOSPlatform version should be the semver form, like "4.4.0". However, If the user add platform ios by using the directory name or git:// case, like

cordova platform add /Home/user/cordova/ios/cordova-ios4.4.0

The iOSPlatform version is Home/user/cordova/ios/cordova-ios4.4.0 not 4.4.0. (See https://github.com/apache/cordova-lib/blob/master/src/cordova/platform_metadata.js and its comment above the getVersions method)

In such case, this plugin hook script does not work.

This pull request, the correct iOSPlatform version is obtained by accessing platform/ios/cordova/version file.

akofman commented 7 years ago

Thanks ! Before merging it, I'm just going to check with the Cordova team if it is possible to expose this function. I don't understand why it's not the case and this will prevent us to copy/paste their sources.

knight9999 commented 7 years ago

I see. Exposing the function getPlatVersionsFromFileSystem is usable.

Mischa1610 commented 7 years ago

For me/us would this Pull Request be also pretty important because we need to use the master branch for cordova-ios because there are fixes regarding XCode 9 and they are not sure when a new version of cordova-ios will be released.

jcesarmobile commented 6 years ago

This probably fixes #43

akofman commented 6 years ago

You're right ! I'm fixing the conflicts and merge this one.

akofman commented 6 years ago

Squashed and merged manually. thx @knight9999 and sorry for the late.