Skip to content

Commit

Permalink
Ensure consistent configuration and output directory (#7)
Browse files Browse the repository at this point in the history
If an app (`ios_application`) depends on a library (`apple_framework`), when building the app and the library separately, the libraries will be built twice into different directories. This is because of transition which causes different configurations. A thorough discussion can be found here.

This change ensures when building the app and the library, they will have same transition, thus they will have the same configuration and same output directory.

We can verify this by running `bazel cquery //ios/foundations/StringFoundation:StringFoundation --universe_scope=//ios/foundations/StringFoundation:StringFoundation,//ios:AirbnbApp` to make sure only one configuration is showing up.

This change requires to have `--experimental_output_directory_naming_scheme=diff_against_baseline` flag set.
  • Loading branch information
qyang-nj authored Mar 28, 2024
1 parent e3903e9 commit f85c820
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rules/transition_support.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _apple_rule_transition_impl(settings, attr):
ret = {
"//command_line_option:apple configuration distinguisher": "applebin_" + platform_type,
"//command_line_option:apple_platform_type": platform_type,
"//command_line_option:apple_split_cpu": settings["//command_line_option:apple_split_cpu"],
"//command_line_option:apple_split_cpu": ios_multi_cpus,
"//command_line_option:compiler": settings["//command_line_option:apple_compiler"] if _supports_clo_apple_compiler else None,
"//command_line_option:cpu": cpu_string,
"//command_line_option:crosstool_top": (
Expand All @@ -118,6 +118,7 @@ def _apple_rule_transition_impl(settings, attr):
"//command_line_option:macos_minimum_os": _min_os_version_or_none(attr, attr_platforms, "macos", platform_type),
"//command_line_option:tvos_minimum_os": _min_os_version_or_none(attr, attr_platforms, "tvos", platform_type),
"//command_line_option:watchos_minimum_os": _min_os_version_or_none(attr, attr_platforms, "watchos", platform_type),
"//command_line_option:minimum_os_version": _min_os_version_or_none(attr, attr_platforms, "ios", platform_type),
}
return ret

Expand Down Expand Up @@ -169,6 +170,7 @@ _apple_rule_transition = transition(
"//command_line_option:macos_minimum_os",
"//command_line_option:tvos_minimum_os",
"//command_line_option:watchos_minimum_os",
"//command_line_option:minimum_os_version",
],
)

Expand Down

0 comments on commit f85c820

Please sign in to comment.