Skip to content

Commit

Permalink
Avoid umbrella header crash error in remote compilation when no defau…
Browse files Browse the repository at this point in the history
…lt umbrella header generated

Fix err_mmap_umbrella_clash error produced by clang that so far can only be reproduced by running a target that turn off generate_default_umbrella_header and compile in a remote execution service
  • Loading branch information
gyfelton committed Aug 20, 2024
1 parent 98d49d5 commit ca95281
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions rules/library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ def _write_umbrella_header(
module_name = name

content = ""

extern_keyword = "extern"
if generate_default_umbrella_header:
extern_keyword = "FOUNDATION_EXPORT"
content += """\
#ifdef __OBJC__
# import <Foundation/Foundation.h>
Expand All @@ -165,13 +166,13 @@ def _write_umbrella_header(
for header in public_headers:
content += "#import \"{header}\"\n".format(header = paths.basename(header))

if generate_default_umbrella_header:
content += """
FOUNDATION_EXPORT double {module_name}VersionNumber;
FOUNDATION_EXPORT const unsigned char {module_name}VersionString[];
content += """
{extern_keyword} double {module_name}VersionNumber;
{extern_keyword} const unsigned char {module_name}VersionString[];
""".format(
module_name = module_name,
)
extern_keyword = extern_keyword,
module_name = module_name,
)

write_file(
name = basename + "~",
Expand Down

0 comments on commit ca95281

Please sign in to comment.