Skip to content

[Tooling] Fix Wear App Universal .apk download #11786

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

Merged
merged 3 commits into from
Jun 25, 2024
Merged
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
7 changes: 6 additions & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -1130,11 +1130,16 @@ platform :android do
# bundle exec fastlane create_gh_release app:WEAR_APP version:1.0.0 prerelease:true
#
private_lane :create_gh_release do |app:, version:, prerelease: false|
validate_app_param!(app)

universal_apk_path = File.join(PROJECT_ROOT_FOLDER, 'artifacts', universal_apk_name(app, version))

# We have a convention that the Wear app's version code is offset by 50000 from the Mobile app's one
# See https://github.com/woocommerce/woocommerce-android/blob/11ae376f2922e4b2eac3f87971b8c2246e56b37b/WooCommerce-Wear/build.gradle#L29
version_code_offset = { MOBILE_APP: 0, WEAR_APP: 50_000 }.fetch(app, 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this ended up not working, because the { key1: value1 } syntax makes a hash whose key is the symbol :key1

So here our hash ends up having the literal keys :MOBILE_APP and :WEAR_APP instead of interpreting those as constant names representing strings.

The fix for this will be:

Suggested change
version_code_offset = { MOBILE_APP: 0, WEAR_APP: 50_000 }.fetch(app, 0)
version_code_offset = { MOBILE_APP => 0, WEAR_APP => 50_000 }.fetch(app, 0)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix for this in #11854

download_universal_apk_from_google_play(
package_name: APP_PACKAGE_NAME,
version_code: build_code_current,
version_code: build_code_current.to_i + version_code_offset,
destination: universal_apk_path,
json_key: UPLOAD_TO_PLAY_STORE_JSON_KEY
)
Expand Down
Loading