Skip to content

Commit b20a440

Browse files
authored
Merge pull request #139 from rabbitmq/erlc-include-path-contains-package
Add the package dir to the include path in erlang_bytecode rules
2 parents 85bf58a + 21238be commit b20a440

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

private/erlang_bytecode.bzl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ def _impl(ctx):
3232
include = ctx.files.hdrs,
3333
)
3434

35+
package_dir = path_join(
36+
ctx.label.workspace_root,
37+
ctx.label.package,
38+
)
39+
3540
erl_libs_files = erl_libs_contents(
3641
ctx,
3742
target_info = target,
@@ -56,9 +61,7 @@ def _impl(ctx):
5661

5762
dest_dir = beam_files[0].dirname
5863

59-
include_args = []
60-
if erl_libs_path != "":
61-
include_args.extend(["-I", erl_libs_path])
64+
include_args = ["-I", package_dir]
6265
for dir in unique_dirnames(ctx.files.hdrs):
6366
include_args.extend(["-I", dir])
6467

private/erlang_bytecode2.bzl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ def _impl(ctx):
3030
include = ctx.files.hdrs,
3131
)
3232

33+
package_dir = path_join(
34+
ctx.label.workspace_root,
35+
ctx.label.package,
36+
)
37+
3338
# this actually just needs to be headers and behaviours, in the context of compiling,
3439
# though it must include the transitive headers and behaviors. Therefore this file
3540
# could have it's own optimized version of `erl_libs_contents`
@@ -55,9 +60,7 @@ def _impl(ctx):
5560
fail(ctx.attr.outs, "do not share a common parent directory")
5661
out_dir = out_dirs[0]
5762

58-
include_args = []
59-
if erl_libs_path != "":
60-
include_args.extend(["-I", erl_libs_path])
63+
include_args = ["-I", package_dir]
6164
for dir in unique_dirnames(ctx.files.hdrs):
6265
include_args.extend(["-I", dir])
6366

0 commit comments

Comments
 (0)