kronenthaler / mod-pbxproj

A python module to manipulate XCode projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Build steps that have shell commands lose formatting when project is saved

michalszelagsonos opened this issue · comments

Describe the bug
I have a project that contains a couple builds steps with shell command. When I save the project, the steps are modified such that quotes and newlines are removed. Here's a git diff showing how the step gets mangled:

                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "scripts/swiftlint.sh\n";
+                       shellScript = scripts/swiftlint.sh
+;

You can see how quotes and newlines are lost.

System information

  1. pbxproj version used: 4.0.0
  2. python version used: 3.11
  3. Xcode version used: 15.2

To Reproduce
Steps to reproduce the behavior:

  1. Add a shell script as a build step into your Xcode project.
  2. Save the project.
  3. Load the project in python and save it.
    project = pbxproj.XcodeProject.load("path to your project.pbxproj file")
    project.save()
    
  4. Inspect your project.pbxproj file, you will see that your build step will lose quotes and newline character.

Expected behavior
Loading and saving the project should preserve the entries, as is.