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

Run scripts #17

Merged
merged 5 commits into from
Aug 2, 2017
Merged

Run scripts #17

merged 5 commits into from
Aug 2, 2017

Conversation

yonaskolb
Copy link
Owner

@yonaskolb yonaskolb commented Aug 1, 2017

Resolves #7

This adds prebuildScripts and postbuildScripts to targets

@yonaskolb yonaskolb requested a review from pepicrft August 1, 2017 16:41
name: runScript.name ?? "Run Script",
inputPaths: Set(runScript.inputFiles),
outputPaths: Set(runScript.outputFiles),
shellPath: runScript.shell ?? "/bin/sh",
Copy link

Choose a reason for hiding this comment

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

What about making shell non-optional and using a default value in the RunScript constructor with /bin/sh. Since the shell is required for creating a PBXShellScriptBuildPhase I'd make it non-optional here as well. What do you think?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yeah that would be an option. I've been trying to keep any specific knowledge out of ProjectSpec though, and just keep it dumb.
Also I think that /bin/sh should be the default value in the xcodeproj constructor, and I didn't want to double up work there. It's something we still need to add to xcodeproj though

case let .script(script):
shellScript = script
}
let escapedScript = shellScript.replacingOccurrences(of: "\"", with: "\\\"").replacingOccurrences(of: "\n", with: "\\n")
Copy link

Choose a reason for hiding this comment

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

Wouldn't you extract this into an extension or a method that is more explicit about why this is necessary?

Copy link
Owner Author

Choose a reason for hiding this comment

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

You're right, this should go into PXBWriter, but I just put it here for now to get it working

@@ -33,7 +33,16 @@ public class ProjectGenerator {
return spec.configs.first { $0.type == .release }!
}

func validate() throws {
func getPath(_ path: String) -> Path {
Copy link

Choose a reason for hiding this comment

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

There's a similar method in PBXProjGenerator. Have you consider extracting it somewhere to use it from both places?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yeah, it felt weird to add it twice. Maybe an extension on Path

Copy link
Owner Author

Choose a reason for hiding this comment

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

I just started to add an extension of Path, but found out that appending paths already checks for absolute paths, so this was all unnecessary :)

@@ -146,8 +146,42 @@ targets:
Release: config_files/release.xcconfig
```

#### Run Scripts
Copy link

Choose a reason for hiding this comment

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

It's great that you document all these things, very useful 👏

Copy link

@pepicrft pepicrft left a comment

Choose a reason for hiding this comment

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

Looks ok to me @yonaskolb. I just left some minor comments.

@yonaskolb yonaskolb merged commit 942e571 into master Aug 2, 2017
@yonaskolb yonaskolb deleted the feature/run_scripts branch August 2, 2017 11:48
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