diff --git a/.gitignore b/.gitignore
index c488a5e3..0ea74afe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,5 +3,5 @@ Identities.p12
_bin
codesigndoc_exports
.gows.user.yml
-
.DS_Store
+.idea/
diff --git a/README.md b/README.md
index d87c0c56..e2e526bb 100644
--- a/README.md
+++ b/README.md
@@ -2,19 +2,14 @@
Your friendly iOS Code Signing Doctor.
-Using this tool is as easy as running `codesigndoc scan` and following the guide
-it prints. At the end of the process you'll have all the code signing files
-(`.p12` Identity file including the Certificate and Private Key, and the
-required Provisioning Profiles) required to do a successful Xcode Archive of
-your Xcode project.
+`codesigndoc` collects all the code signing files required for
+Xcode Archive and IPA export or Xcode Build For Testing action.
What this tool does:
-1. Gathers all information required to do a clean Xcode / Xamarin Studio Archive
- of your project.
-1. Runs a clean Xcode / Xamarin Studio Archive on your project.
-1. From the generated xcarchive file it collects the Code Signing settings Xcode
- / Xamarin Studio used during the Archive.
+1. Gathers all information required for the specified Xcode action.
+1. Runs a clean Xcode Archive or Xcode Build For Testing on your project.
+1. From the generated artifact it collects the Code Signing settings Xcode used during the action.
1. Prints the list of required code signing files.
1. Optionally it can also search for, and export these files.
@@ -73,19 +68,6 @@ If the UITest scanner cannot find the desired scheme, follow these steps:
-
-#### Xamarin
-For Archiving & Exporting IPA for Xamarin project (solution):
-
-
-```
-bash -l -c "$(curl -sfL https://raw.githubusercontent.com/bitrise-io/codesigndoc/master/_scripts/install_wrap-xamarin.sh)"
-```
-
-
-
-----
-
### Manual install & run
1. download the current release - it's a single, stand-alone binary
@@ -99,13 +81,12 @@ bash -l -c "$(curl -sfL https://raw.githubusercontent.com/bitrise-io/codesigndoc
* if you followed the previous examples:
* Xcode project scanner: `./codesigndoc scan xcode`
* Xcode project scanner for UI test targets: `./codesigndoc scan xcodeuitests`
- * Xamarin project scanner: `./codesigndoc scan xamarin`
**Optional xcodebuild flags:**
-`-sdk`: 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")
+`-sdk`: 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`")
-`-destination`: The xcodebuild -destination option takes as its argument a destination specifier describing the device (or devices) to use as a destination i.e `generic/platform=iOS`.
+`-destination`: The xcodebuild `-destination` option takes as its argument a destination specifier describing the device (or devices) to use as a destination i.e `generic/platform=iOS`.
## Manually finding the required base code signing files for an Xcode project or workspace
diff --git a/_scripts/install_wrap-xamarin.sh b/_scripts/install_wrap-xamarin.sh
deleted file mode 100755
index 22c605d1..00000000
--- a/_scripts/install_wrap-xamarin.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-set -e
-
-echo " => Creating a temporary directory for codesigndoc ..."
-temp_dir="$(mktemp -d -t codesigndocXXXXXX)"
-codesigndoc_bin_path="${temp_dir}/codesigndoc"
-
-version_to_use="2.4.4"
-if [ "$1" != "" ] ; then
- version_to_use="$1"
-fi
-if [ ! -z "${CODESIGNDOC_VERSION}" ] ; then
- version_to_use="${CODESIGNDOC_VERSION}"
-fi
-echo " => Downloading version: ${version_to_use}"
-
-scan_command_to_use="xamarin"
-
-codesigndoc_download_url="https://github.com/bitrise-io/codesigndoc/releases/download/${version_to_use}/codesigndoc-Darwin-x86_64"
-echo " => Downloading codesigndoc from (${codesigndoc_download_url}) to (${codesigndoc_bin_path}) ..."
-curl -fL --progress-bar --output "${codesigndoc_bin_path}" "$codesigndoc_download_url"
-echo " => Making it executable ..."
-chmod +x "${codesigndoc_bin_path}"
-echo " => codesigndoc version: $(${codesigndoc_bin_path} version)"
-echo " => Running codesigndoc scan ..."
-echo
-${codesigndoc_bin_path} scan ${scan_command_to_use}
diff --git a/_scripts/update_wrapper_versions.go b/_scripts/update_wrapper_versions.go
index 7c66de97..ae1089fb 100644
--- a/_scripts/update_wrapper_versions.go
+++ b/_scripts/update_wrapper_versions.go
@@ -30,7 +30,7 @@ func substituteVersionInfo(tmpl *template.Template, data VersionInfo, targetPth
}
func main() {
- log.Infof("Only update wrapper versions when release is availabe.")
+ log.Infof("Only update wrapper versions when release is available.")
tmpl := template.Must(template.ParseFiles("install_wrap.sh.template"))
@@ -64,14 +64,4 @@ func main() {
); err != nil {
panic(fmt.Sprintf("%s", err))
}
-
- if err := substituteVersionInfo(tmpl,
- VersionInfo{
- ScanCmd: "xamarin",
- Version: version.VERSION,
- },
- "install_wrap-xamarin.sh",
- ); err != nil {
- panic(fmt.Sprintf("%s", err))
- }
}
diff --git a/cmd/root.go b/cmd/root.go
index e100a567..2a281183 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -12,17 +12,14 @@ var (
enableVerboseLog = false
)
-// RootCmd represents the base command when called without any subcommands
+// RootCmd represents the base command when called without any subcommands.
var RootCmd = &cobra.Command{
Use: "codesigndoc",
Short: "Your friendly iOS Code Signing Doctor",
Long: `Your friendly iOS Code Signing Doctor
-Using this tool is as easy as running "codesigndoc scan xcode/xamarin" and following the guide it prints.
-
-At the end of the process you'll have all the code signing files
-(.p12 Identity file including the Certificate and Private Key,
-and the required Provisioning Profiles) required to do a successful Archive of your iOS project.`,
+codesigndoc collects all the code signing files required for
+Xcode Archive and IPA export or Xcode Build For Testing action.`,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
log.SetEnableDebugLog(enableVerboseLog)
diff --git a/cmd/scan.go b/cmd/scan.go
index 258fadf9..9e93439a 100644
--- a/cmd/scan.go
+++ b/cmd/scan.go
@@ -16,12 +16,12 @@ const (
writeFilesFlag = "write-files"
)
-// scanCmd represents the scan command
+// scanCmd represents the scan command.
var scanCmd = &cobra.Command{
Use: "scan",
- Short: "Scan a project's code signing settings",
- Long: `Scan a project's code signing settings,
-and export the require code signing files.`,
+ Short: "Scans the project's code signing settings",
+ Long: `Scans the project's code signing settings,
+and exports the required code signing files.`,
TraverseChildren: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
switch cmd.Flag(writeFilesFlag).Value.String() {
@@ -65,13 +65,13 @@ func init() {
RootCmd.AddCommand(scanCmd)
scanCmd.PersistentFlags().BoolVar(&isAskForPassword, "ask-pass", false, "Ask for .p12 password, instead of using an empty password")
scanCmd.PersistentFlags().BoolVar(&certificatesOnly, "certs-only", false, "Collect Certificates (Identities) only")
- scanCmd.PersistentFlags().String(writeFilesFlag, "always", `Set wether to export build logs and codesigning files to the ./codesigndoc_exports directory. Defaults to "always". Valid values: "always", "fallback", "disable".
+ scanCmd.PersistentFlags().String(writeFilesFlag, "always", `Set whether to export build logs and codesigning files to the ./codesigndoc_exports directory. Defaults to "always". Valid values: "always", "fallback", "disable".
- always: Writes artifacts in every case.
- fallback: Does not write artifacts if the automatic upload option is chosen interactively or by providing the auth-token and app-slug flag. Writes build log only on failure.
- disabled: Do not write any files to the export directory.`)
// Flags used to automatically upload artifacts.
scanCmd.PersistentFlags().StringVar(&personalAccessToken, authTokenFlag, "", `Bitrise personal access token. By default codesigndoc will ask for it interactively.
-Will upload codesigning files automatically if provided. Requires the app-slug paramater to be also set.`)
+Will upload codesigning files automatically if provided. Requires the app-slug parameter to be also set.`)
scanCmd.PersistentFlags().StringVar(&appSlug, appSlugFlag, "", `Bitrise app slug. By default codesigndoc will ask for it interactively.
Will upload codesigning files automatically if provided. Requires the auth-token parameter to be also set.`)
}
@@ -80,8 +80,7 @@ Will upload codesigning files automatically if provided. Requires the auth-token
type Tool string
const (
- toolXcode Tool = "Xcode"
- toolXamarin Tool = "Visual Studio"
+ toolXcode Tool = "Xcode"
)
// ArchiveError ...
diff --git a/cmd/utils.go b/cmd/utils.go
index a7b58131..a9f0ff0f 100644
--- a/cmd/utils.go
+++ b/cmd/utils.go
@@ -6,25 +6,14 @@ import (
"path"
"github.com/bitrise-io/bitrise-init/scanners/ios"
- "github.com/bitrise-io/bitrise-init/scanners/xamarin"
"github.com/bitrise-io/go-utils/colorstring"
"github.com/bitrise-io/go-utils/log"
"github.com/bitrise-io/go-utils/pathutil"
"github.com/bitrise-io/goinp/goinp"
)
-// projectType enum.
-// Could be iOSProjectType = 0
-// Or xamarinProjectType = 1
-type projectType int
-
-const (
- iOSProjectType projectType = iota
- xamarinProjectType
-)
-
-// Scans the root dir for the provided project files
-func scanForProjectFiles(projType projectType) ([]string, error) {
+// Scans the root dir for the provided project files.
+func scanForProjectFiles() ([]string, error) {
searchDir, err := os.Getwd()
if err != nil {
return nil, err
@@ -35,27 +24,16 @@ func scanForProjectFiles(projType projectType) ([]string, error) {
return nil, fmt.Errorf("failed to search for files in (%s), error: %s", searchDir, err)
}
- var paths []string
- {
- if projType == iOSProjectType {
- paths, err = ios.FilterRelevantWorkspaceFiles(fileList)
- if err != nil {
- return nil, fmt.Errorf("failed to search for workspace files, error: %s", err)
- }
+ paths, err := ios.FilterRelevantWorkspaceFiles(fileList)
+ if err != nil {
+ return nil, fmt.Errorf("failed to search for workspace files, error: %s", err)
+ }
- if len(paths) == 0 {
- paths, err = ios.FilterRelevantProjectFiles(fileList)
- if err != nil {
- return nil, fmt.Errorf("failed to search for project files, error: %s", err)
- }
- }
- } else if projType == xamarinProjectType {
- paths, err = xamarin.FilterSolutionFiles(fileList)
- if err != nil {
- return nil, fmt.Errorf("failed to search for solution files, error: %s", err)
- }
+ if len(paths) == 0 {
+ paths, err = ios.FilterRelevantProjectFiles(fileList)
+ if err != nil {
+ return nil, fmt.Errorf("failed to search for project files, error: %s", err)
}
-
}
if len(paths) == 0 {
@@ -65,12 +43,12 @@ func scanForProjectFiles(projType projectType) ([]string, error) {
return paths, nil
}
-// findProject scans the directory for Xcode Project (.xcworkspace / .xcodeproject) file first
-// If can't find any, ask the user to drag-and-drop the file
+// findProject scans the directory for Xcode Project (.xcworkspace / .xcodeproj) file,
+// if can't find any, ask the user to drag-and-drop the file.
func findXcodeProject() (string, error) {
var projpth string
- projPaths, err := scanForProjectFiles(iOSProjectType)
+ projPaths, err := scanForProjectFiles()
if err != nil {
log.Printf("Failed: %s", err)
fmt.Println()
@@ -100,37 +78,3 @@ the one you usually open in Xcode, then hit Enter.
return projpth, nil
}
-
-// findSolution scans the directory for Xamarin.Solution file first
-// If can't find any, ask the user to drag-and-drop the file
-func findXamarinSolution() (string, error) {
- var solutionPth string
- solPaths, err := scanForProjectFiles(xamarinProjectType)
- if err != nil {
- log.Printf("Failed: %s", err)
- fmt.Println()
-
- log.Infof("Provide the solution file manually")
- askText := `Please drag-and-drop your Xamarin Solution (` + colorstring.Green(".sln") + `) file,
-and then hit Enter`
- solutionPth, err = goinp.AskForPath(askText)
- if err != nil {
- return "", fmt.Errorf("failed to read input: %s", err)
- }
-
- return solutionPth, nil
- }
-
- if len(solPaths) == 1 {
- log.Printf("Found one solution file: %s.", path.Base(solPaths[0]))
- return solPaths[0], nil
- }
-
- log.Printf("Found multiple solution file: %s.", path.Base(solutionPth))
- solutionPth, err = goinp.SelectFromStringsWithDefault("Select the solution file you want to scan", 1, solPaths)
- if err != nil {
- return "", fmt.Errorf("failed to select solution file: %s", err)
- }
-
- return solutionPth, nil
-}
diff --git a/cmd/version.go b/cmd/version.go
index 79ea2397..50fda82d 100644
--- a/cmd/version.go
+++ b/cmd/version.go
@@ -12,7 +12,7 @@ var (
isFullVersionPrint = false
)
-// versionCmd represents the version command
+// versionCmd represents the version command.
var versionCmd = &cobra.Command{
Use: "version",
Short: "Prints version number",
diff --git a/cmd/xamarin.go b/cmd/xamarin.go
deleted file mode 100644
index 667c215c..00000000
--- a/cmd/xamarin.go
+++ /dev/null
@@ -1,219 +0,0 @@
-package cmd
-
-import (
- "encoding/json"
- "fmt"
- "os"
- "path/filepath"
- "sort"
-
- "github.com/bitrise-io/codesigndoc/codesign"
- "github.com/bitrise-io/codesigndoc/codesigndoc"
- "github.com/bitrise-io/codesigndoc/xamarin"
- "github.com/bitrise-io/go-utils/colorstring"
- "github.com/bitrise-io/go-utils/fileutil"
- "github.com/bitrise-io/go-utils/log"
- "github.com/bitrise-io/go-utils/stringutil"
- "github.com/bitrise-io/go-xamarin/analyzers/project"
- "github.com/bitrise-io/go-xamarin/analyzers/solution"
- "github.com/bitrise-io/go-xamarin/builder"
- "github.com/bitrise-io/go-xamarin/constants"
- "github.com/bitrise-io/goinp/goinp"
- "github.com/spf13/cobra"
-)
-
-// xamarinCmd represents the xamarin command
-var xamarinCmd = &cobra.Command{
- Use: "xamarin",
- Short: "Xamarin project scanner",
- Long: `Scan a Xamarin project`,
-
- SilenceUsage: true,
- SilenceErrors: true,
- RunE: scanXamarinProject,
-}
-
-var (
- paramXamarinSolutionFilePath = ""
- paramXamarinConfigurationName = ""
-)
-
-func init() {
- scanCmd.AddCommand(xamarinCmd)
-
- xamarinCmd.Flags().StringVar(¶mXamarinSolutionFilePath, "file", "", `Xamarin Solution file path`)
- xamarinCmd.Flags().StringVar(¶mXamarinConfigurationName, "config", "", `Xamarin Configuration Name (e.g.: "Release|iPhone")`)
-}
-
-func archivableSolutionConfigNames(projectsByID map[string]project.Model) []string {
- archivableSolutionConfigNameSet := map[string]bool{}
- for _, project := range projectsByID {
- if project.SDK != constants.SDKIOS || project.OutputType != "exe" {
- continue
- }
-
- var archivableProjectConfigNames []string
- for name, config := range project.Configs {
- if builder.IsDeviceArch(config.MtouchArchs...) {
- archivableProjectConfigNames = append(archivableProjectConfigNames, name)
- }
-
- }
-
- for solutionConfigName, projectConfigName := range project.ConfigMap {
- for _, archivableProjectConfigName := range archivableProjectConfigNames {
- if archivableProjectConfigName == projectConfigName {
- archivableSolutionConfigNameSet[solutionConfigName] = true
- }
- }
- }
- }
-
- archivableSolutionConfigNames := []string{}
- for configName := range archivableSolutionConfigNameSet {
- archivableSolutionConfigNames = append(archivableSolutionConfigNames, configName)
- }
- sort.Strings(archivableSolutionConfigNames)
-
- return archivableSolutionConfigNames
-}
-
-func scanXamarinProject(cmd *cobra.Command, args []string) error {
- absExportOutputDirPath, err := absOutputDir()
- if err != nil {
- return err
- }
-
- xamarinCmd := xamarin.CommandModel{}
- // --- Inputs ---
-
- // Xamarin Solution Path
- xamarinCmd.SolutionFilePath = paramXamarinSolutionFilePath
- if xamarinCmd.SolutionFilePath == "" {
- fmt.Println()
- log.Infof("Scan the directory for solution files")
- log.Warnf("You can specify the Xamarin Solution file to scan with the --file flag.")
-
- //
- // Scan the directory for Xamarin.Solution file first
- // If can't find any, ask the user to drag-and-drop the file
- var err error
- if xamarinCmd.SolutionFilePath, err = findXamarinSolution(); err != nil {
- return err
- }
- }
- log.Debugf("xamSolutionPth: %s", xamarinCmd.SolutionFilePath)
-
- xamSln, err := solution.New(xamarinCmd.SolutionFilePath, true)
- if err != nil {
- return fmt.Errorf("failed to analyze Xamarin solution: %s", err)
- }
-
- if enableVerboseLog {
- b, err := json.MarshalIndent(xamSln, "", "\t")
- if err == nil {
- log.Debugf("xamarin solution:\n%s", b)
- }
- }
-
- archivableSolutionConfigNames := archivableSolutionConfigNames(xamSln.ProjectMap)
-
- if len(archivableSolutionConfigNames) < 1 {
- return ArchiveError{toolXamarin, `no acceptable Configuration found in the provided Solution and Project, or none can be used for iOS "Archive for Publishing".`}
- }
-
- // Xamarin Configuration Name
- selectedXamarinConfigurationName := ""
- {
- if paramXamarinConfigurationName != "" {
- // configuration specified via flag/param
- for _, configName := range archivableSolutionConfigNames {
- if paramXamarinConfigurationName == configName {
- selectedXamarinConfigurationName = configName
- break
- }
- }
- if selectedXamarinConfigurationName == "" {
- return ArchiveError{toolXamarin, fmt.Sprintf("invalid Configuration specified (%s), either not found in the provided Solution and Project or it can't be used for iOS Archive.", paramXamarinConfigurationName)}
- }
- } else {
- // no configuration CLI param specified
- if len(archivableSolutionConfigNames) == 1 {
- selectedXamarinConfigurationName = archivableSolutionConfigNames[0]
- } else {
- fmt.Println()
- answerValue, err := goinp.SelectFromStringsWithDefault(`Select the Configuration Name you use for "Archive for Publishing" (usually Release|iPhone)`, 1, archivableSolutionConfigNames)
- if err != nil {
- return fmt.Errorf("failed to select Configuration: %s", err)
- }
- log.Debugf("selected configuration: %v", answerValue)
- selectedXamarinConfigurationName = answerValue
- }
- }
- }
- if selectedXamarinConfigurationName == "" {
- return ArchiveError{toolXamarin, `no acceptable Configuration found (it was empty) in the provided Solution and Project, or none can be used for iOS "Archive for Publishing".`}
- }
- if err := xamarinCmd.SetConfigurationPlatformCombination(selectedXamarinConfigurationName); err != nil {
- return fmt.Errorf("failed to set Configuration Platform combination for the command, error: %s", err)
- }
-
- fmt.Println()
- fmt.Println()
- log.Printf(`🔦 Running a Build, to get all the required code signing settings...`)
- logOutputFilePath := filepath.Join(absExportOutputDirPath, "xamarin-build-output.log")
-
- archivePath, logOutput, err := xamarinCmd.GenerateArchive()
- if writeFiles == codesign.WriteFilesAlways || writeFiles == codesign.WriteFilesFallback && err != nil { // save the xamarin output into a debug log file
- if err := os.MkdirAll(absExportOutputDirPath, 0700); err != nil {
- return fmt.Errorf("failed to create output directory, error: %s", err)
- }
-
- log.Infof("💡 "+colorstring.Yellow("Saving xamarin output into file")+": %s", logOutputFilePath)
- if err := fileutil.WriteStringToFile(logOutputFilePath, logOutput); err != nil {
- log.Errorf("Failed to save xamarin build output into file (%s), error: %s", logOutputFilePath, err)
- }
- }
- if err != nil {
- log.Warnf("Last lines of the build log:")
- fmt.Println(stringutil.LastNLines(logOutput, 15))
-
- log.Infof(colorstring.Yellow("Please check the build log to see what caused the error."))
- fmt.Println()
-
- log.Errorf("Build failed.")
- log.Infof(colorstring.Yellow("Open the project: ")+"%s", xamarinCmd.SolutionFilePath)
- log.Infof(colorstring.Yellow(`And do "Archive for Publishing", after selecting the Configuration+Platform: `)+"%s|%s", xamarinCmd.Configuration, xamarinCmd.Platform)
- fmt.Println()
-
- return ArchiveError{toolXamarin, "failed to run xamarin build command: " + err.Error()}
- }
-
- // If certificatesOnly is set, CollectCodesignFiles returns an empty slice for profiles
- certificatesToExport, profilesToExport, err := codesigndoc.CollectCodesignFiles(archivePath, certificatesOnly)
- if err != nil {
- return err
- }
-
- certificates, profiles, err := codesign.ExportCodesigningFiles(certificatesToExport, profilesToExport, isAskForPassword)
- if err != nil {
- return err
- }
-
- exportResult, err := codesign.UploadAndWriteCodesignFiles(certificates,
- profiles,
- codesign.WriteFilesConfig{
- WriteFiles: writeFiles,
- AbsOutputDirPath: absExportOutputDirPath,
- },
- codesign.UploadConfig{
- PersonalAccessToken: personalAccessToken,
- AppSlug: appSlug,
- })
- if err != nil {
- return err
- }
-
- printFinished(exportResult, absExportOutputDirPath)
- return nil
-}
diff --git a/cmd/xcode.go b/cmd/xcode.go
index 49616b9d..b0aba71d 100644
--- a/cmd/xcode.go
+++ b/cmd/xcode.go
@@ -18,11 +18,12 @@ import (
"github.com/spf13/cobra"
)
-// xcodeCmd represents the xcode command
+// xcodeCmd represents the xcode command.
var xcodeCmd = &cobra.Command{
Use: "xcode",
- Short: "Xcode project scanner",
- Long: `Scan an Xcode project`,
+ Short: "Scans the project's code signing settings for Xcode Archive and IPA export actions",
+ Long: `Scans the project's code signing settings for Xcode Archive and IPA export actions
+and exports the required code signing files.`,
SilenceUsage: true,
SilenceErrors: true,
@@ -50,7 +51,7 @@ func absOutputDir() (string, error) {
absExportOutputDirPath, err := pathutil.AbsPath(confExportOutputDirPath)
log.Debugf("absExportOutputDirPath: %s", absExportOutputDirPath)
if err != nil {
- return absExportOutputDirPath, fmt.Errorf("Failed to determine absolute path of export dir: %s", confExportOutputDirPath)
+ return absExportOutputDirPath, fmt.Errorf("failed to determine absolute path of export dir: %s", confExportOutputDirPath)
}
return absExportOutputDirPath, nil
}
@@ -66,10 +67,10 @@ func scanXcodeProject(_ *cobra.Command, _ []string) error {
projectPath := paramXcodeProjectFilePath
if projectPath == "" {
log.Infof("Scan the directory for project files")
- log.Warnf("You can specify the Xcode project/workscape file to scan with the --file flag.")
+ log.Warnf("You can specify the Xcode project/workspace file to scan with the --file flag.")
- // Scan the directory for Xcode Project (.xcworkspace / .xcodeproject) file first
- // If can't find any, ask the user to drag-and-drop the file
+ // Scan the directory for Xcode Project (.xcworkspace / .xcodeproj) file,
+ // if can't find any, ask the user to drag-and-drop the file
projpth, err := findXcodeProject()
if err != nil {
return err
@@ -138,7 +139,7 @@ func scanXcodeProject(_ *cobra.Command, _ []string) error {
log.Infof("💡 "+colorstring.Yellow("Saving xcodebuild output into file")+": %s", xcodebuildOutputFilePath)
if err := fileutil.WriteStringToFile(xcodebuildOutputFilePath, xcodebuildOutput); err != nil {
- return fmt.Errorf("Failed to save xcodebuild output into file (%s), error: %s", xcodebuildOutputFilePath, err)
+ return fmt.Errorf("failed to save xcodebuild output into file (%s), error: %s", xcodebuildOutputFilePath, err)
}
}
return nil
diff --git a/cmd/xcodeUITests.go b/cmd/xcodeUITests.go
index fc042759..74a516d9 100644
--- a/cmd/xcodeUITests.go
+++ b/cmd/xcodeUITests.go
@@ -21,8 +21,9 @@ import (
var xcodeUITestsCmd = &cobra.Command{
Use: "xcodeuitests",
- Short: "Xcode project scanner for UI tests",
- Long: `Scan an Xcode project for UI test targets`,
+ Short: "Scans the project's code signing settings for Xcode Build For Testing action",
+ Long: `Scans the project's code signing settings for Xcode Build For Testing action
+and exports the required code signing files.`,
SilenceUsage: true,
SilenceErrors: true,
@@ -38,7 +39,7 @@ func init() {
xcodeUITestsCmd.Flags().StringVar(¶mXcodeDestination, "xcodebuild-destination", "", "The xcodebuild -destination option takes as its argument a destination specifier describing the device (or devices) to use as a destination i.e `generic/platform=iOS`. If a value is specified for this flag it'll be passed to xcodebuild.")
}
-func scanXcodeUITestsProject(cmd *cobra.Command, args []string) error {
+func scanXcodeUITestsProject(*cobra.Command, []string) error {
absExportOutputDirPath, err := absOutputDir()
if err != nil {
return err
@@ -56,11 +57,11 @@ func scanXcodeUITestsProject(cmd *cobra.Command, args []string) error {
projectPath := paramXcodeProjectFilePath
if projectPath == "" {
log.Infof("Scan the directory for project files")
- log.Warnf("You can specify the Xcode project/workscape file to scan with the --file flag.")
+ log.Warnf("You can specify the Xcode project/workspace file to scan with the --file flag.")
//
- // Scan the directory for Xcode Project (.xcworkspace / .xcodeproject) file first
- // If can't find any, ask the user to drag-and-drop the file
+ // Scan the directory for Xcode Project (.xcworkspace / .xcodeproj) file,
+ // if can't find any, ask the user to drag-and-drop the file
projpth, err := findXcodeProject()
if err != nil {
return err
@@ -93,7 +94,7 @@ func scanXcodeUITestsProject(cmd *cobra.Command, args []string) error {
fmt.Println()
log.Infof("Schemes with UITest target enabled:")
- // Iterate trough the scheme arrays and get the scheme names
+ // Iterate through the scheme arrays and get the scheme names
var schemesWitUITestNames []string
{
for _, schemeWithUITest := range schemesWitUITests {
diff --git a/codesign/certificates.go b/codesign/certificates.go
index 01a838d7..7059945d 100644
--- a/codesign/certificates.go
+++ b/codesign/certificates.go
@@ -32,15 +32,10 @@ var (
"Apple Development", // type: "Apple Development"
"Apple Distribution", // type: "Apple Distribution"
}
-
- macOSInstallerCertificateNames = []string{
- "3rd Party Mac Developer Installer", // type: "Mac Installer Distribution"
- "Developer ID Installer", // type: "Developer ID Installer"
- }
)
// InstalledCertificates returns the certificate installed in the keychain,
-// the expired certificates are removed from the list
+// the expired certificates are removed from the list.
func InstalledCertificates(certType certificateType) ([]certificateutil.CertificateInfoModel, error) {
var certs []certificateutil.CertificateInfoModel
var err error
@@ -68,11 +63,11 @@ func InstalledCertificates(certType certificateType) ([]certificateutil.Certific
}
}
- return certificateutil.FilterValidCertificateInfos(certs).ValidCertificates, nil
+ return certificateutil.FilterValidCertificateInfos(certs).ValidCertificates, err
}
// IsDistributionCertificate returns true if the given certificate
-// is an iOS Distribution, Mac App Distribution or Developer ID Application certificate
+// is an iOS Distribution, Mac App Distribution or Developer ID Application certificate.
func IsDistributionCertificate(cert certificateutil.CertificateInfoModel) bool {
if strings.Contains(strings.ToLower(cert.CommonName), strings.ToLower("iPhone Distribution")) {
return true
@@ -86,16 +81,12 @@ func IsDistributionCertificate(cert certificateutil.CertificateInfoModel) bool {
}
// IsInstallerCertificate returns true if the given certificate
-// is an installer certificate
+// is an installer certificate.
func IsInstallerCertificate(cert certificateutil.CertificateInfoModel) bool {
- if strings.Contains(strings.ToLower(cert.CommonName), strings.ToLower("installer")) {
- return true
- }
-
- return false
+ return strings.Contains(strings.ToLower(cert.CommonName), strings.ToLower("installer"))
}
-// MapCertificatesByTeam returns a certificate list mapped by the certificate's team (in teamdID - teamName format)
+// MapCertificatesByTeam returns a certificate list mapped by the certificate's team (in teamID - teamName format).
func MapCertificatesByTeam(certificates []certificateutil.CertificateInfoModel) map[string][]certificateutil.CertificateInfoModel {
certificatesByTeam := map[string][]certificateutil.CertificateInfoModel{}
for _, certificateInfo := range certificates {
@@ -110,13 +101,13 @@ func MapCertificatesByTeam(certificates []certificateutil.CertificateInfoModel)
return certificatesByTeam
}
-// FindCertificate returns the first certificate, which's common_name or SHA1 fingerprint matches to the given string
+// FindCertificate returns the first certificate, which common_name or SHA1 fingerprint matches to the given string.
func FindCertificate(nameOrSHA1Fingerprint string, certificates []certificateutil.CertificateInfoModel) (certificateutil.CertificateInfoModel, error) {
for _, certificate := range certificates {
if certificate.CommonName == nameOrSHA1Fingerprint {
return certificate, nil
}
- if strings.ToLower(certificate.SHA1Fingerprint) == strings.ToLower(nameOrSHA1Fingerprint) {
+ if strings.EqualFold(certificate.SHA1Fingerprint, nameOrSHA1Fingerprint) {
return certificate, nil
}
}
diff --git a/codesign/export.go b/codesign/export.go
index 6efd1835..5717f5d1 100644
--- a/codesign/export.go
+++ b/codesign/export.go
@@ -19,40 +19,40 @@ import (
"github.com/bitrise-io/goinp/goinp"
)
-// UploadConfig contains configuration to automatically upload artifacts to bitrise.io
+// UploadConfig contains configuration to automatically upload artifacts to bitrise.io.
type UploadConfig struct {
PersonalAccessToken string
AppSlug string
}
-// WriteFilesConfig controls writing artifacts as files
+// WriteFilesConfig controls writing artifacts as files.
type WriteFilesConfig struct {
WriteFiles WriteFilesLevel
AbsOutputDirPath string
}
-// WriteFilesLevel describes if codesigning files should be written to the output directory
+// WriteFilesLevel describes if codesigning files should be written to the output directory.
type WriteFilesLevel int
const (
- // Invalid represents an invalid value
+ // Invalid represents an invalid value.
Invalid WriteFilesLevel = iota
- // WriteFilesAlways writes build logs and codesigning files always
+ // WriteFilesAlways writes build logs and codesigning files always.
WriteFilesAlways
- // WriteFilesFallback writes artifacts when upload was not chosen or failed
+ // WriteFilesFallback writes artifacts when upload was not chosen or failed.
WriteFilesFallback
- // WriteFilesDisabled does not write any files
+ // WriteFilesDisabled does not write any files.
WriteFilesDisabled
)
-// ExportReport describes the output of codesigning files export
+// ExportReport describes the output of codesigning files export.
type ExportReport struct {
CertificatesUploaded bool
ProvisioningProfilesUploaded bool
CodesignFilesWritten bool
}
-// ExportCodesigningFiles exports certificates from the Keychain and provisoining profiles from their directory
+// ExportCodesigningFiles exports certificates from the Keychain and provisioning profiles from their directory.
func ExportCodesigningFiles(certificatesRequired []certificateutil.CertificateInfoModel, profilesRequired []profileutil.ProvisioningProfileInfoModel, askForPassword bool) (models.Certificates, []models.ProvisioningProfile, error) {
certificates, err := exportIdentities(certificatesRequired, askForPassword)
if err != nil {
@@ -67,13 +67,13 @@ func ExportCodesigningFiles(certificatesRequired []certificateutil.CertificateIn
return certificates, profiles, nil
}
-// UploadAndWriteCodesignFiles exports then uploads codesign files to bitrise.io and saves them to output folder
+// UploadAndWriteCodesignFiles exports then uploads codesign files to bitrise.io and saves them to output folder.
func UploadAndWriteCodesignFiles(certificates models.Certificates, provisioningProfiles []models.ProvisioningProfile, writeFilesConfig WriteFilesConfig, uploadConfig UploadConfig) (ExportReport, error) {
var client *bitrise.Client
// both or none CLI flags are required
if uploadConfig.PersonalAccessToken != "" && uploadConfig.AppSlug != "" {
- // Upload automatically if token is provided as CLI paramter, do not export to filesystem
- // Used to upload artifacts as part of an other CLI tool
+ // Upload automatically if token is provided as CLI parameter, do not export to filesystem.
+ // Used to upload artifacts as part of another CLI tool
var err error
client, err = bitrise.NewClient(uploadConfig.PersonalAccessToken)
if err != nil {
@@ -157,7 +157,7 @@ func writeFiles(identities models.Certificates, provisioningProfiles []models.Pr
return nil
}
-// exportIdentities exports the given certificates merged in a single .p12 file
+// exportIdentities exports the given certificates merged in a single .p12 file.
func exportIdentities(certificates []certificateutil.CertificateInfoModel, isAskForPassword bool) (models.Certificates, error) {
if len(certificates) == 0 {
return models.Certificates{}, nil
@@ -173,7 +173,7 @@ func exportIdentities(certificates []certificateutil.CertificateInfoModel, isAsk
fmt.Println()
log.Infof("Exporting the Identities (Certificates):")
- identitiesWithKeychainRefs := []osxkeychain.IdentityWithRefModel{}
+ var identitiesWithKeychainRefs []osxkeychain.IdentityWithRefModel
defer osxkeychain.ReleaseIdentityWithRefList(identitiesWithKeychainRefs)
for _, certificate := range certificates {
@@ -190,10 +190,10 @@ func exportIdentities(certificates []certificateutil.CertificateInfoModel, isAsk
identitiesWithKeychainRefs = append(identitiesWithKeychainRefs, *identityRef)
}
- identityKechainRefs := osxkeychain.CreateEmptyCFTypeRefSlice()
+ identityKeychainRefs := osxkeychain.CreateEmptyCFTypeRefSlice()
for _, aIdentityWithRefItm := range identitiesWithKeychainRefs {
fmt.Println("exporting Identity:", aIdentityWithRefItm.Label)
- identityKechainRefs = append(identityKechainRefs, aIdentityWithRefItm.KeychainRef)
+ identityKeychainRefs = append(identityKeychainRefs, aIdentityWithRefItm.KeychainRef)
}
fmt.Println()
@@ -210,7 +210,7 @@ func exportIdentities(certificates []certificateutil.CertificateInfoModel, isAsk
log.Warnf("you will have to accept (Allow) those to be able to export the Identities!")
fmt.Println()
- identities, err := osxkeychain.ExportFromKeychain(identityKechainRefs, isAskForPassword)
+ identities, err := osxkeychain.ExportFromKeychain(identityKeychainRefs, isAskForPassword)
if err != nil {
return models.Certificates{}, fmt.Errorf("failed to export from Keychain: %s", err)
}
@@ -220,12 +220,12 @@ func exportIdentities(certificates []certificateutil.CertificateInfoModel, isAsk
}, nil
}
-// writeIdentities writes identities to a file path
-func writeIdentities(identites []byte, absExportOutputDirPath string) error {
- return ioutil.WriteFile(filepath.Join(absExportOutputDirPath, "Identities.p12"), identites, 0600)
+// writeIdentities writes identities to a file path.
+func writeIdentities(identities []byte, absExportOutputDirPath string) error {
+ return ioutil.WriteFile(filepath.Join(absExportOutputDirPath, "Identities.p12"), identities, 0600)
}
-// exportProvisioningProfiles returns provisioning profies
+// exportProvisioningProfiles returns provisioning profiles.
func exportProvisioningProfiles(profiles []profileutil.ProvisioningProfileInfoModel) ([]models.ProvisioningProfile, error) {
if len(profiles) == 0 {
return nil, nil
@@ -266,7 +266,7 @@ func exportProvisioningProfiles(profiles []profileutil.ProvisioningProfileInfoMo
return exportedProfiles, nil
}
-// writeProvisioningProfiles writes provisioning profiles to the filesystem
+// writeProvisioningProfiles writes provisioning profiles to the filesystem.
func writeProvisioningProfiles(profiles []models.ProvisioningProfile, absExportOutputDirPath string) error {
for _, profile := range profiles {
exportFileName := utility.ProfileExportFileNameNoPath(profile.Info)
diff --git a/codesign/profiles.go b/codesign/profiles.go
index c083adc1..93a99c22 100644
--- a/codesign/profiles.go
+++ b/codesign/profiles.go
@@ -4,7 +4,7 @@ import (
"github.com/bitrise-io/go-xcode/profileutil"
)
-// FilterLatestProfiles renmoves older versions of the same profile
+// FilterLatestProfiles removes older versions of the same profile.
func FilterLatestProfiles(profiles []profileutil.ProvisioningProfileInfoModel) []profileutil.ProvisioningProfileInfoModel {
profilesByBundleIDAndName := map[string][]profileutil.ProvisioningProfileInfoModel{}
for _, profile := range profiles {
@@ -19,7 +19,7 @@ func FilterLatestProfiles(profiles []profileutil.ProvisioningProfileInfoModel) [
profilesByBundleIDAndName[bundleIDAndName] = profs
}
- filteredProfiles := []profileutil.ProvisioningProfileInfoModel{}
+ var filteredProfiles []profileutil.ProvisioningProfileInfoModel
for _, profiles := range profilesByBundleIDAndName {
var latestProfile *profileutil.ProvisioningProfileInfoModel
for _, profile := range profiles {
diff --git a/codesigndoc/codesigndoc.go b/codesigndoc/codesigndoc.go
index 0b3b56f4..afaaf120 100644
--- a/codesigndoc/codesigndoc.go
+++ b/codesigndoc/codesigndoc.go
@@ -20,7 +20,7 @@ const collectCodesigningFilesInfo = `To collect available code sign files, we se
`
// CollectCodesignFiles collects the codesigning files required to create an xcode archive
-// and filers them for the specified export method
+// and filers them for the specified export method.
func CollectCodesignFiles(archivePath string, certificatesOnly bool) ([]certificateutil.CertificateInfoModel, []profileutil.ProvisioningProfileInfoModel, error) {
// Find out the XcArchive type
isMacOs, err := xcarchive.IsMacOS(archivePath)
@@ -78,24 +78,24 @@ func getFilesToExport(archivePath string, installedCertificates []certificateuti
var certificate certificateutil.CertificateInfoModel
var archive Archive
- var achiveCodeSignGroup export.CodeSignGroup
+ var archiveCodeSignGroup export.CodeSignGroup
if macOS {
- archive, achiveCodeSignGroup, err = getMacOSCodeSignGroup(archivePath, installedCertificates)
+ archive, archiveCodeSignGroup, err = getMacOSCodeSignGroup(archivePath, installedCertificates)
if err != nil {
return nil, nil, err
}
- certificate = achiveCodeSignGroup.Certificate()
+ certificate = archiveCodeSignGroup.Certificate()
} else {
- archive, achiveCodeSignGroup, err = getIOSCodeSignGroup(archivePath, installedCertificates)
+ archive, archiveCodeSignGroup, err = getIOSCodeSignGroup(archivePath, installedCertificates)
if err != nil {
return nil, nil, err
}
- certificate = achiveCodeSignGroup.Certificate()
+ certificate = archiveCodeSignGroup.Certificate()
}
- certificatesToExport := []certificateutil.CertificateInfoModel{}
- profilesToExport := []profileutil.ProvisioningProfileInfoModel{}
+ var certificatesToExport []certificateutil.CertificateInfoModel
+ var profilesToExport []profileutil.ProvisioningProfileInfoModel
if certificatesOnly {
exportCertificate, err := collectExportCertificate(macOS, certificate, installedCertificates, installedInstallerCertificates)
@@ -106,7 +106,7 @@ func getFilesToExport(archivePath string, installedCertificates []certificateuti
certificatesToExport = append(certificatesToExport, certificate)
certificatesToExport = append(certificatesToExport, exportCertificate...)
} else {
- certificatesToExport, profilesToExport, err = collectCertificatesAndProfiles(archive, certificate, installedCertificates, installedProfiles, certificatesToExport, profilesToExport, achiveCodeSignGroup)
+ certificatesToExport, profilesToExport, err = collectCertificatesAndProfiles(archive, installedCertificates, installedProfiles, certificatesToExport, profilesToExport, archiveCodeSignGroup)
if err != nil {
return nil, nil, err
}
@@ -115,10 +115,10 @@ func getFilesToExport(archivePath string, installedCertificates []certificateuti
return certificatesToExport, profilesToExport, nil
}
-func collectCertificatesAndProfiles(archive Archive, certificate certificateutil.CertificateInfoModel,
+func collectCertificatesAndProfiles(archive Archive,
installedCertificates []certificateutil.CertificateInfoModel, installedProfiles []profileutil.ProvisioningProfileInfoModel,
certificatesToExport []certificateutil.CertificateInfoModel, profilesToExport []profileutil.ProvisioningProfileInfoModel,
- achiveCodeSignGroup export.CodeSignGroup) ([]certificateutil.CertificateInfoModel, []profileutil.ProvisioningProfileInfoModel, error) {
+ archiveCodeSignGroup export.CodeSignGroup) ([]certificateutil.CertificateInfoModel, []profileutil.ProvisioningProfileInfoModel, error) {
_, macOS := archive.(xcarchive.MacosArchive)
@@ -146,7 +146,7 @@ func collectCertificatesAndProfiles(archive Archive, certificate certificateutil
return nil, nil, errors.New("no export code sign groups collected")
}
- codeSignGroups := append(exportCodeSignGroups, achiveCodeSignGroup)
+ codeSignGroups := append(exportCodeSignGroups, archiveCodeSignGroup)
certificates, profiles := extractCertificatesAndProfiles(codeSignGroups...)
certificatesToExport = append(certificatesToExport, certificates...)
profilesToExport = append(profilesToExport, profiles...)
diff --git a/codesigndoc/codesigngroup.go b/codesigndoc/codesigngroup.go
index b8e7bb09..aab858fd 100644
--- a/codesigndoc/codesigngroup.go
+++ b/codesigndoc/codesigngroup.go
@@ -17,7 +17,7 @@ import (
"github.com/bitrise-io/goinp/goinp"
)
-// extractCertificatesAndProfiles returns the certificates and provisioning profiles of the given codesign group
+// extractCertificatesAndProfiles returns the certificates and provisioning profiles of the given codesign group.
func extractCertificatesAndProfiles(codeSignGroups ...export.CodeSignGroup) ([]certificateutil.CertificateInfoModel, []profileutil.ProvisioningProfileInfoModel) {
certificateMap := map[string]certificateutil.CertificateInfoModel{}
profilesMap := map[string]profileutil.ProvisioningProfileInfoModel{}
@@ -35,8 +35,8 @@ func extractCertificatesAndProfiles(codeSignGroups ...export.CodeSignGroup) ([]c
}
}
- certificates := []certificateutil.CertificateInfoModel{}
- profiles := []profileutil.ProvisioningProfileInfoModel{}
+ var certificates []certificateutil.CertificateInfoModel
+ var profiles []profileutil.ProvisioningProfileInfoModel
for _, certificate := range certificateMap {
certificates = append(certificates, certificate)
}
@@ -46,7 +46,7 @@ func extractCertificatesAndProfiles(codeSignGroups ...export.CodeSignGroup) ([]c
return certificates, profiles
}
-// exportMethod returns which ipa/pkg/app export type is allowed by the given codesign group
+// exportMethod returns which ipa/pkg/app export type is allowed by the given codesign group.
func exportMethod(group export.CodeSignGroup) string {
for _, profile := range group.BundleIDProfileMap() {
return string(profile.ExportType)
@@ -54,7 +54,7 @@ func exportMethod(group export.CodeSignGroup) string {
return ""
}
-// printCodesignGroup prints the given codesign group
+// printCodesignGroup prints the given codesign group.
func printCodesignGroup(group export.CodeSignGroup) {
fmt.Printf("%s %s (%s)\n", colorstring.Green("development team:"), group.Certificate().TeamName, group.Certificate().TeamID)
fmt.Printf("%s %s [%s]\n", colorstring.Green("codesign identity:"), group.Certificate().CommonName, group.Certificate().Serial)
@@ -74,7 +74,7 @@ func printCodesignGroup(group export.CodeSignGroup) {
}
}
-// collectExportCertificate returns the certificate to use for the ipa export
+// 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) {
var selectedCertificates []certificateutil.CertificateInfoModel
@@ -126,20 +126,17 @@ func filterCertificates(isMacArchive bool, selectedExportMethod, selectedTeam st
})
log.Debugf("DeveloperDistribution certificates: %v\n", certsForSelectedExport)
- break
case "installer":
certsForSelectedExport = certificateutil.FilterCertificateInfoModelsByFilterFunc(installedInstallerCertificates, func(certInfo certificateutil.CertificateInfoModel) bool {
return codesign.IsInstallerCertificate(certInfo)
})
log.Debugf("Installer certificates: %v\n", certsForSelectedExport)
- break
default:
certsForSelectedExport = certificateutil.FilterCertificateInfoModelsByFilterFunc(installedCertificates, func(certInfo certificateutil.CertificateInfoModel) bool {
return codesign.IsDistributionCertificate(certInfo)
})
log.Debugf("Distribution certificates: %v\n", certsForSelectedExport)
- break
}
filteredCertificatesByTeam := codesign.MapCertificatesByTeam(certsForSelectedExport)
@@ -150,14 +147,14 @@ func filterCertificates(isMacArchive bool, selectedExportMethod, selectedTeam st
return nil, nil
}
- // If we already selected a team, we can skip it. (e.g mac app-store export)
+ // If we already selected a team, we can skip it. (e.g. mac app-store export)
if selectedTeam == "" {
useArchiveTeam := true
_, contains := filteredCertificatesByTeam[fmt.Sprintf("%s - %s", archiveCertificate.TeamID, archiveCertificate.TeamName)]
- // Ask the question if there is multiple valid team and the archiving team is one of them.
- // 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.
+ // Ask if there is multiple valid team and the archiving team is one of them.
+ // Skip it if only 1 team has certificates on the machine. Or the archiving team doesn't have the desired certificate type.
+ // Skip the question + set the useArchiveTeam = false, if multiple team has certificates for the export method but the archiving team is not one of them.
if len(filteredCertificatesByTeam) > 1 && contains {
fmt.Println()
@@ -167,7 +164,7 @@ Would you like to use this team to export an ipa file?`, archiveCertificate.Team
if err != nil {
return selectedCertificates, fmt.Errorf("failed to read input: %s", err)
}
- // If multiple team has certificate for the export method but the archiving team is not one of them.
+ // If multiple team has certificates for the export method but the archiving team is not one of them.
} else if !contains {
archiveTeam := fmt.Sprintf("%s - %s", archiveCertificate.TeamName, archiveCertificate.TeamID)
@@ -183,7 +180,7 @@ Would you like to use this team to export an ipa file?`, archiveCertificate.Team
// Use different team for export than archive.
if !useArchiveTeam {
- teams := []string{}
+ var teams []string
for team := range filteredCertificatesByTeam {
if hasCertificateForDistType(selectedExportMethod, filteredCertificatesByTeam[team]) {
teams = append(teams, team)
@@ -202,7 +199,7 @@ Would you like to use this team to export an ipa file?`, archiveCertificate.Team
// Find the specific development certificate.
filteredTeamCertificates := filteredCertificatesByTeam[selectedTeam]
- certificateOptions := []string{}
+ var certificateOptions []string
for _, certInfo := range filteredTeamCertificates {
certificateOption := fmt.Sprintf("%s [%s]", certInfo.CommonName, certInfo.Serial)
@@ -213,12 +210,8 @@ Would you like to use this team to export an ipa file?`, archiveCertificate.Team
switch selectedExportMethod {
case "development":
certType = "development"
- break
case "installer":
certType = "installer"
- break
- default:
- break
}
fmt.Println()
@@ -235,7 +228,7 @@ Would you like to use this team to export an ipa file?`, archiveCertificate.Team
}
}
- // Collect installer cert for MacOS app-store export.
+ // Collect installer cert for macOS app-store export.
if selectedExportMethod == "app-store" && isMacArchive {
fmt.Println()
question := `Do you want to collect installer certificate for the app-store export? [yes,no]`
@@ -261,9 +254,9 @@ Would you like to use this team to export an ipa file?`, archiveCertificate.Team
return selectedCertificates, nil
}
-// collectExportCodeSignGroups returns the codesigngroups required to export an ipa/.app with the selected export methods
+// collectExportCodeSignGroups returns the codesign groups required to export an ipa/.app with the selected export methods.
func collectExportCodeSignGroups(archive Archive, installedCertificates []certificateutil.CertificateInfoModel, installedProfiles []profileutil.ProvisioningProfileInfoModel) ([]export.CodeSignGroup, error) {
- collectedCodeSignGroups := []export.CodeSignGroup{}
+ var collectedCodeSignGroups []export.CodeSignGroup
_, isMacArchive := archive.(xcarchive.MacosArchive)
codeSignGroups := collectExportSelectableCodeSignGroups(archive, installedCertificates, installedProfiles)
@@ -279,7 +272,7 @@ func collectExportCodeSignGroups(archive Archive, installedCertificates []certif
exportMethods = append(exportMethods, "ad-hoc", "enterprise")
}
- for true {
+ for {
selectedExportMethod, err := goinp.SelectFromStringsWithDefault("Select the ipa export method", 1, exportMethods)
if err != nil {
return nil, fmt.Errorf("failed to read input: %s", err)
@@ -314,8 +307,8 @@ func collectExportCodeSignGroups(archive Archive, installedCertificates []certif
}
// Select certificate
- certificates := []certificateutil.CertificateInfoModel{}
- certificateOptions := []string{}
+ var certificates []certificateutil.CertificateInfoModel
+ var certificateOptions []string
for _, group := range filteredCodeSignGroups {
certificate := group.Certificate
certificates = append(certificates, certificate)
@@ -323,7 +316,7 @@ func collectExportCodeSignGroups(archive Archive, installedCertificates []certif
certificateOptions = append(certificateOptions, certificateOption)
}
- selectedCertificateOption := ""
+ var selectedCertificateOption string
if len(certificateOptions) == 1 {
selectedCertificateOption = certificateOptions[0]
@@ -366,13 +359,13 @@ func collectExportCodeSignGroups(archive Archive, installedCertificates []certif
selectedBundleIDProfileMap := map[string]profileutil.ProvisioningProfileInfoModel{}
for bundleID, profiles := range bundleIDProfilesMap {
profiles = codesign.FilterLatestProfiles(profiles)
- profileOptions := []string{}
+ var profileOptions []string
for _, profile := range profiles {
profileOption := fmt.Sprintf("%s (%s)", profile.Name, profile.UUID)
profileOptions = append(profileOptions, profileOption)
}
- selectedProfileOption := ""
+ var selectedProfileOption string
if len(profileOptions) == 1 {
selectedProfileOption = profileOptions[0]
@@ -401,9 +394,9 @@ func collectExportCodeSignGroups(archive Archive, installedCertificates []certif
var collectedCodeSignGroup export.CodeSignGroup
if isMacArchive {
- installedInstallerCertificates := []certificateutil.CertificateInfoModel{}
+ var installedInstallerCertificates []certificateutil.CertificateInfoModel
- var selectedInstallerCetrificate certificateutil.CertificateInfoModel
+ var selectedInstallerCertificate certificateutil.CertificateInfoModel
if selectedExportMethod == string(exportoptions.MethodAppStore) {
installedInstallerCertificates, err = certificateutil.InstalledInstallerCertificateInfos()
if err != nil {
@@ -418,15 +411,15 @@ func collectExportCodeSignGroups(archive Archive, installedCertificates []certif
log.Debugf(certInfo.String())
}
- for _, installerCetrificate := range installedInstallerCertificates {
- if installerCetrificate.TeamID == selectedCertificate.TeamID {
- selectedInstallerCetrificate = installerCetrificate
+ for _, installerCertificate := range installedInstallerCertificates {
+ if installerCertificate.TeamID == selectedCertificate.TeamID {
+ selectedInstallerCertificate = installerCertificate
break
}
}
}
- collectedCodeSignGroup = export.NewMacGroup(*selectedCertificate, &selectedInstallerCetrificate, selectedBundleIDProfileMap)
+ collectedCodeSignGroup = export.NewMacGroup(*selectedCertificate, &selectedInstallerCertificate, selectedBundleIDProfileMap)
} else {
collectedCodeSignGroup = export.NewIOSGroup(*selectedCertificate, selectedBundleIDProfileMap)
}
@@ -452,19 +445,19 @@ func collectExportCodeSignGroups(archive Archive, installedCertificates []certif
return collectedCodeSignGroups, nil
}
-// collectExportSelectableCodeSignGroups returns every possible codesigngroup which can be used to export an ipa file
+// collectExportSelectableCodeSignGroups returns every possible codesign group which can be used to export an ipa file.
func collectExportSelectableCodeSignGroups(archive Archive, installedCertificates []certificateutil.CertificateInfoModel, installedProfiles []profileutil.ProvisioningProfileInfoModel) []export.SelectableCodeSignGroup {
- bundleIDEntitlemenstMap := archive.BundleIDEntitlementsMap()
+ bundleIDEEntitlementsMap := archive.BundleIDEntitlementsMap()
fmt.Println()
log.Infof("Targets to sign:")
- for bundleID, entitlements := range bundleIDEntitlemenstMap {
+ for bundleID, entitlements := range bundleIDEEntitlementsMap {
fmt.Printf("- %s with %d capabilities\n", bundleID, len(entitlements))
}
fmt.Println()
- bundleIDs := []string{}
- for bundleID := range bundleIDEntitlemenstMap {
+ var bundleIDs []string
+ for bundleID := range bundleIDEEntitlementsMap {
bundleIDs = append(bundleIDs, bundleID)
}
codeSignGroups := export.CreateSelectableCodeSignGroups(installedCertificates, installedProfiles, bundleIDs)
@@ -479,7 +472,7 @@ func collectExportSelectableCodeSignGroups(archive Archive, installedCertificate
}
codeSignGroups = export.FilterSelectableCodeSignGroups(codeSignGroups,
- export.CreateEntitlementsSelectableCodeSignGroupFilter(bundleIDEntitlemenstMap),
+ export.CreateEntitlementsSelectableCodeSignGroupFilter(bundleIDEEntitlementsMap),
)
// Handle if archive used NON xcode managed profile
@@ -502,8 +495,8 @@ func collectExportSelectableCodeSignGroups(archive Archive, installedCertificate
return codeSignGroups
}
-// hasCertificateForDistType returns true if the provided certificate list has certificate for the selected cert type.
-// If isDistCert == true it will search for Distribution Certificates. If it's == false it will search for Developmenttion Certificates.
+// hasCertificateForDistType returns true if the provided certificate list has certificates for the selected cert type.
+// If isDistCert == true it will search for Distribution Certificates. If it's == false it will search for Development Certificates.
// If the team doesn't have any certificate for the selected cert type, it will return false.
func hasCertificateForDistType(exportMethod string, certificates []certificateutil.CertificateInfoModel) bool {
switch exportMethod {
diff --git a/codesigndoc/xcode.go b/codesigndoc/xcode.go
index db49b7e1..85b764be 100644
--- a/codesigndoc/xcode.go
+++ b/codesigndoc/xcode.go
@@ -12,7 +12,7 @@ import (
"github.com/bitrise-io/go-xcode/utility"
)
-// BuildXcodeArchive builds an Xcode archive
+// BuildXcodeArchive builds an Xcode archive.
func BuildXcodeArchive(xcodeCmd xcode.CommandModel, handleBuildLog func(string) error) (archivePath string, err error) {
// Output tools versions
xcodebuildVersion, err := utility.GetXcodeVersion()
diff --git a/codesigndocuitests/codesigndoc.go b/codesigndocuitests/codesigndoc.go
index 006cf023..f766e216 100644
--- a/codesigndocuitests/codesigndoc.go
+++ b/codesigndocuitests/codesigndoc.go
@@ -18,7 +18,7 @@ const collectCodesigningFilesInfo = `To collect available code sign files, we se
`
// CollectCodesignFiles collects the codesigning files for the UITests-Runner.app
-// and filters them for the specified export method
+// and filters them for the specified export method.
func CollectCodesignFiles(buildPath string, certificatesOnly bool) ([]certificateutil.CertificateInfoModel, []profileutil.ProvisioningProfileInfoModel, error) {
// Find out the XcArchive type
certificateType := codesign.IOSCertificate
@@ -50,8 +50,8 @@ func CollectCodesignFiles(buildPath string, certificatesOnly bool) ([]certificat
}
func getFilesToExport(buildPath string, installedCertificates []certificateutil.CertificateInfoModel, installedProfiles []profileutil.ProvisioningProfileInfoModel, certificatesOnly bool) ([]certificateutil.CertificateInfoModel, []profileutil.ProvisioningProfileInfoModel, error) {
- certificatesToExport := []certificateutil.CertificateInfoModel{}
- profilesToExport := []profileutil.ProvisioningProfileInfoModel{}
+ var certificatesToExport []certificateutil.CertificateInfoModel
+ var profilesToExport []profileutil.ProvisioningProfileInfoModel
if certificatesOnly {
exportCertificate, err := collectExportCertificate(installedCertificates)
diff --git a/codesigndocuitests/codesigngroup.go b/codesigndocuitests/codesigngroup.go
index 06d5d636..3f101412 100644
--- a/codesigndocuitests/codesigngroup.go
+++ b/codesigndocuitests/codesigngroup.go
@@ -13,12 +13,11 @@ import (
"github.com/bitrise-io/go-xcode/certificateutil"
"github.com/bitrise-io/go-xcode/export"
"github.com/bitrise-io/go-xcode/exportoptions"
- "github.com/bitrise-io/go-xcode/plistutil"
"github.com/bitrise-io/go-xcode/profileutil"
"github.com/bitrise-io/goinp/goinp"
)
-// extractCertificatesAndProfiles returns the certificates and provisioning profiles of the given codesign group
+// extractCertificatesAndProfiles returns the certificates and provisioning profiles of the given codesign group.
func extractCertificatesAndProfiles(codeSignGroups ...export.CodeSignGroup) ([]certificateutil.CertificateInfoModel, []profileutil.ProvisioningProfileInfoModel) {
certificateMap := map[string]certificateutil.CertificateInfoModel{}
profilesMap := map[string]profileutil.ProvisioningProfileInfoModel{}
@@ -31,8 +30,8 @@ func extractCertificatesAndProfiles(codeSignGroups ...export.CodeSignGroup) ([]c
}
}
- certificates := []certificateutil.CertificateInfoModel{}
- profiles := []profileutil.ProvisioningProfileInfoModel{}
+ var certificates []certificateutil.CertificateInfoModel
+ var profiles []profileutil.ProvisioningProfileInfoModel
for _, certificate := range certificateMap {
certificates = append(certificates, certificate)
}
@@ -42,7 +41,7 @@ func extractCertificatesAndProfiles(codeSignGroups ...export.CodeSignGroup) ([]c
return certificates, profiles
}
-// codesignMethod returns which code sign method type is allowed by the given codesign group
+// codesignMethod returns which code sign method type is allowed by the given codesign group.
func codesignMethod(group export.CodeSignGroup) string {
for _, profile := range group.BundleIDProfileMap() {
return string(profile.ExportType)
@@ -50,7 +49,7 @@ func codesignMethod(group export.CodeSignGroup) string {
return ""
}
-// printCodesignGroup prints the given codesign group
+// printCodesignGroup prints the given codesign group.
func printCodesignGroup(group export.CodeSignGroup) {
fmt.Printf("%s %s (%s)\n", colorstring.Green("development team:"), group.Certificate().TeamName, group.Certificate().TeamID)
fmt.Printf("%s %s [%s]\n", colorstring.Green("codesign identity:"), group.Certificate().CommonName, group.Certificate().Serial)
@@ -66,7 +65,7 @@ func printCodesignGroup(group export.CodeSignGroup) {
}
}
-// collectExportCertificate returns the certificate to use for the UITest-Runner
+// collectExportCertificate returns the certificate to use for the UITest-Runner.
func collectExportCertificate(installedCertificates []certificateutil.CertificateInfoModel) ([]certificateutil.CertificateInfoModel, error) {
var selectedCertificates []certificateutil.CertificateInfoModel
@@ -115,13 +114,11 @@ func selectFilteredCertificates(selectedCodeSignMethod, selectedTeam string, ins
})
log.Debugf("DeveloperDistribution certificates: %v\n", certsForSelectedCodeSign)
- break
default:
certsForSelectedCodeSign = certificateutil.FilterCertificateInfoModelsByFilterFunc(installedCertificates, func(certInfo certificateutil.CertificateInfoModel) bool {
return codesign.IsDistributionCertificate(certInfo)
})
log.Debugf("Distribution certificates: %v\n", certsForSelectedCodeSign)
- break
}
filteredCertificatesByTeam := codesign.MapCertificatesByTeam(certsForSelectedCodeSign)
@@ -132,10 +129,10 @@ func selectFilteredCertificates(selectedCodeSignMethod, selectedTeam string, ins
return nil, nil
}
- // If we already selected a team, we can skip it. (e.g mac app-store export)
+ // If we already selected a team, we can skip it. (e.g. mac app-store export)
if selectedTeam == "" {
// Use different team for export than archive.
- teams := []string{}
+ var teams []string
for team := range filteredCertificatesByTeam {
if hasCertificateForDistType(selectedCodeSignMethod, filteredCertificatesByTeam[team]) {
teams = append(teams, team)
@@ -151,7 +148,7 @@ func selectFilteredCertificates(selectedCodeSignMethod, selectedTeam string, ins
// Find the specific development certificate.
filteredTeamCertificates := filteredCertificatesByTeam[selectedTeam]
- certificateOptions := []string{}
+ var certificateOptions []string
for _, certInfo := range filteredTeamCertificates {
certificateOption := fmt.Sprintf("%s [%s]", certInfo.CommonName, certInfo.Serial)
@@ -180,9 +177,9 @@ func selectFilteredCertificates(selectedCodeSignMethod, selectedTeam string, ins
return selectedCertificates, nil
}
-// collectExportCodeSignGroups returns the codesigngroups required for the UITest target with the selected code signing methods
+// collectExportCodeSignGroups returns the codesign groups required for the UITest target with the selected code signing methods.
func collectExportCodeSignGroups(testRunner IOSTestRunner, installedCertificates []certificateutil.CertificateInfoModel, installedProfiles []profileutil.ProvisioningProfileInfoModel) ([]export.CodeSignGroup, error) {
- collectedCodeSignGroups := []export.CodeSignGroup{}
+ var collectedCodeSignGroups []export.CodeSignGroup
codeSignGroups := collectExportSelectableCodeSignGroups(testRunner, installedCertificates, installedProfiles)
if len(codeSignGroups) == 0 {
@@ -194,7 +191,7 @@ func collectExportCodeSignGroups(testRunner IOSTestRunner, installedCertificates
log.Infof("Code signing for target with %s bundle ID", strings.TrimRight(testRunnerID, "-Runner"))
codeSignMethods := []string{"development", "app-store", "ad-hoc", "enterprise"}
- for true {
+ for {
selectedCodeSignMethod, err := goinp.SelectFromStringsWithDefault("Select the code signing method", 1, codeSignMethods)
if err != nil {
return nil, fmt.Errorf("failed to read input: %s", err)
@@ -229,8 +226,8 @@ func collectExportCodeSignGroups(testRunner IOSTestRunner, installedCertificates
}
// Select certificate
- certificates := []certificateutil.CertificateInfoModel{}
- certificateOptions := []string{}
+ var certificates []certificateutil.CertificateInfoModel
+ var certificateOptions []string
for _, group := range filteredCodeSignGroups {
certificate := group.Certificate
certificates = append(certificates, certificate)
@@ -238,7 +235,7 @@ func collectExportCodeSignGroups(testRunner IOSTestRunner, installedCertificates
certificateOptions = append(certificateOptions, certificateOption)
}
- selectedCertificateOption := ""
+ var selectedCertificateOption string
if len(certificateOptions) == 1 {
selectedCertificateOption = certificateOptions[0]
@@ -281,13 +278,13 @@ func collectExportCodeSignGroups(testRunner IOSTestRunner, installedCertificates
selectedBundleIDProfileMap := map[string]profileutil.ProvisioningProfileInfoModel{}
for bundleID, profiles := range bundleIDProfilesMap {
profiles = codesign.FilterLatestProfiles(profiles)
- profileOptions := []string{}
+ var profileOptions []string
for _, profile := range profiles {
profileOption := fmt.Sprintf("%s (%s)", profile.Name, profile.UUID)
profileOptions = append(profileOptions, profileOption)
}
- selectedProfileOption := ""
+ var selectedProfileOption string
if len(profileOptions) == 1 {
selectedProfileOption = profileOptions[0]
@@ -314,9 +311,7 @@ func collectExportCodeSignGroups(testRunner IOSTestRunner, installedCertificates
return nil, fmt.Errorf("failed to find Provisioning Profiles for UITest target signing")
}
- var collectedCodeSignGroup export.CodeSignGroup
-
- collectedCodeSignGroup = export.NewIOSGroup(*selectedCertificate, selectedBundleIDProfileMap)
+ collectedCodeSignGroup := export.NewIOSGroup(*selectedCertificate, selectedBundleIDProfileMap)
fmt.Println()
log.Infof("Codesign settings will be used for %s method:", codesignMethod(collectedCodeSignGroup))
@@ -339,13 +334,12 @@ func collectExportCodeSignGroups(testRunner IOSTestRunner, installedCertificates
return collectedCodeSignGroups, nil
}
-// collectExportSelectableCodeSignGroups returns every possible codesigngroup which can be used to sign the UITest-Runner
+// collectExportSelectableCodeSignGroups returns every possible codesign group which can be used to sign the UITest-Runner.
func collectExportSelectableCodeSignGroups(testRunner IOSTestRunner, installedCertificates []certificateutil.CertificateInfoModel, installedProfiles []profileutil.ProvisioningProfileInfoModel) []export.SelectableCodeSignGroup {
- bundleIDEntitlemenstMap := map[string]plistutil.PlistData{}
- bundleIDEntitlemenstMap = testRunner.BundleIDEntitlementsMap()
+ bundleIDEEntitlementsMap := testRunner.BundleIDEntitlementsMap()
- bundleIDs := []string{}
- for bundleID := range bundleIDEntitlemenstMap {
+ var bundleIDs []string
+ for bundleID := range bundleIDEEntitlementsMap {
bundleIDs = append(bundleIDs, bundleID)
}
codeSignGroups := export.CreateSelectableCodeSignGroups(installedCertificates, installedProfiles, bundleIDs)
@@ -360,7 +354,7 @@ func collectExportSelectableCodeSignGroups(testRunner IOSTestRunner, installedCe
}
codeSignGroups = export.FilterSelectableCodeSignGroups(codeSignGroups,
- export.CreateEntitlementsSelectableCodeSignGroupFilter(bundleIDEntitlemenstMap),
+ export.CreateEntitlementsSelectableCodeSignGroupFilter(bundleIDEEntitlementsMap),
)
fmt.Println()
@@ -393,8 +387,8 @@ func collectExportSelectableCodeSignGroups(testRunner IOSTestRunner, installedCe
return codeSignGroups
}
-// hasCertificateForDistType returns true if the provided certificate list has certificate for the selected cert type.
-// If isDistCert == true it will search for Distribution Certificates. If it's == false it will search for Developmenttion Certificates.
+// hasCertificateForDistType returns true if the provided certificate list has certificates for the selected cert type.
+// If isDistCert == true it will search for Distribution Certificates. If it's == false it will search for Development Certificates.
// If the team doesn't have any certificate for the selected cert type, it will return false.
func hasCertificateForDistType(exportMethod string, certificates []certificateutil.CertificateInfoModel) bool {
if exportMethod == "development" {
diff --git a/codesigndocuitests/iostestrunner.go b/codesigndocuitests/iostestrunner.go
index b7f6cdf8..fa0df6f5 100644
--- a/codesigndocuitests/iostestrunner.go
+++ b/codesigndocuitests/iostestrunner.go
@@ -9,7 +9,6 @@ import (
"github.com/bitrise-io/go-utils/pathutil"
"github.com/bitrise-io/go-xcode/plistutil"
"github.com/bitrise-io/go-xcode/profileutil"
- "github.com/bitrise-io/go-xcode/utility"
)
// IOSTestRunner ...
@@ -20,9 +19,9 @@ type IOSTestRunner struct {
ProvisioningProfile profileutil.ProvisioningProfileInfoModel
}
-// NewIOSTestRunners is the *-Runner.app which is generated with the xcodebuild build-for-testing command
+// NewIOSTestRunners is the *-Runner.app which is generated with the xcodebuild build-for-testing command.
func NewIOSTestRunners(path string) ([]*IOSTestRunner, error) {
- runnerPattern := filepath.Join(utility.EscapeGlobPath(path), "*-Runner.app")
+ runnerPattern := filepath.Join(pathutil.EscapeGlobPath(path), "*-Runner.app")
possibleTestRunnerPths, err := filepath.Glob(runnerPattern)
if err != nil {
return nil, err
@@ -34,13 +33,13 @@ func NewIOSTestRunners(path string) ([]*IOSTestRunner, error) {
var testRunners []*IOSTestRunner
for _, testRunnerPath := range possibleTestRunnerPths {
- infoPlist := plistutil.PlistData{}
+ var infoPlist plistutil.PlistData
{
infoPlistPath := filepath.Join(testRunnerPath, "Info.plist")
if exist, err := pathutil.IsPathExists(infoPlistPath); err != nil {
return nil, fmt.Errorf("failed to check if Info.plist exists at: %s, error: %s", infoPlistPath, err)
} else if !exist {
- return nil, fmt.Errorf("Info.plist not exists at: %s", infoPlistPath)
+ return nil, fmt.Errorf("an Info.plist not exists at: %s", infoPlistPath)
}
plist, err := plistutil.NewPlistDataFromFile(infoPlistPath)
@@ -51,7 +50,7 @@ func NewIOSTestRunners(path string) ([]*IOSTestRunner, error) {
infoPlist = plist
}
- provisioningProfile := profileutil.ProvisioningProfileInfoModel{}
+ var provisioningProfile profileutil.ProvisioningProfileInfoModel
{
provisioningProfilePath := filepath.Join(testRunnerPath, "embedded.mobileprovision")
if exist, err := pathutil.IsPathExists(provisioningProfilePath); err != nil {
@@ -67,7 +66,7 @@ func NewIOSTestRunners(path string) ([]*IOSTestRunner, error) {
provisioningProfile = profile
}
- entitlements := plistutil.PlistData{}
+ var entitlements plistutil.PlistData
{
cmd := command.New("codesign", "-d", "--entitlements", "-", testRunnerPath)
out, err := cmd.RunAndReturnTrimmedOutput()
diff --git a/go.mod b/go.mod
index 7841d342..1834abcc 100644
--- a/go.mod
+++ b/go.mod
@@ -3,13 +3,10 @@ module github.com/bitrise-io/codesigndoc
go 1.16
require (
- github.com/bitrise-io/bitrise-init v0.0.0-20210520122036-d213de321eb8
- github.com/bitrise-io/go-utils v0.0.0-20210520073355-367fa34178f5
- github.com/bitrise-io/go-xamarin v0.0.0-20210519123500-acea30f4caad
- github.com/bitrise-io/go-xcode v0.0.0-20210520114025-bdbec53ee59f
+ github.com/bitrise-io/bitrise-init v0.0.0-20220223091922-37dca4521588
+ github.com/bitrise-io/go-utils v1.0.1
+ github.com/bitrise-io/go-xcode v1.0.3
github.com/bitrise-io/goinp v0.0.0-20210504152833-8559b0680ab1
- github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
- github.com/hashicorp/go-retryablehttp v0.7.0 // indirect
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.1.3
github.com/stretchr/testify v1.7.0
diff --git a/go.sum b/go.sum
index 368acecc..86fbe5b0 100644
--- a/go.sum
+++ b/go.sum
@@ -25,34 +25,27 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bitrise-io/bitrise v0.0.0-20210519130014-380842fb41c1 h1:PERqeGZZkMrGYSSN/Stk+YkhErgdk37aVqc5UgnIEoo=
github.com/bitrise-io/bitrise v0.0.0-20210519130014-380842fb41c1/go.mod h1:Jqf2PLwOKL1bYdbQIhVkNd55YyYKJBXyY0EtlRg5uw4=
-github.com/bitrise-io/bitrise-init v0.0.0-20210520122036-d213de321eb8 h1:1EvmLZfb7z6zRrq3RoRufEtRXbnB1v0rrxEuEb70jDE=
-github.com/bitrise-io/bitrise-init v0.0.0-20210520122036-d213de321eb8/go.mod h1:I9KSWJm177/IOBMQHzn6BLgymVLQ0xlv/gMwDCYkWYU=
+github.com/bitrise-io/bitrise-init v0.0.0-20220223091922-37dca4521588 h1:x+s0oyOY3Uw8WBjzBJtaNdvZVL/5d5eHIVLrAvFgHag=
+github.com/bitrise-io/bitrise-init v0.0.0-20220223091922-37dca4521588/go.mod h1:7IdKULzEH9t/gmjuRWn+h59cpd0uq5WRD7bXpJ/SxVk=
github.com/bitrise-io/colorstring v0.0.0-20180614154802-a8cd70115192/go.mod h1:CIHVcxZUvsG99XUJV6JlR7okNsMMGY81jMvPC20W+O0=
github.com/bitrise-io/envman v0.0.0-20200512105748-919e33f391ee/go.mod h1:m8pTp1o3Sw9uzDxb1WRm5IBRnMau2iOvPMSnRCAhQNI=
github.com/bitrise-io/envman v0.0.0-20210517135508-b2b4fe89eac5 h1:3jVXjsejV+1EW9Sp7ef+sMinD0J3HFsPgh4Du6ctqZc=
github.com/bitrise-io/envman v0.0.0-20210517135508-b2b4fe89eac5/go.mod h1:m8pTp1o3Sw9uzDxb1WRm5IBRnMau2iOvPMSnRCAhQNI=
github.com/bitrise-io/go-plist v0.0.0-20210301100253-4b1a112ccd10 h1:/2OyBFI7GjYKexBPcfTPvKFz8Ks7qYzkkz2SQ8aiJgc=
github.com/bitrise-io/go-plist v0.0.0-20210301100253-4b1a112ccd10/go.mod h1:pARutiL3kEuRLV3JvswidvfCj+9Y3qMZtji2BDqLFsA=
-github.com/bitrise-io/go-steputils v0.0.0-20210507072936-92fde382fb33/go.mod h1:YCtb1VETn/rF9tCt9oInhd/cwbt1ETPm+dTlDIfyD+A=
-github.com/bitrise-io/go-steputils v0.0.0-20210514150206-5b6261447e77 h1:+wd+ADdtJCRL9JEghE1RMbR4ywXBYNvIBelAW/UkWr8=
-github.com/bitrise-io/go-steputils v0.0.0-20210514150206-5b6261447e77/go.mod h1:H0iZjgsAR5NA6pnlD/zKB6AbxEsskq55pwJ9klVmP8w=
-github.com/bitrise-io/go-utils v0.0.0-20210323091856-00429d8e1e87/go.mod h1:tTEsKvbz1LbzuN/KpVFHXnLtcAPdEgIdM41s0lL407s=
+github.com/bitrise-io/go-steputils v1.0.1 h1:lwPl2W1njfANrBoTCkuqOOYbTha263ZFqoWQH0fwhaY=
+github.com/bitrise-io/go-steputils v1.0.1/go.mod h1:YIUaQnIAyK4pCvQG0hYHVkSzKNT9uL2FWmkFNW4mfNI=
github.com/bitrise-io/go-utils v0.0.0-20210505091801-98b7dc39ee61/go.mod h1:nhdaDQFvaMny1CugVV6KjK92/q97ENo0RuKSW5I4fbA=
github.com/bitrise-io/go-utils v0.0.0-20210505121718-07411d72e36e/go.mod h1:nhdaDQFvaMny1CugVV6KjK92/q97ENo0RuKSW5I4fbA=
-github.com/bitrise-io/go-utils v0.0.0-20210506064210-b22e2b7b3ad3/go.mod h1:nhdaDQFvaMny1CugVV6KjK92/q97ENo0RuKSW5I4fbA=
-github.com/bitrise-io/go-utils v0.0.0-20210507100250-37de47dfa6ce/go.mod h1:15EZZf02noI5nWFqXMZEoyb1CyqYRXTMz5Fyu4CWFzI=
-github.com/bitrise-io/go-utils v0.0.0-20210514083430-4d1fb0330dfe/go.mod h1:DRx7oFuAqk0dbKpAKCqWl0TgrowfJUb/MqYPRscxJOQ=
-github.com/bitrise-io/go-utils v0.0.0-20210520073355-367fa34178f5 h1:kclxBfygfNK6kWUB+9xcsfPLBen8Us9gubhitfL/Z6c=
-github.com/bitrise-io/go-utils v0.0.0-20210520073355-367fa34178f5/go.mod h1:DRx7oFuAqk0dbKpAKCqWl0TgrowfJUb/MqYPRscxJOQ=
-github.com/bitrise-io/go-xamarin v0.0.0-20210519123500-acea30f4caad h1:KFshPET6nvwptQhOzBtpi7A+QZIZJuZEy23xC2NXLLE=
-github.com/bitrise-io/go-xamarin v0.0.0-20210519123500-acea30f4caad/go.mod h1:w+iF7jlZGSalbGO7WHLHYUiivtd3p78VQYnEQ/t+WxM=
-github.com/bitrise-io/go-xcode v0.0.0-20210520114025-bdbec53ee59f h1:vx+uiuLDMqsbdqXorl0uO/LMVBLxeitMebyBRdvEqvk=
-github.com/bitrise-io/go-xcode v0.0.0-20210520114025-bdbec53ee59f/go.mod h1:a5IANtAnyazHgNjI6/kwQw5vU/WJo1zQ4Lja9WRUNmA=
+github.com/bitrise-io/go-utils v1.0.1 h1:e7mepVBkVN1DXRPESNXb0djEw6bxB6B93p/Q74zzcvk=
+github.com/bitrise-io/go-utils v1.0.1/go.mod h1:ZY1DI+fEpZuFpO9szgDeICM4QbqoWVt0RSY3tRI1heY=
+github.com/bitrise-io/go-xcode v1.0.3 h1:uj9Yx62szJ9zGKTLuPaS0k1E9ldtCiOm17wivi5u9+4=
+github.com/bitrise-io/go-xcode v1.0.3/go.mod h1:Y0Wu2dXm0MilJ/4D3+gPHaNMlUcP+1DjIPoLPykq7wY=
github.com/bitrise-io/goinp v0.0.0-20210504152833-8559b0680ab1 h1:iQZl/dKHp14xol7ye4e9FaSrw8o27TF5/nv3aUDfdD0=
github.com/bitrise-io/goinp v0.0.0-20210504152833-8559b0680ab1/go.mod h1:iRbd8zAXLeNy+0gic0eqNCxXvDGe8ZEY/uYX2CCeAoo=
github.com/bitrise-io/gows v0.0.0-20210505125306-dd92ff463938/go.mod h1:3Cp9ceJ8wHl1Av6oEE2ff1iWaYLliQuD+oaNdyM0NWQ=
-github.com/bitrise-io/pkcs12 v0.0.0-20210430063833-0da06eb56630 h1:V+xoYqGSkN8aUxCc806zDKjGGpBVUtV0Vytf5OsB3gc=
-github.com/bitrise-io/pkcs12 v0.0.0-20210430063833-0da06eb56630/go.mod h1:UiXKNs0essbC14a2TvGlnUKo9isP9m4guPrp8KJHJpU=
+github.com/bitrise-io/pkcs12 v0.0.0-20211108084543-e52728e011c8 h1:kmvU8AxrNTxXsVPKepBHD8W+eCVmeaKyTkRuUJB2K38=
+github.com/bitrise-io/pkcs12 v0.0.0-20211108084543-e52728e011c8/go.mod h1:UiXKNs0essbC14a2TvGlnUKo9isP9m4guPrp8KJHJpU=
github.com/bitrise-io/stepman v0.0.0-20210505110307-5c2296bcc558/go.mod h1:WLh58JYBgbD1Z/yyw1AkFz/90F6oBL0HS/luBpUW9dI=
github.com/bitrise-io/stepman v0.0.0-20210517135458-203f7a48d37a h1:qsEFYqhVeo0mLrdl7nLTNbCz0AZ+8nOxQD+LPFw2Oq4=
github.com/bitrise-io/stepman v0.0.0-20210517135458-203f7a48d37a/go.mod h1:WLh58JYBgbD1Z/yyw1AkFz/90F6oBL0HS/luBpUW9dI=
@@ -95,9 +88,9 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
-github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
+github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
@@ -120,7 +113,6 @@ github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrj
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
-github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4=
github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
@@ -128,7 +120,6 @@ github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerX
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
-github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
@@ -147,7 +138,6 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
-github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
@@ -240,11 +230,10 @@ golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnf
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
-golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
-golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc=
-golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
+golang.org/x/crypto v0.0.0-20211202192323-5770296d904e h1:MUP6MR3rJ7Gk9LEia0LP2ytiH6MuCfs7qYz+47jGdD8=
+golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -259,12 +248,10 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
-golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
-golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -280,6 +267,7 @@ golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -304,25 +292,26 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200219091948-cb0a6d8edb6c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210503173754-0981d6026fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20210511113859-b0526f3d8744/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E=
-golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211205182925-97ca703d548d h1:FjkYO/PPp4Wi0EAUOVLxePm7qVW4r4ctbWpURyuOD0E=
+golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
-golang.org/x/term v0.0.0-20210503060354-a79de5458b56 h1:b8jxX3zqjpqb2LklXPzKSGJhzyxCOZSz8ncv8Nv+y7w=
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
+golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
+golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
+golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
@@ -338,10 +327,7 @@ golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
-golang.org/x/tools v0.0.0-20200220224806-8a925fa4c0df/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
@@ -388,6 +374,6 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
-howett.net/plist v0.0.0-20201203080718-1454fab16a06 h1:QDxUo/w2COstK1wIBYpzQlHX/NqaQTcf9jyz347nI58=
-howett.net/plist v0.0.0-20201203080718-1454fab16a06/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0=
+howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM=
+howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
diff --git a/models/models.go b/models/models.go
index 8bc7c3cb..160153fa 100644
--- a/models/models.go
+++ b/models/models.go
@@ -5,13 +5,13 @@ import (
"github.com/bitrise-io/go-xcode/profileutil"
)
-// Certificates contains all of the certificates as io.Reader, besides an array of the certificate infos
+// Certificates contains all the certificates as io.Reader, besides an array of the certificate infos.
type Certificates struct {
Info []certificateutil.CertificateInfoModel
Content []byte
}
-// ProvisioningProfile contains parsed data in the provisioning profile and the original profile file contents
+// ProvisioningProfile contains parsed data in the provisioning profile and the original profile file contents.
type ProvisioningProfile struct {
Info profileutil.ProvisioningProfileInfoModel
Content []byte
diff --git a/osxkeychain/osxkeychain.go b/osxkeychain/osxkeychain.go
index e895c724..88202586 100644
--- a/osxkeychain/osxkeychain.go
+++ b/osxkeychain/osxkeychain.go
@@ -84,13 +84,6 @@ func ReleaseRef(refItem C.CFTypeRef) {
C.CFRelease(refItem)
}
-// ReleaseRefList ...
-func ReleaseRefList(refItems []C.CFTypeRef) {
- for _, itm := range refItems {
- ReleaseRef(itm)
- }
-}
-
// ReleaseIdentityWithRefList ...
func ReleaseIdentityWithRefList(refItems []IdentityWithRefModel) {
for _, itm := range refItems {
@@ -109,7 +102,7 @@ func GetCertificateDataFromIdentityRef(identityRef C.CFTypeRef) (*x509.Certifica
var secCertificateRef C.SecCertificateRef
osStatusCode := C.SecIdentityCopyCertificate(secIdentityRef, &secCertificateRef)
if osStatusCode != C.errSecSuccess {
- return nil, fmt.Errorf("Failed to call SecItemCopyMatch - OSStatus: %d", osStatusCode)
+ return nil, fmt.Errorf("failed to call SecItemCopyMatch - OSStatus: %d", osStatusCode)
}
certificateCFData := C.SecCertificateCopyData(secCertificateRef)
@@ -135,7 +128,7 @@ type IdentityWithRefModel struct {
func FindAndValidateIdentity(identityLabel string) (*IdentityWithRefModel, error) {
foundIdentityRefs, err := FindIdentity(identityLabel)
if err != nil {
- return nil, fmt.Errorf("Failed to find Identity, error: %s", err)
+ return nil, fmt.Errorf("failed to find Identity, error: %s", err)
}
if len(foundIdentityRefs) < 1 {
return nil, nil
@@ -148,7 +141,7 @@ func FindAndValidateIdentity(identityLabel string) (*IdentityWithRefModel, error
for _, aIdentityRef := range foundIdentityRefs {
cert, err := GetCertificateDataFromIdentityRef(aIdentityRef.KeychainRef)
if err != nil {
- return nil, fmt.Errorf("Failed to read certificate data, error: %s", err)
+ return nil, fmt.Errorf("failed to read certificate data, error: %s", err)
}
if err := certificateutil.CheckValidity(*cert); err != nil {
@@ -180,19 +173,19 @@ func FindIdentity(identityLabel string) ([]IdentityWithRefModel, error) {
var resultRefs C.CFTypeRef
osStatusCode := C.SecItemCopyMatching((C.CFDictionaryRef)(queryDict), &resultRefs)
if osStatusCode != C.errSecSuccess {
- return nil, fmt.Errorf("Failed to call SecItemCopyMatch - OSStatus: %d", osStatusCode)
+ return nil, fmt.Errorf("failed to call SecItemCopyMatch - OSStatus: %d", osStatusCode)
}
defer C.CFRelease(C.CFTypeRef(resultRefs))
identitiesArrRef := C.CFArrayRef(resultRefs)
identitiesCount := C.CFArrayGetCount(identitiesArrRef)
if identitiesCount < 1 {
- return nil, fmt.Errorf("No Identity (certificate + related private key) found in your Keychain")
+ return nil, fmt.Errorf("no Identity (certificate + related private key) found in your Keychain")
}
log.Debugf("identitiesCount: %d", identitiesCount)
// filter the identities, by label
- retIdentityRefs := []IdentityWithRefModel{}
+ var retIdentityRefs []IdentityWithRefModel
for i := C.CFIndex(0); i < identitiesCount; i++ {
aIdentityRef := C.CFArrayGetValueAtIndex(identitiesArrRef, i)
log.Debugf("aIdentityRef: %#v", aIdentityRef)
diff --git a/utility/utility.go b/utility/utility.go
index a56af5fc..c43e56c1 100644
--- a/utility/utility.go
+++ b/utility/utility.go
@@ -14,7 +14,7 @@ import (
"github.com/bitrise-io/go-xcode/xcodeproject/xcscheme"
)
-// ProfileExportFileNameNoPath creates a file name for the given profile with pattern: uuid.escaped_profile_name.[mobileprovision|provisionprofile]
+// ProfileExportFileNameNoPath creates a file name for the given profile with pattern: uuid.escaped_profile_name.[mobileprovision|provisionprofile].
func ProfileExportFileNameNoPath(info profileutil.ProvisioningProfileInfoModel) string {
replaceRexp, err := regexp.Compile("[^A-Za-z0-9_.-]")
if err != nil {
@@ -121,7 +121,7 @@ func getPlatform(buildSettings serialized.Object) (Platform, error) {
case strings.HasPrefix(sdk, "watchos"):
return watchOS, nil
default:
- return "", fmt.Errorf("unkown SDKROOT: %s", sdk)
+ return "", fmt.Errorf("unknown SDKROOT: %s", sdk)
}
}
diff --git a/vendor/github.com/bitrise-io/bitrise-init/models/configbuilder.go b/vendor/github.com/bitrise-io/bitrise-init/models/configbuilder.go
index fcb5ab09..af85ee5c 100644
--- a/vendor/github.com/bitrise-io/bitrise-init/models/configbuilder.go
+++ b/vendor/github.com/bitrise-io/bitrise-init/models/configbuilder.go
@@ -68,17 +68,7 @@ func (builder *ConfigBuilderModel) Generate(projectType string, appEnvs ...envma
workflows[string(workflowID)] = workflowBuilder.generate()
}
- triggerMap := []bitriseModels.TriggerMapItemModel{
- bitriseModels.TriggerMapItemModel{
- PushBranch: "*",
- WorkflowID: string(PrimaryWorkflowID),
- },
- bitriseModels.TriggerMapItemModel{
- PullRequestSourceBranch: "*",
- WorkflowID: string(PrimaryWorkflowID),
- },
- }
-
+ triggerMap := []bitriseModels.TriggerMapItemModel{}
app := bitriseModels.AppModel{
Environments: appEnvs,
}
diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/appclip.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/appclip.go
new file mode 100644
index 00000000..4b16c880
--- /dev/null
+++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/appclip.go
@@ -0,0 +1,42 @@
+package ios
+
+import (
+ "github.com/bitrise-io/bitrise-init/models"
+ "github.com/bitrise-io/bitrise-init/steps"
+ envmanModels "github.com/bitrise-io/envman/models"
+ "github.com/bitrise-io/go-utils/log"
+ "github.com/bitrise-io/go-xcode/xcodeproject/xcodeproj"
+ "github.com/bitrise-io/go-xcode/xcodeproject/xcscheme"
+)
+
+func schemeHasAppClipTarget(project xcodeproj.XcodeProj, scheme xcscheme.Scheme) bool {
+ for _, entry := range scheme.BuildAction.BuildActionEntries {
+ target, found := project.Proj.Target(entry.BuildableReference.BlueprintIdentifier)
+ if !found {
+ log.TDebugf("no target found for blueprint ID (%s) project (%s)", entry.BuildableReference.BlueprintIdentifier, project.Path)
+ continue
+ }
+
+ if target.CanExportAppClip() {
+ return true
+ }
+ }
+
+ return false
+}
+
+func shouldAppendExportAppClipStep(hasAppClip bool, exportMethod string) bool {
+ return hasAppClip &&
+ (exportMethod == "development" || exportMethod == "ad-hoc")
+}
+
+func appendExportAppClipStep(configBuilder *models.ConfigBuilderModel, workflowID models.WorkflowID) {
+ exportXCArchiveStepInputModels := []envmanModels.EnvironmentItemModel{
+ {ProjectPathInputKey: "$" + ProjectPathInputEnvKey},
+ {SchemeInputKey: "$" + SchemeInputEnvKey},
+ {ExportXCArchiveProductInputKey: ExportXCArchiveProductInputAppClipValue},
+ {DistributionMethodInputKey: "$" + DistributionMethodEnvKey},
+ {AutomaticCodeSigningKey: AutomaticCodeSigningValue},
+ }
+ configBuilder.AppendStepListItemsTo(workflowID, steps.ExportXCArchiveStepListItem(exportXCArchiveStepInputModels...))
+}
diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/icon.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/icon.go
index f84e7b9d..734ec4be 100644
--- a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/icon.go
+++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/icon.go
@@ -12,54 +12,29 @@ import (
"github.com/bitrise-io/go-xcode/xcodeproject/xcscheme"
)
-// lookupIconBySchemeName returns possible ios app icons for a scheme.
-func lookupIconBySchemeName(projectPath string, schemeName string, basepath string) (models.Icons, error) {
- project, err := xcodeproj.Open(projectPath)
- if err != nil {
- return nil, fmt.Errorf("failed to open project file: %s, error: %s", projectPath, err)
- }
-
- scheme, _, err := project.Scheme(schemeName)
- if err != nil {
- return nil, fmt.Errorf("failed to find scheme (%s) in project (%s), error: %s", schemeName, project.Path, err)
- }
-
- blueprintID := getBlueprintID(*scheme)
- if blueprintID == "" {
- log.TDebugf("scheme (%s) does not contain app buildable reference in project (%s)", scheme.Name, project.Path)
- return nil, nil
+func getMainTarget(project xcodeproj.XcodeProj, scheme xcscheme.Scheme) (xcodeproj.Target, error) {
+ entry, found := scheme.AppBuildActionEntry()
+ if !found {
+ return xcodeproj.Target{}, fmt.Errorf("scheme (%s) does not contain app buildable reference in project (%s)", scheme.Name, project.Path)
}
- // Search for the main target
- mainTarget, found := targetByBlueprintID(project.Proj.Targets, blueprintID)
+ blueprintID := entry.BuildableReference.BlueprintIdentifier
+ mainTarget, found := project.Proj.Target(blueprintID)
if !found {
- return nil, fmt.Errorf("no target found for blueprint ID (%s) project (%s)", blueprintID, project.Path)
+ return xcodeproj.Target{}, fmt.Errorf("no target found for blueprint ID (%s) in project (%s)", blueprintID, project.Path)
}
- return lookupIconByTarget(projectPath, mainTarget, basepath)
+ return mainTarget, nil
}
-// lookupIconByTargetName returns possible ios app icons for a target.
-func lookupIconByTargetName(projectPath string, targetName string, basepath string) (models.Icons, error) {
- target, err := nameToTarget(projectPath, targetName)
+func lookupIconByScheme(project xcodeproj.XcodeProj, scheme xcscheme.Scheme, basePath string) (models.Icons, error) {
+ mainTarget, err := getMainTarget(project, scheme)
if err != nil {
- return nil, err
+ log.TDebugf("%s", err)
+ return nil, nil
}
- return lookupIconByTarget(projectPath, target, basepath)
-}
-
-func nameToTarget(projectPath string, targetName string) (xcodeproj.Target, error) {
- project, err := xcodeproj.Open(projectPath)
- if err != nil {
- return xcodeproj.Target{}, fmt.Errorf("failed to open project file: %s, error: %s", projectPath, err)
- }
-
- target, found := targetByName(project, targetName)
- if !found {
- return xcodeproj.Target{}, fmt.Errorf("not found target: %s, in project: %s", targetName, projectPath)
- }
- return target, nil
+ return lookupIconByTarget(project.Path, mainTarget, basePath)
}
func lookupIconByTarget(projectPath string, target xcodeproj.Target, basepath string) (models.Icons, error) {
@@ -97,33 +72,3 @@ func lookupIconByTarget(projectPath string, target xcodeproj.Target, basepath st
}
return icons, nil
}
-
-func getBlueprintID(scheme xcscheme.Scheme) string {
- var blueprintID string
- for _, entry := range scheme.BuildAction.BuildActionEntries {
- if entry.BuildableReference.IsAppReference() {
- blueprintID = entry.BuildableReference.BlueprintIdentifier
- break
- }
- }
- return blueprintID
-}
-
-func targetByBlueprintID(targets []xcodeproj.Target, blueprintID string) (xcodeproj.Target, bool) {
- for _, target := range targets {
- if target.ID == blueprintID {
- return target, true
- }
- }
- return xcodeproj.Target{}, false
-}
-
-func targetByName(proj xcodeproj.XcodeProj, target string) (xcodeproj.Target, bool) {
- projTargets := proj.Proj.Targets
- for _, t := range projTargets {
- if t.Name == target {
- return t, true
- }
- }
- return xcodeproj.Target{}, false
-}
diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/ios.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/ios.go
index 9207664f..caa41e09 100644
--- a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/ios.go
+++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/ios.go
@@ -8,8 +8,10 @@ import "github.com/bitrise-io/bitrise-init/models"
// Scanner ...
type Scanner struct {
- SearchDir string
- ConfigDescriptors []ConfigDescriptor
+ DetectResult DetectResult
+
+ ConfigDescriptors []ConfigDescriptor
+
ExcludeAppIcon bool
SuppressPodFileParseError bool
}
@@ -26,13 +28,13 @@ func (Scanner) Name() string {
// DetectPlatform ...
func (scanner *Scanner) DetectPlatform(searchDir string) (bool, error) {
- scanner.SearchDir = searchDir
-
- detected, err := Detect(XcodeProjectTypeIOS, searchDir)
+ result, err := ParseProjects(XcodeProjectTypeIOS, searchDir, scanner.ExcludeAppIcon, scanner.SuppressPodFileParseError)
if err != nil {
return false, err
}
+ scanner.DetectResult = result
+ detected := len(result.Projects) > 0
return detected, nil
}
@@ -43,7 +45,7 @@ func (Scanner) ExcludedScannerNames() []string {
// Options ...
func (scanner *Scanner) Options() (models.OptionNode, models.Warnings, models.Icons, error) {
- options, configDescriptors, icons, warnings, err := GenerateOptions(XcodeProjectTypeIOS, scanner.SearchDir, scanner.ExcludeAppIcon, scanner.SuppressPodFileParseError)
+ options, configDescriptors, icons, warnings, err := GenerateOptions(XcodeProjectTypeIOS, scanner.DetectResult)
if err != nil {
return models.OptionNode{}, warnings, nil, err
}
@@ -59,13 +61,13 @@ func (Scanner) DefaultOptions() models.OptionNode {
}
// Configs ...
-func (scanner *Scanner) Configs() (models.BitriseConfigMap, error) {
- return GenerateConfig(XcodeProjectTypeIOS, scanner.ConfigDescriptors, true)
+func (scanner *Scanner) Configs(isPrivateRepository bool) (models.BitriseConfigMap, error) {
+ return GenerateConfig(XcodeProjectTypeIOS, scanner.ConfigDescriptors, isPrivateRepository)
}
// DefaultConfigs ...
func (Scanner) DefaultConfigs() (models.BitriseConfigMap, error) {
- return GenerateDefaultConfig(XcodeProjectTypeIOS, true)
+ return GenerateDefaultConfig(XcodeProjectTypeIOS)
}
// GetProjectType returns the project_type property used in a bitrise config
diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/podfile.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/podfile.go
index 6d6c2f88..8c77c07b 100644
--- a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/podfile.go
+++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/podfile.go
@@ -1,17 +1,16 @@
package ios
import (
+ "encoding/json"
"errors"
"fmt"
"path/filepath"
"strings"
- "encoding/json"
-
"github.com/bitrise-io/go-utils/fileutil"
"github.com/bitrise-io/go-utils/log"
"github.com/bitrise-io/go-utils/pathutil"
- "github.com/bitrise-io/go-xcode/xcodeproj"
+ "github.com/bitrise-io/go-utils/sliceutil"
)
const podfileBase = "Podfile"
@@ -49,7 +48,10 @@ begin
podfile = Pod::Podfile.from_file(podfile_path)
targets = podfile.target_definitions
- puts "#{{}.to_json}" unless targets
+ if !targets
+ puts "#{{}.to_json}"
+ exit
+ end
target_project_map = {}
targets.each do |name, target_definition|
@@ -63,17 +65,11 @@ rescue => e
end
`
- absPodfilePth, err := filepath.Abs(podfileParser.podfilePth)
- if err != nil {
- return map[string]string{}, fmt.Errorf("failed to expand path (%s), error: %s", podfileParser.podfilePth, err)
- }
+ envs := []string{fmt.Sprintf("PODFILE_PATH=%s", podfileParser.podfilePth)}
- envs := []string{fmt.Sprintf("PODFILE_PATH=%s", absPodfilePth)}
- podfileDir := filepath.Dir(absPodfilePth)
-
- out, err := runRubyScriptForOutput(rubyScriptContent, gemfileContent, podfileDir, envs)
+ out, err := runRubyScriptForOutput(rubyScriptContent, gemfileContent, envs)
if err != nil {
- return map[string]string{}, fmt.Errorf("ruby script failed, error: %s", err)
+ return map[string]string{}, fmt.Errorf("ruby script failed: %s", err)
}
if out == "" {
@@ -87,11 +83,11 @@ end
var targetDefinitionOutput targetDefinitionOutputModel
if err := json.Unmarshal([]byte(out), &targetDefinitionOutput); err != nil {
- return map[string]string{}, fmt.Errorf("failed to parse target definition output, error: %s", err)
+ return map[string]string{}, fmt.Errorf("failed to parse target definition output: %s", err)
}
if podfileParser.shouldRaiseReadDefinitionError(targetDefinitionOutput.Error) {
- return map[string]string{}, fmt.Errorf("failed to read target defintion map, error: %s", targetDefinitionOutput.Error)
+ return map[string]string{}, fmt.Errorf("failed to read target definition map: %s", targetDefinitionOutput.Error)
}
return targetDefinitionOutput.Data, nil
@@ -112,21 +108,26 @@ func (podfileParser podfileParser) shouldRaiseReadDefinitionError(err string) bo
return true
}
-func (podfileParser podfileParser) getUserDefinedProjectRelavtivePath(cocoapodsVersion string) (string, error) {
+func (podfileParser podfileParser) getUserDefinedProjectAbsPath(cocoapodsVersion string) (string, error) {
targetProjectMap, err := podfileParser.getTargetDefinitionProjectMap(cocoapodsVersion)
if err != nil {
- return "", fmt.Errorf("failed to get target definition map, error: %s", err)
+ return "", fmt.Errorf("failed to get target definition map: %s", err)
}
- for target, project := range targetProjectMap {
- if target == "Pods" {
- return project, nil
+ // Return the first custom project
+ for _, projectRelPath := range targetProjectMap {
+ if projectRelPath == "" { // this should not happen
+ continue
}
+
+ projectAbsPath := filepath.Join(filepath.Dir(podfileParser.podfilePth), projectRelPath)
+ return projectAbsPath, nil
}
+
return "", nil
}
-func (podfileParser podfileParser) getUserDefinedWorkspaceRelativePath(cocoapodsVersion string) (string, error) {
+func (podfileParser podfileParser) getUserDefinedWorkspaceAbsPath(cocoapodsVersion string) (string, error) {
gemfileCocoapodsVersion := ""
if cocoapodsVersion != "" {
gemfileCocoapodsVersion = fmt.Sprintf(`, '%s'`, cocoapodsVersion)
@@ -149,23 +150,22 @@ begin
# For example: require_relative '../node_modules/react-native/scripts/react_native_pods'
Dir.chdir(File.dirname(podfile_path))
podfile = Pod::Podfile.from_file(podfile_path)
- pth = podfile.workspace_path
- puts "#{{ :data => pth }.to_json}"
+ if !podfile.workspace_path
+ puts "#{{}.to_json}"
+ exit
+ end
+
+ puts "#{{ :data => podfile.workspace_path }.to_json}"
rescue => e
puts "#{{ :error => "#{e.to_s} Reason: #{e.message}"}.to_json}"
end
`
- absPodfilePth, err := filepath.Abs(podfileParser.podfilePth)
- if err != nil {
- return "", fmt.Errorf("failed to expand path (%s), error: %s", podfileParser.podfilePth, err)
- }
- envs := []string{fmt.Sprintf("PODFILE_PATH=%s", absPodfilePth)}
- podfileDir := filepath.Dir(absPodfilePth)
+ envs := []string{fmt.Sprintf("PODFILE_PATH=%s", podfileParser.podfilePth)}
- out, err := runRubyScriptForOutput(rubyScriptContent, gemfileContent, podfileDir, envs)
+ out, err := runRubyScriptForOutput(rubyScriptContent, gemfileContent, envs)
if err != nil {
- return "", fmt.Errorf("ruby script failed, error: %s", err)
+ return "", fmt.Errorf("ruby script failed: %s", err)
}
if out == "" {
@@ -179,14 +179,19 @@ end
var workspacePathOutput workspacePathOutputModel
if err := json.Unmarshal([]byte(out), &workspacePathOutput); err != nil {
- return "", fmt.Errorf("failed to parse workspace path output, error: %s", err)
+ return "", fmt.Errorf("failed to parse workspace path output: %s", err)
}
if podfileParser.shouldRaiseReadDefinitionError(workspacePathOutput.Error) {
- return "", fmt.Errorf("failed to read workspace path, error: %s", workspacePathOutput.Error)
+ return "", fmt.Errorf("failed to read workspace path: %s", workspacePathOutput.Error)
+ }
+
+ if workspacePathOutput.Data == "" { // no custom workspace path
+ return "", nil
}
- return workspacePathOutput.Data, nil
+ workspaceAbsPath := filepath.Join(filepath.Dir(podfileParser.podfilePth), workspacePathOutput.Data)
+ return workspaceAbsPath, nil
}
// GetWorkspaceProjectMap ...
@@ -211,43 +216,41 @@ func (podfileParser podfileParser) GetWorkspaceProjectMap(projects []string) (ma
return map[string]string{}, err
}
- projectRelPth, err := podfileParser.getUserDefinedProjectRelavtivePath(cocoapodsVersion)
+ projectPth, err := podfileParser.getUserDefinedProjectAbsPath(cocoapodsVersion)
if err != nil {
- return map[string]string{}, fmt.Errorf("failed to get user defined project path, error: %s", err)
+ return map[string]string{}, fmt.Errorf("failed to get user defined project path: %s", err)
}
- if projectRelPth == "" {
+ if projectPth == "" {
projects, err := pathutil.FilterPaths(projects, pathutil.InDirectoryFilter(podfileDir, true))
if err != nil {
- return map[string]string{}, fmt.Errorf("failed to filter projects, error: %s", err)
+ return map[string]string{}, fmt.Errorf("failed to filter projects: %s", err)
}
if len(projects) == 0 {
- return map[string]string{}, errors.New("failed to determin workspace - project mapping: no explicit project specified and no project found in the Podfile's directory")
+ return map[string]string{}, errors.New("failed to determine workspace - project mapping: no explicit project specified and no project found in the Podfile's directory")
} else if len(projects) > 1 {
- return map[string]string{}, errors.New("failed to determin workspace - project mapping: no explicit project specified and more than one project found in the Podfile's directory")
+ return map[string]string{}, errors.New("failed to determine workspace - project mapping: no explicit project specified and more than one project found in the Podfile's directory")
}
- projectRelPth = filepath.Base(projects[0])
+ projectPth = projects[0]
}
- projectPth := filepath.Join(podfileDir, projectRelPth)
if exist, err := pathutil.IsPathExists(projectPth); err != nil {
- return map[string]string{}, fmt.Errorf("failed to check if path (%s) exists, error: %s", projectPth, err)
+ return map[string]string{}, fmt.Errorf("failed to check if path (%s) exists: %s", projectPth, err)
} else if !exist {
return map[string]string{}, fmt.Errorf("project not found at: %s", projectPth)
}
- workspaceRelPth, err := podfileParser.getUserDefinedWorkspaceRelativePath(cocoapodsVersion)
+ workspacePth, err := podfileParser.getUserDefinedWorkspaceAbsPath(cocoapodsVersion)
if err != nil {
- return map[string]string{}, fmt.Errorf("failed to get user defined workspace path, error: %s", err)
+ return map[string]string{}, fmt.Errorf("failed to get user defined workspace path: %s", err)
}
- if workspaceRelPth == "" {
+ if workspacePth == "" {
projectName := filepath.Base(strings.TrimSuffix(projectPth, ".xcodeproj"))
- workspaceRelPth = projectName + ".xcworkspace"
+ workspacePth = filepath.Join(podfileDir, projectName+".xcworkspace")
}
- workspacePth := filepath.Join(podfileDir, workspaceRelPth)
return map[string]string{
workspacePth: projectPth,
@@ -286,7 +289,7 @@ func (podfileParser podfileParser) cocoapodsVersion(podfileLockPth string) (stri
func (podfileParser podfileParser) fixPodfileQuotation(podfilePth string) error {
podfileContent, err := fileutil.ReadStringFromFile(podfilePth)
if err != nil {
- return fmt.Errorf("failed to read podfile (%s), error: %s", podfilePth, err)
+ return fmt.Errorf("failed to read podfile (%s): %s", podfilePth, err)
}
podfileContent = strings.Replace(podfileContent, `‘`, `'`, -1)
@@ -295,63 +298,58 @@ func (podfileParser podfileParser) fixPodfileQuotation(podfilePth string) error
podfileContent = strings.Replace(podfileContent, `”`, `"`, -1)
if err := fileutil.WriteStringToFile(podfilePth, podfileContent); err != nil {
- return fmt.Errorf("failed to apply Podfile quotation fix, error: %s", err)
+ return fmt.Errorf("failed to apply Podfile quotation fix: %s", err)
}
return nil
}
-// MergePodWorkspaceProjectMap ...
// Previously we separated standalone projects and workspaces.
// But pod workspace-project map may define workspace which is not in the repository, but will be created by `pod install`.
// Related project should be found in the standalone projects list.
// We will create this workspace model, join the related project and remove this project from standlone projects.
// If workspace is in the repository, both workspace and project should be find in the input lists.
-func MergePodWorkspaceProjectMap(podWorkspaceProjectMap map[string]string, standaloneProjects []xcodeproj.ProjectModel, workspaces []xcodeproj.WorkspaceModel) ([]xcodeproj.ProjectModel, []xcodeproj.WorkspaceModel, error) {
- mergedStandaloneProjects := []xcodeproj.ProjectModel{}
- mergedWorkspaces := []xcodeproj.WorkspaceModel{}
-
+func mergePodWorkspaceProjectMap(podWorkspaceProjectMap map[string]string, detected containers) (containers, error) {
for podWorkspaceFile, podProjectFile := range podWorkspaceProjectMap {
- podWorkspace, found := FindWorkspaceInList(podWorkspaceFile, workspaces)
+ podWorkspace, found := findInList(podWorkspaceFile, detected.workspaces)
if found {
// Workspace found, this means workspace is in the repository.
- podWorkspace.IsPodWorkspace = true
+ detected.podWorkspacePaths = append(detected.podWorkspacePaths, podWorkspace.path())
+ podWorkspaceProjects, err := podWorkspace.projectPaths()
+ if err != nil {
+ return containers{}, fmt.Errorf("failed to get workspace projects: %s", err)
+ }
// This case the project is already attached to the workspace.
- _, found := FindProjectInList(podProjectFile, podWorkspace.Projects)
+ found := sliceutil.IsStringInSlice(podProjectFile, podWorkspaceProjects)
if !found {
- return []xcodeproj.ProjectModel{}, []xcodeproj.WorkspaceModel{}, fmt.Errorf("pod workspace (%s) found, but assigned project (%s) project not", podWorkspaceFile, podProjectFile)
+ return containers{}, fmt.Errorf("pod workspace (%s) found, but assigned project (%s) project not", podWorkspaceFile, podProjectFile)
}
- // And the project is not standalone.
- _, found = FindProjectInList(podProjectFile, standaloneProjects)
+ // And the project is not standalone
+ _, found = findInList(podProjectFile, detected.standaloneProjects)
if found {
- return []xcodeproj.ProjectModel{}, []xcodeproj.WorkspaceModel{}, fmt.Errorf("pod workspace (%s) found, but assigned project (%s) marked as standalone", podWorkspaceFile, podProjectFile)
+ return containers{}, fmt.Errorf("pod workspace (%s) found, but assigned project (%s) marked as standalone", podWorkspaceFile, podProjectFile)
}
-
- mergedStandaloneProjects = standaloneProjects
- mergedWorkspaces = ReplaceWorkspaceInList(workspaces, podWorkspace)
} else {
// Workspace not found, this means workspace is not in the repository,
- // but it will created by `pod install`.
- podWorkspace = xcodeproj.WorkspaceModel{
- Pth: podWorkspaceFile,
- Name: strings.TrimSuffix(filepath.Base(podWorkspaceFile), filepath.Ext(podWorkspaceFile)),
- IsPodWorkspace: true,
- }
+ // but it will be created by `pod install`.
+ detected.podWorkspacePaths = append(detected.podWorkspacePaths, podWorkspaceFile)
// This case the pod project was marked previously as standalone project.
- podProject, found := FindProjectInList(podProjectFile, standaloneProjects)
+ podProject, found := findInList(podProjectFile, detected.standaloneProjects)
if !found {
- return []xcodeproj.ProjectModel{}, []xcodeproj.WorkspaceModel{}, fmt.Errorf("pod workspace (%s) will be generated by (%s) project, but it does not found", podWorkspaceFile, podProjectFile)
+ return containers{}, fmt.Errorf("pod workspace (%s) will be generated by (%s) project, but it does not found", podWorkspaceFile, podProjectFile)
}
- podWorkspace.Projects = []xcodeproj.ProjectModel{podProject}
-
- mergedStandaloneProjects = RemoveProjectFromList(podProjectFile, standaloneProjects)
- mergedWorkspaces = append(workspaces, podWorkspace)
+ detected.standaloneProjects = removeProjectFromList(podProjectFile, detected.standaloneProjects)
+ detected.workspaces = append(detected.workspaces, newPodWorkspace(podWorkspaceFile, []container{podProject}))
}
}
- return mergedStandaloneProjects, mergedWorkspaces, nil
+ return containers{
+ standaloneProjects: detected.standaloneProjects,
+ workspaces: detected.workspaces,
+ podWorkspacePaths: detected.podWorkspacePaths,
+ }, nil
}
diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/project.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/project.go
new file mode 100644
index 00000000..937eb87d
--- /dev/null
+++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/project.go
@@ -0,0 +1,149 @@
+package ios
+
+import (
+ "fmt"
+
+ "github.com/bitrise-io/go-utils/pathutil"
+ xcodeproject "github.com/bitrise-io/go-xcode/xcodeproject/xcodeproj"
+ "github.com/bitrise-io/go-xcode/xcodeproject/xcscheme"
+ "github.com/bitrise-io/go-xcode/xcodeproject/xcworkspace"
+)
+
+type container interface {
+ isWorkspace() bool
+ // path returns container absolute path
+ path() string
+ // schemes returns schemes mapped to the project or workspace path
+ schemes() (map[string][]xcscheme.Scheme, error)
+ projects() ([]xcodeproject.XcodeProj, []string, error)
+ projectPaths() ([]string, error)
+}
+
+// projectContainer ...
+type projectContainer struct {
+ project xcodeproject.XcodeProj
+}
+
+func newProject(path string) (projectContainer, error) {
+ if !xcodeproject.IsXcodeProj(path) {
+ return projectContainer{}, fmt.Errorf("path (%s) is not a Project", path)
+ }
+
+ project, err := xcodeproject.Open(path)
+ if err != nil {
+ return projectContainer{}, fmt.Errorf("failed to open Project (%s): %v", path, err)
+ }
+
+ return projectContainer{
+ project: project,
+ }, nil
+}
+
+func (p projectContainer) isWorkspace() bool {
+ return false
+}
+
+func (p projectContainer) path() string {
+ return p.project.Path
+}
+
+func (p projectContainer) schemes() (map[string][]xcscheme.Scheme, error) {
+ projectSchemes, err := p.project.Schemes()
+ if err != nil {
+ return nil, fmt.Errorf("failed to list Schemes in Project (%s): %v", p.project.Path, err)
+ }
+
+ containerToSchemes := make(map[string][]xcscheme.Scheme)
+ containerToSchemes[p.project.Path] = projectSchemes
+
+ return containerToSchemes, nil
+}
+
+func (p projectContainer) projects() ([]xcodeproject.XcodeProj, []string, error) {
+ return []xcodeproject.XcodeProj{p.project}, []string{}, nil
+}
+
+func (p projectContainer) projectPaths() ([]string, error) {
+ return []string{p.project.Path}, nil
+}
+
+// workspaceContainer ...
+type workspaceContainer struct {
+ workspace xcworkspace.Workspace
+}
+
+func newWorkspace(path string) (workspaceContainer, error) {
+ if !xcworkspace.IsWorkspace(path) {
+ return workspaceContainer{}, fmt.Errorf("path (%s) is not a Workspace", path)
+ }
+
+ workspace, err := xcworkspace.Open(path)
+ if err != nil {
+ return workspaceContainer{}, fmt.Errorf("failed to open Workspace (%s): %v", path, err)
+ }
+
+ return workspaceContainer{
+ workspace: workspace,
+ }, nil
+}
+
+func (w workspaceContainer) isWorkspace() bool {
+ return true
+}
+
+func (w workspaceContainer) path() string {
+ return w.workspace.Path
+}
+
+func (w workspaceContainer) schemes() (map[string][]xcscheme.Scheme, error) {
+ containerToSchemes, err := w.workspace.Schemes()
+ if err != nil {
+ return nil, fmt.Errorf("failed to list Schemes in Workspace (%s): %v", w.workspace.Path, err)
+ }
+
+ return containerToSchemes, nil
+}
+
+func (w workspaceContainer) projects() ([]xcodeproject.XcodeProj, []string, error) {
+ projPaths, err := w.workspace.ProjectFileLocations()
+ if err != nil {
+ return nil, nil, err
+ }
+
+ var projects []xcodeproject.XcodeProj
+ var missingProjects []string
+ for _, projPath := range projPaths {
+ if exist, err := pathutil.IsPathExists(projPath); err != nil {
+ return nil, nil, fmt.Errorf("failed to list Projects in the Workspace (%s), can not check if path (%s) exists: %v", w.workspace.Path, projPath, err)
+ } else if !exist {
+ missingProjects = append(missingProjects, projPath)
+ continue
+ }
+
+ project, err := xcodeproject.Open(projPath)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to open Project (%s) in the Workspace (%s): %v", projPath, w.workspace.Path, err)
+ }
+
+ projects = append(projects, project)
+ }
+
+ return projects, missingProjects, nil
+}
+
+func (w workspaceContainer) projectPaths() ([]string, error) {
+ return w.workspace.ProjectFileLocations()
+}
+
+func numberOfSharedSchemes(containerToSchemes map[string][]xcscheme.Scheme) int {
+ var count int
+ for _, schemes := range containerToSchemes {
+ for _, scheme := range schemes {
+ if scheme.IsShared {
+ count++
+ }
+ }
+ }
+
+ return count
+}
diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/project_pod.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/project_pod.go
new file mode 100644
index 00000000..fc4f291b
--- /dev/null
+++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/project_pod.go
@@ -0,0 +1,69 @@
+package ios
+
+import (
+ "fmt"
+
+ "github.com/bitrise-io/go-xcode/xcodeproject/xcodeproj"
+ "github.com/bitrise-io/go-xcode/xcodeproject/xcscheme"
+)
+
+type podWorkspace struct {
+ workspacePath string
+ workspaceProjects []container
+}
+
+func newPodWorkspace(path string, projects []container) podWorkspace {
+ return podWorkspace{
+ workspacePath: path,
+ workspaceProjects: projects,
+ }
+}
+
+func (w podWorkspace) isWorkspace() bool {
+ return true
+}
+
+func (w podWorkspace) path() string {
+ return w.workspacePath
+}
+
+func (w podWorkspace) schemes() (map[string][]xcscheme.Scheme, error) {
+ projectToSchemes := make(map[string][]xcscheme.Scheme)
+
+ for _, p := range w.workspaceProjects {
+ innerSchemes, err := p.schemes()
+ if err != nil {
+ return nil, fmt.Errorf("%s", err)
+ }
+
+ for path, schemes := range innerSchemes {
+ projectToSchemes[path] = schemes
+ }
+ }
+
+ return projectToSchemes, nil
+}
+
+func (w podWorkspace) projects() ([]xcodeproj.XcodeProj, []string, error) {
+ var innerProjects []xcodeproj.XcodeProj
+ for _, p := range w.workspaceProjects {
+ projects, _, err := p.projects()
+ if err != nil {
+ return nil, nil, err
+ }
+
+ innerProjects = append(innerProjects, projects...)
+ }
+
+ return innerProjects, nil, nil
+}
+
+func (w podWorkspace) projectPaths() ([]string, error) {
+ var paths []string
+
+ for _, p := range w.workspaceProjects {
+ paths = append(paths, p.path())
+ }
+
+ return paths, nil
+}
diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/rubyscript.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/rubyscript.go
index 66ed83bb..ef584550 100644
--- a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/rubyscript.go
+++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/rubyscript.go
@@ -13,7 +13,7 @@ import (
"github.com/bitrise-io/go-utils/pathutil"
)
-func runRubyScriptForOutput(scriptContent, gemfileContent, inDir string, withEnvs []string) (string, error) {
+func runRubyScriptForOutput(scriptContent, gemfileContent string, withEnvs []string) (string, error) {
tmpDir, err := pathutil.NormalizedOSTempDirPath("__bitrise-init__")
if err != nil {
return "", err
@@ -32,10 +32,7 @@ func runRubyScriptForOutput(scriptContent, gemfileContent, inDir string, withEnv
}
cmd := command.New("bundle", "install")
-
- if inDir != "" {
- cmd.SetDir(inDir)
- }
+ cmd.SetDir(tmpDir)
withEnvs = append(withEnvs, "BUNDLE_GEMFILE="+gemfilePth)
cmd.AppendEnvs(withEnvs...)
@@ -62,9 +59,9 @@ func runRubyScriptForOutput(scriptContent, gemfileContent, inDir string, withEnv
cmd = command.New("ruby", rubyScriptPth)
}
- if inDir != "" {
- cmd.SetDir(inDir)
- }
+ // Set the temp dir as working dir, so the project defined `.ruby-version` does not cause ruby resolution to fail:
+ // [ ... ] ruby script failed, error: rbenv: version `2.7.4' is not installed (set by /[ ... ]/MyTestApp/.ruby-version)
+ cmd.SetDir(tmpDir)
if len(withEnvs) > 0 {
cmd.AppendEnvs(withEnvs...)
diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/utility.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/utility.go
index ea8d183e..b657c3ff 100644
--- a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/utility.go
+++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/utility.go
@@ -9,12 +9,11 @@ import (
"github.com/bitrise-io/bitrise-init/analytics"
"github.com/bitrise-io/bitrise-init/models"
- "github.com/bitrise-io/bitrise-init/steps"
- envmanModels "github.com/bitrise-io/envman/models"
"github.com/bitrise-io/go-utils/fileutil"
"github.com/bitrise-io/go-utils/log"
"github.com/bitrise-io/go-utils/pathutil"
- "github.com/bitrise-io/go-xcode/xcodeproj"
+ "github.com/bitrise-io/go-utils/sliceutil"
+ "github.com/bitrise-io/go-xcode/xcodeproject/xcscheme"
)
const (
@@ -45,21 +44,31 @@ const (
SchemeInputSummary = "An Xcode scheme defines a collection of targets to build, a configuration to use when building, and a collection of tests to execute. Only shared schemes are detected automatically but you can use any scheme as a target on Bitrise. You can change the scheme at any time in your Env Vars."
)
+const (
+ // DistributionMethodInputKey ...
+ DistributionMethodInputKey = "distribution_method"
+ // DistributionMethodEnvKey ...
+ DistributionMethodEnvKey = "BITRISE_DISTRIBUTION_METHOD"
+ // DistributionMethodInputTitle ...
+ DistributionMethodInputTitle = "Distribution method"
+ // DistributionMethodInputSummary ...
+ DistributionMethodInputSummary = "The export method used to create an .ipa file in your builds, stored as an Environment Variable. You can change this at any time, or even create several .ipa files with different export methods in the same build."
+)
+
const (
// ExportMethodInputKey ...
ExportMethodInputKey = "export_method"
- // ExportMethodInputEnvKey ...
- ExportMethodInputEnvKey = "BITRISE_EXPORT_METHOD"
- // IosExportMethodInputTitle ...
- IosExportMethodInputTitle = "ipa export method"
- // MacExportMethodInputTitle ...
- MacExportMethodInputTitle = "Application export method\nNOTE: `none` means: Export a copy of the application without re-signing."
- // IosExportMethodInputSummary ...
- IosExportMethodInputSummary = "The export method used to create an .ipa file in your builds, stored as an Environment Variable. You can change this at any time, or even create several .ipa files with different export methods in the same build."
- // MacExportMethodInputSummary ...
- MacExportMethodInputSummary = "The export method used to create an .app file in your builds, stored as an Environment Variable. You can change this at any time, or even create several .app files with different export methods in the same build."
+ // ExportMethodEnvKey ...
+ ExportMethodEnvKey = "BITRISE_EXPORT_METHOD"
+ // ExportMethodInputTitle ...
+ ExportMethodInputTitle = "Application export method\nNOTE: `none` means: Export a copy of the application without re-signing."
+ // ExportMethodInputSummary ...
+ ExportMethodInputSummary = "The export method used to create an .app file in your builds, stored as an Environment Variable. You can change this at any time, or even create several .app files with different export methods in the same build."
)
+// XCConfigContentInputKey ...
+const XCConfigContentInputKey = "xcconfig_content"
+
// IosExportMethods ...
var IosExportMethods = []string{"app-store", "ad-hoc", "enterprise", "development"}
@@ -79,6 +88,13 @@ const (
ConfigurationInputKey = "configuration"
)
+const (
+ // AutomaticCodeSigningInputKey ...
+ AutomaticCodeSigningInputKey = "automatic_code_signing"
+ // AutomaticCodeSigningInputAPIKeyValue ...
+ AutomaticCodeSigningInputAPIKeyValue = "api-key"
+)
+
const (
// CarthageCommandInputKey ...
CarthageCommandInputKey = "carthage_command"
@@ -90,6 +106,42 @@ const cartfileResolvedBase = "Cartfile.resolved"
// AllowCartfileBaseFilter ...
var AllowCartfileBaseFilter = pathutil.BaseFilter(cartfileBase, true)
+// Scheme is an Xcode project scheme or target
+type Scheme struct {
+ Name string
+ Missing bool
+ HasXCTests bool
+ HasAppClip bool
+
+ Icons models.Icons
+}
+
+// Project is an Xcode project on the filesystem
+type Project struct {
+ RelPath string
+ // Is it a standalone project or a workspace?
+ IsWorkspace bool
+ IsPodWorkspace bool
+
+ // Carthage command to run: bootstrap/update
+ CarthageCommand string
+ Warnings models.Warnings
+
+ Schemes []Scheme
+}
+
+// DetectResult ...
+type DetectResult struct {
+ Projects []Project
+ Warnings models.Warnings
+}
+
+type containers struct {
+ standaloneProjects []container
+ workspaces []container
+ podWorkspacePaths []string
+}
+
// ConfigDescriptor ...
type ConfigDescriptor struct {
HasPodfile bool
@@ -155,35 +207,6 @@ func HasCartfileResolvedInDirectoryOf(pth string) bool {
return exist
}
-// Detect ...
-func Detect(projectType XcodeProjectType, searchDir string) (bool, error) {
- fileList, err := pathutil.ListPathInDirSortedByComponents(searchDir, true)
- if err != nil {
- return false, err
- }
-
- log.TInfof("Filter relevant Xcode project files")
-
- relevantXcodeprojectFiles, err := FilterRelevantProjectFiles(fileList, projectType)
- if err != nil {
- return false, err
- }
-
- log.TPrintf("%d Xcode %s project files found", len(relevantXcodeprojectFiles), string(projectType))
- for _, xcodeprojectFile := range relevantXcodeprojectFiles {
- log.TPrintf("- %s", xcodeprojectFile)
- }
-
- if len(relevantXcodeprojectFiles) == 0 {
- log.TPrintf("platform not detected")
- return false, nil
- }
-
- log.TSuccessf("Platform detected")
-
- return true, nil
-}
-
func fileContains(pth, str string) (bool, error) {
content, err := fileutil.ReadStringFromFile(pth)
if err != nil {
@@ -193,7 +216,7 @@ func fileContains(pth, str string) (bool, error) {
return strings.Contains(content, str), nil
}
-func printMissingSharedSchemesAndGenerateWarning(projectPth, defaultGitignorePth string, targets []xcodeproj.TargetModel) string {
+func printMissingSharedSchemesAndGenerateWarning(projectRelPth, defaultGitignorePth string) string {
isXcshareddataGitignored := false
if exist, err := pathutil.IsPathExists(defaultGitignorePth); err != nil {
log.TWarnf("Failed to check if .gitignore file exists at: %s, error: %s", defaultGitignorePth, err)
@@ -207,10 +230,10 @@ func printMissingSharedSchemesAndGenerateWarning(projectPth, defaultGitignorePth
}
log.TPrintf("")
- log.TErrorf("No shared schemes found, adding recreate-user-schemes step...")
+ log.TErrorf("No shared schemes found, adding recreate-user-schemes Step...")
log.TErrorf("The newly generated schemes may differ from the ones in your project.")
- message := `No shared schemes found for project: ` + projectPth + `.` + "\n"
+ message := `No shared schemes found for project: ` + projectRelPth + `.` + "\n"
if isXcshareddataGitignored {
log.TErrorf("Your gitignore file (%s) contains 'xcshareddata', maybe shared schemes are gitignored?", defaultGitignorePth)
@@ -222,14 +245,7 @@ func printMissingSharedSchemesAndGenerateWarning(projectPth, defaultGitignorePth
}
message += `Automatically generated schemes may differ from the ones in your project.
-Make sure to