Trick the srcs_test to regenerate the list of sources at every change of the workspace
We need to declare a dependency on something that change every time the workspace change or we get false negative failure.
def _impl(rctx):
workspace = rctx.path(Label("//:BUILD")).dirname
srcs_excludes = "XXXXXXXXXXXXXX1268778dfsdf4"
+ # Depending in ~/.git/logs/HEAD is a trick to depends on something that
+ # change everytime the workspace content change.
+ r = rctx.execute(["test", "-f", "%s/.git/logs/HEAD" % workspace])
+ if r.return_code == 0:
+ # We only add the dependency if it exists.
+ unused_var = rctx.path(Label("//:.git/logs/HEAD")) # pylint: disable=unused-variable
+
if "SRCS_EXCLUDES" in rctx.os.environ:
srcs_excludes = rctx.os.environ["SRCS_EXCLUDES"]
r = rctx.execute(["find", str(workspace), "-type", "f"])
