pw_hdlc: Create BUILD.bazel

Also add a BUILD.bazel file for one pw_build dependency.

No-Docs-Update-Reason: Small change
Change-Id: I38c197af28419fdb3baa03d52f9ee23e34fac6b4
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/60740
Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
diff --git a/pw_build/py/BUILD.bazel b/pw_build/py/BUILD.bazel
new file mode 100644
index 0000000..5abf4e7
--- /dev/null
+++ b/pw_build/py/BUILD.bazel
@@ -0,0 +1,30 @@
+# Copyright 2021 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+load("@rules_python//python:defs.bzl", "py_library")
+
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])
+
+py_library(
+    name = "pw_build",
+    srcs = [
+        "pw_build/__init__.py",
+        # TODO(tonymd): Add more sources when needed.
+        # Used by pw_hdlc/py/decode_test.py:
+        "pw_build/generated_tests.py",
+    ],
+    imports = ["."],
+)
diff --git a/pw_env_setup/BUILD.gn b/pw_env_setup/BUILD.gn
index a92b7a4b..572e859 100644
--- a/pw_env_setup/BUILD.gn
+++ b/pw_env_setup/BUILD.gn
@@ -95,7 +95,9 @@
   packages = _pigweed_python_deps
   include_tests = true
   extra_files = [
+    "$dir_pigweed/pw_build/py/BUILD.bazel > pw_build/BUILD.bazel",
     "$dir_pigweed/pw_cli/py/BUILD.bazel > pw_cli/BUILD.bazel",
+    "$dir_pigweed/pw_hdlc/py/BUILD.bazel > pw_hdlc/BUILD.bazel",
     "$dir_pigweed/pw_protobuf/py/BUILD.bazel > pw_protobuf/BUILD.bazel",
     "$dir_pigweed/pw_protobuf_compiler/py/BUILD.bazel > pw_protobuf_compiler/BUILD.bazel",
     "$dir_pigweed/pw_rpc/py/BUILD.bazel > pw_rpc/BUILD.bazel",
diff --git a/pw_hdlc/py/BUILD.bazel b/pw_hdlc/py/BUILD.bazel
new file mode 100644
index 0000000..a88424d
--- /dev/null
+++ b/pw_hdlc/py/BUILD.bazel
@@ -0,0 +1,59 @@
+# Copyright 2021 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+load("@rules_python//python:defs.bzl", "py_library", "py_test")
+
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])
+
+py_library(
+    name = "pw_hdlc",
+    srcs = [
+        "pw_hdlc/__init__.py",
+        "pw_hdlc/decode.py",
+        "pw_hdlc/encode.py",
+        "pw_hdlc/protocol.py",
+        "pw_hdlc/rpc.py",
+    ],
+    imports = ["."],
+    deps = [
+        "//pw_protobuf_compiler/py:pw_protobuf_compiler",
+        "//pw_rpc/py:pw_rpc",
+        "//pw_status/py:pw_status",
+    ],
+)
+
+py_test(
+    name = "encode_test",
+    size = "small",
+    srcs = [
+        "encode_test.py",
+    ],
+    deps = [
+        ":pw_hdlc",
+    ],
+)
+
+py_test(
+    name = "decode_test",
+    size = "small",
+    srcs = [
+        "decode_test.py",
+    ],
+    deps = [
+        ":pw_hdlc",
+        "//pw_build/py:pw_build",
+    ],
+)