[bazel_migration] Migrate ffx/lib/port_picker Migrate the Rust library `port_picker` from GN to Bazel. - Limit the `visibility` of migrated library to `//src/developer/ffx:__subpackages__`. - Include the library test to `//src/developer/ffx:tests` Bazel `test_suite()` target and exclude the library test from `//src/developer/ffx/lib:tests` GN `group` target. Test: fx build --host @//src/developer/ffx/lib/port_picker:lib Test: fx build --host //src/developer/ffx/lib/port_picker:lib Test: fx bazel test --config=host //src/developer/ffx:tests Test: fx build //src/developer/ffx:tests Test: fx build --host //build:bazel2gn_verifications Bug: 559509349 TAG: agy CONV: a9c0213e-c2d5-41dc-b7e2-07a23864fdcf Change-Id: I424948b731dd0d5d667834ca5601e1034d652012 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1814011 Fuchsia-Auto-Submit: David Turner <digit@google.com> Commit-Queue: David Turner <digit@google.com> Reviewed-by: David Turner <digit@google.com>
diff --git a/build/bazel2gn_verification_targets.gni b/build/bazel2gn_verification_targets.gni index d726813..c20ed2e 100644 --- a/build/bazel2gn_verification_targets.gni +++ b/build/bazel2gn_verification_targets.gni
@@ -67,6 +67,7 @@ "//src/developer/ffx/lib/logging:verify_bazel2gn", "//src/developer/ffx/lib/metrics:verify_bazel2gn", "//src/developer/ffx/lib/netext:verify_bazel2gn", + "//src/developer/ffx/lib/port_picker:verify_bazel2gn", "//src/developer/ffx/lib/sdk:verify_bazel2gn", "//src/developer/ffx/lib/timeout:verify_bazel2gn", "//src/developer/ffx/lib/version:verify_bazel2gn",
diff --git a/src/developer/ffx/BUILD.bazel b/src/developer/ffx/BUILD.bazel index dc28932..5427d0c 100644 --- a/src/developer/ffx/BUILD.bazel +++ b/src/developer/ffx/BUILD.bazel
@@ -34,6 +34,7 @@ "//src/developer/ffx/lib/logging:lib_test", "//src/developer/ffx/lib/metrics:lib_test", "//src/developer/ffx/lib/netext:lib_test", + "//src/developer/ffx/lib/port_picker:lib_test", "//src/developer/ffx/lib/traceable_error:lib_test", "//src/developer/ffx/lib/version:lib_test", ],
diff --git a/src/developer/ffx/lib/ffx_libraries_list.gni b/src/developer/ffx/lib/ffx_libraries_list.gni index 1de85e2..478304e4 100644 --- a/src/developer/ffx/lib/ffx_libraries_list.gni +++ b/src/developer/ffx/lib/ffx_libraries_list.gni
@@ -71,6 +71,7 @@ "logging", "metrics", "netext", + "port_picker", "traceable_error", "version",
diff --git a/src/developer/ffx/lib/port_picker/BUILD.bazel b/src/developer/ffx/lib/port_picker/BUILD.bazel new file mode 100644 index 0000000..4fe05ed --- /dev/null +++ b/src/developer/ffx/lib/port_picker/BUILD.bazel
@@ -0,0 +1,18 @@ +# Copyright 2026 The Fuchsia Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +load("@platforms//host:constraints.bzl", "HOST_CONSTRAINTS") +load("//build/bazel/rules/rust:defs.bzl", "rustc_library") + +package(default_applicable_licenses = ["//:license"]) + +rustc_library( + name = "lib", + srcs = ["src/lib.rs"], + crate_name = "port_picker", + edition = "2024", + target_compatible_with = HOST_CONSTRAINTS, + visibility = ["//src/developer/ffx:__subpackages__"], + with_host_unit_tests = True, +)
diff --git a/src/developer/ffx/lib/port_picker/BUILD.gn b/src/developer/ffx/lib/port_picker/BUILD.gn index 0a2064d..5c57a0f 100644 --- a/src/developer/ffx/lib/port_picker/BUILD.gn +++ b/src/developer/ffx/lib/port_picker/BUILD.gn
@@ -2,26 +2,49 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/rust/rustc_library.gni") - assert(is_host, "port_picker is for use with the host toolchain only") -rustc_library("lib") { - name = "port_picker" - with_unit_tests = true - edition = "2024" - sources = [ "src/lib.rs" ] -} - -group("tests") { - testonly = true - deps = [ ":lib_test" ] -} - group("port_picker") { - testonly = true - deps = [ - ":lib", - ":tests", - ] + deps = [ ":lib" ] +} + +## BAZEL2GN SENTINEL - DO NOT EDIT BELOW THIS LINE ## +# +# ________ _________ ________ ________ +# |\ ____\|\___ ___\\ __ \|\ __ \ +# \ \ \___|\|___ \ \_\ \ \|\ \ \ \|\ \ +# \ \_____ \ \ \ \ \ \ \\\ \ \ ____\ +# \|____|\ \ \ \ \ \ \ \\\ \ \ \___| +# ____\_\ \ \ \__\ \ \_______\ \__\ +# |\_________\ \|__| \|_______|\|__| +# \|_________| +# +# +# AUTO-GENERATED - DO NOT EDIT +# +# The targets below are auto-generated based on the targets defined in the +# BUILD.bazel file from the same directory. If you made changes to targets in +# Bazel, instead of editing this file manually, run: +# +# > fx bazel2gn +# +# Please do NOT edit this file directly. Instead, edit the BUILD.bazel file and +# rerun bazel2gn. + +import("//build/tools/bazel2gn/bazel_migration.gni") + +# A self-verification target for generated content in this file. +if (is_host) { + verify_bazel2gn("verify_bazel2gn") { + } +} + +if (is_host) { + rustc_library("lib") { + sources = [ "src/lib.rs" ] + crate_name = "port_picker" + edition = "2024" + visibility = [ "//src/developer/ffx/*" ] + with_unit_tests = true + } }