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
fix(ios): append TitaniumKit.xcframework if module is created with sdk < 9.2.0 #12153
Conversation
Tests:
|
Works for me. Want some more eyes on this from other QE's. |
@@ -237,6 +252,60 @@ iOSModuleBuilder.prototype.processLicense = function processLicense() { | |||
}; | |||
|
|||
iOSModuleBuilder.prototype.processTiXcconfig = function processTiXcconfig(next) { | |||
const srcFile = path.join(this.projectDir, this.moduleName + '.xcodeproj', 'project.pbxproj'); | |||
const xcodeProject = xcode.project(path.join(this.projectDir, this.moduleName + '.xcodeproj', 'project.pbxproj')); | |||
const contents = fs.readFileSync(srcFile).toString(); |
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.
FYI, when reading a file, you can avoid converting from Buffer
to String
(calling toString()
), by passing in an encoding argument to the readFile call: fs.readFileSync(srcFile, 'utf8');
this.logger.warn(`Module created with sdk < 9.2.0, need to add TitaniumKit.xcframework. The ${this.moduleName}.xcodeproj has been updated.`); | ||
|
||
xcodeProject.hash = xcodeParser.parse(contents); | ||
const xobjs = xcodeProject.hash.project.objects, |
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.
Just a style thing in JS - in the old days you should use var
and declare all variables at the top of the scope, because JS hoisted them to the top of the scope anyways, so we wanted to match in source to avoid inconsistency. But with let
/const
, they're more like variables in any other language, they're more or less treated as declared/initialized where you define them, so you don't need to stick them at the top of the block/scope. Ideally we'd break up this big block of declared variables and move them to be declared where they're needed to make it easier to follow the logic and which grouping of variables applies to what lines of code used to edit/process them.
This is a long way of saying, most of these variables aren't needed until lines 294/299 below.
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.
Generally LGTM.
For older modules, do they have a TitaniumKit.framework reference that needs to be removed/replaced by the xcframework reference?
https://jira.appcelerator.org/browse/TIMOB-28159