es-ude / EmbeddedSystemsBuildScripts

Bazel build scripts used for all projects of the embedded systems department
MIT License
4 stars 5 forks source link

Add description on how to mock external dependency headers #40

Open saphieron opened 3 years ago

saphieron commented 3 years ago

The readme covers how to mock a header file that is contained within the current project. However, when wanting to mock against an external dependency pulled in via bazel the paths differ slightly.

An example could be:

mock( name = "mock_ElasticNodemiddleware", srcs = ["@ElasticNodeMiddleware//:ElasticNodeMiddleware/elasticNodeMiddleware.h"], copts = ["-DTEST"], deps = ["@ElasticNodeMiddleware//:ElasticNodeMiddlewareLibHdr",], )

While this is fairly obvious once one is familiar with how the bazel syntax works for external references, it would still help having this reference here.