Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Commit 6284fc7

Browse files
committed
[skip ci] Bump build code
1 parent d3fca81 commit 6284fc7

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

fastlane/Fastfile

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ VERSION_FILE = Fastlane::Wpmreleasetoolkit::Versioning::AndroidVersionFile.new(v
1919

2020
VERSION_CALCULATOR = Fastlane::Wpmreleasetoolkit::Versioning::SemanticVersionCalculator.new
2121
VERSION_FORMATTER = Fastlane::Wpmreleasetoolkit::Versioning::RCNotationVersionFormatter.new
22-
BUILD_CODE_CALCULATOR = Fastlane::Wpmreleasetoolkit::Versioning::SimpleBuildCodeCalculator.new
23-
BUILD_CODE_FORMATTER = Fastlane::Wpmreleasetoolkit::Versioning::SimpleBuildCodeFormatter.new
22+
# Using DerivedBuildCodeFormatter to derive build codes from version name (format: 1XXYYZZNNN)
23+
# This eliminates the need for manual build code incrementing and provides deterministic versioning
24+
BUILD_CODE_FORMATTER = Fastlane::Wpmreleasetoolkit::Versioning::DerivedBuildCodeFormatter.new
2425

2526
PROTOTYPE_BUILD_DOMAIN = 'https://cdn.a8c-ci.services'
2627
RELEASE_BUILD_TYPE = 'Release'
@@ -211,7 +212,7 @@ end
211212
# Versioning utils
212213
#####################################################################################
213214

214-
# Updates the build code in version.properties to the next build code and commits the change
215+
# Updates the build code in version.properties by incrementing the build number and deriving the new build code
215216
#
216217
def bump_build_code
217218
VERSION_FILE.write_version(
@@ -260,19 +261,25 @@ def release_version_next
260261
VERSION_FORMATTER.release_version(release_version_next)
261262
end
262263

263-
# Returns the current build code of the app
264+
# Returns the current build code of the app derived from the current version
264265
#
265266
def build_code_current
266-
build_code_current = VERSION_FILE.read_version_code
267-
BUILD_CODE_FORMATTER.build_code(build_code: build_code_current)
267+
current_version = VERSION_FORMATTER.parse(version_name_current)
268+
BUILD_CODE_FORMATTER.build_code(version: current_version)
268269
end
269270

270-
# Returns the next build code of the app
271+
# Returns the next build code of the app derived from the current version with incremented build number
271272
#
272273
def build_code_next
273-
build_code_current = VERSION_FILE.read_version_code
274-
build_code_next = BUILD_CODE_CALCULATOR.next_build_code(build_code: build_code_current)
275-
BUILD_CODE_FORMATTER.build_code(build_code: build_code_next)
274+
current_version = VERSION_FORMATTER.parse(version_name_current)
275+
# Create a new version with incremented build number
276+
next_version = Fastlane::Models::AppVersion.new(
277+
current_version.major,
278+
current_version.minor,
279+
current_version.patch,
280+
current_version.build_number + 1
281+
)
282+
BUILD_CODE_FORMATTER.build_code(version: next_version)
276283
end
277284

278285
# Generates a build number for the prototype build

version.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
versionName=0.1
2-
versionCode=7
1+
versionName=0.2
2+
versionCode=100020001

0 commit comments

Comments
 (0)