You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@heron.apache.org by GitBox <gi...@apache.org> on 2018/06/18 13:10:03 UTC

[GitHub] kramasamy closed pull request #2921: Add JDK/JAVA_HOME to bazel_configure.py

kramasamy closed pull request #2921: Add JDK/JAVA_HOME to bazel_configure.py
URL: https://github.com/apache/incubator-heron/pull/2921
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/bazel_configure.py b/bazel_configure.py
index b91efe253d..ed8b4391f8 100755
--- a/bazel_configure.py
+++ b/bazel_configure.py
@@ -263,6 +263,19 @@ def discover_tool(program, msg, envvar, min_version = ''):
   print('Using %s:\t%s' % (msg.ljust(20), print_value))
   return VALUE
 
+def discover_jdk():
+  try:
+    jdk_path = os.environ['JAVA_HOME']
+  except KeyError:
+    javac_path = real_program_path('javac')
+    if javac_path is None:
+        fail("You need to have JDK installed to build Heron.\n"
+             "You can set the JAVA_HOME environment variavle to specify the full path to yours.")
+    jdk_bin_path = os.path.dirname(javac_path)
+    jdk_path = os.path.dirname(jdk_bin_path)
+  print('Using %s:\t%s' % ('JDK'.ljust(20), jdk_path))
+  return jdk_path
+
 ######################################################################
 # Discover the linker directory
 ######################################################################
@@ -377,6 +390,7 @@ def main():
   env_map['CXXCPP'] = discover_tool('cpp','C++ preprocessor', 'CXXCPP', cpp_min)
   env_map['LD'] =  discover_tool('ld','linker', 'LD')
   env_map['BLDFLAG'] = discover_linker(env_map)
+  env_map['JAVA_HOME'] = discover_jdk()
 
   # Discover the utilities
   env_map['AUTOMAKE'] = discover_tool('automake', 'Automake', 'AUTOMAKE', '1.9.6')


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services