Skip to content

Commit 3e3a270

Browse files
committed
Make sure includes taken from cc_library attrs are package-relative.
For example, a cc_library located at //foo/bar:baz might specify `includes = ["include"]` and that should be passed to the compiler as `-Ifoo/bar/include`, not `-Iinclude`. PiperOrigin-RevId: 221508265
1 parent c46cec0 commit 3e3a270

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

swift/internal/swift_c_module_aspect.bzl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,16 @@ def _swift_c_module_aspect_impl(target, aspect_ctx):
157157

158158
return [SwiftClangModuleInfo(
159159
transitive_compile_flags = depset(
160-
direct = ["-I{}".format(include) for include in attr.includes],
160+
direct = [
161+
"-isystem{}".format(include)
162+
for include in target.cc.system_include_directories
163+
] + [
164+
"-iquote{}".format(include)
165+
for include in target.cc.quote_include_directories
166+
] + [
167+
"-I{}".format(include)
168+
for include in target.cc.include_directories
169+
],
161170
),
162171
transitive_defines = depset(direct = target.cc.defines),
163172
transitive_headers = depset(transitive = (

0 commit comments

Comments
 (0)