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

Allow builds to skip iOS and watchOS device SDKs when the codesigning identity is not installed #583

Merged
merged 48 commits into from
Sep 9, 2015

Conversation

abbeycode
Copy link
Contributor

This addresses issues #576, #235, and #281, by adding a new --simulator-only flag, and also properly treating the iphonesimulator and watchsimulator values for the --platform flag.

I added associated value for Platform and BuildPlatform attached to the .iOS and .watchOS values, in addition to passing a simulatorOnly parameter around between functions. After adding the associated values, I also had to implement the == overload to keep the enums Equatable and allow them to be used in switch statements.

…OS device builds. The "iphonesimulator" and "watchsimulator" platform values also skip the device SDKs
@abbeycode
Copy link
Contributor Author

Should I make any changes to this guy?

@mdiep
Copy link
Member

mdiep commented Jul 1, 2015

Most of the core contributors have been pretty busy recently. I'll try to take a look at this soon. ☺️

@abbeycode
Copy link
Contributor Author

Anything I can do to help with this review?

@mdiep
Copy link
Member

mdiep commented Jul 13, 2015

I started reviewing all the open PRs over the weekend. I hope to get to this sometime this week. Sorry for the delay!

@mdiep
Copy link
Member

mdiep commented Jul 18, 2015

Thank you for opening a pull request! And sorry it took me so long to look at this. It's been a busy month. 😄

However, as discussed in #281, we're not interested in adding a command-line flag for this. Carthage should build for device if it's able and automatically build only for the simulator in the case where code signing identities haven't been set up.

@mdiep mdiep self-assigned this Jul 18, 2015
@abbeycode
Copy link
Contributor Author

Ok, and what about specifying "iphonesimulator" or "watchsimulator"? In master, those have no semantic difference from "iphoneos" or "watchos" – should I keep my change to treat those as simulator-only?

@mdiep
Copy link
Member

mdiep commented Jul 18, 2015

No, I don't think that's something that Carthage should be concerned with.

…he machine has any iOS or iPhone signing identities configured, rather than relying on a command line flag. It's calling the command line tool "security" to list the signing identities.

At present, the "should build for all platforms" test case is failing (on my machine), since it's expecting the ARM architectures, and I don't have any iOS signing identities. I'm not sure what the correct way to isolate that configuration is with ReactiveCocoa
@abbeycode
Copy link
Contributor Author

@mdiep I updated (and simplified) the pull request to check with the "security" command's output, and only build for devices if an iOS signing identity is present. Can you please take a look? Also, this is my first time writing ReactiveCocoa code, so any constructive feedback is greatly appreciated.

@mdiep
Copy link
Member

mdiep commented Jul 20, 2015

That's great! Thanks for tackling this! I'll add this to my todo list and try to review it in the next few days.

…ing identities installed, rather than many errors that are less clear
}
|> map { (identityLine: String) -> String? in
var error: NSError? = nil
let regex = NSRegularExpression(pattern: "\".+\"", options: nil, error: &error)
Copy link
Member

Choose a reason for hiding this comment

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

I'd really like to see this split out into a private static variable, like targetSettingsRegex above.

It'd also be nice for it to be a bit more specific. I think something like this would work:

^\s*\d\)\s+\w+\s+"(.+)"$

Note the use of a capturing group for the actual name of the identity. Bonus points if you use AllowCommentsAndWhitespace to separate the comments to make it a little clearer. 😄

@mdiep
Copy link
Member

mdiep commented Jul 22, 2015

Thanks again for tackling this! ✨ I left some higher level notes above, but I think you're on the right track here. 👍

The other thing that I'd like to see is for Carthage to print a warning if it falls back to a simulator only build.

@abbeycode
Copy link
Contributor Author

Alright, I've taken care of cleaning up the regex stuff, but now I'm left to the hard part and can use some guidance. The only way I see to get any settings from the project in Carthage is through xcodebuild. When running BuildSettings.loadWithArguments(), EXPANDED_CODE_SIGN_IDENTITY is empty. The only setting returned from there that seemed to indicate something useful was the CODE_SIGNING_ALLOWED key. This returned "NO" for every iOS target in the unit tests, and "YES" for every Mac target, but that seems like shaky ground to stand on. We'd ideally also be able to determine whether the build wants a developer or distribution certificate.

I think we need to get the CODE_SIGN_IDENTITY value out of the project.pbxproj value. Do you know of any way to leverage Carthage's existing code to accomplish that? CocoaPods's Xcodeproj does this.

@mdiep
Copy link
Member

mdiep commented Jul 25, 2015

With BuildSettings.loadWithArguments(), I can get a CODE_SIGN_IDENTITY for a project that has a set identity. Strangely, Xcode itself is showing iOS Developer when the .pbxproj and xcodebuild show iPhone Developer. I don't know if that's important.

Will that do what we need?

@abbeycode
Copy link
Contributor Author

Thanks for telling me it worked for you – allowed me to find my bug and now I'm seeing iPhone Developer also. For the iOS/iPhone divide, it looks like they started showing iOS in the UI at some point, but kept on using iPhone behind the scenes consistently in the keychain and project, I suppose for backwards compatibility. I should have a new solution ready soon.

… string, and started using that, in combination with the CODE_SIGN_IDENTITY build setting, to determine whether a build is possible for each SDK
@abbeycode
Copy link
Contributor Author

@ikesyo Don't worry about it, those are all helpful tips. Let me know how it all looks! @mdiep I got yours too (first commit above)

@mdiep
Copy link
Member

mdiep commented Sep 8, 2015

@ikesyo I'll let you give this another look. You can merge when you're satisfied with it! Thank you for reviewing. ❤️

@ikesyo
Copy link
Member

ikesyo commented Sep 9, 2015

Looks good now! I'm happy to merge the great work of @abbeycode and @mdiep 💖

ikesyo added a commit that referenced this pull request Sep 9, 2015
Allow builds to skip iOS and watchOS device SDKs when the codesigning identity is not installed
@ikesyo ikesyo merged commit 48328bd into Carthage:master Sep 9, 2015
@ikesyo ikesyo mentioned this pull request Sep 9, 2015
@mdiep
Copy link
Member

mdiep commented Sep 9, 2015

Thanks for the pull request, @abbeycode! And thank you for being patient through the review process!!

mdiep added a commit that referenced this pull request Sep 9, 2015
@abbeycode abbeycode deleted the simulator-only branch September 9, 2015 13:43
@abbeycode
Copy link
Contributor Author

No problem, it was a great learning experience. When do you expect the next release to be cut?

@mdiep
Copy link
Member

mdiep commented Sep 9, 2015

I plan to do a release sometime this week.

@abbeycode
Copy link
Contributor Author

👍

@guidomb
Copy link
Contributor

guidomb commented Sep 9, 2015

@mdiep Could you update this thread when a new release is cut so we can make a new homebrew release?

@mdiep
Copy link
Member

mdiep commented Sep 13, 2015

I just released 0.9 Sad Effects. 🎉

@DenTelezhkin
Copy link

@mdiep Can I ask you to release 0.9.0 on Homebrew? Been looking forward to this release for several months.

@guidomb
Copy link
Contributor

guidomb commented Sep 13, 2015

I have made the PR for Carthage 0.9 in Homebrew Homebrew/legacy-homebrew#43884

@mdiep
Copy link
Member

mdiep commented Sep 13, 2015

@guidomb Just in time for me to release 0.9.1. 😄

@guidomb
Copy link
Contributor

guidomb commented Sep 24, 2015

@abbeycode Could you take a look at #776. I think that that bug was introduced by this patch.

@abbeycode
Copy link
Contributor Author

It seems like Homebrew/legacy-homebrew#43884 has stalled a bit (but it's on the home stretch). What's holding it up at this point?

@AAverin
Copy link

AAverin commented Nov 19, 2015

Was this feature released?
Anything I need to configure to use it?

@abbeycode
Copy link
Contributor Author

@AAverin It was released, and you don't need to do anything to use it. It skips device SDKs (only building for the simulator) when there are no signing identities present.

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.

None yet

8 participants