From ecf612f3598ce90b81913bafa9664122db3b19e4 Mon Sep 17 00:00:00 2001 From: Laszlo Pusok Date: Tue, 8 Feb 2022 10:13:08 +0100 Subject: [PATCH] bitrise-init dep update --- go.mod | 2 +- go.sum | 4 +- .../bitrise-init/scanners/flutter/const.go | 9 + .../bitrise-init/scanners/flutter/flutter.go | 221 ++++++--------- .../bitrise-init/scanners/ios/podfile.go | 40 ++- .../bitrise-init/scanners/ios/rubyscript.go | 13 +- .../bitrise-init/scanners/ios/utility.go | 7 + .../scanners/reactnative/const.go | 94 +++--- .../bitrise-init/scanners/reactnative/expo.go | 106 ++----- .../scanners/reactnative/plain.go | 268 ++++++++---------- .../scanners/reactnative/reactnative.go | 8 +- vendor/modules.txt | 2 +- 12 files changed, 302 insertions(+), 472 deletions(-) create mode 100644 vendor/github.com/bitrise-io/bitrise-init/scanners/flutter/const.go diff --git a/go.mod b/go.mod index af127899..93db7235 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.15 require ( github.com/bitrise-io/bitrise v0.0.0-20210623145422-513e39485248 // indirect - github.com/bitrise-io/bitrise-init v0.0.0-20220201222253-de20a87cb89e + github.com/bitrise-io/bitrise-init v0.0.0-20220207155038-1a335925b04e github.com/bitrise-io/envman v0.0.0-20210630102032-df85af51bd1a // indirect github.com/bitrise-io/go-steputils v0.0.0-20210527075147-910ce7a105a1 github.com/bitrise-io/go-utils v0.0.0-20210713111255-08be784d45d0 diff --git a/go.sum b/go.sum index 90423008..c3529635 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,8 @@ github.com/bitrise-io/bitrise v0.0.0-20210519130014-380842fb41c1/go.mod h1:Jqf2P github.com/bitrise-io/bitrise v0.0.0-20210623145422-513e39485248 h1:GfhBF379/Uwu4fmalhwwoJv3RcqlrlEo8+gGEcuXLsw= github.com/bitrise-io/bitrise v0.0.0-20210623145422-513e39485248/go.mod h1:jqk9VdrvlRpRfIqA2DZHVNEMvPycmlpBfpiKxk89R6w= github.com/bitrise-io/bitrise-init v0.0.0-20210518121553-1e678625c45d/go.mod h1:2bxvLp7xgXC3HsacG2Z5nn6WOjk8kbNOmLWjinnhnKg= -github.com/bitrise-io/bitrise-init v0.0.0-20220201222253-de20a87cb89e h1:ZCvqdt8TCDKyFVUXfJie+jsmiJhCXv7BReCh0wsKpKE= -github.com/bitrise-io/bitrise-init v0.0.0-20220201222253-de20a87cb89e/go.mod h1:I9KSWJm177/IOBMQHzn6BLgymVLQ0xlv/gMwDCYkWYU= +github.com/bitrise-io/bitrise-init v0.0.0-20220207155038-1a335925b04e h1:8WxOgFiJE/EZppYJaOrXvSHbnFUFhu/AXlkJ7tiANXI= +github.com/bitrise-io/bitrise-init v0.0.0-20220207155038-1a335925b04e/go.mod h1:I9KSWJm177/IOBMQHzn6BLgymVLQ0xlv/gMwDCYkWYU= github.com/bitrise-io/colorstring v0.0.0-20180614154802-a8cd70115192/go.mod h1:CIHVcxZUvsG99XUJV6JlR7okNsMMGY81jMvPC20W+O0= github.com/bitrise-io/envman v0.0.0-20200512105748-919e33f391ee/go.mod h1:m8pTp1o3Sw9uzDxb1WRm5IBRnMau2iOvPMSnRCAhQNI= github.com/bitrise-io/envman v0.0.0-20210517135508-b2b4fe89eac5/go.mod h1:m8pTp1o3Sw9uzDxb1WRm5IBRnMau2iOvPMSnRCAhQNI= diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/flutter/const.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/flutter/const.go new file mode 100644 index 00000000..70c156f8 --- /dev/null +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/flutter/const.go @@ -0,0 +1,9 @@ +package flutter + +const ( + primaryWorkflowDescription = `Builds project and runs tests. + +Next steps: +- Check out [Getting started with Flutter apps](https://devcenter.bitrise.io/en/getting-started/getting-started-with-flutter-apps.html). +` +) diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/flutter/flutter.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/flutter/flutter.go index a39b0c7b..5e66a9ba 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/flutter/flutter.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/flutter/flutter.go @@ -16,7 +16,7 @@ import ( envmanModels "github.com/bitrise-io/envman/models" "github.com/bitrise-io/go-utils/log" "github.com/bitrise-io/go-xcode/xcodeproject/xcworkspace" - yaml "gopkg.in/yaml.v2" + "gopkg.in/yaml.v2" ) const ( @@ -27,19 +27,14 @@ const ( defaultIOSConfiguration = "Release" projectLocationInputEnvKey = "BITRISE_FLUTTER_PROJECT_LOCATION" projectLocationInputTitle = "Project location" - projectTypeInputEnvKey = "BITRISE_FLUTTER_PROJECT_TYPE" - projectTypeInputTitle = "Project Type" - testsInputTitle = "Run tests found in the project" platformInputTitle = "Platform" projectLocationInputSummary = "The path to your Flutter project, stored as an Environment Variable. In your Workflows, you can specify paths relative to this path. You can change this at any time." - testsInputSummary = "Our Flutter Test Step can run the tests found in your project's repository." platformInputSummary = "The target platform for your first build. Your options are iOS, Android, both, or neither. You can change this in your Env Vars at any time." installerUpdateFlutterKey = "is_update" ) var ( platforms = []string{ - "none", "android", "ios", "both", @@ -249,74 +244,35 @@ func (scanner *Scanner) Options() (models.OptionNode, models.Warnings, models.Ic flutterProjectLocationOption := models.NewOption(projectLocationInputTitle, projectLocationInputSummary, projectLocationInputEnvKey, models.TypeSelector) for _, project := range scanner.projects { + var testKey string if project.hasTest { - flutterProjectHasTestOption := models.NewOption(testsInputTitle, testsInputSummary, "", models.TypeSelector) - flutterProjectLocationOption.AddOption(project.path, flutterProjectHasTestOption) - - for _, v := range []string{"yes", "no"} { - cfg := configName - if v == "yes" { - cfg += "-test" - } + testKey = "test" + } else { + testKey = "notest" + } + cfg := configName + "-" + testKey - if project.hasIosProject || project.hasAndroidProject { - if project.hasIosProject { - projectPathOption := models.NewOption(ios.ProjectPathInputTitle, ios.ProjectPathInputSummary, ios.ProjectPathInputEnvKey, models.TypeSelector) - flutterProjectHasTestOption.AddOption(v, projectPathOption) + if project.hasIosProject { + xcodeProjectPathOption := models.NewOption(ios.ProjectPathInputTitle, ios.ProjectPathInputSummary, ios.ProjectPathInputEnvKey, models.TypeSelector) + flutterProjectLocationOption.AddOption(project.path, xcodeProjectPathOption) - for xcodeWorkspacePath, schemes := range project.xcodeProjectPaths { - schemeOption := models.NewOption(ios.SchemeInputTitle, ios.SchemeInputSummary, ios.SchemeInputEnvKey, models.TypeSelector) - projectPathOption.AddOption(xcodeWorkspacePath, schemeOption) + for xcodeWorkspacePath, schemes := range project.xcodeProjectPaths { + schemeOption := models.NewOption(ios.SchemeInputTitle, ios.SchemeInputSummary, ios.SchemeInputEnvKey, models.TypeSelector) + xcodeProjectPathOption.AddOption(xcodeWorkspacePath, schemeOption) - for _, scheme := range schemes { - distributionMethodOption := models.NewOption(ios.DistributionMethodInputTitle, ios.DistributionMethodInputSummary, ios.DistributionMethodEnvKey, models.TypeSelector) - schemeOption.AddOption(scheme, distributionMethodOption) + for _, scheme := range schemes { + distributionMethodOption := models.NewOption(ios.DistributionMethodInputTitle, ios.DistributionMethodInputSummary, ios.DistributionMethodEnvKey, models.TypeSelector) + schemeOption.AddOption(scheme, distributionMethodOption) - for _, exportMethod := range ios.IosExportMethods { - configOption := models.NewConfigOption(cfg+"-app-"+getBuildablePlatform(project.hasAndroidProject, project.hasIosProject), nil) - distributionMethodOption.AddConfig(exportMethod, configOption) - } - } - } - } else { + for _, exportMethod := range ios.IosExportMethods { configOption := models.NewConfigOption(cfg+"-app-"+getBuildablePlatform(project.hasAndroidProject, project.hasIosProject), nil) - flutterProjectHasTestOption.AddOption(v, configOption) + distributionMethodOption.AddConfig(exportMethod, configOption) } - } else { - configOption := models.NewConfigOption(cfg, nil) - flutterProjectHasTestOption.AddOption(v, configOption) } } } else { - cfg := configName - - if project.hasIosProject || project.hasAndroidProject { - if project.hasIosProject { - projectPathOption := models.NewOption(ios.ProjectPathInputTitle, ios.ProjectPathInputSummary, ios.ProjectPathInputEnvKey, models.TypeSelector) - flutterProjectLocationOption.AddOption(project.path, projectPathOption) - - for xcodeWorkspacePath, schemes := range project.xcodeProjectPaths { - schemeOption := models.NewOption(ios.SchemeInputTitle, ios.SchemeInputSummary, ios.SchemeInputEnvKey, models.TypeSelector) - projectPathOption.AddOption(xcodeWorkspacePath, schemeOption) - - for _, scheme := range schemes { - distributionMethodOption := models.NewOption(ios.DistributionMethodInputTitle, ios.DistributionMethodInputSummary, ios.DistributionMethodEnvKey, models.TypeSelector) - schemeOption.AddOption(scheme, distributionMethodOption) - - for _, exportMethod := range ios.IosExportMethods { - configOption := models.NewConfigOption(cfg+"-app-"+getBuildablePlatform(project.hasAndroidProject, project.hasIosProject), nil) - distributionMethodOption.AddConfig(exportMethod, configOption) - } - } - } - } else { - configOption := models.NewConfigOption(cfg+"-app-"+getBuildablePlatform(project.hasAndroidProject, project.hasIosProject), nil) - flutterProjectLocationOption.AddOption(project.path, configOption) - } - } else { - configOption := models.NewConfigOption(cfg, nil) - flutterProjectLocationOption.AddOption(project.path, configOption) - } + configOption := models.NewConfigOption(cfg+"-app-"+getBuildablePlatform(project.hasAndroidProject, project.hasIosProject), nil) + flutterProjectLocationOption.AddOption(project.path, configOption) } } @@ -338,41 +294,29 @@ func getBuildablePlatform(hasAndroidProject, hasIosProject bool) string { func (Scanner) DefaultOptions() models.OptionNode { flutterProjectLocationOption := models.NewOption(projectLocationInputTitle, projectLocationInputSummary, projectLocationInputEnvKey, models.TypeUserInput) - flutterProjectHasTestOption := models.NewOption(testsInputTitle, testsInputSummary, "", models.TypeSelector) - flutterProjectLocationOption.AddOption("", flutterProjectHasTestOption) + cfg := configName + "-test" - for _, v := range []string{"yes", "no"} { - cfg := configName - if v == "yes" { - cfg += "-test" - } - flutterPlatformOption := models.NewOption(platformInputTitle, platformInputSummary, "", models.TypeSelector) - flutterProjectHasTestOption.AddOption(v, flutterPlatformOption) + flutterPlatformOption := models.NewOption(platformInputTitle, platformInputSummary, "", models.TypeSelector) + flutterProjectLocationOption.AddOption("", flutterPlatformOption) - for _, platform := range platforms { - if platform != "none" { - if platform != "android" { - projectPathOption := models.NewOption(ios.ProjectPathInputTitle, ios.ProjectPathInputSummary, ios.ProjectPathInputEnvKey, models.TypeUserInput) - flutterPlatformOption.AddOption(platform, projectPathOption) + for _, platform := range platforms { + if platform != "android" { + projectPathOption := models.NewOption(ios.ProjectPathInputTitle, ios.ProjectPathInputSummary, ios.ProjectPathInputEnvKey, models.TypeUserInput) + flutterPlatformOption.AddOption(platform, projectPathOption) - schemeOption := models.NewOption(ios.SchemeInputTitle, ios.SchemeInputSummary, ios.SchemeInputEnvKey, models.TypeUserInput) - projectPathOption.AddOption("", schemeOption) + schemeOption := models.NewOption(ios.SchemeInputTitle, ios.SchemeInputSummary, ios.SchemeInputEnvKey, models.TypeUserInput) + projectPathOption.AddOption("", schemeOption) - distributionMethodOption := models.NewOption(ios.DistributionMethodInputTitle, ios.DistributionMethodInputSummary, ios.DistributionMethodEnvKey, models.TypeSelector) - schemeOption.AddOption("", distributionMethodOption) + distributionMethodOption := models.NewOption(ios.DistributionMethodInputTitle, ios.DistributionMethodInputSummary, ios.DistributionMethodEnvKey, models.TypeSelector) + schemeOption.AddOption("", distributionMethodOption) - for _, exportMethod := range ios.IosExportMethods { - configOption := models.NewConfigOption(cfg+"-app-"+platform, nil) - distributionMethodOption.AddConfig(exportMethod, configOption) - } - } else { - configOption := models.NewConfigOption(cfg+"-app-"+platform, nil) - flutterPlatformOption.AddConfig(platform, configOption) - } - } else { - configOption := models.NewConfigOption(cfg, nil) - flutterPlatformOption.AddConfig(platform, configOption) + for _, exportMethod := range ios.IosExportMethods { + configOption := models.NewConfigOption(cfg+"-app-"+platform, nil) + distributionMethodOption.AddConfig(exportMethod, configOption) } + } else { + configOption := models.NewConfigOption(cfg+"-app-"+platform, nil) + flutterPlatformOption.AddConfig(platform, configOption) } } @@ -380,34 +324,40 @@ func (Scanner) DefaultOptions() models.OptionNode { } // Configs ... -func (scanner *Scanner) Configs(_ bool) (models.BitriseConfigMap, error) { - return scanner.DefaultConfigs() +func (scanner *Scanner) Configs(isPrivateRepository bool) (models.BitriseConfigMap, error) { + return generateConfigMap(isPrivateRepository) } // DefaultConfigs ... func (scanner Scanner) DefaultConfigs() (models.BitriseConfigMap, error) { + return generateConfigMap(true) +} + +func generateConfigMap(isPrivateRepository bool) (models.BitriseConfigMap, error) { configs := models.BitriseConfigMap{} for _, variant := range []struct { configID string test bool - deploy bool platform string }{ - {test: false, deploy: false, configID: configName}, - {test: true, deploy: false, configID: configName + "-test"}, - {test: false, deploy: true, platform: "both", configID: configName + "-app-both"}, - {test: true, deploy: true, platform: "both", configID: configName + "-test-app-both"}, - {test: false, deploy: true, platform: "android", configID: configName + "-app-android"}, - {test: true, deploy: true, platform: "android", configID: configName + "-test-app-android"}, - {test: false, deploy: true, platform: "ios", configID: configName + "-app-ios"}, - {test: true, deploy: true, platform: "ios", configID: configName + "-test-app-ios"}, + {test: false, platform: "both", configID: configName + "-notest-app-both"}, + {test: true, platform: "both", configID: configName + "-test-app-both"}, + {test: false, platform: "android", configID: configName + "-notest-app-android"}, + {test: true, platform: "android", configID: configName + "-test-app-android"}, + {test: false, platform: "ios", configID: configName + "-notest-app-ios"}, + {test: true, platform: "ios", configID: configName + "-test-app-ios"}, } { configBuilder := models.NewDefaultConfigBuilder() // primary + configBuilder.SetWorkflowDescriptionTo(models.PrimaryWorkflowID, primaryWorkflowDescription) - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(false)...) + prepareSteps := steps.DefaultPrepareStepListV2(steps.PrepareListParams{ + ShouldIncludeCache: false, + ShouldIncludeActivateSSH: isPrivateRepository, + }) + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, prepareSteps...) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.FlutterInstallStepListItem( envmanModels.EnvironmentItemModel{installerUpdateFlutterKey: "false"}, @@ -416,60 +366,53 @@ func (scanner Scanner) DefaultConfigs() (models.BitriseConfigMap, error) { // cache-pull is after flutter-installer, to prevent removal of pub system cache configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.CachePullStepListItem()) - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.FlutterAnalyzeStepListItem( - envmanModels.EnvironmentItemModel{projectLocationInputKey: "$" + projectLocationInputEnvKey}, - )) - if variant.test { configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.FlutterTestStepListItem( envmanModels.EnvironmentItemModel{projectLocationInputKey: "$" + projectLocationInputEnvKey}, )) } - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultDeployStepList(true)...) + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultDeployStepListV2(true)...) // deploy + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultPrepareStepList(false)...) - if variant.deploy { - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultPrepareStepList(false)...) + if variant.platform != "android" { + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.CertificateAndProfileInstallerStepListItem()) + } - if variant.platform != "android" { - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.CertificateAndProfileInstallerStepListItem()) - } + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.FlutterInstallStepListItem( + envmanModels.EnvironmentItemModel{installerUpdateFlutterKey: "false"}, + )) - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.FlutterInstallStepListItem( - envmanModels.EnvironmentItemModel{installerUpdateFlutterKey: "false"}, - )) + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.CachePullStepListItem()) - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.CachePullStepListItem()) + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.FlutterAnalyzeStepListItem( + envmanModels.EnvironmentItemModel{projectLocationInputKey: "$" + projectLocationInputEnvKey}, + )) - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.FlutterAnalyzeStepListItem( + if variant.test { + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.FlutterTestStepListItem( envmanModels.EnvironmentItemModel{projectLocationInputKey: "$" + projectLocationInputEnvKey}, )) + } - if variant.test { - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.FlutterTestStepListItem( - envmanModels.EnvironmentItemModel{projectLocationInputKey: "$" + projectLocationInputEnvKey}, - )) - } + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.FlutterBuildStepListItem( + envmanModels.EnvironmentItemModel{projectLocationInputKey: "$" + projectLocationInputEnvKey}, + envmanModels.EnvironmentItemModel{platformInputKey: variant.platform}, + )) - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.FlutterBuildStepListItem( - envmanModels.EnvironmentItemModel{projectLocationInputKey: "$" + projectLocationInputEnvKey}, - envmanModels.EnvironmentItemModel{platformInputKey: variant.platform}, + if variant.platform != "android" { + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.XcodeArchiveStepListItem( + envmanModels.EnvironmentItemModel{ios.ProjectPathInputKey: "$" + ios.ProjectPathInputEnvKey}, + envmanModels.EnvironmentItemModel{ios.SchemeInputKey: "$" + ios.SchemeInputEnvKey}, + envmanModels.EnvironmentItemModel{ios.DistributionMethodInputKey: "$" + ios.DistributionMethodEnvKey}, + envmanModels.EnvironmentItemModel{ios.ConfigurationInputKey: defaultIOSConfiguration}, )) - - if variant.platform != "android" { - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.XcodeArchiveStepListItem( - envmanModels.EnvironmentItemModel{ios.ProjectPathInputKey: "$" + ios.ProjectPathInputEnvKey}, - envmanModels.EnvironmentItemModel{ios.SchemeInputKey: "$" + ios.SchemeInputEnvKey}, - envmanModels.EnvironmentItemModel{ios.DistributionMethodInputKey: "$" + ios.DistributionMethodEnvKey}, - envmanModels.EnvironmentItemModel{ios.ConfigurationInputKey: defaultIOSConfiguration}, - )) - } - - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultDeployStepList(true)...) } + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultDeployStepList(true)...) + config, err := configBuilder.Generate(scannerName) if err != nil { return models.BitriseConfigMap{}, err diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/podfile.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/podfile.go index 6d6c2f88..b184d152 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/podfile.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/podfile.go @@ -65,15 +65,14 @@ end absPodfilePth, err := filepath.Abs(podfileParser.podfilePth) if err != nil { - return map[string]string{}, fmt.Errorf("failed to expand path (%s), error: %s", podfileParser.podfilePth, err) + return map[string]string{}, fmt.Errorf("failed to expand path (%s): %s", podfileParser.podfilePth, err) } envs := []string{fmt.Sprintf("PODFILE_PATH=%s", absPodfilePth)} - podfileDir := filepath.Dir(absPodfilePth) - out, err := runRubyScriptForOutput(rubyScriptContent, gemfileContent, podfileDir, envs) + out, err := runRubyScriptForOutput(rubyScriptContent, gemfileContent, envs) if err != nil { - return map[string]string{}, fmt.Errorf("ruby script failed, error: %s", err) + return map[string]string{}, fmt.Errorf("ruby script failed: %s", err) } if out == "" { @@ -87,11 +86,11 @@ end var targetDefinitionOutput targetDefinitionOutputModel if err := json.Unmarshal([]byte(out), &targetDefinitionOutput); err != nil { - return map[string]string{}, fmt.Errorf("failed to parse target definition output, error: %s", err) + return map[string]string{}, fmt.Errorf("failed to parse target definition output: %s", err) } if podfileParser.shouldRaiseReadDefinitionError(targetDefinitionOutput.Error) { - return map[string]string{}, fmt.Errorf("failed to read target defintion map, error: %s", targetDefinitionOutput.Error) + return map[string]string{}, fmt.Errorf("failed to read target definition map: %s", targetDefinitionOutput.Error) } return targetDefinitionOutput.Data, nil @@ -115,7 +114,7 @@ func (podfileParser podfileParser) shouldRaiseReadDefinitionError(err string) bo func (podfileParser podfileParser) getUserDefinedProjectRelavtivePath(cocoapodsVersion string) (string, error) { targetProjectMap, err := podfileParser.getTargetDefinitionProjectMap(cocoapodsVersion) if err != nil { - return "", fmt.Errorf("failed to get target definition map, error: %s", err) + return "", fmt.Errorf("failed to get target definition map: %s", err) } for target, project := range targetProjectMap { @@ -157,15 +156,14 @@ end ` absPodfilePth, err := filepath.Abs(podfileParser.podfilePth) if err != nil { - return "", fmt.Errorf("failed to expand path (%s), error: %s", podfileParser.podfilePth, err) + return "", fmt.Errorf("failed to expand path (%s): %s", podfileParser.podfilePth, err) } envs := []string{fmt.Sprintf("PODFILE_PATH=%s", absPodfilePth)} - podfileDir := filepath.Dir(absPodfilePth) - out, err := runRubyScriptForOutput(rubyScriptContent, gemfileContent, podfileDir, envs) + out, err := runRubyScriptForOutput(rubyScriptContent, gemfileContent, envs) if err != nil { - return "", fmt.Errorf("ruby script failed, error: %s", err) + return "", fmt.Errorf("ruby script failed: %s", err) } if out == "" { @@ -179,11 +177,11 @@ end var workspacePathOutput workspacePathOutputModel if err := json.Unmarshal([]byte(out), &workspacePathOutput); err != nil { - return "", fmt.Errorf("failed to parse workspace path output, error: %s", err) + return "", fmt.Errorf("failed to parse workspace path output: %s", err) } if podfileParser.shouldRaiseReadDefinitionError(workspacePathOutput.Error) { - return "", fmt.Errorf("failed to read workspace path, error: %s", workspacePathOutput.Error) + return "", fmt.Errorf("failed to read workspace path: %s", workspacePathOutput.Error) } return workspacePathOutput.Data, nil @@ -213,19 +211,19 @@ func (podfileParser podfileParser) GetWorkspaceProjectMap(projects []string) (ma projectRelPth, err := podfileParser.getUserDefinedProjectRelavtivePath(cocoapodsVersion) if err != nil { - return map[string]string{}, fmt.Errorf("failed to get user defined project path, error: %s", err) + return map[string]string{}, fmt.Errorf("failed to get user defined project path: %s", err) } if projectRelPth == "" { projects, err := pathutil.FilterPaths(projects, pathutil.InDirectoryFilter(podfileDir, true)) if err != nil { - return map[string]string{}, fmt.Errorf("failed to filter projects, error: %s", err) + return map[string]string{}, fmt.Errorf("failed to filter projects: %s", err) } if len(projects) == 0 { - return map[string]string{}, errors.New("failed to determin workspace - project mapping: no explicit project specified and no project found in the Podfile's directory") + return map[string]string{}, errors.New("failed to determine workspace - project mapping: no explicit project specified and no project found in the Podfile's directory") } else if len(projects) > 1 { - return map[string]string{}, errors.New("failed to determin workspace - project mapping: no explicit project specified and more than one project found in the Podfile's directory") + return map[string]string{}, errors.New("failed to determine workspace - project mapping: no explicit project specified and more than one project found in the Podfile's directory") } projectRelPth = filepath.Base(projects[0]) @@ -233,14 +231,14 @@ func (podfileParser podfileParser) GetWorkspaceProjectMap(projects []string) (ma projectPth := filepath.Join(podfileDir, projectRelPth) if exist, err := pathutil.IsPathExists(projectPth); err != nil { - return map[string]string{}, fmt.Errorf("failed to check if path (%s) exists, error: %s", projectPth, err) + return map[string]string{}, fmt.Errorf("failed to check if path (%s) exists: %s", projectPth, err) } else if !exist { return map[string]string{}, fmt.Errorf("project not found at: %s", projectPth) } workspaceRelPth, err := podfileParser.getUserDefinedWorkspaceRelativePath(cocoapodsVersion) if err != nil { - return map[string]string{}, fmt.Errorf("failed to get user defined workspace path, error: %s", err) + return map[string]string{}, fmt.Errorf("failed to get user defined workspace path: %s", err) } if workspaceRelPth == "" { @@ -286,7 +284,7 @@ func (podfileParser podfileParser) cocoapodsVersion(podfileLockPth string) (stri func (podfileParser podfileParser) fixPodfileQuotation(podfilePth string) error { podfileContent, err := fileutil.ReadStringFromFile(podfilePth) if err != nil { - return fmt.Errorf("failed to read podfile (%s), error: %s", podfilePth, err) + return fmt.Errorf("failed to read podfile (%s): %s", podfilePth, err) } podfileContent = strings.Replace(podfileContent, `‘`, `'`, -1) @@ -295,7 +293,7 @@ func (podfileParser podfileParser) fixPodfileQuotation(podfilePth string) error podfileContent = strings.Replace(podfileContent, `”`, `"`, -1) if err := fileutil.WriteStringToFile(podfilePth, podfileContent); err != nil { - return fmt.Errorf("failed to apply Podfile quotation fix, error: %s", err) + return fmt.Errorf("failed to apply Podfile quotation fix: %s", err) } return nil diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/rubyscript.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/rubyscript.go index 66ed83bb..ef584550 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/rubyscript.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/rubyscript.go @@ -13,7 +13,7 @@ import ( "github.com/bitrise-io/go-utils/pathutil" ) -func runRubyScriptForOutput(scriptContent, gemfileContent, inDir string, withEnvs []string) (string, error) { +func runRubyScriptForOutput(scriptContent, gemfileContent string, withEnvs []string) (string, error) { tmpDir, err := pathutil.NormalizedOSTempDirPath("__bitrise-init__") if err != nil { return "", err @@ -32,10 +32,7 @@ func runRubyScriptForOutput(scriptContent, gemfileContent, inDir string, withEnv } cmd := command.New("bundle", "install") - - if inDir != "" { - cmd.SetDir(inDir) - } + cmd.SetDir(tmpDir) withEnvs = append(withEnvs, "BUNDLE_GEMFILE="+gemfilePth) cmd.AppendEnvs(withEnvs...) @@ -62,9 +59,9 @@ func runRubyScriptForOutput(scriptContent, gemfileContent, inDir string, withEnv cmd = command.New("ruby", rubyScriptPth) } - if inDir != "" { - cmd.SetDir(inDir) - } + // Set the temp dir as working dir, so the project defined `.ruby-version` does not cause ruby resolution to fail: + // [ ... ] ruby script failed, error: rbenv: version `2.7.4' is not installed (set by /[ ... ]/MyTestApp/.ruby-version) + cmd.SetDir(tmpDir) if len(withEnvs) > 0 { cmd.AppendEnvs(withEnvs...) diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/utility.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/utility.go index fc6e5726..c95f5295 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/utility.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/utility.go @@ -87,6 +87,13 @@ const ( ConfigurationInputKey = "configuration" ) +const ( + // AutomaticCodeSigningInputKey ... + AutomaticCodeSigningInputKey = "automatic_code_signing" + // AutomaticCodeSigningInputAPIKeyValue ... + AutomaticCodeSigningInputAPIKeyValue = "api-key" +) + const ( // CarthageCommandInputKey ... CarthageCommandInputKey = "carthage_command" diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/const.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/const.go index 50aba05a..e7b705cf 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/const.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/const.go @@ -1,59 +1,41 @@ package reactnative -const deployWorkflowDescription = `## Configure Android part of the deploy workflow - -To generate a signed APK: - -1. Open the **Workflow** tab of your project on Bitrise.io -1. Add **Sign APK step right after Android Build step** -1. Click on **Code Signing** tab -1. Find the **ANDROID KEYSTORE FILE** section -1. Click or drop your file on the upload file field -1. Fill the displayed 3 input fields: -1. **Keystore password** -1. **Keystore alias** -1. **Private key password** -1. Click on **[Save metadata]** button - -That's it! From now on, **Sign APK** step will receive your uploaded files. - -## Configure iOS part of the deploy workflow - -To generate IPA: - -1. Open the **Workflow** tab of your project on Bitrise.io -1. Click on **Code Signing** tab -1. Find the **PROVISIONING PROFILE** section -1. Click or drop your file on the upload file field -1. Find the **CODE SIGNING IDENTITY** section -1. Click or drop your file on the upload file field -1. Click on **Workflows** tab -1. Select deploy workflow -1. Select **Xcode Archive & Export for iOS** step -1. Open **Force Build Settings** input group -1. Specify codesign settings -Set **Force code signing with Development Team**, **Force code signing with Code Signing Identity** -and **Force code signing with Provisioning Profile** inputs regarding to the uploaded codesigning files -1. Specify manual codesign style -If the codesigning files, are generated manually on the Apple Developer Portal, -you need to explicitly specify to use manual coedsign settings -(as ejected rn projects have xcode managed codesigning turned on). -To do so, add 'CODE_SIGN_STYLE="Manual"' to 'Additional options for xcodebuild call' input - -## To run this workflow - -If you want to run this workflow manually: - -1. Open the app's build list page -2. Click on **[Start/Schedule a Build]** button -3. Select **deploy** in **Workflow** dropdown input -4. Click **[Start Build]** button - -Or if you need this workflow to be started by a GIT event: - -1. Click on **Triggers** tab -2. Setup your desired event (push/tag/pull) and select **deploy** workflow -3. Click on **[Done]** and then **[Save]** buttons - -The next change in your repository that matches any of your trigger map event will start **deploy** workflow. +const ( + deployWorkflowDescription = `Tests, builds and deploys the app using *Deploy to bitrise.io* Step. + +Next steps: +- Set up an [Apple service with API key](https://devcenter.bitrise.io/en/accounts/connecting-to-services/connecting-to-an-apple-service-with-api-key.html). +- Check out [Getting started with React Native apps](https://devcenter.bitrise.io/en/getting-started/getting-started-with-react-native-apps.html). +` + + primaryWorkflowDescription = `Runs tests. + +Next steps: +- Check out [Getting started with React Native apps](https://devcenter.bitrise.io/en/getting-started/getting-started-with-react-native-apps.html). +` + + primaryWorkflowNoTestsDescription = `Installs dependencies. + +Next steps: +- Add tests to your project and configure the workflow to run them. +- Check out [Getting started with React Native apps](https://devcenter.bitrise.io/en/getting-started/getting-started-with-react-native-apps.html). +` + deployExpoWorkflowDescription = `Tests, builds and deploys the app. + +Next steps: +- Check out [Getting started with Expo apps](https://devcenter.bitrise.io/en/getting-started/getting-started-with-expo-apps.html). +` + + primaryExpoWorkflowDescription = `Runs tests. + +Next steps: +- Check out [Getting started with Expo apps](https://devcenter.bitrise.io/en/getting-started/getting-started-with-expo-apps.html). +` + + primaryExpoWorkflowNoTestsDescription = `Installs dependencies. + +Next steps: +- Add tests to your project and configure the workflow to run them. +- Check out [Getting started with Expo apps](https://devcenter.bitrise.io/en/getting-started/getting-started-with-expo-apps.html). ` +) diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/expo.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/expo.go index 7a2a813b..803059ae 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/expo.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/expo.go @@ -209,7 +209,7 @@ func (scanner *Scanner) expoOptions() (models.OptionNode, models.Warnings, error } // expoConfigs implements ScannerInterface.Configs function for Expo based React Native projects. -func (scanner *Scanner) expoConfigs() (models.BitriseConfigMap, error) { +func (scanner *Scanner) expoConfigs(isPrivateRepo bool) (models.BitriseConfigMap, error) { configMap := models.BitriseConfigMap{} // determine workdir @@ -224,11 +224,6 @@ func (scanner *Scanner) expoConfigs() (models.BitriseConfigMap, error) { } log.TPrintf("Working directory: %v", relPackageJSONDir) - workdirEnvList := []envmanModels.EnvironmentItemModel{} - if relPackageJSONDir != "" { - workdirEnvList = append(workdirEnvList, envmanModels.EnvironmentItemModel{workDirInputKey: relPackageJSONDir}) - } - xcodeArchiveStepListItem := steps.XcodeArchiveStepListItem( envmanModels.EnvironmentItemModel{ios.ProjectPathInputKey: "$" + ios.ProjectPathInputEnvKey}, envmanModels.EnvironmentItemModel{ios.SchemeInputKey: "$" + ios.SchemeInputEnvKey}, @@ -244,86 +239,26 @@ func (scanner *Scanner) expoConfigs() (models.BitriseConfigMap, error) { "DEVELOPMENT_TEAM = $BITRISE_IOS_DEVELOPMENT_TEAM"}, ) - if !scanner.hasTest { - // if the project has no test script defined, - // we can only provide deploy like workflow, - // so that is going to be the primary workflow - - configBuilder := models.NewDefaultConfigBuilder() - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(false)...) - - if scanner.hasYarnLockFile { - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.YarnStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "install"})...)) - } else { - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.NpmStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "install"})...)) - } - - projectDir := relPackageJSONDir - if relPackageJSONDir == "" { - projectDir = "./" - } - - if !scanner.expoSettings.isAllIdentifierPresent() { - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.ScriptSteplistItem(expoBareAddIdentiferScriptTitle, - envmanModels.EnvironmentItemModel{"content": expoBareAddIdentifiersScript(filepath.Join(projectDir, expoAppJSONName), androidPackageEnvKey, iosBundleIDEnvKey)}, - )) - } - - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.ExpoDetachStepListItem( - envmanModels.EnvironmentItemModel{"project_path": projectDir}, - )) - - // android build - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.InstallMissingAndroidToolsStepListItem( - envmanModels.EnvironmentItemModel{android.GradlewPathInputKey: "$" + android.ProjectLocationInputEnvKey + "/gradlew"}, - )) - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.AndroidBuildStepListItem( - envmanModels.EnvironmentItemModel{android.ProjectLocationInputKey: "$" + android.ProjectLocationInputEnvKey}, - envmanModels.EnvironmentItemModel{android.ModuleInputKey: "$" + android.ModuleInputEnvKey}, - envmanModels.EnvironmentItemModel{android.VariantInputKey: "$" + android.VariantInputEnvKey}, - )) - - // ios build - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.CertificateAndProfileInstallerStepListItem()) - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, xcodeArchiveStepListItem) - - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultDeployStepList(false)...) - configBuilder.SetWorkflowDescriptionTo(models.PrimaryWorkflowID, deployWorkflowDescription) - - bitriseDataModel, err := configBuilder.Generate(scannerName) - if err != nil { - return models.BitriseConfigMap{}, err - } - - data, err := yaml.Marshal(bitriseDataModel) - if err != nil { - return models.BitriseConfigMap{}, err - } - - configMap[expoConfigName] = string(data) - - return configMap, nil - } - // primary workflow configBuilder := models.NewDefaultConfigBuilder() - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(false)...) - if scanner.hasYarnLockFile { - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.YarnStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "install"})...)) - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.YarnStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "test"})...)) - } else { - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.NpmStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "install"})...)) - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.NpmStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "test"})...)) + primaryDescription := primaryExpoWorkflowNoTestsDescription + if scanner.hasTest { + primaryDescription = primaryExpoWorkflowDescription } - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultDeployStepList(false)...) + + configBuilder.SetWorkflowDescriptionTo(models.PrimaryWorkflowID, primaryDescription) + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepListV2(steps.PrepareListParams{ + ShouldIncludeCache: false, + ShouldIncludeActivateSSH: isPrivateRepo, + })...) + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, scanner.getTestSteps(relPackageJSONDir)...) + + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultDeployStepListV2(false)...) // deploy workflow + configBuilder.SetWorkflowDescriptionTo(models.DeployWorkflowID, deployExpoWorkflowDescription) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultPrepareStepList(false)...) - if scanner.hasYarnLockFile { - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.YarnStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "install"})...)) - } else { - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.NpmStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "install"})...)) - } + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, scanner.getTestSteps(relPackageJSONDir)...) projectDir := relPackageJSONDir if relPackageJSONDir == "" { @@ -355,7 +290,6 @@ func (scanner *Scanner) expoConfigs() (models.BitriseConfigMap, error) { configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, xcodeArchiveStepListItem) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultDeployStepList(false)...) - configBuilder.SetWorkflowDescriptionTo(models.DeployWorkflowID, deployWorkflowDescription) bitriseDataModel, err := configBuilder.Generate(scannerName) if err != nil { @@ -420,13 +354,17 @@ func (Scanner) expoDefaultConfigs() (models.BitriseConfigMap, error) { // primary workflow configBuilder := models.NewDefaultConfigBuilder() - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(false)...) + configBuilder.SetWorkflowDescriptionTo(models.PrimaryWorkflowID, primaryExpoWorkflowDescription) + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepListV2(steps.PrepareListParams{ + ShouldIncludeCache: false, + ShouldIncludeActivateSSH: true, + })...) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.YarnStepListItem(envmanModels.EnvironmentItemModel{workDirInputKey: "$WORKDIR"}, envmanModels.EnvironmentItemModel{"command": "install"})) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.YarnStepListItem(envmanModels.EnvironmentItemModel{workDirInputKey: "$WORKDIR"}, envmanModels.EnvironmentItemModel{"command": "test"})) - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultDeployStepList(false)...) + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultDeployStepListV2(false)...) // deploy workflow - configBuilder.SetWorkflowDescriptionTo(models.DeployWorkflowID, deployWorkflowDescription) + configBuilder.SetWorkflowDescriptionTo(models.DeployWorkflowID, deployExpoWorkflowDescription) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultPrepareStepList(false)...) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.YarnStepListItem(envmanModels.EnvironmentItemModel{workDirInputKey: "$WORKDIR"}, envmanModels.EnvironmentItemModel{"command": "install"})) diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/plain.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/plain.go index ea0ffb21..c7e46a08 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/plain.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/plain.go @@ -10,6 +10,7 @@ import ( "github.com/bitrise-io/bitrise-init/scanners/ios" "github.com/bitrise-io/bitrise-init/steps" "github.com/bitrise-io/bitrise-init/utility" + bitriseModels "github.com/bitrise-io/bitrise/models" envmanModels "github.com/bitrise-io/envman/models" "github.com/bitrise-io/go-utils/pathutil" "gopkg.in/yaml.v2" @@ -158,7 +159,7 @@ func (scanner *Scanner) defaultOptions() models.OptionNode { } // configs implements ScannerInterface.Configs function for plain React Native projects. -func (scanner *Scanner) configs() (models.BitriseConfigMap, error) { +func (scanner *Scanner) configs(isPrivateRepo bool) (models.BitriseConfigMap, error) { configMap := models.BitriseConfigMap{} packageJSONDir := filepath.Dir(scanner.packageJSONPth) @@ -171,91 +172,71 @@ func (scanner *Scanner) configs() (models.BitriseConfigMap, error) { relPackageJSONDir = "" } - workdirEnvList := []envmanModels.EnvironmentItemModel{} - if relPackageJSONDir != "" { - workdirEnvList = append(workdirEnvList, envmanModels.EnvironmentItemModel{workDirInputKey: relPackageJSONDir}) - } + configBuilder := models.NewDefaultConfigBuilder() + // ci + primaryDescription := primaryWorkflowNoTestsDescription if scanner.hasTest { - configBuilder := models.NewDefaultConfigBuilder() - - // ci - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(false)...) - if scanner.hasYarnLockFile { - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.YarnStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "install"})...)) - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.YarnStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "test"})...)) - } else { - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.NpmStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "install"})...)) - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.NpmStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "test"})...)) - } - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultDeployStepList(false)...) - - // cd - configBuilder.SetWorkflowDescriptionTo(models.DeployWorkflowID, deployWorkflowDescription) - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultPrepareStepList(false)...) - if scanner.hasYarnLockFile { - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.YarnStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "install"})...)) - } else { - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.NpmStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "install"})...)) - } - - // android cd - if scanner.androidScanner != nil { - projectLocationEnv := "$" + android.ProjectLocationInputEnvKey - - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.InstallMissingAndroidToolsStepListItem( - envmanModels.EnvironmentItemModel{android.GradlewPathInputKey: "$" + android.ProjectLocationInputEnvKey + "/gradlew"}, - )) - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.AndroidBuildStepListItem( - envmanModels.EnvironmentItemModel{android.ProjectLocationInputKey: projectLocationEnv}, - )) - } - - // ios cd - if scanner.iosScanner != nil { - for _, descriptor := range scanner.iosScanner.ConfigDescriptors { - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.CertificateAndProfileInstallerStepListItem()) + primaryDescription = primaryWorkflowDescription + } - if descriptor.MissingSharedSchemes { - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.RecreateUserSchemesStepListItem( - envmanModels.EnvironmentItemModel{ios.ProjectPathInputKey: "$" + ios.ProjectPathInputEnvKey}, - )) - } + configBuilder.SetWorkflowDescriptionTo(models.PrimaryWorkflowID, primaryDescription) + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepListV2(steps.PrepareListParams{ + ShouldIncludeCache: false, + ShouldIncludeActivateSSH: isPrivateRepo, + })...) + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, scanner.getTestSteps(relPackageJSONDir)...) - if descriptor.HasPodfile { - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.CocoapodsInstallStepListItem()) - } + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultDeployStepListV2(false)...) - if descriptor.CarthageCommand != "" { - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.CarthageStepListItem( - envmanModels.EnvironmentItemModel{ios.CarthageCommandInputKey: descriptor.CarthageCommand}, - )) - } + // cd + configBuilder.SetWorkflowDescriptionTo(models.DeployWorkflowID, deployWorkflowDescription) + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultPrepareStepListV2(steps.PrepareListParams{ + ShouldIncludeCache: false, + ShouldIncludeActivateSSH: isPrivateRepo, + })...) + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, scanner.getTestSteps(relPackageJSONDir)...) + + // android cd + if scanner.androidScanner != nil { + projectLocationEnv := "$" + android.ProjectLocationInputEnvKey + + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.InstallMissingAndroidToolsStepListItem( + envmanModels.EnvironmentItemModel{android.GradlewPathInputKey: "$" + android.ProjectLocationInputEnvKey + "/gradlew"}, + )) + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.AndroidBuildStepListItem( + envmanModels.EnvironmentItemModel{android.ProjectLocationInputKey: projectLocationEnv}, + )) + } - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.XcodeArchiveStepListItem( + // ios cd + if scanner.iosScanner != nil { + for _, descriptor := range scanner.iosScanner.ConfigDescriptors { + if descriptor.MissingSharedSchemes { + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.RecreateUserSchemesStepListItem( envmanModels.EnvironmentItemModel{ios.ProjectPathInputKey: "$" + ios.ProjectPathInputEnvKey}, - envmanModels.EnvironmentItemModel{ios.SchemeInputKey: "$" + ios.SchemeInputEnvKey}, - envmanModels.EnvironmentItemModel{ios.DistributionMethodInputKey: "$" + ios.DistributionMethodEnvKey}, - envmanModels.EnvironmentItemModel{ios.ConfigurationInputKey: "Release"}, )) + } - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultDeployStepList(false)...) + if descriptor.HasPodfile { + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.CocoapodsInstallStepListItem()) + } - bitriseDataModel, err := configBuilder.Generate(scannerName) - if err != nil { - return models.BitriseConfigMap{}, err - } + if descriptor.CarthageCommand != "" { + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.CarthageStepListItem( + envmanModels.EnvironmentItemModel{ios.CarthageCommandInputKey: descriptor.CarthageCommand}, + )) + } - data, err := yaml.Marshal(bitriseDataModel) - if err != nil { - return models.BitriseConfigMap{}, err - } + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.XcodeArchiveStepListItem( + envmanModels.EnvironmentItemModel{ios.ProjectPathInputKey: "$" + ios.ProjectPathInputEnvKey}, + envmanModels.EnvironmentItemModel{ios.SchemeInputKey: "$" + ios.SchemeInputEnvKey}, + envmanModels.EnvironmentItemModel{ios.DistributionMethodInputKey: "$" + ios.DistributionMethodEnvKey}, + envmanModels.EnvironmentItemModel{ios.ConfigurationInputKey: "Release"}, + envmanModels.EnvironmentItemModel{ios.AutomaticCodeSigningInputKey: ios.AutomaticCodeSigningInputAPIKeyValue}, + )) - configName := configName(scanner.androidScanner != nil, true, true) - configMap[configName] = string(data) - } - } else { - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultDeployStepList(false)...) + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultDeployStepListV2(false)...) bitriseDataModel, err := configBuilder.Generate(scannerName) if err != nil { @@ -267,85 +248,24 @@ func (scanner *Scanner) configs() (models.BitriseConfigMap, error) { return models.BitriseConfigMap{}, err } - configName := configName(scanner.androidScanner != nil, false, true) + configName := configName(scanner.androidScanner != nil, true, scanner.hasTest) configMap[configName] = string(data) } } else { - configBuilder := models.NewDefaultConfigBuilder() - configBuilder.SetWorkflowDescriptionTo(models.DeployWorkflowID, deployWorkflowDescription) - - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(false)...) - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.NpmStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "install"})...)) - - if scanner.androidScanner != nil { - projectLocationEnv := "$" + android.ProjectLocationInputEnvKey + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultDeployStepListV2(false)...) - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.InstallMissingAndroidToolsStepListItem( - envmanModels.EnvironmentItemModel{android.GradlewPathInputKey: "$" + android.ProjectLocationInputEnvKey + "/gradlew"}, - )) - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.AndroidBuildStepListItem( - envmanModels.EnvironmentItemModel{android.ProjectLocationInputKey: projectLocationEnv}, - )) + bitriseDataModel, err := configBuilder.Generate(scannerName) + if err != nil { + return models.BitriseConfigMap{}, err } - if scanner.iosScanner != nil { - for _, descriptor := range scanner.iosScanner.ConfigDescriptors { - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.CertificateAndProfileInstallerStepListItem()) - - if descriptor.MissingSharedSchemes { - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.RecreateUserSchemesStepListItem( - envmanModels.EnvironmentItemModel{ios.ProjectPathInputKey: "$" + ios.ProjectPathInputEnvKey}, - )) - } - - if descriptor.HasPodfile { - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.CocoapodsInstallStepListItem()) - } - - if descriptor.CarthageCommand != "" { - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.CarthageStepListItem( - envmanModels.EnvironmentItemModel{ios.CarthageCommandInputKey: descriptor.CarthageCommand}, - )) - } - - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.XcodeArchiveStepListItem( - envmanModels.EnvironmentItemModel{ios.ProjectPathInputKey: "$" + ios.ProjectPathInputEnvKey}, - envmanModels.EnvironmentItemModel{ios.SchemeInputKey: "$" + ios.SchemeInputEnvKey}, - envmanModels.EnvironmentItemModel{ios.DistributionMethodInputKey: "$" + ios.DistributionMethodEnvKey}, - envmanModels.EnvironmentItemModel{ios.ConfigurationInputKey: "Release"}, - )) - - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultDeployStepList(false)...) - - bitriseDataModel, err := configBuilder.Generate(scannerName) - if err != nil { - return models.BitriseConfigMap{}, err - } - - data, err := yaml.Marshal(bitriseDataModel) - if err != nil { - return models.BitriseConfigMap{}, err - } - - configName := configName(scanner.androidScanner != nil, true, false) - configMap[configName] = string(data) - } - } else { - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultDeployStepList(false)...) - - bitriseDataModel, err := configBuilder.Generate(scannerName) - if err != nil { - return models.BitriseConfigMap{}, err - } - - data, err := yaml.Marshal(bitriseDataModel) - if err != nil { - return models.BitriseConfigMap{}, err - } - - configName := configName(scanner.androidScanner != nil, false, false) - configMap[configName] = string(data) + data, err := yaml.Marshal(bitriseDataModel) + if err != nil { + return models.BitriseConfigMap{}, err } + + configName := configName(scanner.androidScanner != nil, false, scanner.hasTest) + configMap[configName] = string(data) } return configMap, nil @@ -355,16 +275,25 @@ func (scanner *Scanner) configs() (models.BitriseConfigMap, error) { func (scanner *Scanner) defaultConfigs() (models.BitriseConfigMap, error) { configBuilder := models.NewDefaultConfigBuilder() - // ci - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(false)...) - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.NpmStepListItem(envmanModels.EnvironmentItemModel{"command": "install"})) - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.NpmStepListItem(envmanModels.EnvironmentItemModel{"command": "test"})) - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultDeployStepList(false)...) - - // cd + // primary + configBuilder.SetWorkflowDescriptionTo(models.PrimaryWorkflowID, primaryWorkflowDescription) + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepListV2(steps.PrepareListParams{ + ShouldIncludeCache: false, + ShouldIncludeActivateSSH: true, + })...) + // Assuming project uses yarn and has tests + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.YarnStepListItem(envmanModels.EnvironmentItemModel{"command": "install"})) + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.YarnStepListItem(envmanModels.EnvironmentItemModel{"command": "test"})) + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultDeployStepListV2(false)...) + + // deploy configBuilder.SetWorkflowDescriptionTo(models.DeployWorkflowID, deployWorkflowDescription) - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultPrepareStepList(false)...) - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.NpmStepListItem(envmanModels.EnvironmentItemModel{"command": "install"})) + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultPrepareStepListV2(steps.PrepareListParams{ + ShouldIncludeCache: false, + ShouldIncludeActivateSSH: true, + })...) + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.YarnStepListItem(envmanModels.EnvironmentItemModel{"command": "install"})) + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.YarnStepListItem(envmanModels.EnvironmentItemModel{"command": "test"})) // android projectLocationEnv := "$" + android.ProjectLocationInputEnvKey @@ -377,15 +306,15 @@ func (scanner *Scanner) defaultConfigs() (models.BitriseConfigMap, error) { )) // ios - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.CertificateAndProfileInstallerStepListItem()) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.XcodeArchiveStepListItem( envmanModels.EnvironmentItemModel{ios.ProjectPathInputKey: "$" + ios.ProjectPathInputEnvKey}, envmanModels.EnvironmentItemModel{ios.SchemeInputKey: "$" + ios.SchemeInputEnvKey}, envmanModels.EnvironmentItemModel{ios.DistributionMethodInputKey: "$" + ios.DistributionMethodEnvKey}, envmanModels.EnvironmentItemModel{ios.ConfigurationInputKey: "Release"}, + envmanModels.EnvironmentItemModel{ios.AutomaticCodeSigningInputKey: ios.AutomaticCodeSigningInputAPIKeyValue}, )) - configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultDeployStepList(false)...) + configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultDeployStepListV2(false)...) bitriseDataModel, err := configBuilder.Generate(scannerName) if err != nil { @@ -404,3 +333,28 @@ func (scanner *Scanner) defaultConfigs() (models.BitriseConfigMap, error) { return configMap, nil } + +func (scanner *Scanner) getTestSteps(workDir string) []bitriseModels.StepListItemModel { + var ( + testSteps = []bitriseModels.StepListItemModel{} + workdirEnvList = []envmanModels.EnvironmentItemModel{} + ) + + if workDir != "" { + workdirEnvList = append(workdirEnvList, envmanModels.EnvironmentItemModel{workDirInputKey: workDir}) + } + + if scanner.hasYarnLockFile { + testSteps = append(testSteps, steps.YarnStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "install"})...)) + if scanner.hasTest { + testSteps = append(testSteps, steps.YarnStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "test"})...)) + } + } else { + testSteps = append(testSteps, steps.NpmStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "install"})...)) + if scanner.hasTest { + testSteps = append(testSteps, steps.NpmStepListItem(append(workdirEnvList, envmanModels.EnvironmentItemModel{"command": "test"})...)) + } + } + + return testSteps +} diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/reactnative.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/reactnative.go index 9fcde024..270388c0 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/reactnative.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/reactnative.go @@ -258,15 +258,17 @@ func (scanner *Scanner) Options() (options models.OptionNode, warnings models.Wa } else { options, warnings, err = scanner.options() } + return } // Configs implements ScannerInterface.Configs function. -func (scanner *Scanner) Configs(_ bool) (models.BitriseConfigMap, error) { +func (scanner *Scanner) Configs(isPrivateRepo bool) (models.BitriseConfigMap, error) { if scanner.expoSettings != nil { - return scanner.expoConfigs() + return scanner.expoConfigs(isPrivateRepo) } - return scanner.configs() + + return scanner.configs(isPrivateRepo) } // DefaultOptions implements ScannerInterface.DefaultOptions function. diff --git a/vendor/modules.txt b/vendor/modules.txt index 5ccc2129..85c325e4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -3,7 +3,7 @@ github.com/beevik/etree # github.com/bitrise-io/bitrise v0.0.0-20210623145422-513e39485248 ## explicit github.com/bitrise-io/bitrise/models -# github.com/bitrise-io/bitrise-init v0.0.0-20220201222253-de20a87cb89e +# github.com/bitrise-io/bitrise-init v0.0.0-20220207155038-1a335925b04e ## explicit github.com/bitrise-io/bitrise-init/analytics github.com/bitrise-io/bitrise-init/errormapper