Skip to content
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 Writing of showEnvVarsInLog #240

Merged
merged 1 commit into from
Mar 7, 2018
Merged

Fix Writing of showEnvVarsInLog #240

merged 1 commit into from
Mar 7, 2018

Conversation

briantkelley
Copy link
Contributor

@briantkelley briantkelley commented Mar 7, 2018

Short description 📝

Xcode writes showEnvVarsInLog to the pbxproj file if it’s set to false. If it’s true, it’s omitted.

Solution 📦

Update xcproj to use the same behavior as Xcode to eliminate diffs when round tripping Xcode projects.

This requires defaulting to true when decoding the project file if the key is omitted. I also updated the default parameter in the initializer to true for good measure.

Implementation 👩‍💻👨‍💻

  • Verify "Show environment variables in build log" is true when creating a new Run Script build phase
  • Verify Xcode writes the flag when false but never when true

This change is Reviewable

@@ -117,7 +117,10 @@ extension PBXShellScriptBuildPhase: PlistSerializable {
if let shellScript = shellScript {
dictionary["shellScript"] = .string(CommentedString(shellScript))
}
dictionary["showEnvVarsInLog"] = .string(CommentedString("\(showEnvVarsInLog.int)"))
if !showEnvVarsInLog {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about adding a test that tests this behaviour?

Xcode writes showEnvVarsInLog to the pbxproj file if it’s set to false. If it’s true it’s omitted. Update xcproj to use the same behavior to eliminate diffs when round tripping Xcode projects.

This requires defaulting to true when decoding the project file if the key is omitted. I also updated the default parameter in the initializer to true for good measure.
@briantkelley briantkelley merged commit 343d686 into master Mar 7, 2018
@pepicrft pepicrft deleted the showEnvVarsInLog branch March 8, 2018 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants