Skip to content

Commit f248165

Browse files
watwarsmeta-codesync[bot]
authored andcommitted
Make all swift anon targets content based hashed
Summary: TSIA For the anon targets, we could not use `get_uses_experimental_content_based_path_hashing(ctx)` to determine whether we enable content based paths to them (as demonstrated in D86439116) The reason is that the current setup of rolling out the feature is on a per app basis by adding a modifier to the app's target platform. The issue that brings is that any dependency that is built against the execution platform won't get that information, causing them to still have content based paths disabled. Then, when come to anon targets, if target A and target B both depends on anon target X, if A has content based path enabled and B has it disabled, this would cause an inconsistent state for target X, which leads to a duplicate entry in modulemap.json (https://www.internalfb.com/intern/diffing/?paste_number=2028864153), and hence causing build failures. The solution, as described by the updated rollout plan: https://docs.google.com/document/d/1tS5CUQ8Xdpx6-hbsUx6NoGXd4VpuZu7FeXtXfHVGoRo/edit?tab=t.0, is that we will be a bit more aggressive in our rollout strategy and just enable content based path by default to the targets that are causing issues. #buildall-fbobjc Reviewed By: benb Differential Revision: D86690264 fbshipit-source-id: 3c976288fee84cc24cbbee6b2067badb9a65825a
1 parent a305493 commit f248165

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

prelude/apple/swift/swift_pcm_compilation.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def get_swift_pcm_anon_targets(
6161
"enable_cxx_interop": enable_cxx_interop,
6262
"name": uncompiled_dep.label,
6363
"swift_cxx_args": swift_cxx_args,
64+
"uses_experimental_content_based_path_hashing": True,
6465
"_swift_toolchain": get_swift_toolchain_info_dep(ctx),
6566
}))
6667

@@ -218,6 +219,7 @@ _swift_pcm_compilation = rule(
218219
"dep": attrs.dep(),
219220
"enable_cxx_interop": attrs.bool(),
220221
"swift_cxx_args": attrs.list(attrs.string(), default = []),
222+
"uses_experimental_content_based_path_hashing": attrs.bool(),
221223
"_swift_toolchain": attrs.dep(),
222224
},
223225
)

prelude/apple/swift/swift_sdk_pcm_compilation.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def get_swift_sdk_pcm_anon_targets(
103103
"enable_cxx_interop": enable_cxx_interop,
104104
"name": module_dep.label,
105105
"swift_cxx_args": swift_cxx_args,
106+
"uses_experimental_content_based_path_hashing": True,
106107
"_swift_toolchain": get_swift_toolchain_info_dep(ctx),
107108
})
108109
for module_dep in uncompiled_sdk_deps
@@ -283,6 +284,7 @@ _swift_sdk_pcm_compilation = rule(
283284
"dep": attrs.dep(),
284285
"enable_cxx_interop": attrs.bool(),
285286
"swift_cxx_args": attrs.list(attrs.string(), default = []),
287+
"uses_experimental_content_based_path_hashing": attrs.bool(),
286288
"_swift_toolchain": attrs.dep(),
287289
},
288290
)

prelude/apple/swift/swift_swiftinterface_compilation.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def get_swift_interface_anon_targets(
3434
{
3535
"dep": d,
3636
"name": d.label,
37+
"uses_experimental_content_based_path_hashing": True,
3738
"_swift_toolchain": get_swift_toolchain_info_dep(ctx),
3839
},
3940
)
@@ -160,6 +161,7 @@ _swift_interface_compilation = rule(
160161
impl = _swift_interface_compilation_impl,
161162
attrs = {
162163
"dep": attrs.dep(),
164+
"uses_experimental_content_based_path_hashing": attrs.bool(),
163165
"_swift_toolchain": attrs.dep(),
164166
},
165167
)

0 commit comments

Comments
 (0)