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

accommodate bazel changes #3113

Closed
sreev opened this issue Nov 19, 2018 · 5 comments
Closed

accommodate bazel changes #3113

sreev opened this issue Nov 19, 2018 · 5 comments

Comments

@sreev
Copy link
Contributor

sreev commented Nov 19, 2018

https://blog.bazel.build/2018/08/22/bazel-homebrew.html

  • upgrade bazel, per instructions on above link
  • change heron build instructions
@sreev
Copy link
Contributor Author

sreev commented Nov 19, 2018

$ brew uninstall --force bazel
Uninstalling bazel... (48 files, 402.5MB)

$ brew tap bazelbuild/tap
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Tapping bazelbuild/tap
Cloning into '/usr/local/Homebrew/Library/Taps/bazelbuild/homebrew-tap'...
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 9 (delta 0), reused 4 (delta 0), pack-reused 0
Unpacking objects: 100% (9/9), done.
Tapped 2 formulae (38 files, 47.0KB).

$ brew tap-pin bazelbuild/tap
==> Pinned bazelbuild/tap

$ brew install bazel
To restore the stashed changes to /usr/local/Homebrew run:
  'cd /usr/local/Homebrew && git stash pop'
==> Downloading https://homebrew.bintray.com/bottles/bazel-0.18.1.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring bazel-0.18.1.mojave.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/bazel/0.18.1: 12 files, 117.4MB

$ bazel version
WARNING: Processed legacy workspace file incubator-heron/tools/bazel.rc. This file will not be processed in the next release of Bazel. Please read https://github.com/bazelbuild/bazel/issues/6319 for further information, including how to upgrade.
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
Build label: 0.18.1-homebrew
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Nov 2 11:16:42 2018 (1541157402)
Build timestamp: 1541157402
Build timestamp as int: 1541157402

$ brew upgrade bazel
Error: bazel 0.18.1 already installed

$ bazel clean --expunge
WARNING: Processed legacy workspace file /Users/svaddi/SreeVaddi/source/github/sreev/incubator-heron/tools/bazel.rc. This file will not be processed in the next release of Bazel. Please read https://github.com/bazelbuild/bazel/issues/6319 for further information, including how to upgrade.
INFO: Starting clean.

$ ./bazel_configure.py
Platform Darwin
Using C compiler          :	/usr/bin/clang (10.0.0)
Using C++ compiler        :	/usr/bin/clang++ (10.0.0)
Using C preprocessor      :	/usr/bin/cpp (10.0.0)
Using C++ preprocessor    :	/usr/bin/cpp (10.0.0)
Using linker              :	/usr/bin/ld
Using JDK                 :	/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
Using Automake            :	/usr/local/Cellar/automake/1.16.1_1/bin/automake (1.16.1)
Using Autoconf            :	/usr/local/Cellar/autoconf/2.69/bin/autoconf (2.69)
package(default_visibility = ["//visibility:public"])

Using Make                :	/usr/bin/make (3.81)
Using Python              :	/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/bin/python2.7 (2.7.15)
# Copyright (C) 2016 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.
# Javadoc rule.

def _impl(ctx):
  zip_output = ctx.outputs.zip
  transitive_jar_set = depset()
  source_jars = depset()
  for l in ctx.attr.libs:
    source_jars += l.java.source_jars
    transitive_jar_set += l.java.transitive_deps
  transitive_jar_paths = [j.path for j in transitive_jar_set]
  dir = ctx.outputs.zip.path + ".dir"
  source = ctx.outputs.zip.path + ".source"
  external_docs = ["http://docs.oracle.com/javase/8/docs/api"] + ctx.attr.external_docs
  cmd = [
      "rm -rf %s" % source,
      "mkdir %s" % source,
      " && ".join(["unzip -qud %s %s" % (source, j.path) for j in source_jars]),
      "rm -rf %s" % dir,
      "mkdir %s" % dir,
      " ".join([
        ctx.file._javadoc.path,
        "-Xdoclint:-missing",
        "-protected",
        "-encoding UTF-8",
        "-charset UTF-8",
        "-notimestamp",
# Copyright (C) 2016 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.
# Javadoc rule.

def _impl(ctx):
  zip_output = ctx.outputs.zip
  transitive_jar_set = depset()
  source_jars = depset()
  for l in ctx.attr.libs:
    source_jars += l.java.source_jars
    transitive_jar_set += l.java.transitive_deps
  transitive_jar_paths = [j.path for j in transitive_jar_set]
  dir = ctx.outputs.zip.path + ".dir"
  source = ctx.outputs.zip.path + ".source"
  external_docs = ["http://docs.oracle.com/javase/8/docs/api"] + ctx.attr.external_docs
  cmd = [
      "rm -rf %s" % source,
      "mkdir %s" % source,
      " && ".join(["unzip -qud %s %s" % (source, j.path) for j in source_jars]),
      "rm -rf %s" % dir,
      "mkdir %s" % dir,
      " ".join([
        ctx.file._javadoc.path,
        "-Xdoclint:-missing",
        "-protected",
        "-encoding UTF-8",
        "-charset UTF-8",
        "-notimestamp",
Using Libtool             :	/usr/local/Cellar/libtool/2.4.6_1/bin/glibtool (2.4.6)
# Copyright (C) 2016 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.
# Javadoc rule.

def _impl(ctx):
  zip_output = ctx.outputs.zip
  transitive_jar_set = depset()
  source_jars = depset()
  for l in ctx.attr.libs:
    source_jars += l.java.source_jars
    transitive_jar_set += l.java.transitive_deps
  transitive_jar_paths = [j.path for j in transitive_jar_set]
  dir = ctx.outputs.zip.path + ".dir"
  source = ctx.outputs.zip.path + ".source"
  external_docs = ["http://docs.oracle.com/javase/8/docs/api"] + ctx.attr.external_docs
  cmd = [
      "rm -rf %s" % source,
      "mkdir %s" % source,
      " && ".join(["unzip -qud %s %s" % (source, j.path) for j in source_jars]),
      "rm -rf %s" % dir,
      "mkdir %s" % dir,
      " ".join([
        ctx.file._javadoc.path,
        "-Xdoclint:-missing",
"tools/rules/javadoc.bzl" [noeol] 74L, 2593C
        ctx.file._javadoc.path,
        "-Xdoclint:-missing",
        "-protected",
        "-encoding UTF-8",
        "-charset UTF-8",
        "-notimestamp",
        "-quiet",
        "-windowtitle '%s'" % ctx.attr.title,
        " ".join(['-link %s' % url for url in external_docs]),
        "-sourcepath %s" % source,
        "-subpackages ",
        ":".join(ctx.attr.pkgs),
        " -classpath ",
        ":".join(transitive_jar_paths),
        "-d %s" % dir]),
    "find %s -exec touch -t 198001010000 '{}' ';'" % dir,
    "(cd %s && zip -qr ../%s *)" % (dir, ctx.outputs.zip.basename),
  ]
  ctx.action(
      inputs = list(transitive_jar_set) + list(source_jars) + ctx.files._jdk,
      outputs = [zip_output],
      command = " && ".join(cmd))
java_doc = rule(
    attrs = {
        "libs": attr.label_list(allow_files = False),
        "pkgs": attr.string_list(),
        "title": attr.string(),
        "external_docs": attr.string_list(),
        "_javadoc": attr.label(
            default = Label("@local_jdk//:bin/javadoc"),
            single_file = True,
            allow_files = True,
        ),
        "_jdk": attr.label(
            default = Label("@local_jdk//:jdk-default"),
        "_javadoc": attr.label(
Using archiver            :	/usr/bin/ar
Using coverage tool       :	/usr/bin/gcov
dwp                       :	not found, but ok
Using nm                  :	/usr/bin/nm
objcopy                   :	not found, but ok
Using objdump             :	/usr/bin/objdump
Using strip               :	/usr/bin/strip


$ bazel build --config=darwin heron/...
WARNING: Processed legacy workspace file /Users/svaddi/SreeVaddi/source/github/sreev/incubator-heron/tools/bazel.rc. This file will not be processed in the next release of Bazel. Please read https://github.com/bazelbuild/bazel/issues/6319 for further information, including how to upgrade.
Starting local Bazel server and connecting to it...
INFO: SHA256 (https://pypi.python.org/packages/c9/1d/bd19e691fd4cfe908c76c429fe6e4436c9e83583c4414b54f6c85471954a/wheel-0.29.0.tar.gz) = 1ebb8ad7e26b448e9caa4773d2357849bf80ff9e313964bcaf79cbf0201a1648
INFO: SHA256 (https://pypi.python.org/packages/d9/03/155b3e67fe35fe5b6f4227a8d9e96a14fda828b18199800d161bcefc1359/requests-2.12.3.tar.gz) = de5d266953875e9647e37ef7bfe6ef1a46ff8ddfe61b5b3652edf7ea717ee2b2
INFO: SHA256 (https://pypi.python.org/packages/3a/1d/cd41cd3765b78a4353bbf27d18b099f7afbcd13e7f2dc9520f304ec8981c/pex-1.2.15.tar.gz) = 0147d19123340677b9793b00ec86fe65b6697db3ec99afb796da2300ae5fec14
INFO: SHA256 (https://pypi.python.org/packages/68/13/1bfbfbd86560e61fa9803d241084fff41a775bf56ee8b3ad72fc9e550dad/setuptools-31.0.0.tar.gz) = 0818cc0de692c3a5c83ca83aa7ec7ba6bc206f278735f1e0267b8d0e095cfe7a
INFO: SHA256 (https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.6.2.tar.gz) = e4d8560e163c3d875fd5d9e5542b5fd5bec810febdcba61481fe5fc4e6b1fd05
INFO: SHA256 (https://pypi.python.org/packages/53/67/9620edf7803ab867b175e4fd23c7b8bd8eba11cb761514dcd2e726ef07da/py-1.4.34-py2.py3-none-any.whl) = 2ccb79b01769d99115aa600d7eed99f524bf752bba8f041dc1c184853514655a
INFO: SHA256 (https://pypi.python.org/packages/fd/3e/d326a05d083481746a769fc051ae8d25f574ef140ad4fe7f809a2b63c0f0/pytest-3.1.3-py2.py3-none-any.whl) = 2a4f483468954621fcc8f74784f3b42531e5b5008d49fc609b37bc4dbc6dead1
ERROR: /Users/svaddi/SreeVaddi/source/github/sreev/incubator-heron/heron/spi/src/java/BUILD:6:1: every rule of type java_doc implicitly depends upon the target '@local_jdk//:jdk-default', but this target could not be found because of: no such target '@local_jdk//:jdk-default': target 'jdk-default' not declared in package '' (did you mean 'jre-default'?) defined by /private/var/tmp/_bazel_svaddi/ad590ad4eafb86a9912ced0bf3547c8f/external/local_jdk/BUILD.bazel
ERROR: Analysis of target '//heron/spi/src/java:heron-spi-javadoc' failed; build aborted: Analysis failed
INFO: Elapsed time: 47.900s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (186 packages loaded)


$ vi tools/rules/javadoc.bzl
replace:
default = Label("@local_jdk//:jdk-default"),
with:
default = Label("@local_jdk//:bin/javadoc"),
& save

$ bazel clean --expunge
WARNING: Processed legacy workspace file /Users/svaddi/SreeVaddi/source/github/sreev/incubator-heron/tools/bazel.rc. This file will not be processed in the next release of Bazel. Please read https://github.com/bazelbuild/bazel/issues/6319 for further information, including how to upgrade.
INFO: Starting clean.

$ ./bazel_configure.py
Platform Darwin
Using C compiler          :	/usr/bin/clang (10.0.0)
Using C++ compiler        :	/usr/bin/clang++ (10.0.0)
Using C preprocessor      :	/usr/bin/cpp (10.0.0)
Using C++ preprocessor    :	/usr/bin/cpp (10.0.0)
Using linker              :	/usr/bin/ld
Using JDK                 :	/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
Using Automake            :	/usr/local/Cellar/automake/1.16.1_1/bin/automake (1.16.1)
Using Autoconf            :	/usr/local/Cellar/autoconf/2.69/bin/autoconf (2.69)
Using Make                :	/usr/bin/make (3.81)
Using Python              :	/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/bin/python2.7 (2.7.15)
Using Libtool             :	/usr/local/Cellar/libtool/2.4.6_1/bin/glibtool (2.4.6)
Using archiver            :	/usr/bin/ar
Using coverage tool       :	/usr/bin/gcov
dwp                       :	not found, but ok
Using nm                  :	/usr/bin/nm
objcopy                   :	not found, but ok
Using objdump             :	/usr/bin/objdump
Using strip               :	/usr/bin/strip


$ bazel build --config=darwin heron/...
...
...
...
Nov 18, 2018 11:50:54 PM org.apache.bazel.checkstyle.PythonCheckstyle main
INFO: 98 python files found by checkstyle
INFO: Elapsed time: 954.644s, Critical Path: 233.01s
INFO: 2252 processes: 1921 local, 331 worker.
INFO: Build completed successfully, 3926 total actions

@sreev
Copy link
Contributor Author

sreev commented Nov 19, 2018

build successful on macOS Mojave Version 10.14, java version "1.8.0_181".

@sreev
Copy link
Contributor Author

sreev commented Nov 19, 2018

added new file %WORKSPACE%/.bazelrc
with one line:
import tools/bazel.rc

$ bazel build --config=darwin heron/...
WARNING: Duplicate rc file: /Users/svaddi/SreeVaddi/source/github/sreev/incubator-heron/tools/bazel.rc is read multiple times, most recently imported from /Users/svaddi/SreeVaddi/source/github/sreev/incubator-heron/.bazelrc
WARNING: Processed legacy workspace file /Users/svaddi/SreeVaddi/source/github/sreev/incubator-heron/tools/bazel.rc. This file will not be processed in the next release of Bazel. Please read https://github.com/bazelbuild/bazel/issues/6319 for further information, including how to upgrade.
Starting local Bazel server and connecting to it...
...
...
...
INFO: From Executing extra_action //tools/python:checkstyle_python on //heron/tools/tracker/tests/python:query_operator_unittest_runner:
Nov 19, 2018 12:27:50 AM org.apache.bazel.checkstyle.PythonCheckstyle main
INFO: 85 python files found by checkstyle
INFO: Elapsed time: 946.638s, Critical Path: 179.46s
INFO: 2252 processes: 1921 local, 331 worker.
INFO: Build completed successfully, 3926 total actions

@rohanag12
Copy link
Contributor

Fixed by #3209

@Code0x58
Copy link
Contributor

looks like another one to close off

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

No branches or pull requests

4 participants