You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@heron.apache.org by ni...@apache.org on 2022/02/27 06:36:00 UTC
[incubator-heron] 02/02: Updated BUILD files to use platform info
This is an automated email from the ASF dual-hosted git repository.
nicknezis pushed a commit to branch nicknezis/bazel-platforms
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git
commit 7809ea98a0894c95abccd496eff3065f0757203b
Author: Nicholas Nezis <ni...@gmail.com>
AuthorDate: Sun Feb 27 01:33:51 2022 -0500
Updated BUILD files to use platform info
---
heron/common/src/cpp/basics/BUILD | 2 +-
heron/common/src/cpp/metrics/BUILD | 2 +-
third_party/gperftools/gperftools.BUILD | 20 ++-----------
third_party/helm/BUILD | 2 +-
third_party/zookeeper/BUILD | 10 +------
tools/bazel.rc | 50 ++++-----------------------------
tools/platform/BUILD | 36 +++++++++++++++++-------
tools/rules/pex/BUILD | 2 +-
8 files changed, 38 insertions(+), 86 deletions(-)
diff --git a/heron/common/src/cpp/basics/BUILD b/heron/common/src/cpp/basics/BUILD
index 22eb43e..e8d3646 100644
--- a/heron/common/src/cpp/basics/BUILD
+++ b/heron/common/src/cpp/basics/BUILD
@@ -54,7 +54,7 @@ cc_library(
"@com_github_corvusoft_kashmir_cpp//:kashmir-cxx",
"@com_google_protobuf//:protobuf",
] + select({
- "//tools/platform:darwin": [],
+ "@platforms//os:osx": [],
"//conditions:default": ["@org_nongnu_libunwind//:libunwind"],
}),
)
diff --git a/heron/common/src/cpp/metrics/BUILD b/heron/common/src/cpp/metrics/BUILD
index 05bf2cd..dfabd41 100644
--- a/heron/common/src/cpp/metrics/BUILD
+++ b/heron/common/src/cpp/metrics/BUILD
@@ -43,7 +43,7 @@ cc_library(
"@com_github_google_glog//:glog",
"@com_google_protobuf//:protobuf",
] + select({
- "//tools/platform:darwin": [],
+ "@platforms//os:osx": [],
"//conditions:default": ["@org_nongnu_libunwind//:libunwind"],
}),
)
diff --git a/third_party/gperftools/gperftools.BUILD b/third_party/gperftools/gperftools.BUILD
index 6f8d2b7..2f294ed 100644
--- a/third_party/gperftools/gperftools.BUILD
+++ b/third_party/gperftools/gperftools.BUILD
@@ -2,22 +2,6 @@ licenses(["notice"])
package(default_visibility = ["//visibility:public"])
-config_setting(
- name = "darwin",
- values = {
- "cpu": "darwin",
- },
- visibility = ["//visibility:public"],
-)
-
-config_setting(
- name = "k8",
- values = {
- "cpu": "k8",
- },
- visibility = ["//visibility:public"],
-)
-
common_script = [
"export UNWIND_DIR=$$(pwd)/$(GENDIR)/external/org_nongnu_libunwind",
"echo $$UNWIND_DIR",
@@ -43,7 +27,7 @@ linux_script = "\n".join(common_script + [
genrule(
name = "gperftools-srcs",
srcs = select({
- ":darwin": [],
+ "@platforms//os:osx": [],
"//conditions:default": ["@org_apache_heron//third_party/libunwind:libunwind-files"]
}),
outs = [
@@ -77,7 +61,7 @@ genrule(
"lib/libtcmalloc_minimal_debug.a",
],
cmd = select({
- ":darwin": mac_script,
+ "@platforms//os:osx": mac_script,
"//conditions:default": linux_script,
}),
)
diff --git a/third_party/helm/BUILD b/third_party/helm/BUILD
index 9e4a24b..c358176 100644
--- a/third_party/helm/BUILD
+++ b/third_party/helm/BUILD
@@ -5,7 +5,7 @@ package(default_visibility = ["//visibility:public"])
filegroup(
name = "helm",
srcs = select({
- "//tools/platform:darwin": ["@helm_mac//:helm-exec"],
+ "@platforms//os:osx": ["@helm_mac//:helm-exec"],
"//conditions:default": ["@helm_linux//:helm-exec"],
}),
)
diff --git a/third_party/zookeeper/BUILD b/third_party/zookeeper/BUILD
index 456f080..b530784 100644
--- a/third_party/zookeeper/BUILD
+++ b/third_party/zookeeper/BUILD
@@ -20,7 +20,7 @@ genrule(
"lib/libzookeeper_st.a",
],
cmd = select({
- ":darwin": "\n".join([
+ "@platforms//os:osx": "\n".join([
"export INSTALL_DIR=$$(pwd)/$(@D)",
"export TMP_DIR=$$(mktemp -d -t zookeeper.XXXXX)",
"export CXXFLAGS=-Wno-error",
@@ -86,11 +86,3 @@ cc_library(
],
linkstatic = 1,
)
-
-config_setting(
- name = "darwin",
- values = {
- "cpu": "darwin",
- },
- visibility = ["//visibility:public"],
-)
diff --git a/tools/bazel.rc b/tools/bazel.rc
index bdb8537..b91713f 100644
--- a/tools/bazel.rc
+++ b/tools/bazel.rc
@@ -22,48 +22,8 @@ build --ignore_unsupported_sandboxing
build --spawn_strategy=standalone
build --workspace_status_command scripts/release/status.sh
-# For Linux
-# To use it: bazel build --config=linux
-build:linux --experimental_action_listener=tools/cpp:compile_cpp
-build:linux --experimental_action_listener=tools/java:compile_java
-build:linux --experimental_action_listener=tools/python:compile_python
-build:linux --genrule_strategy=standalone
-build:linux --ignore_unsupported_sandboxing
-build:linux --linkopt -lm
-build:linux --linkopt -lpthread
-build:linux --linkopt -lrt
-build:linux --spawn_strategy=standalone
-build:linux --workspace_status_command scripts/release/status.sh
-build:linux --copt=-O3
-
-# For Mac
-# To use it: bazel build --config=darwin
-build:darwin --experimental_action_listener=tools/cpp:compile_cpp
-build:darwin --experimental_action_listener=tools/java:compile_java
-build:darwin --experimental_action_listener=tools/python:compile_python
-build:darwin --genrule_strategy=standalone
-build:darwin --ignore_unsupported_sandboxing
-build:darwin --spawn_strategy=standalone
-build:darwin --workspace_status_command scripts/release/status.sh
-build:darwin --copt=-O3
-
-### Disabled checkstyle
-
-# For Linux
-# To use it: bazel build --config=linux_nostyle
-build:linux_nostyle --genrule_strategy=standalone
-build:linux_nostyle --ignore_unsupported_sandboxing
-build:linux_nostyle --linkopt -lm
-build:linux_nostyle --linkopt -lpthread
-build:linux_nostyle --linkopt -lrt
-build:linux_nostyle --spawn_strategy=standalone
-build:linux_nostyle --workspace_status_command scripts/release/status.sh
-build:linux_nostyle --copt=-O3
-
-# For Mac
-# To use it: bazel build --config=darwin_nostyle
-build:darwin_nostyle --genrule_strategy=standalone
-build:darwin_nostyle --ignore_unsupported_sandboxing
-build:darwin_nostyle --spawn_strategy=standalone
-build:darwin_nostyle --workspace_status_command scripts/release/status.sh
-build:darwin_nostyle --copt=-O3
+# To enable stylecheck
+# To use it: bazel build --config=stylecheck
+build:stylecheck --experimental_action_listener=tools/cpp:compile_cpp
+build:stylecheck --experimental_action_listener=tools/java:compile_java
+build:stylecheck --experimental_action_listener=tools/python:compile_python
diff --git a/tools/platform/BUILD b/tools/platform/BUILD
index d176770..1fea883 100644
--- a/tools/platform/BUILD
+++ b/tools/platform/BUILD
@@ -1,17 +1,33 @@
package(default_visibility = ["//visibility:public"])
-config_setting(
- name = "darwin",
- values = {
- "cpu": "darwin",
- },
- visibility = ["//visibility:public"],
-)
+# config_setting(
+# name = "osx_x86_64",
+# constraint_values = {
+# "@platforms//arch:x86_64",
+# "@platforms//os:osx",
+# },
+# visibility = ["//visibility:public"],
+# )
+
+# config_setting(
+# name = "osx_arm",
+# constraint_values = {
+# "@platforms//arch:armv6-m1",
+# "@platforms//os:osx",
+# },
+# visibility = ["//visibility:public"],
+# )
config_setting(
- name = "k8",
- values = {
- "cpu": "k8",
+ name = "linux_x86_64",
+ constraint_values = {
+ "@platforms//arch:x86_64",
+ "@platforms//os:linux",
},
+ values = {
+ "linkopt": "-lm",
+ "linkopt": "-lpthread",
+ "linkopt": "-lrt",
+ }
visibility = ["//visibility:public"],
)
diff --git a/tools/rules/pex/BUILD b/tools/rules/pex/BUILD
index b2aa361..f3736e4 100644
--- a/tools/rules/pex/BUILD
+++ b/tools/rules/pex/BUILD
@@ -71,7 +71,7 @@ genrule(
],
outs = ["pex_wrapper.pex"],
cmd = select({
- "//tools/platform:darwin": "\n".join(PRE_EXECUTE + DARWIN_EXECUTE + POST_EXECUTE),
+ "@platforms//os:osx": "\n".join(PRE_EXECUTE + DARWIN_EXECUTE + POST_EXECUTE),
"//conditions:default": "\n".join(PRE_EXECUTE + LINUX_EXECUTE + POST_EXECUTE),
}),
executable = True,