diff --git a/MODULE.bazel b/MODULE.bazel index f6ef89d7a..8130affdb 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -10,13 +10,13 @@ bazel_dep(name = "bazel_features", version = "1.3.0") bazel_dep(name = "bazel_skylib", version = "1.3.0") bazel_dep( name = "rules_swift", - version = "1.6.0", + version = "1.18.0", max_compatibility_level = 2, repo_name = "build_bazel_rules_swift", ) bazel_dep( name = "rules_apple", - version = "2.0.0", + version = "3.6.0", repo_name = "build_bazel_rules_apple", ) bazel_dep(name = "rules_python", version = "0.27.1") diff --git a/xcodeproj/internal/incremental_xcodeprojinfos.bzl b/xcodeproj/internal/incremental_xcodeprojinfos.bzl index 14149350b..a6c6b5d90 100644 --- a/xcodeproj/internal/incremental_xcodeprojinfos.bzl +++ b/xcodeproj/internal/incremental_xcodeprojinfos.bzl @@ -258,6 +258,7 @@ def _target_info_fields( def _make_skipped_target_xcodeprojinfo( *, + ctx, automatic_target_info, rule_attr, skip_type, @@ -269,6 +270,7 @@ def _make_skipped_target_xcodeprojinfo( forwards them on, not collecting any information for the current target. Args: + ctx: The aspect context. automatic_target_info: The `XcodeProjAutomaticTargetProcessingInfo` for `the target. rule_attr: `ctx.rule.attr`. @@ -360,6 +362,22 @@ def _make_skipped_target_xcodeprojinfo( ], ) + if automatic_target_info.env: + direct_envs = [] + for info in deps_transitive_infos: + if not info.xcode_target: + continue + + info_env = getattr(rule_attr, automatic_target_info.env, {}) + info_env = { + k: ctx.expand_make_variables("env", v, {}) + for k, v in info_env.items() + } + env = dicts.add(info_env, test_env) + direct_envs.append(struct(id = info.xcode_target.id, env = tuple([(k, v) for k, v in env.items()]))) + else: + direct_envs = None + return _target_info_fields( args = memory_efficient_depset( [ @@ -380,24 +398,7 @@ def _make_skipped_target_xcodeprojinfo( compilation_providers = provider_compilation_providers, direct_dependencies = direct_dependencies, envs = memory_efficient_depset( - [ - struct( - id = info.xcode_target.id, - env = tuple([ - (k, v) - for k, v in dicts.add( - getattr( - rule_attr, - automatic_target_info.env, - {}, - ), - test_env, - ).items() - ]), - ) - for info in deps_transitive_infos - if info.xcode_target - ] if automatic_target_info.env else None, + direct_envs, transitive = [ info.envs for info in valid_transitive_infos @@ -797,6 +798,7 @@ def _make_xcodeprojinfo( ) if target_skip_type: info_fields = _make_skipped_target_xcodeprojinfo( + ctx = ctx, automatic_target_info = automatic_target_info, rule_attr = rule_attr, skip_type = target_skip_type, diff --git a/xcodeproj/internal/legacy_xcodeprojinfos.bzl b/xcodeproj/internal/legacy_xcodeprojinfos.bzl index b7ae9caa6..adbaa405a 100644 --- a/xcodeproj/internal/legacy_xcodeprojinfos.bzl +++ b/xcodeproj/internal/legacy_xcodeprojinfos.bzl @@ -352,6 +352,19 @@ def _make_skipped_target_xcodeprojinfo( "{}:{}".format(package_label_str, label_name), ) + if automatic_target_info.env: + direct_envs = [] + for info in deps_transitive_infos: + info_env = getattr(rule_attr, automatic_target_info.env, {}) + info_env = { + k: ctx.expand_make_variables("env", v, {}) + for k, v in info_env.items() + } + env = dicts.add(info_env, ctx.configuration.test_env) + direct_envs.append(struct(id = info.xcode_target.id, env = struct(**env))) + else: + direct_envs = None + return _target_info_fields( args = memory_efficient_depset( [ @@ -371,22 +384,7 @@ def _make_skipped_target_xcodeprojinfo( compilation_providers = provider_compilation_providers, direct_dependencies = direct_dependencies, envs = memory_efficient_depset( - [ - struct( - id = info.xcode_target.id, - env = struct( - **dicts.add( - getattr( - rule_attr, - automatic_target_info.env, - {}, - ), - ctx.configuration.test_env, - ) - ), - ) - for info in deps_transitive_infos - ] if automatic_target_info.env else None, + direct_envs, transitive = [ info.envs for info in valid_transitive_infos