Xcodeproj icon indicating copy to clipboard operation
Xcodeproj copied to clipboard

TargetAttributes is not being updated in project.pbxproj

Open felire opened this issue 4 years ago • 8 comments

Hi, I wrote a script to delete some targets and create some build configurations. The script works fine but the TargetAttributes from project.pbxproj is not being updated. I realized that if I use Xcode after running the script and do something insignificant the file is updated and everything is okey, but I want to avoid that step. Is there any command to update the project.pbxproj file? Something like clean format or something like that?

felire avatar Apr 07 '20 15:04 felire

Is there any command to update the project.pbxproj file?

Do you mean using Xcodeproj::Project.open(...) instead of .new(...)?

dnkoutso avatar Apr 07 '20 16:04 dnkoutso

Yes, I used Xcodeproj::Project.open(...)

felire avatar Apr 07 '20 17:04 felire

it might be a bug that TargetAttributes is not updated. Will have to make a change and add a test for it.

dnkoutso avatar Apr 07 '20 17:04 dnkoutso

And the target folders are not being deleted neither. I had to deleted in other script not with this gem. How much time would take to fix this? Thanks

felire avatar Apr 07 '20 17:04 felire

I do not know how long it would take unfortunately. It all depends on the change. I personally don't have time to look into this right now.

Generally we want to follow as much as possible what Xcode does so if there is something from deleting a target that Xcodeproj doesn't do that Xcode now does then we need to update it here.

dnkoutso avatar Apr 07 '20 17:04 dnkoutso

And is there a way to update the project or to make a clean or something like that or not?

felire avatar Apr 07 '20 17:04 felire

You probably have enough information/api methods to do this as a follow up in your script yes.

dnkoutso avatar Apr 07 '20 17:04 dnkoutso

I deleted doing this:

target_atts_obj = project.root_object.attributes['TargetAttributes']
target_atts_obj.delete(target.uuid)

felire avatar Apr 07 '20 18:04 felire