Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

#816 compile heron with bazel 0.2.3 #869

Merged
merged 31 commits into from
Jun 22, 2016
Merged

#816 compile heron with bazel 0.2.3 #869

merged 31 commits into from
Jun 22, 2016

Conversation

caofangkun
Copy link
Contributor

Since Bazel Release 0.1.5 (2016-02-05)

"Repository rules must use names that are valid workspace names.", see: bazelbuild/bazel#874

➜  heron git:(master) ✗ bazel version 
Build label: 0.2.3
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue May 17 14:21:13 2016 (1463494873)
Build timestamp: 1463494873
Build timestamp as int: 1463494873

@@ -6,90 +6,90 @@ java_library(
name = "aws-java-sdk",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. In order for the travis ci to compile correctly, you need to download bazel 0.2.3 in the .travis.yml
https://github.com/twitter/heron/blob/master/.travis.yml

Can you make the changes and update the PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kramasamy I have fixed this bug.

The Travis CI still not pass yet, I will get into the root of the matter to find out why.

@kramasamy
Copy link
Contributor

kramasamy commented Jun 14, 2016

@caofangkun - When I looked the log of travis ci, it seems to failing in pants. I was wondering if you could enable some logs so that we can identify why the error message is being issued.

Based on @billonahill comments - I recommend add some debugging to see what file isn't being copied, or to set should_log to return True in tracer.py

@kramasamy kramasamy changed the title #816 complie heron with bazel 0.2.3 #816 compile heron with bazel 0.2.3 Jun 15, 2016
@taishi8117
Copy link
Contributor

@caofangkun We've figured out that Bazel made some internal changes with handling Python scripts, which seem to have caused the travis failure. The following diff should fix this issue.

diff --git a/3rdparty/pex/_pex.py b/3rdparty/pex/_pex.py
index 14e1ffe..a0c4f3b 100644
--- a/3rdparty/pex/_pex.py
+++ b/3rdparty/pex/_pex.py
@@ -20,7 +20,7 @@ if not zipfile.is_zipfile(sys.argv[0]):
     sys.modules.pop('twitter.common.python', None)

     root = os.path.join(
-        os.sep.join(__file__.split(os.sep)[:-6]), '3rdparty/pex/_pex.runfiles/3rdparty')
+        os.sep.join(__file__.split(os.sep)[:-6]), 'pex/_pex.runfiles/__main__/3rdparty')
     sys.path.insert(0, os.path.join(root, 'pex'))
     sys.path.insert(0, os.path.join(root, 'setuptools'))
     setuptools_py =  os.path.join(root, 'setuptools')

Additionally, the following modifications may be necessary.

diff --git a/scripts/packages/BUILD b/scripts/packages/BUILD
index a990e75..4779d77 100644
--- a/scripts/packages/BUILD
+++ b/scripts/packages/BUILD
@@ -1,7 +1,6 @@
 package(default_visibility = ["//visibility:public"])

-load("/tools/build_defs/pkg/pkg", "pkg_tar")
-load("/tools/build_defs/pkg/pkg", "pkg_deb")
+load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar", "pkg_deb")
diff --git a/tools/java/BUILD b/tools/java/BUILD
index 3a099b8..74a39b4 100644
--- a/tools/java/BUILD
+++ b/tools/java/BUILD
@@ -9,7 +9,7 @@ java_toolchain(
     target_version = "7",
     bootclasspath = ["@bazel_tools//tools/jdk:bootclasspath"],
     extclasspath = ["@bazel_tools//tools/jdk:extdir"],
-    javac = ["@bazel_tools//tools/jdk:javac"],
+    javac = ["@bazel_tools//third_party/java/jdk/langtools:javac_jar"],
     javabuilder = ["@bazel_tools//tools/jdk:JavaBuilder_deploy.jar"],
     singlejar = ["@bazel_tools//tools/jdk:SingleJar_deploy.jar"],
     genclass = ["@bazel_tools//tools/jdk:GenClass_deploy.jar"],

@kramasamy
Copy link
Contributor

I am also getting this warnings -

bazel build --config=ubuntu heron/...
WARNING: /Users/kramasamy/workspace/heron24/3rdparty/zookeeper/BUILD:82:16: in includes attribute of cc_library rule //3rdparty/zookeeper:zookeeper-cxx: 'include' resolves to '3rdparty/zookeeper/include' not in 'third_party'. This will be an error in the future.
WARNING: /Users/kramasamy/workspace/heron24/3rdparty/libevent/BUILD:100:16: in includes attribute of cc_library rule //3rdparty/libevent:libevent-cxx: 'include' resolves to '3rdparty/libevent/include' not in 'third_party'. This will be an error in the future.
WARNING: /Users/kramasamy/workspace/heron24/3rdparty/gflags/BUILD:49:16: in includes attribute of cc_library rule //3rdparty/gflags:gflags-cxx: 'include' resolves to '3rdparty/gflags/include' not in 'third_party'. This will be an error in the future.
WARNING: /Users/kramasamy/workspace/heron24/3rdparty/gtest/BUILD:94:16: in includes attribute of cc_library rule //3rdparty/gtest:gtest-cxx: 'include' resolves to '3rdparty/gtest/include' not in 'third_party'. This will be an error in the future.
WARNING: /Users/kramasamy/workspace/heron24/3rdparty/gperftools/BUILD:71:16: in includes attribute of cc_library rule //3rdparty/gperftools:tcmalloc-cxx: 'include' resolves to '3rdparty/gperftools/include' not in 'third_party'. This will be an error in the future.
WARNING: /Users/kramasamy/workspace/heron24/3rdparty/jansson/BUILD:46:16: in includes attribute of cc_library rule //3rdparty/jansson:jansson-cxx: 'include' resolves to '3rdparty/jansson/include' not in 'third_party'. This will be an error in the future.
WARNING: /Users/kramasamy/workspace/heron24/3rdparty/gmock/BUILD:83:16: in includes attribute of cc_library rule //3rdparty/gmock:gmock-cxx: 'include' resolves to '3rdparty/gmock/include' not in 'third_party'. This will be an error in the future.
WARNING: /Users/kramasamy/workspace/heron24/3rdparty/glog/BUILD:54:16: in includes attribute of cc_library rule //3rdparty/glog:glog-cxx: 'include' resolves to '3rdparty/glog/include' not in 'third_party'. This will be an error in the future.
WARNING: /Users/kramasamy/workspace/heron24/3rdparty/protobuf/BUILD:141:16: in includes attribute of cc_library rule //3rdparty/protobuf:protobuf-cxx: 'include' resolves to '3rdparty/protobuf/include' not in 'third_party'. This will be an error in the future.
WARNING: /Users/kramasamy/workspace/heron24/3rdparty/yaml-cpp/BUILD:127:16: in includes attribute of cc_library rule //3rdparty/yaml-cpp:yaml-cxx: 'include' resolves to '3rdparty/yaml-cpp/include' not in 'third_party'. This will be an error in the future.

@kramasamy
Copy link
Contributor

kramasamy commented Jun 16, 2016

When I looked at the travis-ci logs, it seems to be failing with java tests and looking at each of the logs shows the following -

exec ${PAGER:-/usr/bin/less} "$0" || exit 1
-----------------------------------------------------------------------------
Class not found: [rotating-map_unittest]

BazelTestRunner exiting with a return value of 2
JVM shutdown hooks (if any) will run now.
The JVM will exit once they complete.

-- JVM shutdown starting at 2016-06-16 04:33:10 --

@caofangkun
Copy link
Contributor Author

Since Bazel 0.2.3, Bazel warns if a cc rule's includes attribute points out of third_party
bazelbuild/bazel@f0a1884

@taishi8117
Copy link
Contributor

Bazel team is working on this issue -- they might remove these warnings as well.
bazelbuild/bazel#1286

@taishi8117
Copy link
Contributor

taishi8117 commented Jun 16, 2016

For unit tests failure, it seems because of Bazel's change in java_test behavior since 0.2.1.
bazelbuild/bazel#1017

@taishi8117
Copy link
Contributor

taishi8117 commented Jun 16, 2016

@caofangkun Since Bazel's internal test structure changed, the pull from #938 (already merged to master) and the following changes are also necessary, which should resolve the unit test failures in Travis.

diff --git a/heron/common/tests/java/com/twitter/heron/common/config/Constants.java b/heron/common/tests/java/com/twitter/heron/common/config/Constants.java
index bd13b68..db1ed1e 100644
--- a/heron/common/tests/java/com/twitter/heron/common/config/Constants.java
+++ b/heron/common/tests/java/com/twitter/heron/common/config/Constants.java
@@ -24,7 +24,7 @@ public final class Constants {
   public static final String LAUNCHER_CLASS_KEY = "heron.launcher.class";

   public static final String TEST_DATA_PATH =
-      "/heron/common/tests/java/com/twitter/heron/common/config/testdata";
+      "/__main__/heron/common/tests/java/com/twitter/heron/common/config/testdata";

   private Constants() {
   }
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 cd8b8d1..dadef82 100644
--- a/heron/instance/tests/java/com/twitter/heron/resource/Constants.java
+++ b/heron/instance/tests/java/com/twitter/heron/resource/Constants.java
@@ -41,7 +41,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 =
-      "/heron/config/src/yaml/conf/test/test_heron_internals.yaml";
+      "/__main__/heron/config/src/yaml/conf/test/test_heron_internals.yaml";

   private Constants() {
   }
diff --git a/heron/spi/tests/java/com/twitter/heron/spi/common/TestConstants.java b/heron/spi/tests/java/com/twitter/heron/spi/common/TestConstants.java
index f968363..cc2cd59 100644
--- a/heron/spi/tests/java/com/twitter/heron/spi/common/TestConstants.java
+++ b/heron/spi/tests/java/com/twitter/heron/spi/common/TestConstants.java
@@ -16,7 +16,7 @@ package com.twitter.heron.spi.common;

 final class TestConstants {
   public static final String TEST_DATA_PATH =
-      "/heron/spi/tests/java/com/twitter/heron/spi/common/testdata";
+      "/__main__/heron/spi/tests/java/com/twitter/heron/spi/common/testdata";

   private TestConstants() {
   }
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 d206f33..deb96cd 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 =
-      "/heron/uploaders/tests/java/com/twitter/heron/uploader/localfs/testdata";
+      "/__main__/heron/uploaders/tests/java/com/twitter/heron/uploader/localfs/testdata";

   private LocalFileSystemConstantsTest() {
   }

@caofangkun
Copy link
Contributor Author

Hi @kramasamy @taishi8117
Thank you very much for your kind help. CI passed ... at last!

@kramasamy
Copy link
Contributor

Awesome! The only issue remaining is the warnings which is not fixed even in bazel 0.3.0

@caofangkun
Copy link
Contributor Author

caofangkun commented Jun 17, 2016

Hi @kramasamy

According to code of bazelbuild/bazel@f0a1884#diff-b1e05be607e9de9e40f306162531dc81R431

I did the following changes, and the warnings gone.

twitter-heron git:(heron-816-1) ✗ mv 3rdparty third_party
twitter-heron git:(heron-816-1) ✗ sed -i "s/3rdparty/third_party/g" `grep 3rdparty -rl ./`

Should i fix this in this PR or file a new issue and fix it later?

@billonahill
Copy link
Contributor

Please update bazel version for the website here too:
https://github.com/twitter/heron/blob/master/website/config.yaml#L24

And in the md files we should reference it via:

{{% bazelVersion %}}

@@ -162,11 +162,11 @@ RUN \
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
```

#### Step 5 - An installation script for [Bazel](http://bazel.io/) version 0.1.2 or above.
#### Step 5 - An installation script for [Bazel](http://bazel.io/) version 0.2.3 or above.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update to use {{% bazelVersion %}} here and below.

@caofangkun
Copy link
Contributor Author

caofangkun commented Jun 20, 2016

Hi @billonahill I have included your feedback in d74c1dc , Could you please have a review?

@kramasamy
Copy link
Contributor

@caofangkun - travis-ci seems to have failed. Can you please check?

@taishi8117
Copy link
Contributor

taishi8117 commented Jun 20, 2016

@kramasamy @caofangkun For the not a valid file name (cc, h, cpp, cu, cuh) warnings, the following diff should resolve it.

diff --git a/tools/java/src/com/twitter/bazel/checkstyle/CppCheckstyle.java b/tools/java/src/com/twitter/bazel/checkstyle/CppCheckstyle.java
index dd5d758..d1b6f87 100644
--- a/tools/java/src/com/twitter/bazel/checkstyle/CppCheckstyle.java
+++ b/tools/java/src/com/twitter/bazel/checkstyle/CppCheckstyle.java
@@ -134,6 +134,7 @@ public final class CppCheckstyle {
                     Predicates.not(Predicates.containsPattern("third_party/")),
                     Predicates.not(Predicates.containsPattern("config/heron-config.h")),
                     Predicates.not(Predicates.containsPattern(".*pb.h$")),
+                    Predicates.not(Predicates.containsPattern(".*cc_wrapper.sh$")),
                     Predicates.not(Predicates.containsPattern(".*pb.cc$"))
             )
     );

@taishi8117
Copy link
Contributor

taishi8117 commented Jun 20, 2016

Looking at the Travis failure message, I just realized that a similar error existed even from cc5da14, although Travis CI was successful for some reasons.

ERROR: /home/travis/build/twitter/heron/heron/proto/BUILD:109:1: error executing shell command: 'set -e
rm -rf bazel-out/local-fastbuild/genfiles/heron/proto/proto_stmgr_java_src.srcjar.srcs
mkdir bazel-out/local-fastbuild/genfiles/heron/proto/proto_stmgr_java_src.srcjar.srcs
bazel-out/local-f...' failed: namespace-sandbox failed: error executing command

[Update]
It seems that Travis started failing after merging #943 (as javadoc failure check is enabled by set -e in heron/website/scripts/javadocs.sh). Related to the issue #766.

curl -O -L https://github.com/bazelbuild/bazel/releases/download/0.1.2/bazel-0.1.2-installer-darwin-x86_64.sh
chmod +x bazel-0.1.2-installer-darwin-x86_64.sh
./bazel-0.1.2-installer-darwin-x86_64.sh --user
wget -O /tmp/bazel.sh https://github.com/bazelbuild/bazel/releases/download/{{% bazelVersion %}}/bazel-{{% bazelVersion %}}-installer-linux-x86_64.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/linux/darwin/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@caofangkun
Copy link
Contributor Author

Hi @taishi8117 , Thank you so much for your help, I have fixed it as you suggested.

@kramasamy
Copy link
Contributor

@caofangkun - can you update your branch since yours seems to have conflicts?

@caofangkun
Copy link
Contributor Author

@kramasamy I'm working on the conficts now, will fix it soon :)

@taishi8117
Copy link
Contributor

taishi8117 commented Jun 21, 2016

@caofangkun Thanks for fixing the conflicts. The Javadoc error might be resolved by merging #968 (already merged to master) --- can you try that? (and enable set -e again)

@caofangkun
Copy link
Contributor Author

Thank you @taishi8117 After merge the CI passed now.

@kramasamy
Copy link
Contributor

Looks good to me! 👍

@taishi8117
Copy link
Contributor

Looks great!

@kramasamy kramasamy merged commit ca87470 into apache:master Jun 22, 2016
@kramasamy kramasamy mentioned this pull request Jun 22, 2016
@nlu90
Copy link
Member

nlu90 commented Jun 22, 2016

@kramasamy What are the changes need to be made for our Twitter internal building/testing environment?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants