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

Add option to put build products in Xcode's DerivedData #302

Open
tkrajacic opened this issue Sep 20, 2015 · 16 comments
Open

Add option to put build products in Xcode's DerivedData #302

tkrajacic opened this issue Sep 20, 2015 · 16 comments

Comments

@tkrajacic
Copy link

At the moment xcodebuild creates a build/ dir for output in the projects directory.

One could set the CONFIGURATION_BUILD_DIR environment variable but it would be great if jazzy would automatically use the DerivedData/ directory from the project file.

The directory for the project could probably be obtained via:

xcodebuild -project MyProject.xcodeproj -showBuildSettings

Sure, one could just .gitignore the build/ directory (which everyone hopefully does anyway) but it is just one more directory uselessly cluttering the project.

@jpsim
Copy link
Collaborator

jpsim commented Sep 20, 2015

I absolutely understand why you'd want to avoid writing to a build/ directory, and I'd definitely recommend setting CONFIGURATION_BUILD_DIR to do this.

It's not apparent to me that adding a new configuration parameter would be worthwhile given that it does the same thing as an existing environment variable, only with a different default, and would go against what users may already be familiar with xcodebuild.

@jpsim jpsim closed this as completed Sep 20, 2015
@tkrajacic
Copy link
Author

I agree it was a bad idea suggesting a new configuration parameter.

The proposal should have been:
Jazzy should honor the build directory of the project

Would that make sense to you?

@jpsim
Copy link
Collaborator

jpsim commented Sep 20, 2015

Jazzy shells out to xcodebuild, and if a custom build directory is set in the Xcode project, it should respect that. However, Xcode.app and xcodebuild have different defaults. It may be preferable for jazzy to override the default to mimic Xcode.app but I'm still not convinced.

@tkrajacic
Copy link
Author

Maybe you could leave the issue open? See what others think.

I am still strongly favoring jazzy using the DerivedData directory as default, as it would be difficult to manually set this (you can't know the exact directory name including the hash value unless you check the project file manually)

@pcantrell
Copy link
Collaborator

I’m sure I’d have spent an hour digging for the output the first time I used Jazzy if it defaulted to DerivedData.

@tkrajacic
Copy link
Author

@pcantrell I think you are mistaking 'output' in this context. I don't mean the documentation! I mean the build products of xcodebuild which you most certainly never need...

@pcantrell
Copy link
Collaborator

Ah, I see what you mean. Using DerviedData (or any tmp dir) does make sense.

But why don't I get a build dir when I run jazzy? My project doesn't override CONFIGURATION_BUILD_DIR. I do override the derived data dir globally in my Xcode prefs … but isn't that what you're saying doesn't work and you want to work?

@tkrajacic
Copy link
Author

I think you are seeing what @jpsim was mentioning (and I didn't know).
When you do not set a build directory implicitly, Xcode and xcodebuild have different defaults.

Xcode defaults to DerivedData/, and xcodebuild to a local build/ directory.

When you do set a directory then jazzy will pick up on it.
Since I (and I can only assume most others?) am using the default DerivedData/ jazzy doesn't see anything set and xcodebuild will go ahead with its own default of build/.

I am voting for jazzy using Xcode's default of DerivedData/ here if nothing is specified within Xcode.

@tkrajacic
Copy link
Author

@jpsim Would you mind leaving this open (re-open it), or is anything like discussed here completely out of the question? I don't think the request is unreasonable, or maybe someone will come up with a better solution.

@jpsim
Copy link
Collaborator

jpsim commented Sep 21, 2015

You're absolutely right that the request is reasonable, I just can't think of a solution that wouldn't be just as confusing to others. If anyone can make a PR that does this in a nice way, without shifting the confusion from one set of users to another, I'd be happy to consider it.

@pigeon-archive
Copy link
Contributor

Any updates on this?

@jpsim
Copy link
Collaborator

jpsim commented Nov 26, 2016

No progress to report.

@drekka
Copy link

drekka commented Jul 20, 2017

I came across this trying to figure out how to avoid creating the 'build' directory in my project every time I run Jazzy. I'm using defaults in my project.

I tried passing a 'BUILD_DIR', 'CONFIGURATION_BUILD_DIR' and several other settings, but Jazzy still created the build dir and stored files in it. I also tried passing '-x "-derivedDataPath xxx"' with no luck either.

All I want to do is to change from creating a directory called 'build' to a temporary directory I'll create manually.

@johnfairh
Copy link
Collaborator

I think you want -x SYMROOT=wherever

@drekka
Copy link

drekka commented Jul 25, 2017

Hi. I tried using the SYMROOT option but it didn't work. I ended up figuring out how to use the -x option to set the derivedDataPath. It wouldn't work until I added the -scheme option as well, but it's now working fine and putting the build files in the temporary directory I pass to it.

 jazzy --xcodebuild-arguments "-configuration,$CONFIGURATION,-derivedDataPath,$TMP_DIR,-scheme,ReleaseScheme" ...

@SDGGiesbrecht
Copy link
Contributor

Hurray! Thanks for the tip @drekka.

I fought with this a while back and ended up giving up. Now I will take another look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants