Skip to content

Commit

Permalink
Refined exporting conditions and migrated to Go modules (#47)
Browse files Browse the repository at this point in the history
* Warning replaced with error

* Additional check added to export condition

* Tests improved

* Migrated to Go modules

* Eliminate deprecated packages

* Eliminiate Ionic Archive Step dependency
  • Loading branch information
istvankovacs-bitrise committed May 12, 2021
1 parent 8c11ef0 commit e6c828d
Show file tree
Hide file tree
Showing 145 changed files with 313 additions and 11,285 deletions.
87 changes: 0 additions & 87 deletions Gopkg.lock

This file was deleted.

16 changes: 0 additions & 16 deletions Gopkg.toml

This file was deleted.

17 changes: 0 additions & 17 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,23 +141,6 @@ workflows:
inputs:
- path: ${ORIG_BITRISE_SOURCE_DIR}

# ----------------------------------------------------------------
# --- Utility workflows
dep-update:
title: Dep update
description: |
Used for updating bitrise dependencies with dep
steps:
- script:
title: Dependency update
inputs:
- content: |-
#!/bin/bash
set -ex
go get -u -v github.com/golang/dep/cmd/dep
dep ensure -v
dep ensure -v -update
# ----------------------------------------------------------------
# --- workflows to Share this step into a Step Library
audit-this-step:
Expand Down
11 changes: 11 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module bitrise-steplib/steps-cordova-archive

go 1.15

require (
github.com/bitrise-io/go-steputils v0.0.0-20210507072936-92fde382fb33
github.com/bitrise-io/go-utils v0.0.0-20210506064210-b22e2b7b3ad3
github.com/bitrise-steplib/steps-cordova-archive v0.0.0-20210401121956-8c11ef01e45b
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
gopkg.in/yaml.v2 v2.4.0 // indirect
)
37 changes: 37 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
github.com/bitrise-io/go-steputils v0.0.0-20210507072936-92fde382fb33 h1:4QpxkX2oNefww7k76ZUD4C7unfP4c8H0c0QP7SdfrTQ=
github.com/bitrise-io/go-steputils v0.0.0-20210507072936-92fde382fb33/go.mod h1:YCtb1VETn/rF9tCt9oInhd/cwbt1ETPm+dTlDIfyD+A=
github.com/bitrise-io/go-utils v0.0.0-20210506064210-b22e2b7b3ad3 h1:XVwIES1M3PdXr8gUIlG5LLUe6TC6Gfl1j/pB27ehbME=
github.com/bitrise-io/go-utils v0.0.0-20210506064210-b22e2b7b3ad3/go.mod h1:nhdaDQFvaMny1CugVV6KjK92/q97ENo0RuKSW5I4fbA=
github.com/bitrise-steplib/steps-cordova-archive v0.0.0-20210401121956-8c11ef01e45b h1:kXnvqqpgMxHbdoVa2NQ+ZAS+r6TnHfrVRTcD39cFxTc=
github.com/bitrise-steplib/steps-cordova-archive v0.0.0-20210401121956-8c11ef01e45b/go.mod h1:M15BfyTAkx77kw6x5sMtnA7lftZH7mG/r2A4bW7lyBU=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
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/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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
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-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200219091948-cb0a6d8edb6c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/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 h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
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=
22 changes: 11 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import (
"strings"
"time"

"github.com/bitrise-community/steps-cordova-archive/cordova"
"github.com/bitrise-community/steps-ionic-archive/jsdependency"
"github.com/bitrise-io/go-steputils/jsdependency"
"github.com/bitrise-io/go-steputils/stepconf"
"github.com/bitrise-io/go-steputils/tools"
"github.com/bitrise-io/go-utils/colorstring"
"github.com/bitrise-io/go-utils/command"
"github.com/bitrise-io/go-utils/errorutil"
"github.com/bitrise-io/go-utils/log"
"github.com/bitrise-io/go-utils/pathutil"
"github.com/bitrise-io/go-utils/sliceutil"
"github.com/bitrise-io/go-utils/ziputil"
"github.com/bitrise-tools/go-steputils/stepconf"
"github.com/bitrise-tools/go-steputils/tools"
"github.com/bitrise-steplib/steps-cordova-archive/cordova"
"github.com/kballard/go-shellquote"
)

Expand Down Expand Up @@ -55,15 +55,15 @@ func installDependency(packageManager jsdependency.Tool, name string, version st
}
for i, cmd := range cmdSlice {
fmt.Println()
log.Donef("$ %s", cmd.PrintableCommandArgs())
log.Donef("$ %s", cmd.Slice.PrintableCommandArgs())
fmt.Println()

// Yarn returns an error if the package is not added before removal, ignoring
if out, err := cmd.RunAndReturnTrimmedCombinedOutput(); err != nil && !(packageManager == jsdependency.Yarn && i == 0) {
if out, err := cmd.Slice.RunAndReturnTrimmedCombinedOutput(); err != nil && !(packageManager == jsdependency.Yarn && i == 0) {
if errorutil.IsExitStatusError(err) {
return fmt.Errorf("Failed to update %s version: %s failed, output: %s", name, cmd.PrintableCommandArgs(), out)
return fmt.Errorf("Failed to update %s version: %s failed, output: %s", name, cmd.Slice.PrintableCommandArgs(), out)
}
return fmt.Errorf("Failed to update %s version: %s failed, error: %s", name, cmd.PrintableCommandArgs(), err)
return fmt.Errorf("Failed to update %s version: %s failed, error: %s", name, cmd.Slice.PrintableCommandArgs(), err)
}
}
return nil
Expand Down Expand Up @@ -305,7 +305,7 @@ func main() {
fail("Failed to find ipas in dir (%s), error: %s", iosOutputDir, err)
}

if len(ipas) > 0 {
if configs.Target == "device" && len(ipas) > 0 {
if exportedPth, err := moveAndExportOutputs(ipas, configs.DeployDir, ipaPathEnvKey, false); err != nil {
fail("Failed to export ipas, error: %s", err)
} else {
Expand Down Expand Up @@ -342,9 +342,9 @@ func main() {
fail("Failed to find apps in dir (%s), error: %s", iosOutputDir, err)
}

if len(apps) > 0 {
if configs.Target == "emulator" && len(apps) > 0 {
if exportedPth, err := moveAndExportOutputs(apps, configs.DeployDir, appDirPathEnvKey, true); err != nil {
log.Warnf("Failed to export apps, error: %s", err)
fail("Failed to export apps, error: %s", err)
} else {
log.Donef("The app dir path is now available in the Environment Variable: %s (value: %s)", appDirPathEnvKey, exportedPth)

Expand Down
20 changes: 16 additions & 4 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func Test_checkBuildProducts(t *testing.T) {
true,
},
{
"ios emulator target OK",
"ios emulator target, app generated, OK",
args{
[]string{},
[]string{},
Expand All @@ -77,19 +77,31 @@ func Test_checkBuildProducts(t *testing.T) {
false,
},
{
"ios emulator target, ipa generated FAIL",
"ios emulator target, ipa generated, FAIL",
args{
[]string{},
[]string{},
[]string{},
[]string{"/path.apk"},
[]string{"/path.ipa"},
[]string{"ios"},
"emulator",
},
true,
},
{
"ios device target, app generated FAIL",
"ios device target, ipa generated, OK",
args{
[]string{},
[]string{},
[]string{},
[]string{"/app_path.ipa"},
[]string{"ios"},
"device",
},
false,
},
{
"ios device target, app generated, FAIL",
args{
[]string{},
[]string{},
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit e6c828d

Please sign in to comment.