Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change BuildVersion to int64 allowing larger build numbers #37

Merged
merged 3 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions step/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ type Input struct {
Scheme string `env:"scheme,required"`
Target string `env:"target"`
Configuration string `env:"configuration"`
BuildVersion int `env:"build_version,required"`
BuildVersionOffset int `env:"build_version_offset"`
BuildVersion int64 `env:"build_version,required"`
BuildVersionOffset int64 `env:"build_version_offset"`
BuildShortVersionString string `env:"build_short_version_string"`
}

Expand All @@ -15,11 +15,11 @@ type Config struct {
Scheme string
Target string
Configuration string
BuildVersion int
BuildVersionOffset int
BuildVersion int64
BuildVersionOffset int64
BuildShortVersionString string
}

type Result struct {
BuildVersion int
BuildVersion int64
}
8 changes: 4 additions & 4 deletions step/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (u Updater) Run(config Config) (Result, error) {
}

func (u Updater) Export(result Result) error {
return u.exporter.ExportOutput("XCODE_BUNDLE_VERSION", strconv.Itoa(result.BuildVersion))
return u.exporter.ExportOutput("XCODE_BUNDLE_VERSION", strconv.FormatInt(result.BuildVersion, 10))
}

func generatesInfoPlist(helper *projectmanager.ProjectHelper, targetName, configuration string) (bool, error) {
Expand All @@ -93,7 +93,7 @@ func generatesInfoPlist(helper *projectmanager.ProjectHelper, targetName, config
return generatesInfoPlist, err
}

func updateVersionNumbersInProject(helper *projectmanager.ProjectHelper, targetName, configuration string, bundleVersion int, shortVersion string) error {
func updateVersionNumbersInProject(helper *projectmanager.ProjectHelper, targetName, configuration string, bundleVersion int64, shortVersion string) error {
if targetName == "" {
targetName = helper.MainTarget.Name
}
Expand Down Expand Up @@ -124,7 +124,7 @@ func updateVersionNumbersInProject(helper *projectmanager.ProjectHelper, targetN
return nil
}

func updateVersionNumbersInInfoPlist(helper *projectmanager.ProjectHelper, targetName, configuration string, bundleVersion int, shortVersion string) error {
func updateVersionNumbersInInfoPlist(helper *projectmanager.ProjectHelper, targetName, configuration string, bundleVersion int64, shortVersion string) error {
buildConfig, err := buildConfiguration(helper, targetName, configuration)
if err != nil {
return err
Expand All @@ -138,7 +138,7 @@ func updateVersionNumbersInInfoPlist(helper *projectmanager.ProjectHelper, targe
absoluteInfoPlistPath := filepath.Join(filepath.Dir(helper.XcProj.Path), infoPlistPath)

infoPlist, format, _ := xcodeproj.ReadPlistFile(absoluteInfoPlistPath)
infoPlist["CFBundleVersion"] = strconv.Itoa(bundleVersion)
infoPlist["CFBundleVersion"] = strconv.FormatInt(bundleVersion, 10)

if shortVersion != "" {
infoPlist["CFBundleShortVersionString"] = shortVersion
Expand Down
2 changes: 1 addition & 1 deletion step/step_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestExport(t *testing.T) {
result := Result{BuildVersion: 999}

mockFactory := mocks.NewFactory(t)
arguments := []string{"add", "--key", "XCODE_BUNDLE_VERSION", "--value", strconv.Itoa(result.BuildVersion)}
arguments := []string{"add", "--key", "XCODE_BUNDLE_VERSION", "--value", strconv.FormatInt(result.BuildVersion, 10)}
mockFactory.On("Create", "envman", arguments, (*command.Opts)(nil)).Return(testCommand())

inputParser := stepconf.NewInputParser(env.NewRepository())
Expand Down