Add Python binary and library configuarations to BUILD.extras
Change-Id: Ibacfa52664cb334e9999c68cb37434e46258a35c
diff --git a/BUILD b/BUILD
index e37ec91..8cc0e41 100644
--- a/BUILD
+++ b/BUILD
@@ -27,6 +27,7 @@
"perfetto_java_lite_proto_library",
"perfetto_proto_library",
"perfetto_py_binary",
+ "perfetto_py_library",
"perfetto_gensignature_internal_only",
)
@@ -3283,3 +3284,18 @@
"__TRACE_PROCESSOR_SIG_TAG2",
],
)
+
+perfetto_py_binary(
+ name = "api_main",
+ srcs = ["src/trace_processor/python/api_main.py"],
+ deps = [":api_main_lib"],
+ main = "src/trace_processor/python/api_main.py",
+ python_version = "PY3",
+)
+
+perfetto_py_library(
+ name = "api_main_lib",
+ srcs = [
+ "src/trace_processor/python/trace_processor_http.py",
+ ],
+)
diff --git a/BUILD.extras b/BUILD.extras
index 6a0c30e..a8f3a45 100644
--- a/BUILD.extras
+++ b/BUILD.extras
@@ -68,3 +68,18 @@
"__TRACE_PROCESSOR_SIG_TAG2",
],
)
+
+perfetto_py_binary(
+ name = "api_main",
+ srcs = ["src/trace_processor/python/api_main.py"],
+ deps = [":api_main_lib"],
+ main = "src/trace_processor/python/api_main.py",
+ python_version = "PY3",
+)
+
+perfetto_py_library(
+ name = "api_main_lib",
+ srcs = [
+ "src/trace_processor/python/trace_processor_http.py",
+ ],
+)
diff --git a/bazel/rules.bzl b/bazel/rules.bzl
index af272f5..01c432f 100644
--- a/bazel/rules.bzl
+++ b/bazel/rules.bzl
@@ -48,6 +48,10 @@
if not _rule_override("py_binary", **kwargs):
native.py_binary(**kwargs)
+def perfetto_py_library(**kwargs):
+ if not _rule_override("py_library", **kwargs):
+ native.py_library(**kwargs)
+
# +----------------------------------------------------------------------------+
# | Proto-related rules |
# +----------------------------------------------------------------------------+
diff --git a/bazel/standalone/perfetto_cfg.bzl b/bazel/standalone/perfetto_cfg.bzl
index 68a0ead..aef8ba2 100644
--- a/bazel/standalone/perfetto_cfg.bzl
+++ b/bazel/standalone/perfetto_cfg.bzl
@@ -85,6 +85,7 @@
proto_library = None,
py_binary = None,
+ py_library = None,
# We only need this for internal binaries. No other embeedder should
# care about this.
diff --git a/src/trace_processor/python/api_main.py b/src/trace_processor/python/api_main.py
new file mode 100644
index 0000000..cdab397
--- /dev/null
+++ b/src/trace_processor/python/api_main.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python3
+# Copyright (C) 2020 The Android Open Source Project
+#
+# 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
+#
+# http://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.
+
+from trace_processor_http import TraceProcessorHttp
+
+
+def main():
+ tp = TraceProcessorHttp()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/src/trace_processor/python/trace_processor_http.py b/src/trace_processor/python/trace_processor_http.py
new file mode 100644
index 0000000..510d1f8
--- /dev/null
+++ b/src/trace_processor/python/trace_processor_http.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+# Copyright (C) 2020 The Android Open Source Project
+#
+# 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
+#
+# http://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.
+
+
+class TraceProcessorHttp:
+
+ def __init__(self):
+ pass
diff --git a/tools/gen_bazel b/tools/gen_bazel
index ce82c1e..1a6f807 100755
--- a/tools/gen_bazel
+++ b/tools/gen_bazel
@@ -393,6 +393,7 @@
"perfetto_java_lite_proto_library",
"perfetto_proto_library",
"perfetto_py_binary",
+ "perfetto_py_library",
"perfetto_gensignature_internal_only",
)