Add jni_md_header for NetBSD (#381)

The :jni target pulls the machine-dependent jni_md.h out of the JDK per
host, with a java_runtime_files target and a select arm for each
platform.  FreeBSD and OpenBSD are there; add NetBSD, whose JDK ships
include/netbsd/jni_md.h just as the others do, so that Bazel's native
code builds against the right header when it is bootstrapped there.

The config_setting is defined here rather than taken from
@bazel_tools//src/conditions, so that it resolves with every Bazel
version rather than only those carrying bazelbuild/bazel#31069.
@platforms//os:netbsd has been in the platforms module since 0.0.11,
which this module already depends on.

DragonFly BSD needs @platforms//os:dragonfly, which is not in a
platforms release yet (bazelbuild/platforms#143), so it will follow in a
separate change.

Closes #381

COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_java/pull/381 from zakinko:bsd-jni-headers 0231dcb4b7b00f868f71199d074dd4e3ad198e5f
PiperOrigin-RevId: 983122880
Change-Id: I53649e71b4b50134c91d363cedb2eb2436e8d4e0
diff --git a/toolchains/BUILD b/toolchains/BUILD
index 9d4dd8a..e605607 100644
--- a/toolchains/BUILD
+++ b/toolchains/BUILD
@@ -129,6 +129,19 @@
     srcs = ["include/openbsd/jni_md.h"],
 )
 
+java_runtime_files(
+    name = "jni_md_header-netbsd",
+    srcs = ["include/netbsd/jni_md.h"],
+)
+
+# Defined here rather than taken from @bazel_tools//src/conditions so that it
+# resolves with every Bazel version: @platforms//os:netbsd has been in the
+# platforms module since 0.0.11.
+config_setting(
+    name = "netbsd",
+    constraint_values = ["@platforms//os:netbsd"],
+)
+
 # The Java native interface. Depend on this package if you #include <jni.h>.
 #
 # See test_jni in third_party/bazel/src/test/shell/bazel/bazel_java_test.sh for
@@ -140,6 +153,7 @@
         "@bazel_tools//src/conditions:freebsd": [":jni_md_header-freebsd"],
         "@bazel_tools//src/conditions:linux": [":jni_md_header-linux"],
         "@bazel_tools//src/conditions:openbsd": [":jni_md_header-openbsd"],
+        ":netbsd": [":jni_md_header-netbsd"],
         "@bazel_tools//src/conditions:windows": [":jni_md_header-windows"],
         "//conditions:default": [],
     }),
@@ -148,6 +162,7 @@
         "@bazel_tools//src/conditions:freebsd": ["include/freebsd"],
         "@bazel_tools//src/conditions:linux": ["include/linux"],
         "@bazel_tools//src/conditions:openbsd": ["include/openbsd"],
+        ":netbsd": ["include/netbsd"],
         "@bazel_tools//src/conditions:windows": ["include/win32"],
         "//conditions:default": [],
     }),