diff --git a/go.mod b/go.mod index 07dbdd8..6f834aa 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/bitrise-io/go-xcode v0.0.0-20190718082554-07ccf582b6b1 // indirect github.com/bitrise-io/goinp v0.0.0-20190611131639-bd18a8681e27 // indirect github.com/bitrise-io/stepman v0.0.0-20190813144014-10564a4888a6 // indirect - github.com/bitrise-io/xcode-project v0.0.0-20190829132102-743450f7d0f0 + github.com/bitrise-io/xcode-project v0.0.0-20190829132102-743450f7d0f0 // indirect github.com/bitrise-steplib/bitrise-step-android-unit-test v0.0.0-20190902203028-ff8e682d8645 github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver v0.0.0-20190815132021-09bfb54640c4 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 diff --git a/main.go b/main.go index 90a5170..210c5f6 100644 --- a/main.go +++ b/main.go @@ -30,6 +30,7 @@ type Config struct { Lane string `env:"lane,required"` UpdateFastlane bool `env:"update_fastlane,opt[true,false]"` VerboseLog bool `env:"verbose_log,opt[yes,no]"` + EnableCache bool `env:"enable_cache,opt[yes,no]"` GemHome string `env:"GEM_HOME"` } @@ -318,27 +319,29 @@ func main() { failf("Command failed, error: %s", err) } - fmt.Println() - log.Infof("Collecting cache") + if config.EnableCache { + fmt.Println() + log.Infof("Collecting cache") - c := cache.New() - for _, depFunc := range depsFuncs { - includes, excludes, err := depFunc(workDir) - log.Debugf("%s found include path:\n%s\nexclude paths:\n%s", functionName(depFunc), strings.Join(includes, "\n"), strings.Join(excludes, "\n")) - if err != nil { - log.Warnf("failed to collect dependencies: %s", err.Error()) - continue - } + c := cache.New() + for _, depFunc := range depsFuncs { + includes, excludes, err := depFunc(workDir) + log.Debugf("%s found include path:\n%s\nexclude paths:\n%s", functionName(depFunc), strings.Join(includes, "\n"), strings.Join(excludes, "\n")) + if err != nil { + log.Warnf("failed to collect dependencies: %s", err.Error()) + continue + } - for _, item := range includes { - c.IncludePath(item) - } + for _, item := range includes { + c.IncludePath(item) + } - for _, item := range excludes { - c.ExcludePath(item) + for _, item := range excludes { + c.ExcludePath(item) + } + } + if err := c.Commit(); err != nil { + log.Warnf("failed to commit paths to cache: %s", err) } - } - if err := c.Commit(); err != nil { - log.Warnf("failed to commit paths to cache: %s", err) } } diff --git a/step.yml b/step.yml index 104551b..5b9d5d3 100644 --- a/step.yml +++ b/step.yml @@ -54,3 +54,15 @@ inputs: value_options: - "yes" - "no" + - enable_cache: "yes" + opts: + title: "Enable collecting files to be included in the build cache" + description: |- + If enabled the step will add the following cache items (if they exist): + - Pods -> Podfile.lock + - Carthage -> Cartfile.resolved + - Android dependencies + value_options: + - "yes" + - "no" + is_required: true