diff --git a/main.go b/main.go index 71ab678..adc2340 100644 --- a/main.go +++ b/main.go @@ -269,6 +269,9 @@ func main() { if err != nil { log.Warnf("Failed to determine if Podfile is using Specs repo, error: %s", err) } else { + if isUsingSpecsRepo { + addSpecsRepoAnnotation(cmdFactory) + } tracker.Enqueue("step_cocoapods_install_podfile_used", analytics.Properties{ "step_execution_id": envRepository.Get("BITRISE_STEP_EXECUTION_ID"), "build_slug": envRepository.Get("BITRISE_BUILD_SLUG"), diff --git a/podfile.go b/podfile.go index 93a41aa..812e045 100644 --- a/podfile.go +++ b/podfile.go @@ -4,8 +4,16 @@ import ( "bufio" "os" "strings" + + "github.com/bitrise-io/go-utils/v2/command" ) +const specsRepoWarning = `### CocoaPods tip +Your Podfile is still using the Specs repo. Switch to the CDN source for **faster and more reliable** dependency installs! + +Learn more about the **one-line change** [here](https://blog.cocoapods.org/CocoaPods-1.8.0-beta/). +` + // isPodfileUsingSpecsRepo returns true if the Podfile contains a source 'https://github.com/CocoaPods/Specs.git'. // It returns false if the CDN source or any other 3rd party git source is used. func isPodfileUsingSpecsRepo(path string) (bool, error) { @@ -33,3 +41,8 @@ func isPodfileUsingSpecsRepo(path string) (bool, error) { return specsRepoDefined, nil } + +func addSpecsRepoAnnotation(cmdFactory command.Factory) { + cmd := cmdFactory.Create("bitrise", []string{":annotations", "annotate", specsRepoWarning, "--style", "info"}, nil) + _ = cmd.Run() // ignore error, this is best-effort +}