-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ios: support libnode .xcframework format
- Loading branch information
1 parent
94022b3
commit 7951c0c
Showing
4 changed files
with
28 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
|
||
module.exports = function(context) { | ||
// Require the iOS platform Api to get the Xcode .pbxproj path. | ||
var iosPlatformPath = path.join(context.opts.projectRoot, 'platforms', 'ios'); | ||
var iosAPI = require(path.join(iosPlatformPath, 'cordova', 'Api')); | ||
var iosAPIInstance = new iosAPI(); | ||
var pbxprojPath = iosAPIInstance.locations.pbxproj; | ||
var rootIosProjDir = iosAPIInstance.locations.root; | ||
var cordovaProjPath = iosAPIInstance.locations.xcodeCordovaProj; | ||
var xcFrameworkPath = path.join(cordovaProjPath, 'Plugins', 'nodejs-mobile-cordova', 'NodeMobile.xcframework'); | ||
var relativeXcFrameworkPath = path.relative(rootIosProjDir, xcFrameworkPath); | ||
|
||
// Patch the project file to fix a .xcframework include error. | ||
let pbxProjContents = fs.readFileSync(pbxprojPath).toString(); | ||
pbxProjContents = pbxProjContents.replace('path = libs/ios/nodemobile/NodeMobile.xcframework', `path = "${relativeXcFrameworkPath}"`); | ||
pbxProjContents = pbxProjContents.replace('path = "libs/ios/nodemobile/NodeMobile.xcframework"', `path = "${relativeXcFrameworkPath}"`); | ||
fs.writeFileSync(pbxprojPath, pbxProjContents); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters