Handle custom rule src file dependency of build commands

8 views
Skip to first unread message

Red

unread,
Nov 12, 2024, 7:36:03 AMNov 12
to bazel-discuss
I am trying to implement automatic dependency population based on c includes using gazelle. The problem with that is that some source is generated using a custom rule "bazel build gen_src" and these src files are then referenced by cc_library copts to bazel-<project>/external/.. . Since this reference is not available anymore after running "bazel build gazelle" I cant resolve my src dependencies properly. A simple overview of my project structure:

bazel-testproject:
      external:
            +app:
                   another.h <- this is generated by the generate target
my_rules:
      gen_rule_module: <- module to handle the src file generation
      gazelle_module: <- module to handle custom gazelle setup
app:
      some_src:
            some.c <- might depend on some.h and also on another.h
            some.h
      gen_src:
            BUILDFILE <- generate target is declared here

I know that having a persistant location for the generated src files would solve this problem, but I was wondering if this dependency across targets can also be tackled somehow else? If I am fully on the wrong path here I would also appreciate input for optimization. Thanks in advance. 
Reply all
Reply to author
Forward
0 new messages