Skip to content

feat(android_sdk_repository): support string-based platform API level#473

Open
larryxiao625 wants to merge 1 commit intobazelbuild:mainfrom
larryxiao625:feat/support_string_based_platform_api_levels
Open

feat(android_sdk_repository): support string-based platform API level#473
larryxiao625 wants to merge 1 commit intobazelbuild:mainfrom
larryxiao625:feat/support_string_based_platform_api_levels

Conversation

@larryxiao625
Copy link
Copy Markdown

Previously, API levels were handled as integers, which prevented support for minor version formats like "36.1". This change migrates the entire android_sdk_repository rule to treat API levels as strings throughout. This is intend to fix #472

Changes:

  • Rename int_flag/_int_flag_impl to string_flag/_string_flag_impl in helper.bzl; update config type and formatting from int to string
  • Update _read_api_levels in rule.bzl to use is_android_revision and store levels as strings; update default API level selection to parse and compare major.minor.micro components
  • Update all name/path/log formatting from %d to %s for api_level
  • Pass default_api_level as string in template.bzl
  • Add test_platforms_with_minor_versions test to verify "36.1" style API levels are correctly recognized and logged

…s (e.g., "36.1")

Previously, API levels were handled as integers, which prevented support
for minor version formats like "36.1". This change migrates the entire
android_sdk_repository rule to treat API levels as strings throughout.

Changes:
- Rename `int_flag`/`_int_flag_impl` to `string_flag`/`_string_flag_impl`
  in helper.bzl; update config type and formatting from int to string
- Update `_read_api_levels` in rule.bzl to use `is_android_revision` and
  store levels as strings; update default API level selection to parse and
  compare major.minor.micro components
- Update all name/path/log formatting from `%d` to `%s` for api_level
- Pass `default_api_level` as string in template.bzl
- Add `test_platforms_with_minor_versions` test to verify "36.1" style
  API levels are correctly recognized and logged
level.minor,
level.micro,
)).version
if repo_ctx.attr.api_level:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So leaving api_level as an int means that you can't select the minor/micro version, and maybe need to take care with 36 vs 36.0 vs 36.0.0. But changing that would be a change to the api of android_sdk_repository, where likely we'd need to keep the int version for backwards compatibility and add another string attribute for major/minor/micro, maybe api_level_full (perhaps even api_level_mmm for major/minor/micro). We can import this PR without this though and add later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

android_sdk_repository: Support string-based platform API levels (e.g., "36.1")

2 participants