kronenthaler / mod-pbxproj

A python module to manipulate XCode projects
MIT License
1.21k stars 294 forks source link

[BUG] #276

Closed gomerser closed 4 years ago

gomerser commented 4 years ago

Describe the bug I'm trying to add a Run Script Phase using: project.add_run_script('ls -l .') But this results in a "Workspace integrity" - "Couldn't load project"

System information

  1. pbxproj version used: 2.10.2
  2. python version used: 2.7.16
  3. Xcode version used: 11.4.1

To Reproduce

from pbxproj import XcodeProject
# open the project
project = XcodeProject.load('starter.xcodeproj/project.pbxproj')

print("adding pre-build script")
#project.add_run_script('ls -l .', 'starter', True)
project.add_run_script('ls -l .')

# save the project, otherwise your changes won't be picked up by Xcode
project.save()

Expected behavior I expected a working project

kronenthaler commented 4 years ago

can you share the starter.xcodeproj/project.pbxproj file?

gomerser commented 4 years ago

Hi thanks for looking into this. Here's the project file:

On 22 Apr 2020, at 21:42, Ignacio Calderon notifications@github.com wrote:

can you share the starter.xcodeproj/project.pbxproj file?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kronenthaler/mod-pbxproj/issues/276#issuecomment-617994644, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANGJ2SGHXIYTKECZILXK6ATRN5CDVANCNFSM4MOKXMXA.

kronenthaler commented 4 years ago

the mail attachments don't get posted in github... try a link to gist.github.com

gomerser commented 4 years ago

https://gist.github.com/gomerser/8a4e92f1dda33ccbcf5745edee43211d

kronenthaler commented 4 years ago

For starters, this doesn't seem like an Xcode generated project. I gave it a try with the pbxproj 2.10.2, python 3.7.4 and opened in Xcode 11.4.1. The file gets saved properly, i can see the new shellScript phase in place. Of course, i cannot compile it, but that's another story.

gomerser commented 4 years ago

You're right, the project is created by the swift package manager using 'swift package generate-xcodeproj'. I tried now with python 3.7.0 and this worked! Thank you for creating mod-pbxproj, together with the swift package manager it allows me to regenerate code with antlr4 before every build.