This is an automated email from the ASF dual-hosted git repository.

karthikz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git


The following commit(s) were added to refs/heads/master by this push:
     new 5a7faa6  removed glog/gperftools/libevent/libunwind/zookeeper tar.gz 
from source (#2833)
5a7faa6 is described below

commit 5a7faa65200d2fa215301d298b87e69156729104
Author: Karthik Ramasamy <kart...@streaml.io>
AuthorDate: Sun Apr 1 12:53:03 2018 -0700

    removed glog/gperftools/libevent/libunwind/zookeeper tar.gz from source 
(#2833)
    
    * removed glog/gperftools/libevent/libunwind/zookeeper tar.gz from source
    instead all of them are downloaded on the fly and compiled
    WORKSPACE file consists of one entry for each software item and its 
download URL
    
    * fix errors in compilation
    
    * added a default user since in a docker environment root user is not set
    
    * remove package_dir from libunwind srcs
    
    * fix libunwind dependency
    
    * fix ubuntu compilation
    
    * fix unit errors due to workspace name change
    
    * updated the download path for libunwind
    
    * truncate lines greater than 100
---
 WORKSPACE                                          |  37 ++++++++
 heron/common/src/cpp/basics/BUILD                  |   6 +-
 heron/common/src/cpp/metrics/BUILD                 |   7 +-
 heron/common/src/cpp/network/BUILD                 |   2 +-
 heron/common/src/cpp/zookeeper/BUILD               |   2 +-
 .../java/com/twitter/heron/resource/Constants.java |   2 +-
 .../sink/metricscache/MetricsCacheSinkTest.java    |   3 +-
 .../metricsmgr/sink/tmaster/TMasterSinkTest.java   |   3 +-
 .../twitter/heron/spi/common/ConfigLoaderTest.java |   2 +-
 .../localfs/LocalFileSystemConstantsTest.java      |   2 +-
 scripts/release/status.sh                          |   2 +-
 third_party/cereal/cereal.BUILD                    | 101 ---------------------
 third_party/glog/empty.cc                          |   2 -
 third_party/glog/glog-0.3.5.tar.gz                 | Bin 532275 -> 0 bytes
 third_party/glog/{BUILD => glog.BUILD}             |  45 +++++----
 third_party/gperftools/empty.cc                    |   2 -
 third_party/gperftools/gperftools-2.4.tar.gz       | Bin 1346075 -> 0 bytes
 third_party/gperftools/{BUILD => gperftools.BUILD} |  62 ++++++-------
 third_party/libevent/empty.cc                      |   2 -
 third_party/libevent/libevent-2.1.8-stable.tar.gz  | Bin 1026485 -> 0 bytes
 third_party/libevent/{BUILD => libevent.BUILD}     |  24 +----
 third_party/libunwind/BUILD                        |  76 ++--------------
 third_party/libunwind/empty.cc                     |   2 -
 third_party/libunwind/libunwind-1.1.tar.gz         | Bin 1098603 -> 0 bytes
 third_party/libunwind/{BUILD => libunwind.BUILD}   |  42 ++++-----
 third_party/zookeeper/empty.cc                     |   2 -
 third_party/zookeeper/zookeeper-3.4.10.tar.gz      | Bin 35042811 -> 0 bytes
 third_party/zookeeper/{BUILD => zookeeper.BUILD}   |  20 +---
 28 files changed, 140 insertions(+), 308 deletions(-)

diff --git a/WORKSPACE b/WORKSPACE
index 3a59293..b040e43 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -1,3 +1,5 @@
+workspace(name = "org_apache_heron")
+
 # versions shared across artifacts that should be upgraded together
 aws_version = "1.11.58"
 curator_version = "2.9.0"
@@ -810,6 +812,41 @@ http_archive(
 )
 
 new_http_archive(
+    name = "org_libevent_libevent",
+    urls = 
["https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz";],
+    strip_prefix = "libevent-2.1.8-stable",
+    build_file = "third_party/libevent/libevent.BUILD",
+)
+
+new_http_archive(
+    name = "org_nongnu_libunwind",
+    urls = 
["http://download.savannah.nongnu.org/releases/libunwind/libunwind-1.1.tar.gz";],
+    strip_prefix = "libunwind-1.1",
+    build_file = "third_party/libunwind/libunwind.BUILD",
+)
+
+new_http_archive(
+    name = "org_apache_zookeeper",
+    urls = 
["http://apache.cs.utah.edu/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz";],
+    strip_prefix = "zookeeper-3.4.10",
+    build_file = "third_party/zookeeper/zookeeper.BUILD",
+)
+
+new_http_archive(
+    name = "com_github_gperftools_gperftools",
+    urls = 
["https://github.com/gperftools/gperftools/releases/download/gperftools-2.4/gperftools-2.4.tar.gz";],
+    strip_prefix = "gperftools-2.4",
+    build_file = "third_party/gperftools/gperftools.BUILD",
+)
+
+new_http_archive(
+    name = "com_github_google_glog",
+    urls = ["https://github.com/google/glog/archive/v0.3.5.tar.gz";],
+    strip_prefix = "glog-0.3.5",
+    build_file = "third_party/glog/glog.BUILD",
+)
+
+new_http_archive(
     name = "com_google_googletest",
     urls = 
["https://github.com/google/googletest/archive/release-1.8.0.tar.gz";],
     strip_prefix = "googletest-release-1.8.0",
diff --git a/heron/common/src/cpp/basics/BUILD 
b/heron/common/src/cpp/basics/BUILD
index 0c3c682..4e6bcaf 100644
--- a/heron/common/src/cpp/basics/BUILD
+++ b/heron/common/src/cpp/basics/BUILD
@@ -46,14 +46,14 @@ cc_library(
     ],
     deps = [
         "//config:config-cxx",
-        "//third_party/glog:glog-cxx",
+        "@com_github_google_glog//:glog",
         "@com_github_gflags_gflags//:gflags",
-        "//third_party/gperftools:tcmalloc-cxx",
+        "@com_github_gperftools_gperftools//:tcmalloc",
         "//third_party/kashmir:kashmir-cxx",
         "@com_google_protobuf//:protobuf",
     ] + select({
         "//tools/platform:darwin": [], 
-        "//conditions:default": ["//third_party/libunwind:libunwind-cxx"],
+        "//conditions:default": ["@org_nongnu_libunwind//:libunwind"],
     }),
     linkstatic = 1,
 )
diff --git a/heron/common/src/cpp/metrics/BUILD 
b/heron/common/src/cpp/metrics/BUILD
index e7663a1..b101d7a 100644
--- a/heron/common/src/cpp/metrics/BUILD
+++ b/heron/common/src/cpp/metrics/BUILD
@@ -38,8 +38,11 @@ cc_library(
         "//heron/proto:proto-cxx",
         "//heron/common/src/cpp/network:network-cxx",
         "//heron/common/src/cpp/config:config-cxx",
-        "//third_party/glog:glog-cxx",
+        "@com_github_google_glog//:glog",
         "@com_google_protobuf//:protobuf",
-    ],
+    ] + select({
+        "//tools/platform:darwin": [],
+        "//conditions:default": ["@org_nongnu_libunwind//:libunwind"],
+    }),
     linkstatic = 1,
 )
diff --git a/heron/common/src/cpp/network/BUILD 
b/heron/common/src/cpp/network/BUILD
index 56c979e..30c7cef 100644
--- a/heron/common/src/cpp/network/BUILD
+++ b/heron/common/src/cpp/network/BUILD
@@ -46,7 +46,7 @@ cc_library(
         "-I$(GENDIR)/heron/common/src/cpp",
     ],
     deps = [
-        "//third_party/libevent:libevent-cxx",
+        "@org_libevent_libevent//:libevent",
         "//heron/common/src/cpp/threads:threads-cxx",
         "//heron/common/src/cpp/errors:errors-cxx",
         "//heron/common/src/cpp/basics:basics-cxx",
diff --git a/heron/common/src/cpp/zookeeper/BUILD 
b/heron/common/src/cpp/zookeeper/BUILD
index 606b366..c76d130 100644
--- a/heron/common/src/cpp/zookeeper/BUILD
+++ b/heron/common/src/cpp/zookeeper/BUILD
@@ -15,7 +15,7 @@ cc_library(
         "-I$(GENDIR)/heron//common/src/cpp",
     ],
     deps = [
-        "//third_party/zookeeper:zookeeper-cxx",
+        "@org_apache_zookeeper//:zookeeper",
         "//heron/common/src/cpp/network:network-cxx",
         "//heron/common/src/cpp/errors:errors-cxx",
         "//heron/common/src/cpp/basics:basics-cxx",
diff --git 
a/heron/instance/tests/java/com/twitter/heron/resource/Constants.java 
b/heron/instance/tests/java/com/twitter/heron/resource/Constants.java
index dee51ec..390ab37 100644
--- a/heron/instance/tests/java/com/twitter/heron/resource/Constants.java
+++ b/heron/instance/tests/java/com/twitter/heron/resource/Constants.java
@@ -47,7 +47,7 @@ public final class Constants {
   // For bazel, we use the env var to get the path of heron internals config 
file
   public static final String BUILD_TEST_SRCDIR = "TEST_SRCDIR";
   public static final String BUILD_TEST_HERON_INTERNALS_CONFIG_PATH =
-      "/__main__/heron/config/src/yaml/conf/test/test_heron_internals.yaml";
+      
"/org_apache_heron/heron/config/src/yaml/conf/test/test_heron_internals.yaml";
 
   private Constants() {
   }
diff --git 
a/heron/metricsmgr/tests/java/com/twitter/heron/metricsmgr/sink/metricscache/MetricsCacheSinkTest.java
 
b/heron/metricsmgr/tests/java/com/twitter/heron/metricsmgr/sink/metricscache/MetricsCacheSinkTest.java
index bf5a988..6614692 100644
--- 
a/heron/metricsmgr/tests/java/com/twitter/heron/metricsmgr/sink/metricscache/MetricsCacheSinkTest.java
+++ 
b/heron/metricsmgr/tests/java/com/twitter/heron/metricsmgr/sink/metricscache/MetricsCacheSinkTest.java
@@ -85,7 +85,8 @@ public class MetricsCacheSinkTest {
 
     String filePath =
         Paths.get(runFiles,
-                  
"/__main__/heron/config/src/yaml/conf/test/test_heron_internals.yaml").toString();
+                  
"/org_apache_heron/heron/config/src/yaml/conf/test/test_heron_internals.yaml")
+             .toString();
     SystemConfig.Builder sb = SystemConfig.newBuilder(true)
         .putAll(filePath, true)
         .put(SystemConfigKey.HERON_METRICS_EXPORT_INTERVAL, 1);
diff --git 
a/heron/metricsmgr/tests/java/com/twitter/heron/metricsmgr/sink/tmaster/TMasterSinkTest.java
 
b/heron/metricsmgr/tests/java/com/twitter/heron/metricsmgr/sink/tmaster/TMasterSinkTest.java
index fdc3594..93402d2 100644
--- 
a/heron/metricsmgr/tests/java/com/twitter/heron/metricsmgr/sink/tmaster/TMasterSinkTest.java
+++ 
b/heron/metricsmgr/tests/java/com/twitter/heron/metricsmgr/sink/tmaster/TMasterSinkTest.java
@@ -86,7 +86,8 @@ public class TMasterSinkTest {
 
     String filePath =
         Paths.get(runFiles,
-                  
"/__main__/heron/config/src/yaml/conf/test/test_heron_internals.yaml").toString();
+                  
"/org_apache_heron/heron/config/src/yaml/conf/test/test_heron_internals.yaml")
+             .toString();
     SystemConfig.Builder sb = SystemConfig.newBuilder(true)
         .putAll(filePath, true)
         .put(SystemConfigKey.HERON_METRICS_EXPORT_INTERVAL, 1);
diff --git 
a/heron/spi/tests/java/com/twitter/heron/spi/common/ConfigLoaderTest.java 
b/heron/spi/tests/java/com/twitter/heron/spi/common/ConfigLoaderTest.java
index e815dfd..4e28a55 100644
--- a/heron/spi/tests/java/com/twitter/heron/spi/common/ConfigLoaderTest.java
+++ b/heron/spi/tests/java/com/twitter/heron/spi/common/ConfigLoaderTest.java
@@ -38,7 +38,7 @@ import static org.mockito.Mockito.times;
 @PrepareForTest(ConfigLoader.class)
 public class ConfigLoaderTest {
   private static final String TEST_DATA_PATH =
-      "/__main__/heron/spi/tests/java/com/twitter/heron/spi/common/testdata";
+      
"/org_apache_heron/heron/spi/tests/java/com/twitter/heron/spi/common/testdata";
 
   private final String heronHome =
       Paths.get(System.getenv("JAVA_RUNFILES"), TEST_DATA_PATH).toString();
diff --git 
a/heron/uploaders/tests/java/com/twitter/heron/uploader/localfs/LocalFileSystemConstantsTest.java
 
b/heron/uploaders/tests/java/com/twitter/heron/uploader/localfs/LocalFileSystemConstantsTest.java
index deb96cd..2844541 100644
--- 
a/heron/uploaders/tests/java/com/twitter/heron/uploader/localfs/LocalFileSystemConstantsTest.java
+++ 
b/heron/uploaders/tests/java/com/twitter/heron/uploader/localfs/LocalFileSystemConstantsTest.java
@@ -16,7 +16,7 @@ package com.twitter.heron.uploader.localfs;
 
 final class LocalFileSystemConstantsTest {
   public static final String TEST_DATA_PATH =
-      
"/__main__/heron/uploaders/tests/java/com/twitter/heron/uploader/localfs/testdata";
+      
"/org_apache_heron/heron/uploaders/tests/java/com/twitter/heron/uploader/localfs/testdata";
 
   private LocalFileSystemConstantsTest() {
   }
diff --git a/scripts/release/status.sh b/scripts/release/status.sh
index 17d5c64..1418e15 100755
--- a/scripts/release/status.sh
+++ b/scripts/release/status.sh
@@ -78,7 +78,7 @@ echo "HERON_BUILD_TIMESTAMP ${build_timestamp}"
 
 if [ -z ${HERON_BUILD_USER+x} ];
 then
-  build_user=${USER}
+  build_user=${USER:-root}
 else
   build_user=${HERON_BUILD_USER}
 fi
diff --git a/third_party/cereal/cereal.BUILD b/third_party/cereal/cereal.BUILD
index b257597..ec789f3 100644
--- a/third_party/cereal/cereal.BUILD
+++ b/third_party/cereal/cereal.BUILD
@@ -2,107 +2,6 @@ licenses(["notice"])
 
 package(default_visibility = ["//visibility:public"])
 
-pkg_name = "cereal"
-pkg_version = "1.2.2"
-
-package_patch = pkg_name + "-" + pkg_version + ".patch"
-
-file_list = [
-    "include/cereal/access.hpp",
-    "include/cereal/archives/adapters.hpp",
-    "include/cereal/archives/binary.hpp",
-    "include/cereal/archives/json.hpp",
-    "include/cereal/archives/portable_binary.hpp",
-    "include/cereal/archives/xml.hpp",
-    "include/cereal/cereal.hpp",
-    "include/cereal/details/helpers.hpp",
-    "include/cereal/details/polymorphic_impl.hpp",
-    "include/cereal/details/polymorphic_impl_fwd.hpp",
-    "include/cereal/details/static_object.hpp",
-    "include/cereal/details/traits.hpp",
-    "include/cereal/details/util.hpp",
-    "include/cereal/external/base64.hpp",
-    "include/cereal/external/rapidjson/allocators.h",
-    "include/cereal/external/rapidjson/document.h",
-    "include/cereal/external/rapidjson/encodedstream.h",
-    "include/cereal/external/rapidjson/encodings.h",
-    "include/cereal/external/rapidjson/error/en.h",
-    "include/cereal/external/rapidjson/error/error.h",
-    "include/cereal/external/rapidjson/filereadstream.h",
-    "include/cereal/external/rapidjson/filewritestream.h",
-    "include/cereal/external/rapidjson/fwd.h",
-    "include/cereal/external/rapidjson/internal/biginteger.h",
-    "include/cereal/external/rapidjson/internal/diyfp.h",
-    "include/cereal/external/rapidjson/internal/dtoa.h",
-    "include/cereal/external/rapidjson/internal/ieee754.h",
-    "include/cereal/external/rapidjson/internal/itoa.h",
-    "include/cereal/external/rapidjson/internal/meta.h",
-    "include/cereal/external/rapidjson/internal/pow10.h",
-    "include/cereal/external/rapidjson/internal/regex.h",
-    "include/cereal/external/rapidjson/internal/stack.h",
-    "include/cereal/external/rapidjson/internal/strfunc.h",
-    "include/cereal/external/rapidjson/internal/strtod.h",
-    "include/cereal/external/rapidjson/internal/swap.h",
-    "include/cereal/external/rapidjson/istreamwrapper.h",
-    "include/cereal/external/rapidjson/memorybuffer.h",
-    "include/cereal/external/rapidjson/memorystream.h",
-    "include/cereal/external/rapidjson/msinttypes/inttypes.h",
-    "include/cereal/external/rapidjson/msinttypes/stdint.h",
-    "include/cereal/external/rapidjson/ostreamwrapper.h",
-    "include/cereal/external/rapidjson/pointer.h",
-    "include/cereal/external/rapidjson/prettywriter.h",
-    "include/cereal/external/rapidjson/rapidjson.h",
-    "include/cereal/external/rapidjson/reader.h",
-    "include/cereal/external/rapidjson/schema.h",
-    "include/cereal/external/rapidjson/stream.h",
-    "include/cereal/external/rapidjson/stringbuffer.h",
-    "include/cereal/external/rapidjson/writer.h",
-    "include/cereal/external/rapidxml/rapidxml.hpp",
-    "include/cereal/external/rapidxml/rapidxml_iterators.hpp",
-    "include/cereal/external/rapidxml/rapidxml_print.hpp",
-    "include/cereal/external/rapidxml/rapidxml_utils.hpp",
-    "include/cereal/macros.hpp",
-    "include/cereal/types/array.hpp",
-    "include/cereal/types/base_class.hpp",
-    "include/cereal/types/bitset.hpp",
-    "include/cereal/types/chrono.hpp",
-    "include/cereal/types/common.hpp",
-    "include/cereal/types/complex.hpp",
-    "include/cereal/types/concepts/pair_associative_container.hpp",
-    "include/cereal/types/deque.hpp",
-    "include/cereal/types/forward_list.hpp",
-    "include/cereal/types/functional.hpp",
-    "include/cereal/types/list.hpp",
-    "include/cereal/types/map.hpp",
-    "include/cereal/types/memory.hpp",
-    "include/cereal/types/polymorphic.hpp",
-    "include/cereal/types/queue.hpp",
-    "include/cereal/types/set.hpp",
-    "include/cereal/types/stack.hpp",
-    "include/cereal/types/string.hpp",
-    "include/cereal/types/tuple.hpp",
-    "include/cereal/types/unordered_map.hpp",
-    "include/cereal/types/unordered_set.hpp",
-    "include/cereal/types/utility.hpp",
-    "include/cereal/types/valarray.hpp",
-    "include/cereal/types/vector.hpp",
-]
-
-#genrule(
-#    name = "cereal-srcs",
-#    srcs = [package_patch],
-#    outs = ["empty.cc"],
-#    cmd = "\n".join([
-#        "export WORKSPACE_ROOT=$$(pwd)",
-#        "export INSTALL_DIR=$$(pwd)/$(@D)",
-#        "patch -d  -p1 < " + "$$WORKSPACE_ROOT/third_party/cereal/" + 
package_patch,
-#        "rm -f include/cereal/types/boost_variant.hpp",
-#        "rm -f unittests/boost_variant.cpp",
-#        "rm -f unittests/boost_variant.hpp",
-#        "touch empty.cc",
-#    ]),
-#)
-
 cc_library(
     name = "cereal-cxx",
     hdrs = glob(["include/cereal/**/*.hpp"]) + glob(["include/cereal/**/*.h"]),
diff --git a/third_party/glog/empty.cc b/third_party/glog/empty.cc
deleted file mode 100644
index b97c6f4..0000000
--- a/third_party/glog/empty.cc
+++ /dev/null
@@ -1,2 +0,0 @@
-void _empty_glog_xyz() {
-}
diff --git a/third_party/glog/glog-0.3.5.tar.gz 
b/third_party/glog/glog-0.3.5.tar.gz
deleted file mode 100644
index d4e2845..0000000
Binary files a/third_party/glog/glog-0.3.5.tar.gz and /dev/null differ
diff --git a/third_party/glog/BUILD b/third_party/glog/glog.BUILD
similarity index 69%
rename from third_party/glog/BUILD
rename to third_party/glog/glog.BUILD
index 870a4cf..7a5507a 100644
--- a/third_party/glog/BUILD
+++ b/third_party/glog/glog.BUILD
@@ -2,11 +2,21 @@ licenses(["notice"])
 
 package(default_visibility = ["//visibility:public"])
 
-pkg_name = "glog"
-pkg_version = "0.3.5"
+config_setting(
+    name = "darwin",
+    values = {
+        "cpu": "darwin",
+    },
+    visibility = ["//visibility:public"],
+)
 
-package_file = pkg_name + "-" + pkg_version + ".tar.gz"
-package_dir = pkg_name + "-" + pkg_version
+config_setting(
+    name = "k8",
+    values = {
+        "cpu": "k8",
+    },
+    visibility = ["//visibility:public"],
+)
 
 include_files = [
     "include/glog/log_severity.h",
@@ -21,14 +31,13 @@ lib_files = [
 ]
 
 common_script = [
-    'export UNWIND_DIR=$$(pwd)/$(GENDIR)/third_party/libunwind',
+    'export UNWIND_DIR=$$(pwd)/$(GENDIR)/external/org_nongnu_libunwind',
+    'echo $$UNWIND_DIR',
     'export INSTALL_DIR=$$(pwd)/$(@D)',
     'export TMP_DIR=$$(mktemp -d -t glog.XXXXX)',
     'mkdir -p $$TMP_DIR',
-    'cp -R $(SRCS) $$TMP_DIR',
+    'cp -R $$(pwd)/external/com_github_google_glog/* $$TMP_DIR', 
     'cd $$TMP_DIR',
-    'tar xfz ' + package_file,
-    'cd ' + package_dir,
 ]
 
 mac_script = "\n".join(common_script + [
@@ -49,22 +58,19 @@ linux_script = "\n".join(common_script + [
 genrule(
     name = "glog-srcs",
     srcs = select({
-        "//tools/platform:darwin": [package_file],
-        "//conditions:default": [
-            package_file,
-            "//third_party/libunwind:libunwind-files",
-         ]
+        ":darwin": [],
+        "//conditions:default": 
["@org_apache_heron//third_party/libunwind:libunwind-files"]
     }),
     outs = include_files + lib_files,
     cmd = select({
-        "//tools/platform:darwin": mac_script,
+        ":darwin": mac_script,
         "//conditions:default": linux_script,
     }),
 )
 
 cc_library(
-    name = "glog-cxx",
-    srcs = ["empty.cc"] + lib_files,
+    name = "glog",
+    srcs = lib_files,
     hdrs = include_files,
     includes = [
         "include",
@@ -73,13 +79,6 @@ cc_library(
 )
 
 filegroup(
-    name = "glog",
-    srcs = [
-        ":glog-cxx",
-    ]
-)
-
-filegroup(
     name = "glog-files",
     srcs = include_files + lib_files
 )
diff --git a/third_party/gperftools/empty.cc b/third_party/gperftools/empty.cc
deleted file mode 100644
index c3b3b99..0000000
--- a/third_party/gperftools/empty.cc
+++ /dev/null
@@ -1,2 +0,0 @@
-void _empty_gperftools_xyz() {
-}
diff --git a/third_party/gperftools/gperftools-2.4.tar.gz 
b/third_party/gperftools/gperftools-2.4.tar.gz
deleted file mode 100644
index 64374fc..0000000
Binary files a/third_party/gperftools/gperftools-2.4.tar.gz and /dev/null differ
diff --git a/third_party/gperftools/BUILD 
b/third_party/gperftools/gperftools.BUILD
similarity index 69%
rename from third_party/gperftools/BUILD
rename to third_party/gperftools/gperftools.BUILD
index f492644..574e1d6 100644
--- a/third_party/gperftools/BUILD
+++ b/third_party/gperftools/gperftools.BUILD
@@ -2,30 +2,39 @@ licenses(["notice"])
 
 package(default_visibility = ["//visibility:public"])
 
-pkg_name = "gperftools"
-pkg_version = "2.4"
+config_setting(
+    name = "darwin",
+    values = {
+        "cpu": "darwin",
+    },
+    visibility = ["//visibility:public"],
+)
 
-package_file = pkg_name + "-" + pkg_version + ".tar.gz"
-package_dir = pkg_name + "-" + pkg_version
+config_setting(
+    name = "k8",
+    values = {
+        "cpu": "k8",
+    },
+    visibility = ["//visibility:public"],
+)
 
-COMMON_EXECUTE = [
-    "export UNWIND_DIR=$$(pwd)/$(GENDIR)/third_party/libunwind",
+common_script = [
+    "export UNWIND_DIR=$$(pwd)/$(GENDIR)/external/org_nongnu_libunwind",
+    "echo $$UNWIND_DIR",
     "export INSTALL_DIR=$$(pwd)/$(@D)",
     "export TMP_DIR=$$(mktemp -d -t gperftools.XXXXX)",
     "mkdir -p $$TMP_DIR",
-    "cp -R $(SRCS) $$TMP_DIR",
+    "cp -R $$(pwd)/external/com_github_gperftools_gperftools/* $$TMP_DIR",
     "cd $$TMP_DIR",
-    "tar xfz " + package_file,
-    "cd " + package_dir,
 ]
 
-DARWIN_EXECUTE = "\n".join(COMMON_EXECUTE + [
+mac_script = "\n".join(common_script + [
     "./configure --prefix=$$INSTALL_DIR --enable-shared=no",
     "make install",
     "rm -rf $$TMP_DIR",
 ])
 
-LINUX_EXECUTE = "\n".join(COMMON_EXECUTE + [
+linux_script = "\n".join(common_script + [
      './configure --prefix=$$INSTALL_DIR --enable-shared=no 
CPPFLAGS=-I$$UNWIND_DIR/include LDFLAGS="-L$$UNWIND_DIR/lib -lunwind" 
--enable-frame-pointers',
      'make install CPPFLAGS=-I$$UNWIND_DIR/include LDFLAGS="-L$$UNWIND_DIR/lib 
-lunwind"',
      'rm -rf $$TMP_DIR',
@@ -34,11 +43,8 @@ LINUX_EXECUTE = "\n".join(COMMON_EXECUTE + [
 genrule(
     name = "gperftools-srcs",
     srcs = select({
-        "//tools/platform:darwin": [package_file],
-        "//conditions:default": [
-            package_file,
-            "//third_party/libunwind:libunwind-files",
-         ]
+        ":darwin": [],
+        "//conditions:default": 
["@org_apache_heron//third_party/libunwind:libunwind-files"]
     }),
     outs = [
         "bin/pprof",
@@ -71,17 +77,14 @@ genrule(
         "lib/libtcmalloc_minimal_debug.a",
     ],
     cmd = select({
-        "//tools/platform:darwin": DARWIN_EXECUTE,
-        "//conditions:default": LINUX_EXECUTE,
+        ":darwin": mac_script,
+        "//conditions:default": linux_script,
     }),
 )
 
 cc_library(
-    name = "tcmalloc-cxx",
-    srcs = [
-        "empty.cc",
-        "lib/libtcmalloc.a",
-    ],
+    name = "tcmalloc",
+    srcs = ["lib/libtcmalloc.a"],
     hdrs = [
         "include/gperftools/tcmalloc.h",
         "include/gperftools/malloc_extension.h",
@@ -94,11 +97,8 @@ cc_library(
 )
 
 cc_library(
-    name = "profiler-cxx",
-    srcs = [
-        "empty.cc",
-        "lib/libprofiler.a",
-    ],
+    name = "profiler",
+    srcs = ["lib/libprofiler.a"],
     hdrs = [
         "include/gperftools/profiler.h",
     ],
@@ -107,10 +107,10 @@ cc_library(
 )
 
 filegroup(
-    name = "gperftools",
+    name = "gperftools-files",
     srcs = [
         "bin/pprof",
-        ":profiler-cxx",
-        ":tcmalloc-cxx",
+        ":profiler",
+        ":tcmalloc",
     ],
 )
diff --git a/third_party/libevent/empty.cc b/third_party/libevent/empty.cc
deleted file mode 100644
index 932fe13..0000000
--- a/third_party/libevent/empty.cc
+++ /dev/null
@@ -1,2 +0,0 @@
-void _empty_libevent_xyz() {
-}
diff --git a/third_party/libevent/libevent-2.1.8-stable.tar.gz 
b/third_party/libevent/libevent-2.1.8-stable.tar.gz
deleted file mode 100644
index 2004f84..0000000
Binary files a/third_party/libevent/libevent-2.1.8-stable.tar.gz and /dev/null 
differ
diff --git a/third_party/libevent/BUILD b/third_party/libevent/libevent.BUILD
similarity index 80%
rename from third_party/libevent/BUILD
rename to third_party/libevent/libevent.BUILD
index 6e19c4a..b708b28 100644
--- a/third_party/libevent/BUILD
+++ b/third_party/libevent/libevent.BUILD
@@ -2,12 +2,6 @@ licenses(["notice"])
 
 package(default_visibility = ["//visibility:public"])
 
-pkg_name = "libevent"
-pkg_version = "2.1.8-stable"
-
-package_file = pkg_name + "-" + pkg_version + ".tar.gz"
-package_dir = pkg_name + "-" + pkg_version
-
 include_files = [
     "include/evdns.h",
     "include/event.h",
@@ -51,18 +45,13 @@ lib_files = [
 
 genrule(
     name = "libevent-srcs",
-    srcs = [
-        package_file, 
-    ],
     outs = include_files + lib_files,
     cmd = "\n".join([
         'export INSTALL_DIR=$$(pwd)/$(@D)',
         'export TMP_DIR=$$(mktemp -d -t libevent.XXXXX)',
         'mkdir -p $$TMP_DIR',
-        'cp -R $(SRCS) $$TMP_DIR',
+        'cp -R $$(pwd)/external/org_libevent_libevent/* $$TMP_DIR',
         'cd $$TMP_DIR',
-        'tar xfz ' + package_file,
-        'cd ' + package_dir,
         './configure --prefix=$$INSTALL_DIR --enable-shared=no 
--disable-openssl',
         'make install',
         'rm -rf $$TMP_DIR',
@@ -70,15 +59,10 @@ genrule(
 )
 
 cc_library(
-    name = "libevent-cxx",
-    srcs = [ 
-        "empty.cc",
-        "lib/libevent.a",
-    ],
+    name = "libevent",
+    srcs = ["lib/libevent.a"],
     hdrs = include_files,
-    includes = [ 
-        "include",
-    ],  
+    includes = ["include"],  
     linkstatic = 1,
 )
 
diff --git a/third_party/libunwind/BUILD b/third_party/libunwind/BUILD
index 4f56e5f..9c73b70 100644
--- a/third_party/libunwind/BUILD
+++ b/third_party/libunwind/BUILD
@@ -1,75 +1,13 @@
-licenses(["notice"])
-
 package(default_visibility = ["//visibility:public"])
 
-pkg_name = "libunwind"
-pkg_version = "1.1"
-
-package_file = pkg_name + "-" + pkg_version + ".tar.gz"
-package_dir = pkg_name + "-" + pkg_version
-lzma_patch = "libunwind-1.1-lzma-link.patch"
-config_patch = "libunwind-1.1-config.patch"
-cache_patch = "libunwind-1.1-cache.patch"
-
-
-out_files = [
-    "include/libunwind-common.h",
-    "include/libunwind-coredump.h",
-    "include/libunwind-dynamic.h",
-    "include/libunwind.h",
-    "include/libunwind-ptrace.h",
-    "include/libunwind-x86_64.h",
-    "include/unwind.h",
-    "lib/libunwind.a",
-    "lib/libunwind-coredump.a",
-    "lib/libunwind-ptrace.a",
-    "lib/libunwind-setjmp.a",
-    "lib/libunwind-x86_64.a",
-]
-
-genrule(
-    name = "libunwind-srcs",
-    srcs = [
-        package_file,
-        lzma_patch,
-        config_patch,
-        cache_patch
-    ],
-    outs = out_files,
-    cmd = "\n".join([
-        "export INSTALL_DIR=$$(pwd)/$(@D)",
-        "export TMP_DIR=$$(mktemp -d -t libunwind.XXXXX)",
-        "mkdir -p $$TMP_DIR",
-        "cp -R $(SRCS) $$TMP_DIR",
-        "cd $$TMP_DIR",
-        "tar xfz " + package_file,
-        "patch -d " + package_dir + " -p1 < " + lzma_patch,
-        "patch -d " + package_dir + " -p0 < " + config_patch,
-        "patch -d " + package_dir + " -p0 < " + cache_patch,
-        "cd " + package_dir,
-        "./configure --prefix=$$INSTALL_DIR --enable-shared=no 
--disable-minidebuginfo",
-        "make install",
-        "rm -rf $$TMP_DIR",
-    ]),
-)
-
-cc_library(
-    name = "libunwind-cxx",
-    srcs = [
-        "include/libunwind.h",
-        "empty.cc",
-        "lib/libunwind.a",
-    ],
-    hdrs = [
-        "include/libunwind.h",
-    ],
-    includes = [
-        "include",
-    ],
-    linkstatic = 1,
-)
+exports_files([
+    "libunwind-1.1-cache.patch",
+    "libunwind-1.1-config.patch",
+    "libunwind-1.1-lzma-link.patch",
+    "libunwind.BUILD",
+])
 
 filegroup(
     name = "libunwind-files",
-    srcs = out_files,
+    srcs = ["@org_nongnu_libunwind//:libunwind-files"],
 )
diff --git a/third_party/libunwind/empty.cc b/third_party/libunwind/empty.cc
deleted file mode 100644
index 4616e73..0000000
--- a/third_party/libunwind/empty.cc
+++ /dev/null
@@ -1,2 +0,0 @@
-void _empty_libunwind_xyz() {
-}
diff --git a/third_party/libunwind/libunwind-1.1.tar.gz 
b/third_party/libunwind/libunwind-1.1.tar.gz
deleted file mode 100644
index 5dc4fc7..0000000
Binary files a/third_party/libunwind/libunwind-1.1.tar.gz and /dev/null differ
diff --git a/third_party/libunwind/BUILD b/third_party/libunwind/libunwind.BUILD
similarity index 56%
copy from third_party/libunwind/BUILD
copy to third_party/libunwind/libunwind.BUILD
index 4f56e5f..d4b7470 100644
--- a/third_party/libunwind/BUILD
+++ b/third_party/libunwind/libunwind.BUILD
@@ -2,16 +2,10 @@ licenses(["notice"])
 
 package(default_visibility = ["//visibility:public"])
 
-pkg_name = "libunwind"
-pkg_version = "1.1"
-
-package_file = pkg_name + "-" + pkg_version + ".tar.gz"
-package_dir = pkg_name + "-" + pkg_version
 lzma_patch = "libunwind-1.1-lzma-link.patch"
 config_patch = "libunwind-1.1-config.patch"
 cache_patch = "libunwind-1.1-cache.patch"
 
-
 out_files = [
     "include/libunwind-common.h",
     "include/libunwind-coredump.h",
@@ -27,26 +21,31 @@ out_files = [
     "lib/libunwind-x86_64.a",
 ]
 
+exports_files([
+    "libunwind-1.1-cache.patch",
+    "libunwind-1.1-config.patch",
+    "libunwind-1.1-lzma-link.patch",
+    "libunwind.BUILD",
+])
+
 genrule(
     name = "libunwind-srcs",
     srcs = [
-        package_file,
-        lzma_patch,
-        config_patch,
-        cache_patch
+        "@org_apache_heron//third_party/libunwind:libunwind-1.1-cache.patch",
+        "@org_apache_heron//third_party/libunwind:libunwind-1.1-config.patch",
+        
"@org_apache_heron//third_party/libunwind:libunwind-1.1-lzma-link.patch",
     ],
     outs = out_files,
     cmd = "\n".join([
+        "export SOURCE_DIR=$$(pwd)",
         "export INSTALL_DIR=$$(pwd)/$(@D)",
         "export TMP_DIR=$$(mktemp -d -t libunwind.XXXXX)",
         "mkdir -p $$TMP_DIR",
-        "cp -R $(SRCS) $$TMP_DIR",
+        "cp -LR $$(pwd)/external/org_nongnu_libunwind/* $$TMP_DIR",
         "cd $$TMP_DIR",
-        "tar xfz " + package_file,
-        "patch -d " + package_dir + " -p1 < " + lzma_patch,
-        "patch -d " + package_dir + " -p0 < " + config_patch,
-        "patch -d " + package_dir + " -p0 < " + cache_patch,
-        "cd " + package_dir,
+        "patch -p1 < $$SOURCE_DIR/$(location 
@org_apache_heron//third_party/libunwind:libunwind-1.1-lzma-link.patch)",
+        "patch -p0 < $$SOURCE_DIR/$(location 
@org_apache_heron//third_party/libunwind:libunwind-1.1-config.patch)",
+        "patch -p0 < $$SOURCE_DIR/$(location 
@org_apache_heron//third_party/libunwind:libunwind-1.1-cache.patch)",
         "./configure --prefix=$$INSTALL_DIR --enable-shared=no 
--disable-minidebuginfo",
         "make install",
         "rm -rf $$TMP_DIR",
@@ -54,18 +53,13 @@ genrule(
 )
 
 cc_library(
-    name = "libunwind-cxx",
+    name = "libunwind",
     srcs = [
         "include/libunwind.h",
-        "empty.cc",
         "lib/libunwind.a",
     ],
-    hdrs = [
-        "include/libunwind.h",
-    ],
-    includes = [
-        "include",
-    ],
+    hdrs = ["include/libunwind.h"],
+    includes = ["include"],
     linkstatic = 1,
 )
 
diff --git a/third_party/zookeeper/empty.cc b/third_party/zookeeper/empty.cc
deleted file mode 100644
index 670c620..0000000
--- a/third_party/zookeeper/empty.cc
+++ /dev/null
@@ -1,2 +0,0 @@
-void _empty_zookeeper_xyz() {
-}
diff --git a/third_party/zookeeper/zookeeper-3.4.10.tar.gz 
b/third_party/zookeeper/zookeeper-3.4.10.tar.gz
deleted file mode 100644
index 1c2dcdb..0000000
Binary files a/third_party/zookeeper/zookeeper-3.4.10.tar.gz and /dev/null 
differ
diff --git a/third_party/zookeeper/BUILD b/third_party/zookeeper/zookeeper.BUILD
similarity index 79%
rename from third_party/zookeeper/BUILD
rename to third_party/zookeeper/zookeeper.BUILD
index c227d14..bf287c5 100644
--- a/third_party/zookeeper/BUILD
+++ b/third_party/zookeeper/zookeeper.BUILD
@@ -2,17 +2,8 @@ licenses(["notice"])
 
 package(default_visibility = ["//visibility:public"])
 
-pkg_name = "zookeeper"
-pkg_version = "3.4.10"
-
-package_file = pkg_name + "-" + pkg_version + ".tar.gz"
-package_dir = pkg_name + "-" + pkg_version
-
 genrule(
     name = "zookeeper-srcs",
-    srcs = [
-        package_file, 
-    ],
     outs = [
 
         "bin/cli_mt",
@@ -33,12 +24,9 @@ genrule(
     cmd = "\n".join([
         "export INSTALL_DIR=$$(pwd)/$(@D)",
         "export TMP_DIR=$$(mktemp -d -t zookeeper.XXXXX)",
-        "echo $$INSTALL_DIR",
         "mkdir -p $$TMP_DIR",
-        "cp -R $(SRCS) $$TMP_DIR",
-        "cd $$TMP_DIR",
-        "tar xfz " + package_file,
-        "cd " + package_dir + "/src/c",
+        "cp -R $$(pwd)/external/org_apache_zookeeper/* $$TMP_DIR",
+        "cd $$TMP_DIR/src/c",
         "./configure --prefix=$$INSTALL_DIR --enable-shared=no",
         "make install",
         "rm -rf $$TMP_DIR",
@@ -48,7 +36,6 @@ genrule(
 cc_library(
     name = "zookeeper_st-cxx",
     srcs = [
-        "empty.cc",
         "lib/libzookeeper_st.a",
         "include/zookeeper/proto.h",
         "include/zookeeper/recordio.h",
@@ -66,9 +53,8 @@ cc_library(
 )
 
 cc_library(
-    name = "zookeeper-cxx",
+    name = "zookeeper",
     srcs = [
-        "empty.cc",
         "lib/libzookeeper_mt.a",
         "include/zookeeper/proto.h",
         "include/zookeeper/recordio.h",

-- 
To stop receiving notification emails like this one, please contact
karth...@apache.org.

Reply via email to