|
|
|
load(":defs.bzl", "list_inputs") |
|
|
|
package(default_visibility = ["//visibility:public"]) |
|
|
|
genrule( |
|
name = "genrule", |
|
outs = ["gen"], |
|
cmd = "touch $(OUTS)", |
|
) |
|
|
|
list_inputs( |
|
name = "example", |
|
inputs = [ |
|
":BUILD.bazel", |
|
":gen", |
|
], |
|
) |
|
''' |
|
# build //:example |
|
BUILD.bazel |
|
bazel-out/cfg/bin/gen |
|
[OUT] bazel-out/cfg/bin/example |
|
|
|
# build //:example --config=sib (same) |
|
BUILD.bazel |
|
bazel-out/cfg/bin/gen |
|
[OUT] bazel-out/cfg/bin/example |
|
|
|
# build @external_repo//:example |
|
external/+_repo_rules+external_repo/BUILD.bazel |
|
bazel-out/cfg/bin/external/+_repo_rules+external_repo/gen |
|
[OUT] bazel-out/cfg/bin/external/+_repo_rules+external_repo/example |
|
|
|
# build @external_repo//:example --config=sib |
|
../+_repo_rules+external_repo/BUILD.bazel |
|
bazel-out/cfg/k8-fastbuild/bin/gen |
|
[OUT] bazel-out/cfg/k8-fastbuild/bin/example |
|
- !!! path mapping is broken! |
|
''' |
|
|
|
list_inputs( |
|
name = "example_extern_ref", |
|
inputs = [ |
|
"@@//:BUILD.bazel", |
|
"@@//:gen", |
|
"@external_repo//:BUILD.bazel", |
|
"@external_repo//:gen", |
|
], |
|
) |
|
''' |
|
# build //:example_extern_ref |
|
BUILD.bazel |
|
bazel-out/cfg/bin/gen |
|
external/+_repo_rules+external_repo/BUILD.bazel |
|
bazel-out/cfg/bin/external/+_repo_rules+external_repo/gen |
|
[OUT] bazel-out/cfg/bin/example_extern_ref |
|
|
|
# build //:example_extern_ref --config=sib |
|
BUILD.bazel |
|
bazel-out/cfg/bin/gen |
|
../+_repo_rules+external_repo/BUILD.bazel |
|
bazel-out/cfg/k8-fastbuild/bin/gen |
|
[OUT] bazel-out/cfg/bin/example_extern_ref |
|
|
|
# build @external_repo//:example_extern_ref |
|
BUILD.bazel |
|
bazel-out/cfg/bin/gen |
|
external/+_repo_rules+external_repo/BUILD.bazel |
|
bazel-out/cfg/bin/external/+_repo_rules+external_repo/gen |
|
[OUT] bazel-out/cfg/bin/external/+_repo_rules+external_repo/example_extern_ref |
|
|
|
# build @external_repo//:example_extern_ref --config=sib |
|
BUILD.bazel |
|
bazel-out/cfg/bin/gen |
|
../+_repo_rules+external_repo/BUILD.bazel |
|
bazel-out/cfg/k8-fastbuild/bin/gen |
|
[OUT] bazel-out/cfg/k8-fastbuild/bin/example_extern_ref |
|
- !!! path mapping is broken! |
|
''' |
|
|
|
list_inputs( |
|
name = "example_exec", |
|
exec_inputs = [ |
|
":genrule", |
|
], |
|
) |
|
''' |
|
# build @//:example_exec |
|
bazel-out/cfg/bin/gen |
|
[OUT] bazel-out/cfg/bin/example_exec |
|
|
|
# build @//:example_exec --config=sib |
|
bazel-out/cfg/bin/gen |
|
[OUT] bazel-out/cfg/bin/example_exec |
|
|
|
# build @external_repo//:example_exec |
|
bazel-out/cfg/bin/external/+_repo_rules+external_repo/gen |
|
[OUT] bazel-out/cfg/bin/external/+_repo_rules+external_repo/example_exec |
|
|
|
# build @external_repo//:example_exec --config=sib |
|
bazel-out/cfg/k8-opt-exec-ST-d57f47055a04/bin/gen |
|
[OUT] bazel-out/cfg/k8-fastbuild/bin/example_exec |
|
- !!! path mapping is broken! |
|
''' |
|
|
|
list_inputs( |
|
name = "example_both", |
|
inputs = [ |
|
":gen", |
|
], |
|
exec_inputs = [ |
|
":gen", |
|
] |
|
) |
|
''' |
|
# build @//:example_both |
|
bazel-out/k8-fastbuild/bin/gen |
|
bazel-out/k8-opt-exec-ST-d57f47055a04/bin/gen |
|
[OUT] bazel-out/k8-fastbuild/bin/example_both |
|
|
|
# build @//:example_both --config=sib |
|
bazel-out/k8-fastbuild/bin/gen |
|
bazel-out/k8-opt-exec-ST-d57f47055a04/bin/gen |
|
[OUT] bazel-out/k8-fastbuild/bin/example_both |
|
|
|
# build @external_repo//:example_both |
|
bazel-out/k8-fastbuild/bin/external/+_repo_rules+external_repo/gen |
|
bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/+_repo_rules+external_repo/gen |
|
[OUT] bazel-out/k8-fastbuild/bin/external/+_repo_rules+external_repo/example_both |
|
|
|
# build @external_repo//:example_both --config=sib |
|
bazel-out/cfg/k8-fastbuild/bin/gen |
|
bazel-out/cfg/k8-opt-exec-ST-d57f47055a04/bin/gen |
|
[OUT] bazel-out/cfg/k8-fastbuild/bin/example_both |
|
- !!! path mapping is broken! we don't fall back here since there is no |
|
conflict... that happens because the wrong part of the path is being |
|
stripped (not the configuration name) |
|
''' |
|
# NOTE: path-mapping gets silently disabled since there would be a conflict in |
|
# the mapped paths (for `:gen`) |