Skip to content

Conversation

@BirmacherAkos
Copy link
Contributor

@BirmacherAkos BirmacherAkos commented Jan 15, 2019

Description:
For iOS Real Device Testing we need to generate an .xcterstrun file which was generated for generic/real device.
For this we need a development provisioning profile for the main target and for the UITest target too.

Feature:
Add a new scan option: xcodeuitests ./codesigndoc scan xcodeuitests

The scanner scans the provided project / workspace:
https://github.com/bitrise-tools/codesigndoc/pull/94/files#diff-977fdc092f258f73dc948cf69e0a2199R37

  1. The scanner search for valid schemes for the provided iOS projectr / workspace.
    The scheme is valid if:

test

- There is a UITest target target in the not skipped ones :
  https://github.com/bitrise-tools/codesigndoc/pull/94/files#diff-afd3ea939b886556b2101c19dafba29bR182

enabled

  1. The user selects the scheme

  2. Run an xcodebuild build-for-testing command for the selected scheme:

  3. Export the codesigning files:
    https://github.com/bitrise-tools/codesigndoc/pull/94/files#diff-4d4b5fa386f84d41d927fb07965ea196R53

  4. The user selects the codesigning files (certs & profiles) for every UITest target in the scheme:
    https://github.com/bitrise-tools/codesigndoc/pull/94/files#diff-4d4b5fa386f84d41d927fb07965ea196R124


How to test:
You will need an iOS app with UITest enabled:
test

enabled

Run the go run *.go scan xcodeuitests from the root dir.


Dependencies:
Merge the dependendent PRs first:
bitrise-io/xcode-project#26
bitrise-io/go-xcode#72

@BirmacherAkos BirmacherAkos changed the title WIP: Add Ui Target support WIP: Add UI Target support Jan 15, 2019
@BirmacherAkos BirmacherAkos changed the title WIP: Add UI Target support Add UI Target support Jan 21, 2019
@BirmacherAkos BirmacherAkos requested a review from godrei January 21, 2019 14:11
Copy link
Contributor

@godrei godrei left a comment

Choose a reason for hiding this comment

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

pls have a look at my notes


xcodeUITestsCmd.Flags().StringVar(&paramXcodeProjectFilePath, "file", "", "Xcode Project/Workspace file path")
xcodeUITestsCmd.Flags().StringVar(&paramXcodeScheme, "scheme", "", "Xcode Scheme")
xcodeUITestsCmd.Flags().StringVar(&paramXcodebuildSDK, "xcodebuild-sdk", "", "xcodebuild -sdk param. If a value is specified for this flag it'll be passed to xcodebuild as the value of the -sdk flag. For more info about the values please see xcodebuild's -sdk flag docs. Example value: iphoneos")
Copy link
Contributor

Choose a reason for hiding this comment

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

the definition of the variables paramXcodeProjectFilePath (xcode.go line 31) should be duplicated here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are in the same package: cmd. Because of this there is no need to duplicate them.
And I could not "duplicate" them on the same package without changing the variables' name.

func extractCertificatesAndProfiles(codeSignGroups ...export.CodeSignGroup) ([]certificateutil.CertificateInfoModel, []profileutil.ProvisioningProfileInfoModel) {
certificateMap := map[string]certificateutil.CertificateInfoModel{}
profilesMap := map[string]profileutil.ProvisioningProfileInfoModel{}
for _, group := range codeSignGroups {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why put items a map, if returning array?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because of the duplications in the array.
Sadly Golang doesn't support Set, so the other solution for this, to create a map with a certificate.Serial of with the profile.UDID for key.

Copy link
Contributor

@lpusok lpusok Feb 8, 2019

Choose a reason for hiding this comment

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

Got it. Found this example, which could be used in the future:
http://www.golangprograms.com/remove-duplicate-values-from-slice.html

var selectedCertificates []certificateutil.CertificateInfoModel

// Codesign method
codesignMethods := []string{"development", "app-store", "ad-hoc", "enterprise"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be a const somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Golang doesn't allow us to create an array / map as a const:
const initializer []string literal is not a constant

https://groups.google.com/forum/#!topic/golang-nuts/5aynucvg96I

Copy link
Contributor

@godrei godrei left a comment

Choose a reason for hiding this comment

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

pls fix the package lock file, other than that 👊

@lszucs
Copy link
Contributor

lszucs commented Feb 6, 2019

No additional comments.

Copy link
Contributor

@lszucs lszucs left a comment

Choose a reason for hiding this comment

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

No additional comments

…es; and it will return a new array of selected certs which needed to append to the selectedCertificates later;
@BirmacherAkos BirmacherAkos merged commit b2286a9 into master Feb 8, 2019
@BirmacherAkos BirmacherAkos deleted the UITarget branch February 8, 2019 15:09
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.

6 participants