Commit graph

3 commits

Author SHA1 Message Date
Pierre-Clément Tosi
c8d1d863ab ANDROID: bazel: Clean up lexer and parser rules
Simplify the build file as

- dtc_gen creates an unnecessarily broad (and confusing) dependency list
  by using glob([".h"]) as its header list. Instead, dtc now lists
  explicitly the few headers it actually needs;
- generating dtc-lexer.lex.c does not require dtc-parser.{c,h};
- Bison can be told to directly create dtc-parser.{c,h} so no need for
  an unnecessarily broad copying of *.[ch] to move some intermediate
  results.

As a result, we get two genrule() wrapping the source files respectively
generated through lex and bison, which can be listed as srcs of dtc.

Test: bazel build //:all
Change-Id: I238d963af8a338c46f39c8ba9e4314fe536948cf
2023-10-11 16:54:04 +01:00
Pierre-Clément Tosi
6127032bf7 ANDROID: bazel: Fix dtc header dependencies
As dtc compiles util.c, which includes util.h and version_non_gen.h
(or version_gen.h upstream), the cc_binary should list those
dependencies explicitly so that a change in them triggers a rebuild.

Furthermore, dtc also depends on dtc.h and srcpos.h, which are only
found as dependencies by Bazel through the overkill glob(["*.h"]) header
list of dtc_gen so list them explicitly here so that that cc_library can
be dropped.

Introduce the UTILS list to DRY the build file.

Test: bazel build //:dtc
Change-Id: I32076c65b60820dc91f6dc84c3ee3cad310c1db5
2023-10-11 16:53:57 +01:00
John Moon
b148d78706 build: Add BUILD.bazel file
Currently, the dtc project builds with Make.

As some consumers of this project use Bazel, and eventually all of
AOSP will need to move to Bazel anyway, add a a Bazel build
definition.

Bug: 251879933
Change-Id: I62ea59ee306eda58b764df2a9e5f2f33778e4b5c
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2023-04-28 09:19:45 -07:00