-
Notifications
You must be signed in to change notification settings - Fork 464
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
Generate targets with same build settings as Xcode (related to #164) #166
Conversation
👍 Terrific work! |
Note: the build on Ruby 2.0 is succeeding even though some test failed because an issue of the simpelcov gem which is fixed in master (related to e5a69ed). The build on 1.8.7 has been erring because the installation of Ruby is taking too much time. |
Here is a short list of all failing tests:
Both fail because
Expects that
My changes to |
My take:
We need also to check that those settings work fine on Xcode 5 as long as we will support it. Otherwise we could have a temporary compatibility section. It would be also nice to document and automate to the possible extent the process of updating the settings to a new version of Xcode. |
Please document all the changes (especially the breaking ones) on the Changelog. |
Regarding 1, we should ensure that a proper solution is implemented in CocoaPods before the release of this patch. |
@mrackwitz I think that xcodeproj should keep track of the different build settings of each Xcode version. In that way it will be possible to support multiple versions of Xcode at the same time. Is this something that you want to do, or do you prefer me to take over this patch? |
Let's discuss how we would do it first.
Furthermore I think, the build settings could been managed in a better separated / maintainable manner than the current constants module as they are subject to change and will probably bloat the code. If only those build settings are valid outputs, which you can generate with Xcode itself, then the simpler way would be to just deserialze the dumped xcconfigs on-demand. But this is the less comprehensible way, as you can see now how the settings are composed. In the end there is the question why we need to keep track of different versions at all? As soon as Apple releases a new version, they will deprecate the previous one. We could just suppport always the latest version, and developers who need to stay on an older Xcode version could still use an older gem version. I know, that there will be the challenge of organizing versions and dependencies. But let's make this point as transparent as possible. |
The "current" process would enfold to manually create targets. This is error-prone. But I don't see so far a way to automate this process with AppleScript/Automator/…, which would be maintainable. Has anyone helpful ideas regarding this point? |
👍
I was thinking about storing them in a JSON/xcconfig file and to add an Xcodeproj subcommand to output all the build settings per build configuration of a project.
This would allow to provide support for new versions of Xcode as soon as they are released and it automated to the possible extent is not such a maintenance burden in my opinion
Manual creation of the reference project is the only possibility that I can see. The serialisation can be automated though. |
I had already built an yet unreleased tool on top of Xcodeproj, which does the serialization. But as this thing is very feature-bloated and further requirements here introduce unneccessary debt, I contributed instead some of the logic as CLAide Subcommand to To continue those efforts to automate to the possible extent, I added some rake tasks:
|
This is terrific work. |
@mrackwitz can we split this PR in smaller parts to get the bulk of it merged? |
I tried to rebase but I'm not familiar enough with the changes to have gotten it right. /c @fabiopelosin, @mrackwitz |
@fabiopelosin @segiddins @kylef: I've already begun to work on the subtasks. I hope that I will have some time this week to finish it and then merge the changes from master back. |
@alloy I suggested to provide support for multiple Xcode versions because it would aide the transition during RCs and because it appeared easy to implement. This is regardless wether we decide to expose the selection of the Xcode version in CocoaPods. |
Related: CocoaPods/Core#152 |
Sorry, this is going to need rebasing too. |
This patch looks good to me... I think that the work of ext_build_settings_multiple should be discussed in a separated PR |
Will be passed from new_target via configuration_list to common_build_settings
Conflicts: lib/xcodeproj/project/project_helper.rb
Removed because it is not supported anymore: Xcodeproj should generate build settings, which are the same as those from Xcode.
We only catch StandardError. `confirm` allows to escape with a SystemExit.
511cc63
to
2927005
Compare
@@ -1,5 +1,44 @@ | |||
# Xcodeproj Changelog | |||
|
|||
## 0.21.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Master
2927005
to
25f291d
Compare
|
||
targets.each do |name, attributes| | ||
begin | ||
sh "printf '#{name}' | pbcopy" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NSA IS WATCHING!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above:
+ subtitle "Each target name will been copied to your clipboard."
+ confirm "Make sure you have nothing unsaved there"
Because this whole process is not completely automated and requires user interaction.
|
||
# Match further common settings by key sets | ||
keys = [type, platform, target_product_type, language].compact | ||
key_combinations = (1..keys.length).map { |n| keys.combination(n).to_a }.reduce([], :+) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, so intens :D Can this be simplified for casual reading improvement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, flat_map
would help.
Looks good to go to me 👍 |
desc "Create a new empty project" | ||
task :new_project => [:prepare] do | ||
verbose false | ||
require 'xcodeproj' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably use Bundler.require
instead. Otherwise if the Rakefile
isn't ran with bundler we will potentially be running the wrong Xcodeproj.
Most of the other tasks in our Rakefile's protect against this, such as running bacon via sh "bundle exec bacon #{args.spec_file}"
.
Ensure that we load the right gem versions
Generate targets with same build settings as Xcode (related to #164)
With the new version of the toolchain and Xcode, there were introduced new target types (iOS Framework) and some new build settings (i.e. if the target uses Swift.). We have to ensure that the generated targets build settings match those Xcode will create. This PR is related to #164.
Therefore I created a sample project, with a target for each type, dumped their build settings to xcconfig files, built an integration spec, and changed the constants so that the build settings will match the parsed xcconfig files.
Currently there will fail some specs, where we might need to discuss, how Xcodeproj should behave.ToDos
For easier code review I opened a PR on my fork for these points.
ProjectHelper::common_build_settings
instead of manually decompose them in theConstants
ProjectHelper::common_build_settings
, use the current given by defaultDNS_BLOCK_ASSERTIONS=1
for Release configuration, if needed, as it is not included by Xcode by default anymore and so should not be included in targets created with Xcodeproj