Skip to content

Commit 38a2f92

Browse files
BirmacherAkostrapacska
authored andcommitted
- The codesigndoc will not ask about the Provisioning Profiles in --certs-only mode. (#87)
- Log update
1 parent 34b6e7e commit 38a2f92

File tree

6 files changed

+27
-33
lines changed

6 files changed

+27
-33
lines changed

bitriseio/bitriseio.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
)
1818

1919
// UploadCodesigningFiles ...
20-
func UploadCodesigningFiles(certificates []certificateutil.CertificateInfoModel, profiles []profileutil.ProvisioningProfileInfoModel, outputDirPath string) (bool, bool, error) {
20+
func UploadCodesigningFiles(certificates []certificateutil.CertificateInfoModel, profiles []profileutil.ProvisioningProfileInfoModel, certsOnly bool, outputDirPath string) (bool, bool, error) {
2121
accessToken, err := askAccessToken()
2222
if err != nil {
2323
return false, false, err
@@ -35,9 +35,12 @@ func UploadCodesigningFiles(certificates []certificateutil.CertificateInfoModel,
3535

3636
bitriseClient.SetSelectedAppSlug(selectedAppSlug)
3737

38-
provProfilesUploaded, err := uploadExportedProvProfiles(bitriseClient, profiles, outputDirPath)
39-
if err != nil {
40-
return false, false, err
38+
var provProfilesUploaded bool
39+
if !certsOnly {
40+
provProfilesUploaded, err = uploadExportedProvProfiles(bitriseClient, profiles, outputDirPath)
41+
if err != nil {
42+
return false, false, err
43+
}
4144
}
4245

4346
certsUploaded, err := uploadExportedIdentity(bitriseClient, certificates, outputDirPath)

cmd/scan.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,8 @@ func printFinished(provProfilesUploaded bool, certsUploaded bool) {
6565
if !provProfilesUploaded && !certsUploaded {
6666
log.Warnf("You just have to upload the found certificates (.p12) and provisioning profiles (.mobileprovision) and you'll be good to go!")
6767
fmt.Println()
68+
} else if !certsUploaded {
69+
log.Warnf("You just have to upload the found certificates (.p12) and you'll be good to go!")
70+
fmt.Println()
6871
}
6972
}

cmd/xcode.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ func scanXcodeProject(cmd *cobra.Command, args []string) error {
8383
if projectPath == "" {
8484
askText := `Please drag-and-drop your Xcode Project (` + colorstring.Green(".xcodeproj") + `) or Workspace (` + colorstring.Green(".xcworkspace") + `) file,
8585
the one you usually open in Xcode, then hit Enter.
86-
8786
(Note: if you have a Workspace file you should most likely use that)`
88-
fmt.Println()
8987
projpth, err := goinp.AskForPath(askText)
9088
if err != nil {
9189
return fmt.Errorf("failed to read input: %s", err)
@@ -127,7 +125,6 @@ the one you usually open in Xcode, then hit Enter.
127125
xcodeCmd.SDK = paramXcodebuildSDK
128126
}
129127

130-
fmt.Println()
131128
fmt.Println()
132129
log.Printf("🔦 Running an Xcode Archive, to get all the required code signing settings...")
133130
archivePath, buildLog, err := xcodeCmd.GenerateArchive()

codesigndoc/codesigndoc.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,24 @@ func ExportCodesignFiles(archivePath, outputDirPath string, certificatesOnly boo
8787
provProfilesUploaded := (len(profilesToExport) == 0)
8888
certsUploaded := (len(certificatesToExport) == 0)
8989

90-
if len(profilesToExport) > 0 || len(certificatesToExport) > 0 {
90+
var shouldUpload bool
91+
if !certificatesOnly {
9192
fmt.Println()
92-
shouldUpload, err := goinp.AskForBoolFromReader("Do you want to upload the provisioning profiles and certificates to Bitrise?", os.Stdin)
93+
shouldUpload, err = goinp.AskForBoolFromReader("Do you want to upload the provisioning profiles and certificates to Bitrise?", os.Stdin)
9394
if err != nil {
9495
return false, false, err
9596
}
97+
} else {
98+
shouldUpload, err = goinp.AskForBoolFromReader("Do you want to upload the certificates to Bitrise?", os.Stdin)
99+
if err != nil {
100+
return false, false, err
101+
}
102+
}
96103

97-
if shouldUpload {
98-
certsUploaded, provProfilesUploaded, err = bitriseio.UploadCodesigningFiles(certificatesToExport, profilesToExport, outputDirPath)
99-
if err != nil {
100-
return false, false, err
101-
}
104+
if shouldUpload {
105+
certsUploaded, provProfilesUploaded, err = bitriseio.UploadCodesigningFiles(certificatesToExport, profilesToExport, certificatesOnly, outputDirPath)
106+
if err != nil {
107+
return false, false, err
102108
}
103109
}
104110

codesigndoc/codesigngroup.go

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ func printCodesignGroup(group export.CodeSignGroup) {
7575

7676
// collectExportCertificate returns the certificate to use for the ipa export
7777
func collectExportCertificate(isMacArchive bool, archiveCertificate certificateutil.CertificateInfoModel, installedCertificates []certificateutil.CertificateInfoModel, installedInstallerCertificates []certificateutil.CertificateInfoModel) ([]certificateutil.CertificateInfoModel, error) {
78-
fmt.Println()
79-
fmt.Println()
80-
8178
var selectedCertificates []certificateutil.CertificateInfoModel
8279

8380
// Export method
@@ -91,12 +88,12 @@ func collectExportCertificate(isMacArchive bool, archiveCertificate certificateu
9188

9289
// Asking the user over and over until we find a valid certificate for the selected export method.
9390
for searchingValidCertificate := true; searchingValidCertificate; {
94-
9591
fmt.Println()
9692
selectedExportMethod, err := goinp.SelectFromStringsWithDefault("Select the ipa export method", 1, exportMethods)
9793
if err != nil {
9894
return nil, fmt.Errorf("failed to read input: %s", err)
9995
}
96+
10097
log.Debugf("selected export method: %v", selectedExportMethod)
10198

10299
selectedCertificates, err = filterCertificates(isMacArchive, selectedExportMethod, "", selectedCertificates, archiveCertificate, installedCertificates, installedInstallerCertificates)
@@ -105,7 +102,7 @@ func collectExportCertificate(isMacArchive bool, archiveCertificate certificateu
105102
}
106103

107104
fmt.Println()
108-
question := `Do you want to collect another certificate? [yes,no]`
105+
question := `Do you want to collect another certificate?`
109106
searchingValidCertificate, err = goinp.AskForBoolWithDefault(question, true)
110107
if err != nil {
111108
return nil, fmt.Errorf("failed to read input: %s", err)
@@ -161,6 +158,8 @@ func filterCertificates(isMacArchive bool, selectedExportMethod, selectedTeam st
161158
// Skip it if only 1 team has certificates on the machine. Or the archiving team does'n have the desired certificate type.
162159
// Skip the question + set the useArchiveTeam = false, if multiple team has certificate for the export method but the archiving team is not one of them.
163160
if len(filteredCertificatesByTeam) > 1 && contains {
161+
fmt.Println()
162+
164163
question := fmt.Sprintf(`The archive used codesigning files of team: %s - %s
165164
Would you like to use this team to export an ipa file?`, archiveCertificate.TeamID, archiveCertificate.TeamName)
166165
useArchiveTeam, err = goinp.AskForBoolWithDefault(question, true)
@@ -280,7 +279,6 @@ func collectExportCodeSignGroups(archive Archive, installedCertificates []certif
280279
}
281280

282281
for true {
283-
fmt.Println()
284282
selectedExportMethod, err := goinp.SelectFromStringsWithDefault("Select the ipa export method", 1, exportMethods)
285283
if err != nil {
286284
return nil, fmt.Errorf("failed to read input: %s", err)
@@ -302,7 +300,6 @@ func collectExportCodeSignGroups(archive Archive, installedCertificates []certif
302300
fmt.Println()
303301
log.Errorf(collectCodesigningFilesInfo)
304302
fmt.Println()
305-
fmt.Println()
306303
question := "Do you want to collect another ipa export code sign files"
307304
question += "\n(select NO to finish collecting codesign files and continue)"
308305
anotherExport, err := goinp.AskForBoolWithDefault(question, false)
@@ -333,7 +330,6 @@ func collectExportCodeSignGroups(archive Archive, installedCertificates []certif
333330
} else {
334331
sort.Strings(certificateOptions)
335332

336-
fmt.Println()
337333
question := fmt.Sprintf("Select the Codesign Indentity for %s ipa export", selectedExportMethod)
338334
selectedCertificateOption, err = goinp.SelectFromStringsWithDefault(question, 1, certificateOptions)
339335
if err != nil {
@@ -434,15 +430,12 @@ func collectExportCodeSignGroups(archive Archive, installedCertificates []certif
434430
collectedCodeSignGroup = export.NewIOSGroup(*selectedCertificate, selectedBundleIDProfileMap)
435431
}
436432

437-
fmt.Println()
438433
fmt.Println()
439434
log.Infof("Codesign settings will be used for %s .ipa/.app export:", exportMethod(collectedCodeSignGroup))
440-
fmt.Println()
441435
printCodesignGroup(collectedCodeSignGroup)
442436

443437
collectedCodeSignGroups = append(collectedCodeSignGroups, collectedCodeSignGroup)
444438

445-
fmt.Println()
446439
fmt.Println()
447440
question := "Do you want to collect another ipa export code sign files"
448441
question += "\n(select NO to finish collecting codesign files and continue)"
@@ -462,10 +455,8 @@ func collectExportCodeSignGroups(archive Archive, installedCertificates []certif
462455
func collectExportSelectableCodeSignGroups(archive Archive, installedCertificates []certificateutil.CertificateInfoModel, installedProfiles []profileutil.ProvisioningProfileInfoModel) []export.SelectableCodeSignGroup {
463456
bundleIDEntitlemenstMap := archive.BundleIDEntitlementsMap()
464457

465-
fmt.Println()
466458
fmt.Println()
467459
log.Infof("Targets to sign:")
468-
fmt.Println()
469460
for bundleID, entitlements := range bundleIDEntitlemenstMap {
470461
fmt.Printf("- %s with %d capabilities\n", bundleID, len(entitlements))
471462
}
@@ -597,7 +588,6 @@ func getCodeSignGroup(archive Archive, installedCertificates []certificateutil.C
597588

598589
fmt.Println()
599590
log.Infof("Codesign settings used for archive:")
600-
fmt.Println()
601591
printCodesignGroup(archiveCodeSignGroup)
602592

603593
return archiveCodeSignGroup, nil

codesigndoc/export.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@ func collectAndExportIdentities(certificates []certificateutil.CertificateInfoMo
2121
fmt.Println()
2222
fmt.Println()
2323
log.Infof("Required Identities/Certificates (%d)", len(certificates))
24-
fmt.Println()
2524
for _, certificate := range certificates {
2625
log.Printf("- %s", certificate.CommonName)
2726
}
2827

2928
fmt.Println()
3029
log.Infof("Exporting the Identities (Certificates):")
31-
fmt.Println()
3230

3331
identitiesWithKeychainRefs := []osxkeychain.IdentityWithRefModel{}
3432
defer osxkeychain.ReleaseIdentityWithRefList(identitiesWithKeychainRefs)
@@ -80,16 +78,13 @@ func collectAndExportProvisioningProfiles(profiles []profileutil.ProvisioningPro
8078
return nil
8179
}
8280

83-
fmt.Println()
8481
log.Infof("Required Provisioning Profiles (%d)", len(profiles))
85-
fmt.Println()
8682
for _, profile := range profiles {
8783
log.Printf("- %s (UUID: %s)", profile.Name, profile.UUID)
8884
}
8985

9086
fmt.Println()
9187
log.Infof("Exporting Provisioning Profiles...")
92-
fmt.Println()
9388

9489
for _, profile := range profiles {
9590
log.Printf("searching for required Provisioning Profile: %s (UUID: %s)", profile.Name, profile.UUID)

0 commit comments

Comments
 (0)