Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Step 1840 remove xamarin support #155

Merged
merged 8 commits into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ Identities.p12
_bin
codesigndoc_exports
.gows.user.yml

.DS_Store
.idea/
33 changes: 7 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -73,19 +68,6 @@ If the UITest scanner cannot find the desired scheme, follow these steps:
</p>
</details>


#### Xamarin
<details><summary>For Archiving & Exporting IPA for <code>Xamarin</code> project (solution):</summary>
<p>

```
bash -l -c "$(curl -sfL https://raw.githubusercontent.com/bitrise-io/codesigndoc/master/_scripts/install_wrap-xamarin.sh)"
```
</p>
</details>

----

### Manual install & run

1. download the current release - it's a single, stand-alone binary
Expand All @@ -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
Expand Down
27 changes: 0 additions & 27 deletions _scripts/install_wrap-xamarin.sh

This file was deleted.

12 changes: 1 addition & 11 deletions _scripts/update_wrapper_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

Expand Down Expand Up @@ -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))
}
}
9 changes: 3 additions & 6 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 4 additions & 5 deletions cmd/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ 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",
Expand Down Expand Up @@ -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.`)
}
Expand All @@ -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 ...
Expand Down
82 changes: 13 additions & 69 deletions cmd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand All @@ -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()
Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading