kronenthaler / mod-pbxproj

A python module to manipulate XCode projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG]

gomerser opened this issue · comments

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

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

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

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.

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.