Skip to content

Commit

Permalink
fix: keep original source tree when symlink into ext_include_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
gulu-goolu committed Aug 20, 2024
1 parent d9367d2 commit 955882a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion foreign_cc/private/framework.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -749,13 +749,23 @@ def _symlink_contents_to_dir(dir_name, files_list):
path = _file_path(file).strip()
if path:
lines.append("##symlink_contents_to_dir## \
$$EXT_BUILD_ROOT$$/{} $$EXT_BUILD_DEPS$$/{} True".format(path, dir_name))
$$EXT_BUILD_ROOT$$/{} $$EXT_BUILD_DEPS$$/{} True".format(path, _get_dir_name(dir_name, file)))

return lines

def _file_path(file):
return file if type(file) == "string" else file.path

def _get_dir_name(dir, file):
if dir == "include":
if type(file) == "File" and file.owner != None and file.owner.package != "":
workspace_root = file.owner.workspace_root
path = "/".join(file.path.split("/")[:-1])
prefix = "{}/".format(workspace_root)
if path.startswith(prefix):
return "{}/{}".format(dir, path.removeprefix(prefix))
return dir

_FORBIDDEN_FOR_FILENAME = ["\\", "/", ":", "*", "\"", "<", ">", "|"]

def _check_file_name(var):
Expand Down

0 comments on commit 955882a

Please sign in to comment.