diff --git a/MODULE.bazel b/MODULE.bazel index 1f3b1d9eb6dbb39e6178d1adda3d3bba76d6f389..d4319c2a83691aba2358829962e22fb1b4f292b8 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -43,7 +43,15 @@ resolved = use_repo_rule("@toolchain_utils//toolchain/resolved:defs.bzl", "toolc for kind in ("qemu-system", "qemu-img") ] -register_toolchains("//labgrid/toolchain/...") +register_toolchains( + "//labgrid/toolchain/qemu-img/...", + "//labgrid/toolchain/qemu-system/...", + "//labgrid/toolchain/config/qemu/...", + "//labgrid/toolchain/config/ssh/...", +) + +#local config must be last to ensure correct resolution when no platform is set. +register_toolchains("//labgrid/toolchain/config/local/...") # We need to pin to Python 3.11 python = use_extension("@rules_python//python/extensions:python.bzl", "python") diff --git a/e2e/binary/BUILD.bazel b/e2e/binary/BUILD.bazel index 5c4716cd83ed315658c5c66e4c9f3e0c3e1033b1..eb5f2c3e4d3af079d420e0721748e2a3590fe037 100644 --- a/e2e/binary/BUILD.bazel +++ b/e2e/binary/BUILD.bazel @@ -5,7 +5,6 @@ load("@rules_labgrid//labgrid/binary:defs.bzl", "labgrid_binary") labgrid_binary( name = "printenv", src = "@ape//ape:printenv", - platform = "@rules_labgrid//labgrid/platform:localhost", ) genrule( diff --git a/e2e/genrule/BUILD.bazel b/e2e/genrule/BUILD.bazel index 46b3699f766870ba48802ab6f5a73fb06ee4195a..9b221c8ceb91f6a589e083edd95c3e53284e39ef 100644 --- a/e2e/genrule/BUILD.bazel +++ b/e2e/genrule/BUILD.bazel @@ -6,7 +6,6 @@ labgrid_genrule( name = "actual", outs = ["stdout.actual"], cmd = "echo -n $LG_STATE > $@", - platform = "@rules_labgrid//labgrid/platform:localhost", ) write_file( diff --git a/e2e/run/BUILD.bazel b/e2e/run/BUILD.bazel index 34cf2f097f7878b1f8a28daec43d3a75e8c079ba..eae006d09ccbb328b5db37e342b70568e1c45db7 100644 --- a/e2e/run/BUILD.bazel +++ b/e2e/run/BUILD.bazel @@ -9,7 +9,6 @@ labgrid_genrule( srcs = ["@ape//ape:echo"], outs = ["run.actual"], cmd = "$(location @rules_labgrid//labgrid/run) $(location @ape//ape:echo) world > $@", - platform = "@rules_labgrid//labgrid/platform:localhost", tools = ["@rules_labgrid//labgrid/run"], ) @@ -24,7 +23,6 @@ labgrid_genrule( srcs = [":echo-with-runfiles"], outs = ["runfiles.actual"], cmd = "$(location @rules_labgrid//labgrid/run) $(locations :echo-with-runfiles) world > $@", - platform = "@rules_labgrid//labgrid/platform:localhost", tools = ["@rules_labgrid//labgrid/run"], ) @@ -34,7 +32,6 @@ labgrid_genrule( srcs = ["@ape//ape:bash"], outs = ["transfer-file-back.actual"], cmd = "$(location @rules_labgrid//labgrid/run) --get output.txt:$@ $(location @ape//ape:bash) -c 'echo world > output.txt'", - platform = "@rules_labgrid//labgrid/platform:localhost", tools = ["@rules_labgrid//labgrid/run"], ) @@ -44,7 +41,6 @@ labgrid_genrule( srcs = ["@ape//ape:bash"], outs = ["transfer-to-ruledir.actual"], cmd = "$(location @rules_labgrid//labgrid/run) --get output.txt:$(RULEDIR)/transfer-to-ruledir.actual $(location @ape//ape:bash) -c 'echo world > output.txt'", - platform = "@rules_labgrid//labgrid/platform:localhost", tools = ["@rules_labgrid//labgrid/run"], ) @@ -54,7 +50,6 @@ labgrid_genrule( srcs = ["@ape//ape:bash"], outs = ["transfer-to-d.actual"], cmd = "$(location @rules_labgrid//labgrid/run) --get output.txt:$D/transfer-to-d.actual $(location @ape//ape:bash) -c 'echo world > output.txt'", - platform = "@rules_labgrid//labgrid/platform:localhost", tools = ["@rules_labgrid//labgrid/run"], ) @@ -64,7 +59,6 @@ labgrid_genrule( srcs = ["@ape//ape:bash"], outs = ["nested/transfer-to-d.actual"], cmd = "$(location @rules_labgrid//labgrid/run) --get output.txt:$D/transfer-to-d.actual $(location @ape//ape:bash) -c 'echo world > output.txt'", - platform = "@rules_labgrid//labgrid/platform:localhost", tools = ["@rules_labgrid//labgrid/run"], ) @@ -81,7 +75,6 @@ labgrid_genrule( ], outs = ["put-file-with-remote.actual"], cmd = "$(location @rules_labgrid//labgrid/run) --put $(location :hello.txt):hello.txt $(location @ape//ape:cat) hello.txt > $@", - platform = "@rules_labgrid//labgrid/platform:localhost", tools = ["@rules_labgrid//labgrid/run"], ) @@ -93,7 +86,6 @@ labgrid_genrule( ], outs = ["put-file-without-remote.actual"], cmd = "$(location @rules_labgrid//labgrid/run) --put $(location :hello.txt) $(location @ape//ape:cat) $(location :hello.txt) > $@", - platform = "@rules_labgrid//labgrid/platform:localhost", tools = ["@rules_labgrid//labgrid/run"], ) @@ -102,7 +94,6 @@ labgrid_genrule( srcs = ["@ape//ape:printenv"], outs = ["env.actual"], cmd = "$(location @rules_labgrid//labgrid/run) --env HELLO=world -- $(location @ape//ape:printenv) HELLO > $@", - platform = "@rules_labgrid//labgrid/platform:localhost", tools = ["@rules_labgrid//labgrid/run"], ) @@ -120,7 +111,6 @@ labgrid_run_binary( "-c", "echo world > output.txt", ], - platform = "@rules_labgrid//labgrid/platform:localhost", tool = "@rules_labgrid//labgrid/run", ) diff --git a/e2e/run/binary/BUILD.bazel b/e2e/run/binary/BUILD.bazel index a66181f390bbda46679f9f44498384c1b8146b81..13211365317d6376dc10d2546def461b0a13c8ea 100644 --- a/e2e/run/binary/BUILD.bazel +++ b/e2e/run/binary/BUILD.bazel @@ -9,7 +9,6 @@ labgrid_run_binary( "-c", "echo -n $LG_STATE > $(location :stdout.actual)", ], - platform = "@rules_labgrid//labgrid/platform:localhost", tool = "@ape//ape:bash", ) diff --git a/e2e/test/BUILD.bazel b/e2e/test/BUILD.bazel index 7289279bde548e96671d993fd205038546b9fd58..2ae4267da78e966a1881f6f437c1401c76e3a949 100644 --- a/e2e/test/BUILD.bazel +++ b/e2e/test/BUILD.bazel @@ -15,7 +15,6 @@ labgrid_test( name = "test", size = "small", src = ":inner", - platform = "@rules_labgrid//labgrid/platform:localhost", ) # Regression test for: https://gitlab.arm.com/bazel/rules_labgrid/-/issues/77 @@ -23,7 +22,6 @@ labgrid_test( name = "src-in-subpackage", size = "small", src = "//test/subdir:inner", - platform = "@rules_labgrid//labgrid/platform:localhost", ) write_file( @@ -46,7 +44,6 @@ labgrid_test( name = "src-env", size = "small", src = ":inner-with-env", - platform = "@rules_labgrid//labgrid/platform:localhost", ) py_binary( @@ -60,7 +57,6 @@ labgrid_test( size = "small", src = ":inner-without-env", env = {"GREETING": "hello"}, - platform = "@rules_labgrid//labgrid/platform:localhost", ) py_binary( @@ -75,7 +71,6 @@ labgrid_test( size = "small", src = ":inner-with-override-env", env = {"GREETING": "hello"}, - platform = "@rules_labgrid//labgrid/platform:localhost", ) write_file( @@ -101,7 +96,6 @@ labgrid_test( "hello", "world", ], - platform = "@rules_labgrid//labgrid/platform:localhost", ) py_binary( @@ -116,7 +110,6 @@ labgrid_test( size = "small", src = ":inner-without-data", data = [":hello.txt"], - platform = "@rules_labgrid//labgrid/platform:localhost", ) write_file( @@ -144,7 +137,6 @@ labgrid_test( env = { "HELLO_PATH": "$(location :hello.txt)", }, - platform = "@rules_labgrid//labgrid/platform:localhost", ) write_file( @@ -170,6 +162,5 @@ labgrid_test( name = "sharding", size = "small", src = ":inner-sharding", - platform = "@rules_labgrid//labgrid/platform:localhost", shard_count = 2, ) diff --git a/e2e/test/subdir/BUILD.bazel b/e2e/test/subdir/BUILD.bazel index 3a2dc24045ea0ef3421c2fd7d6c751578fc1ef1b..2713f71f78501d22f72469d57c8531e1187eacf0 100644 --- a/e2e/test/subdir/BUILD.bazel +++ b/e2e/test/subdir/BUILD.bazel @@ -15,5 +15,4 @@ labgrid_test( name = "src-in-upper-package", size = "small", src = "//test:inner", - platform = "@rules_labgrid//labgrid/platform:localhost", ) diff --git a/examples/custom-runners/archive-transfer/BUILD.bazel b/examples/custom-runners/archive-transfer/BUILD.bazel index d2742d681b433f0c2e059a7d8fb9b13e1e15151f..615722a60c234aa6e0eab5300d64253eddb4ff1a 100644 --- a/examples/custom-runners/archive-transfer/BUILD.bazel +++ b/examples/custom-runners/archive-transfer/BUILD.bazel @@ -32,7 +32,6 @@ labgrid_genrule( ], outs = ["actual.out"], cmd = "$(location :run) --put=$(location data.txt) --out=$(location :actual.out) $(location @ape//ape:cat) data.txt", - platform = "@rules_labgrid//labgrid/platform:localhost", tools = [":run"], ) diff --git a/labgrid/constraint/device/BUILD.bazel b/labgrid/constraint/device/BUILD.bazel index 5cb7ef796c9bccb3ae6dfebc274bcf960e874abe..1a16d128c18a1a24e26b2de3970cef506e7803be 100644 --- a/labgrid/constraint/device/BUILD.bazel +++ b/labgrid/constraint/device/BUILD.bazel @@ -3,12 +3,6 @@ constraint_setting( visibility = ["//visibility:public"], ) -constraint_value( - name = "localhost", - constraint_setting = ":device", - visibility = ["//visibility:public"], -) - constraint_value( name = "qemu", constraint_setting = ":device", diff --git a/labgrid/platform/BUILD.bazel b/labgrid/platform/BUILD.bazel index bc30a062a6753fcde8bf63379b970b8e228b05f5..80e02fde56288767251156c9a96c52e2910587bf 100644 --- a/labgrid/platform/BUILD.bazel +++ b/labgrid/platform/BUILD.bazel @@ -1,12 +1,5 @@ CPUS = ("amd64", "arm64") -platform( - name = "localhost", - constraint_values = ["//labgrid/constraint/device:localhost"], - parents = ["@local_config_platform//:host"], - visibility = ["//visibility:public"], -) - [ platform( name = "qemu-{}-linux".format(cpu), diff --git a/labgrid/toolchain/config/localhost/BUILD.bazel b/labgrid/toolchain/config/local/BUILD.bazel similarity index 75% rename from labgrid/toolchain/config/localhost/BUILD.bazel rename to labgrid/toolchain/config/local/BUILD.bazel index 8cf578d12f2dbbceadca1c00624c47a691678756..12146d0c0341d3d8705b3aad700b8a196cb8399a 100644 --- a/labgrid/toolchain/config/localhost/BUILD.bazel +++ b/labgrid/toolchain/config/local/BUILD.bazel @@ -7,12 +7,10 @@ labgrid_state( ) labgrid_config_toolchain( - name = "localhost", + name = "local", src = "config.yaml", state = ":state", - target_compatible_with = [ - "//labgrid/constraint/device:localhost", - ], + target_compatible_with = [], deps = [ "//bazel/labgrid/driver", "//bazel/labgrid/strategy", diff --git a/labgrid/toolchain/config/localhost/config.yaml b/labgrid/toolchain/config/local/config.yaml similarity index 100% rename from labgrid/toolchain/config/localhost/config.yaml rename to labgrid/toolchain/config/local/config.yaml