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

Install certificate for local profile #28

Merged
merged 2 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ func runCommandWithRetry(cmd *xcodebuild.CommandBuilder, useXcpretty bool, swift
return output, buildInterval, err
}

func prepareCommand(xcodeCmd *xcodebuild.CommandBuilder, useXcpretty bool, output *bytes.Buffer) (command.Command, *xcpretty.CommandModel) {
func prepareCommand(xcodeCmd *xcodebuild.CommandBuilder, useXcpretty bool, output *bytes.Buffer) (*command.Model, *xcpretty.CommandModel) {
if useXcpretty {
return nil, xcpretty.New(*xcodeCmd)
}

buildRootCmd := xcodeCmd.Command(&command.Opts{
Stdout: io.MultiWriter(os.Stdout, output),
Stderr: io.MultiWriter(os.Stderr, output),
})
buildRootCmd := xcodeCmd.Command()
buildRootCmd.SetStdout(io.MultiWriter(os.Stdout, output))
buildRootCmd.SetStderr(io.MultiWriter(os.Stderr, output))

return buildRootCmd, nil
}
Expand Down
18 changes: 9 additions & 9 deletions codesign.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ package main
import (
"fmt"

"github.com/bitrise-io/go-utils/command"
"github.com/bitrise-io/go-utils/log"
"github.com/bitrise-io/go-utils/retry"
"github.com/bitrise-io/go-xcode/autocodesign"
"github.com/bitrise-io/go-xcode/autocodesign/certdownloader"
"github.com/bitrise-io/go-xcode/autocodesign/codesignasset"
"github.com/bitrise-io/go-xcode/autocodesign/devportalclient"
"github.com/bitrise-io/go-xcode/autocodesign/localcodesignasset"
"github.com/bitrise-io/go-xcode/autocodesign/projectmanager"
"github.com/bitrise-io/go-xcode/codesign"
"github.com/bitrise-io/go-utils/v2/command"
"github.com/bitrise-io/go-utils/v2/log"
"github.com/bitrise-io/go-xcode/devportalservice"
"github.com/bitrise-io/go-xcode/v2/autocodesign"
"github.com/bitrise-io/go-xcode/v2/autocodesign/certdownloader"
"github.com/bitrise-io/go-xcode/v2/autocodesign/codesignasset"
"github.com/bitrise-io/go-xcode/v2/autocodesign/devportalclient"
"github.com/bitrise-io/go-xcode/v2/autocodesign/localcodesignasset"
"github.com/bitrise-io/go-xcode/v2/autocodesign/projectmanager"
"github.com/bitrise-io/go-xcode/v2/codesign"
)

func createCodesignManager(config Config, xcodeMajorVersion int64, logger log.Logger, cmdFactory command.Factory) (codesign.Manager, error) {
Expand Down
14 changes: 10 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@ module github.com/bitrise-steplib/steps-xcode-build-for-test
go 1.17

require (
github.com/bitrise-io/go-steputils v0.0.0-20211205220451-e046db274afb
github.com/bitrise-io/go-utils v0.0.0-20211126092127-3a566ee3f420
github.com/bitrise-io/go-xcode v0.0.0-20220105112357-9757160a67eb
github.com/bitrise-io/go-steputils v1.0.1
github.com/bitrise-io/go-utils v1.0.1
github.com/bitrise-io/go-xcode v1.0.1
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
golang.org/x/text v0.3.7 // indirect
)

require (
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.1
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.1
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.5
)

require (
github.com/bitrise-io/go-plist v0.0.0-20210301100253-4b1a112ccd10 // indirect
github.com/bitrise-io/pkcs12 v0.0.0-20211108084543-e52728e011c8 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa // indirect
github.com/golang-jwt/jwt/v4 v4.1.0 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.0 // indirect
Expand Down
39 changes: 20 additions & 19 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
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-20210929162140-866a65a1e14a/go.mod h1:6Y7Dl40gwgW9YG1RAWcjFBk1u9uotuix8g2IkVTXK34=
github.com/bitrise-io/go-steputils v0.0.0-20211205220451-e046db274afb h1:ZV1aWUW/fAY4kE08bwRGz0iSjfMEyHmkYn9IB/LtSMw=
github.com/bitrise-io/go-steputils v0.0.0-20211205220451-e046db274afb/go.mod h1:lx6GmEBJEga+HqquE2Wld5atUS8ZrvnvBeGrUNRXA9I=
github.com/bitrise-io/go-utils v0.0.0-20210924090918-3e7a04d0da9d/go.mod h1:Vi4MHnaZVL3PVoPPA/Yp6g2pzntkDH8LGiRSY7qw6KQ=
github.com/bitrise-io/go-utils v0.0.0-20211008161027-fa11986847a0/go.mod h1:Vi4MHnaZVL3PVoPPA/Yp6g2pzntkDH8LGiRSY7qw6KQ=
github.com/bitrise-io/go-utils v0.0.0-20211126092127-3a566ee3f420 h1:cbKXuIhwfZzPgvuSCvEtmWxBWSk70Vivj78cOMVWgUg=
github.com/bitrise-io/go-utils v0.0.0-20211126092127-3a566ee3f420/go.mod h1:Vi4MHnaZVL3PVoPPA/Yp6g2pzntkDH8LGiRSY7qw6KQ=
github.com/bitrise-io/go-xcode v0.0.0-20220105112357-9757160a67eb h1:PkWOFSavItNQ0WEtv4XARhzHZnzVAaP9FwJp84lpgR4=
github.com/bitrise-io/go-xcode v0.0.0-20220105112357-9757160a67eb/go.mod h1:Ptio5Y5KeEmLM78dB/atcOl6nXPNDpY0IZF8DwFlBpk=
github.com/bitrise-io/pkcs12 v0.0.0-20210430063833-0da06eb56630/go.mod h1:UiXKNs0essbC14a2TvGlnUKo9isP9m4guPrp8KJHJpU=
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-steputils/v2 v2.0.0-alpha.1 h1:rRttUs9HUZkkK7u+rRsdLh436um2qGvFE5dJeiCoB+o=
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.1/go.mod h1:OC0mHpjD/bqmsHlhG+FWgTouBbcJvmyx896PDP3dRBs=
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-utils/v2 v2.0.0-alpha.1 h1:4PBBhTUl6NthNJCTCexe/22e/crE6FTmYfcMAM/UirY=
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.1/go.mod h1:sy+Ir1X8P3tAAx/qU/r+hqDjHDcrMjIzDEvId1wqNc4=
github.com/bitrise-io/go-xcode v1.0.1 h1:pQBRBoP5vVx+K7FOGoKEGpO8G/zwolNESFFDWHEamAM=
github.com/bitrise-io/go-xcode v1.0.1/go.mod h1:Y0Wu2dXm0MilJ/4D3+gPHaNMlUcP+1DjIPoLPykq7wY=
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.5 h1:WZ3V+h/zF3zEtVa7UCb6nE2L9Sjji9znXp+vuIN9OiM=
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.5/go.mod h1:6YbvyYwZgSTt96CQSQ6QlrkcRiv3ssX8zLijh2TPnbU=
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/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa h1:RDBNVkRviHZtvDvId8XSGPu3rmpmSe+wKRcEWNgsfWU=
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA=
github.com/golang-jwt/jwt/v4 v4.1.0 h1:XUgk2Ex5veyVFVeLm0xhusUTQybEbexJXrvPNOKkSY0=
github.com/golang-jwt/jwt/v4 v4.1.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU=
github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
github.com/google/go-cmp v0.5.2/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=
Expand All @@ -36,7 +38,6 @@ github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
Expand All @@ -54,27 +55,27 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
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-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
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/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
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/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
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=
25 changes: 13 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ import (
"strings"

"github.com/bitrise-io/go-steputils/output"
"github.com/bitrise-io/go-steputils/stepconf"
"github.com/bitrise-io/go-steputils/tools"
"github.com/bitrise-io/go-utils/command"
"github.com/bitrise-io/go-utils/env"
"github.com/bitrise-io/go-steputils/v2/stepconf"
"github.com/bitrise-io/go-utils/errorutil"
"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-utils/stringutil"
"github.com/bitrise-io/go-xcode/codesign"
"github.com/bitrise-io/go-utils/v2/command"
"github.com/bitrise-io/go-utils/v2/env"
v2fileutil "github.com/bitrise-io/go-utils/v2/fileutil"
v2log "github.com/bitrise-io/go-utils/v2/log"
v2pathutil "github.com/bitrise-io/go-utils/v2/pathutil"
"github.com/bitrise-io/go-xcode/utility"
"github.com/bitrise-io/go-xcode/xcconfig"
"github.com/bitrise-io/go-xcode/v2/codesign"
"github.com/bitrise-io/go-xcode/v2/xcconfig"
"github.com/bitrise-io/go-xcode/xcodebuild"
cache "github.com/bitrise-io/go-xcode/xcodecache"
"github.com/bitrise-io/go-xcode/xcodeproject/xcworkspace"
Expand Down Expand Up @@ -73,7 +75,7 @@ func main() {
if err := parser.Parse(&cfg); err != nil {
failf("Issue with input: %s", err)
}
logger := log.NewLogger()
logger := v2log.NewLogger()
logger.EnableDebugLog(cfg.VerboseLog)
log.SetEnableDebugLog(cfg.VerboseLog)

Expand Down Expand Up @@ -108,7 +110,6 @@ func main() {
if cfg.LogFormatter == "xcpretty" {
log.Infof("Output tool check:")

var xcpretty = xcpretty.NewXcpretty()
// check if already installed
if installed, err := xcpretty.IsInstalled(); err != nil {
log.Warnf(" Failed to check if xcpretty is installed, error: %s", err)
Expand Down Expand Up @@ -144,7 +145,7 @@ func main() {

// Detect Xcode major version
factory := command.NewFactory(env.NewRepository())
xcodebuildVersion, err := utility.GetXcodeVersion(factory)
xcodebuildVersion, err := utility.GetXcodeVersion()
if err != nil {
failf("Failed to determin xcode version, error: %s", err)
}
Expand Down Expand Up @@ -212,13 +213,13 @@ func main() {
}
}

xcconfigWriter := xcconfig.NewWriter(pathutil.NewPathProvider(), fileutil.NewFileManager())
xcconfigWriter := xcconfig.NewWriter(v2pathutil.NewPathProvider(), v2fileutil.NewFileManager())
xcconfigPath, err := xcconfigWriter.Write(cfg.XCConfigContent)
if err != nil {
failf(err.Error())
}

xcodeBuildCmd := xcodebuild.NewCommandBuilder(absProjectPath, xcworkspace.IsWorkspace(absProjectPath), "", factory)
xcodeBuildCmd := xcodebuild.NewCommandBuilder(absProjectPath, xcworkspace.IsWorkspace(absProjectPath), "")
xcodeBuildCmd.SetScheme(cfg.Scheme)
xcodeBuildCmd.SetConfiguration(cfg.Configuration)
xcodeBuildCmd.SetCustomBuildAction("build-for-testing")
Expand Down Expand Up @@ -250,7 +251,7 @@ func main() {
// Export
log.Infof("Export:")

buildSettingsCmd := xcodebuild.NewShowBuildSettingsCommand(absProjectPath, factory)
buildSettingsCmd := xcodebuild.NewShowBuildSettingsCommand(absProjectPath)
buildSettingsCmd.SetScheme(cfg.Scheme)
buildSettingsCmd.SetConfiguration(cfg.Configuration)
buildSettingsCmd.SetCustomOptions(append([]string{"build-for-testing"}, customOptions...))
Expand Down
Loading