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 parameter code_signing_identity for CODE_SIGN_IDENTITY setting #12326

Merged
merged 5 commits into from May 18, 2018

Conversation

HarrisHan
Copy link
Contributor

@HarrisHan HarrisHan commented Apr 17, 2018

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.

Motivation and Context

update_project_provisioning(
                xcodeproj: "iOSArchive.xcodeproj",
                profile: "./#{profilename}", # optional if you use sigh
                target_filter: "iOSArchive", # matches name or type of a target
                build_configuration: "Release",
              )

When Release Archive a project with the development export method
The Release XCBuildConfiguration's CODE_SIGN_IDENTITY[sdk=iphoneos*] defualt value is "iPhone Distribution"

This will cause the profile doesn't include distribution signing certificate
image

image

The same as the Debug Archive with ad-hoc export method for Debug XCBuildConfiguration's CODE_SIGN_IDENTITY defualt value is iPhone Developer

So I add a parameter for update_project_provisioning to change the CODE_SIGN_IDENTITY in XCBuildConfiguration so that the certificate will be find

update_project_provisioning(
                xcodeproj: "iOSArchive.xcodeproj",
                profile: "./#{profilename}", # optional if you use sigh
                target_filter: "iOSArchive", # matches name or type of a target
                build_configuration: "Release",
                code_signing_identity: "iPhone Developer" # optionally specify the codesigning identity
              )

  gym

image
image

I use the changed update_project_provisioning action in my local project It worked well

Description

Add parameter codesigning_identity for action update_project_provisioning which you can set to iPhone Developer or iPhone Distribution according to the demand

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@HarrisHan
Copy link
Contributor Author

@googlebot
I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@HarrisHan HarrisHan changed the title Add parameter codesigning_identity for rs/harris/Desktop/iOSArchive/2GG7WJDZBH.cer | | CERT_CERTIFICATE_ID | 2GG7WJDZBH | | SIGH_PROFILE_PATH | /Users/ha setting Add parameter codesigning_identity for CODE_SIGN_IDENTITY setting Apr 17, 2018
@@ -148,7 +160,8 @@ def self.example_code
xcodeproj: "Project.xcodeproj",
profile: "./watch_app_store.mobileprovision", # optional if you use sigh
target_filter: ".*WatchKit Extension.*", # matches name or type of a target
build_configuration: "Release"
build_configuration: "Release",
codesigning_identity: "iPhone Development" #specified the codesigning identity
Copy link
Member

Choose a reason for hiding this comment

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

Can you change this to be # optionally specify the codesigning identity

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for ur advice I had update the code

Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

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

Few small nit picks 🙃

unless build_configuration.build_settings["CODE_SIGN_IDENTITY[sdk=iphoneos*]"].nil?
build_configuration.build_settings["CODE_SIGN_IDENTITY[sdk=iphoneos*]"] = codesigning_identity
end
build_configuration.build_settings["CODE_SIGN_IDENTITY"] = codesigning_identity
Copy link
Member

Choose a reason for hiding this comment

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

Can we change the code in this unless to be...

codesign_build_settings_keys = build_configuration.build_settings.keys.select { |key| key.to_s.match(/CODE_SIGN_IDENTITY.*/) }
codesign_build_settings_keys.each do |setting|
  build_configuration.build_settings[setting] = codesigning_identity
end

so that it works with other platforms and not just iOS? Inspired by https://github.com/fastlane/fastlane/blob/master/fastlane/lib/fastlane/actions/automatic_code_signing.rb#L46-L49

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great idea

@@ -130,7 +138,11 @@ def self.available_options
FastlaneCore::ConfigItem.new(key: :certificate,
env_name: "FL_PROJECT_PROVISIONING_CERTIFICATE_PATH",
description: "Path to apple root certificate",
default_value: "/tmp/AppleIncRootCertificate.cer")
default_value: "/tmp/AppleIncRootCertificate.cer"),
FastlaneCore::ConfigItem.new(key: :codesigning_identity,
Copy link
Member

Choose a reason for hiding this comment

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

Can we also change this key to code_signing_identity?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for ur advice I had update the code

@joshdholtz
Copy link
Member

@HarrisHan Are you still interested in getting this merged in?

Copy link
Contributor Author

@HarrisHan HarrisHan left a comment

Choose a reason for hiding this comment

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

@joshdholtz Thanks for your advice & I have update the code

unless build_configuration.build_settings["CODE_SIGN_IDENTITY[sdk=iphoneos*]"].nil?
build_configuration.build_settings["CODE_SIGN_IDENTITY[sdk=iphoneos*]"] = codesigning_identity
end
build_configuration.build_settings["CODE_SIGN_IDENTITY"] = codesigning_identity
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great idea

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels May 6, 2018
@HarrisHan HarrisHan changed the title Add parameter codesigning_identity for CODE_SIGN_IDENTITY setting Add parameter code_signing_identity for CODE_SIGN_IDENTITY setting May 6, 2018
Copy link
Contributor Author

@HarrisHan HarrisHan left a comment

Choose a reason for hiding this comment

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

I have update the code

@@ -63,6 +64,11 @@ def self.run(params)
next
end

codesign_build_settings_keys = build_configuration.build_settings.keys.select { |key| key.to_s.match(/CODE_SIGN_IDENTITY.*/) }
Copy link
Member

Choose a reason for hiding this comment

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

I think this need to be wrapped in a if code_signing_identity otherwise things will get cleared out if not specified 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@joshdholtz Thx 😬 I have update the code

Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

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

This looks great! Thanks for the contribution ❤️

@joshdholtz joshdholtz merged commit ab13e6c into fastlane:master May 18, 2018
@fastlane-bot
Copy link

Hey @HarrisHan 👋

Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉
The code change now lives in the master branch, however it wasn't released to RubyGems yet.
We usually ship about once a week, and your PR will be included in the next one.

Please let us know if this change requires an immediate release by adding a comment here 👍
We'll notify you once we shipped a new release with your changes 🚀

@fastlane-bot
Copy link

Congratulations! 🎉 This was released as part of fastlane 2.96.0 🚀

@fastlane fastlane locked and limited conversation to collaborators Jul 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants