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

Commit

Permalink
Add JDK/JAVA_HOME to bazel_configure.py (#2921)
Browse files Browse the repository at this point in the history
  • Loading branch information
Code0x58 authored and kramasamy committed Jun 18, 2018
1 parent 81bb28d commit b3522d2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bazel_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
######################################################################
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit b3522d2

Please sign in to comment.