Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions bitriseio/bitriseio.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

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

bitriseClient.SetSelectedAppSlug(selectedAppSlug)

provProfilesUploaded, err := uploadExportedProvProfiles(bitriseClient, profiles, outputDirPath)
if err != nil {
return false, false, err
var provProfilesUploaded bool
if !certsOnly {
provProfilesUploaded, err = uploadExportedProvProfiles(bitriseClient, profiles, outputDirPath)
if err != nil {
return false, false, err
}
}

certsUploaded, err := uploadExportedIdentity(bitriseClient, certificates, outputDirPath)
Expand Down
3 changes: 3 additions & 0 deletions cmd/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,8 @@ func printFinished(provProfilesUploaded bool, certsUploaded bool) {
if !provProfilesUploaded && !certsUploaded {
log.Warnf("You just have to upload the found certificates (.p12) and provisioning profiles (.mobileprovision) and you'll be good to go!")
fmt.Println()
} else if !certsUploaded {
log.Warnf("You just have to upload the found certificates (.p12) and you'll be good to go!")
fmt.Println()
}
}
3 changes: 0 additions & 3 deletions cmd/xcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ func scanXcodeProject(cmd *cobra.Command, args []string) error {
if projectPath == "" {
askText := `Please drag-and-drop your Xcode Project (` + colorstring.Green(".xcodeproj") + `) or Workspace (` + colorstring.Green(".xcworkspace") + `) file,
the one you usually open in Xcode, then hit Enter.

(Note: if you have a Workspace file you should most likely use that)`
fmt.Println()
projpth, err := goinp.AskForPath(askText)
if err != nil {
return fmt.Errorf("failed to read input: %s", err)
Expand Down Expand Up @@ -127,7 +125,6 @@ the one you usually open in Xcode, then hit Enter.
xcodeCmd.SDK = paramXcodebuildSDK
}

fmt.Println()
fmt.Println()
log.Printf("🔦 Running an Xcode Archive, to get all the required code signing settings...")
archivePath, buildLog, err := xcodeCmd.GenerateArchive()
Expand Down
20 changes: 13 additions & 7 deletions codesigndoc/codesigndoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,24 @@ func ExportCodesignFiles(archivePath, outputDirPath string, certificatesOnly boo
provProfilesUploaded := (len(profilesToExport) == 0)
certsUploaded := (len(certificatesToExport) == 0)

if len(profilesToExport) > 0 || len(certificatesToExport) > 0 {
var shouldUpload bool
if !certificatesOnly {
fmt.Println()
shouldUpload, err := goinp.AskForBoolFromReader("Do you want to upload the provisioning profiles and certificates to Bitrise?", os.Stdin)
shouldUpload, err = goinp.AskForBoolFromReader("Do you want to upload the provisioning profiles and certificates to Bitrise?", os.Stdin)
if err != nil {
return false, false, err
}
} else {
shouldUpload, err = goinp.AskForBoolFromReader("Do you want to upload the certificates to Bitrise?", os.Stdin)
if err != nil {
return false, false, err
}
}

if shouldUpload {
certsUploaded, provProfilesUploaded, err = bitriseio.UploadCodesigningFiles(certificatesToExport, profilesToExport, outputDirPath)
if err != nil {
return false, false, err
}
if shouldUpload {
certsUploaded, provProfilesUploaded, err = bitriseio.UploadCodesigningFiles(certificatesToExport, profilesToExport, certificatesOnly, outputDirPath)
if err != nil {
return false, false, err
}
}

Expand Down
18 changes: 4 additions & 14 deletions codesigndoc/codesigngroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ func printCodesignGroup(group export.CodeSignGroup) {

// collectExportCertificate returns the certificate to use for the ipa export
func collectExportCertificate(isMacArchive bool, archiveCertificate certificateutil.CertificateInfoModel, installedCertificates []certificateutil.CertificateInfoModel, installedInstallerCertificates []certificateutil.CertificateInfoModel) ([]certificateutil.CertificateInfoModel, error) {
fmt.Println()
fmt.Println()

var selectedCertificates []certificateutil.CertificateInfoModel

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

// Asking the user over and over until we find a valid certificate for the selected export method.
for searchingValidCertificate := true; searchingValidCertificate; {

fmt.Println()
selectedExportMethod, err := goinp.SelectFromStringsWithDefault("Select the ipa export method", 1, exportMethods)
if err != nil {
return nil, fmt.Errorf("failed to read input: %s", err)
}

log.Debugf("selected export method: %v", selectedExportMethod)

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

fmt.Println()
question := `Do you want to collect another certificate? [yes,no]`
question := `Do you want to collect another certificate?`
searchingValidCertificate, err = goinp.AskForBoolWithDefault(question, true)
if err != nil {
return nil, fmt.Errorf("failed to read input: %s", err)
Expand Down Expand Up @@ -161,6 +158,8 @@ func filterCertificates(isMacArchive bool, selectedExportMethod, selectedTeam st
// Skip it if only 1 team has certificates on the machine. Or the archiving team does'n have the desired certificate type.
// 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.
if len(filteredCertificatesByTeam) > 1 && contains {
fmt.Println()

question := fmt.Sprintf(`The archive used codesigning files of team: %s - %s
Would you like to use this team to export an ipa file?`, archiveCertificate.TeamID, archiveCertificate.TeamName)
useArchiveTeam, err = goinp.AskForBoolWithDefault(question, true)
Expand Down Expand Up @@ -280,7 +279,6 @@ func collectExportCodeSignGroups(archive Archive, installedCertificates []certif
}

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

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

fmt.Println()
fmt.Println()
log.Infof("Codesign settings will be used for %s .ipa/.app export:", exportMethod(collectedCodeSignGroup))
fmt.Println()
printCodesignGroup(collectedCodeSignGroup)

collectedCodeSignGroups = append(collectedCodeSignGroups, collectedCodeSignGroup)

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

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

fmt.Println()
log.Infof("Codesign settings used for archive:")
fmt.Println()
printCodesignGroup(archiveCodeSignGroup)

return archiveCodeSignGroup, nil
Expand Down
5 changes: 0 additions & 5 deletions codesigndoc/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ func collectAndExportIdentities(certificates []certificateutil.CertificateInfoMo
fmt.Println()
fmt.Println()
log.Infof("Required Identities/Certificates (%d)", len(certificates))
fmt.Println()
for _, certificate := range certificates {
log.Printf("- %s", certificate.CommonName)
}

fmt.Println()
log.Infof("Exporting the Identities (Certificates):")
fmt.Println()

identitiesWithKeychainRefs := []osxkeychain.IdentityWithRefModel{}
defer osxkeychain.ReleaseIdentityWithRefList(identitiesWithKeychainRefs)
Expand Down Expand Up @@ -80,16 +78,13 @@ func collectAndExportProvisioningProfiles(profiles []profileutil.ProvisioningPro
return nil
}

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

fmt.Println()
log.Infof("Exporting Provisioning Profiles...")
fmt.Println()

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