diff --git a/go.mod b/go.mod index 02ab23e..a6ffe3b 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,9 @@ module github.com/bitrise-steplib/steps-xcode-build-for-test go 1.17 require ( - github.com/bitrise-io/go-steputils v0.0.0-20210924114124-851d30b88892 - github.com/bitrise-io/go-utils v0.0.0-20210924090918-3e7a04d0da9d - github.com/bitrise-io/go-xcode v0.0.0-20210928140350-ec12eb8661c0 + github.com/bitrise-io/go-steputils v0.0.0-20210929162140-866a65a1e14a + github.com/bitrise-io/go-utils v0.0.0-20210930092040-cceb74a5ac24 + github.com/bitrise-io/go-xcode v0.0.0-20211007125122-93e3a53643a2 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 golang.org/x/text v0.3.7 // indirect ) diff --git a/go.sum b/go.sum index 961c6f6..c3009c0 100644 --- a/go.sum +++ b/go.sum @@ -1,21 +1,24 @@ 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-20210924114124-851d30b88892 h1:aD5jTvdf5zIngQ5HeR7Idteae4yaXLqJGn8PE4k2xtI= -github.com/bitrise-io/go-steputils v0.0.0-20210924114124-851d30b88892/go.mod h1:6Y7Dl40gwgW9YG1RAWcjFBk1u9uotuix8g2IkVTXK34= -github.com/bitrise-io/go-utils v0.0.0-20210924090918-3e7a04d0da9d h1:jU5wvShTLKSo2gYlIBoXONS2MRRL8UwiPOSqi88JF2k= +github.com/bitrise-io/go-steputils v0.0.0-20210929162140-866a65a1e14a h1:RMwXuRF73TEvZejB2f048FUiEQtzwc0MGFfQHJ2v+sk= +github.com/bitrise-io/go-steputils v0.0.0-20210929162140-866a65a1e14a/go.mod h1:6Y7Dl40gwgW9YG1RAWcjFBk1u9uotuix8g2IkVTXK34= github.com/bitrise-io/go-utils v0.0.0-20210924090918-3e7a04d0da9d/go.mod h1:Vi4MHnaZVL3PVoPPA/Yp6g2pzntkDH8LGiRSY7qw6KQ= -github.com/bitrise-io/go-xcode v0.0.0-20210927150020-dd11ae1c9008 h1:9Pn7LCh/W3WnqJ4G3UGJCOn8cYwJELzygZvMR2Zwsow= -github.com/bitrise-io/go-xcode v0.0.0-20210927150020-dd11ae1c9008/go.mod h1:R+mDPZyTUBfd/wpN8bl67BYsDaCTgS6FDwBSZG4UmGA= -github.com/bitrise-io/go-xcode v0.0.0-20210928140350-ec12eb8661c0 h1:gihGjCEtxIM/i0v8jCfRLn6sUG0lBaJ+EBzrdInRXX8= -github.com/bitrise-io/go-xcode v0.0.0-20210928140350-ec12eb8661c0/go.mod h1:R+mDPZyTUBfd/wpN8bl67BYsDaCTgS6FDwBSZG4UmGA= +github.com/bitrise-io/go-utils v0.0.0-20210930092040-cceb74a5ac24 h1:T/tR1FSSH2lUYv9gS2US5ICafIlPogHgh4Jo+LoEv2g= +github.com/bitrise-io/go-utils v0.0.0-20210930092040-cceb74a5ac24/go.mod h1:Vi4MHnaZVL3PVoPPA/Yp6g2pzntkDH8LGiRSY7qw6KQ= +github.com/bitrise-io/go-xcode v0.0.0-20211007125122-93e3a53643a2 h1:85N/eH+myTnLA58/MdfppOhAGw6VwuQfzYLZ1akKCi8= +github.com/bitrise-io/go-xcode v0.0.0-20211007125122-93e3a53643a2/go.mod h1:qXTBqp2B9eCsNNLLhhWDkHlO238KKHAb2hsJZI+Zd/0= github.com/bitrise-io/pkcs12 v0.0.0-20210430063833-0da06eb56630/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/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= -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.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= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-version v1.3.0 h1:McDWVJIU/y+u1BRV06dPaLfLCaT7fUTJLp5r04x7iNw= @@ -44,7 +47,6 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/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/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= diff --git a/main.go b/main.go index 8fc4dcb..b3f839f 100644 --- a/main.go +++ b/main.go @@ -17,6 +17,7 @@ import ( "github.com/bitrise-io/go-utils/pathutil" "github.com/bitrise-io/go-utils/stringutil" "github.com/bitrise-io/go-xcode/utility" + "github.com/bitrise-io/go-xcode/xcconfig" "github.com/bitrise-io/go-xcode/xcodebuild" cache "github.com/bitrise-io/go-xcode/xcodecache" "github.com/bitrise-io/go-xcode/xcodeproject/serialized" @@ -149,17 +150,10 @@ func main() { } } - var xcconfigPath string - if cfg.XCConfigContent != "" { - dir, err := pathutil.NewPathProvider().CreateTempDir("") - if err != nil { - failf("Unable to create temp dir for writing XCConfig: %s", err) - } - xcconfigPath = filepath.Join(dir, "temp.xcconfig") - - if err = fileutil.NewFileManager().Write(xcconfigPath, cfg.XCConfigContent, 0644); err != nil { - failf("unable to write XCConfig content into file: %s", err, err) - } + xcconfigWriter := xcconfig.NewWriter(pathutil.NewPathProvider(), fileutil.NewFileManager()) + xcconfigPath, err := xcconfigWriter.Write(cfg.XCConfigContent) + if err != nil { + failf(err.Error()) } xcodeBuildCmd := xcodebuild.NewCommandBuilder(absProjectPath, xcworkspace.IsWorkspace(absProjectPath), "", factory) diff --git a/vendor/github.com/bitrise-io/go-xcode/xcconfig/xcconfig.go b/vendor/github.com/bitrise-io/go-xcode/xcconfig/xcconfig.go new file mode 100644 index 0000000..a1c9a27 --- /dev/null +++ b/vendor/github.com/bitrise-io/go-xcode/xcconfig/xcconfig.go @@ -0,0 +1,35 @@ +package xcconfig + +import ( + "fmt" + "github.com/bitrise-io/go-utils/fileutil" + "github.com/bitrise-io/go-utils/pathutil" + "path/filepath" +) + +// Writer ... +type Writer interface { + Write(content string) (string, error) +} + +type writer struct { + pathProvider pathutil.PathProvider + fileManager fileutil.FileManager +} + +// NewWriter ... +func NewWriter(pathProvider pathutil.PathProvider, fileManager fileutil.FileManager) Writer { + return &writer{pathProvider: pathProvider, fileManager: fileManager} +} + +func (w writer) Write(content string) (string, error) { + dir, err := w.pathProvider.CreateTempDir("") + if err != nil { + return "", fmt.Errorf("unable to create temp dir for writing XCConfig: %v", err) + } + xcconfigPath := filepath.Join(dir, "temp.xcconfig") + if err = w.fileManager.Write(xcconfigPath, content, 0644); err != nil { + return "", fmt.Errorf("unable to write XCConfig content into file: %v", err) + } + return xcconfigPath, nil +} diff --git a/vendor/modules.txt b/vendor/modules.txt index a575ca4..4047ef9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,14 +1,14 @@ # github.com/bitrise-io/go-plist v0.0.0-20210301100253-4b1a112ccd10 ## explicit; go 1.15 github.com/bitrise-io/go-plist -# github.com/bitrise-io/go-steputils v0.0.0-20210924114124-851d30b88892 +# github.com/bitrise-io/go-steputils v0.0.0-20210929162140-866a65a1e14a ## explicit; go 1.16 github.com/bitrise-io/go-steputils/cache github.com/bitrise-io/go-steputils/output github.com/bitrise-io/go-steputils/ruby github.com/bitrise-io/go-steputils/stepconf github.com/bitrise-io/go-steputils/tools -# github.com/bitrise-io/go-utils v0.0.0-20210924090918-3e7a04d0da9d +# github.com/bitrise-io/go-utils v0.0.0-20210930092040-cceb74a5ac24 ## explicit; go 1.16 github.com/bitrise-io/go-utils/colorstring github.com/bitrise-io/go-utils/command @@ -23,10 +23,11 @@ github.com/bitrise-io/go-utils/pretty github.com/bitrise-io/go-utils/sliceutil github.com/bitrise-io/go-utils/stringutil github.com/bitrise-io/go-utils/ziputil -# github.com/bitrise-io/go-xcode v0.0.0-20210928140350-ec12eb8661c0 -## explicit; go 1.15 +# github.com/bitrise-io/go-xcode v0.0.0-20211007125122-93e3a53643a2 +## explicit; go 1.16 github.com/bitrise-io/go-xcode/models github.com/bitrise-io/go-xcode/utility +github.com/bitrise-io/go-xcode/xcconfig github.com/bitrise-io/go-xcode/xcodebuild github.com/bitrise-io/go-xcode/xcodecache github.com/bitrise-io/go-xcode/xcodeproject/serialized