Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(781)

Unified Diff: editor/tools/compile_analyzer.py

Issue 13948004: Locate javac using the JAVA_HOME env variable when building the analyzer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/compile_analyzer.py
===================================================================
--- editor/tools/compile_analyzer.py (revision 21169)
+++ editor/tools/compile_analyzer.py (working copy)
@@ -10,10 +10,13 @@
import optparse
import os
+import platform
import shutil
import subprocess
import sys
+from os.path import join
+
def GetOptions():
options = optparse.OptionParser(usage='usage: %prog [options] <output>')
options.add_option("--class_path_file",
@@ -33,7 +36,7 @@
def CompileAnalyzer(options, args):
# We rely on all jar files being copied to the output dir.
class_path = options.output_dir + '*'
- cmd = ['javac',
+ cmd = [GetJavacPath(),
'-sourcepath', 'foobar',
'-source', '6',
'-target', '6',
@@ -47,14 +50,14 @@
def CreateJarFile(options):
class_path_file_name = options.output_dir + options.class_path_file
jar_file_name = options.output_dir + options.jar_file_name
- cmd = ['jar', 'cfem', jar_file_name, options.entry_point,
+ cmd = [GetJarToolPath(), 'cfem', jar_file_name, options.entry_point,
class_path_file_name,
- '-C', options.output_dir, options.jar_entry_directory];
+ '-C', options.output_dir, options.jar_entry_directory]
subprocess.call(cmd)
def CopyFiles(options):
# Strip " from the string
- files = options.dependent_jar_files.replace('"', '');
+ files = options.dependent_jar_files.replace('"', '')
for f in files.split(" "):
shutil.copy(f, options.output_dir)
@@ -69,6 +72,25 @@
# Add new line
print >> output
+def GetJavacPath():
+ if 'JAVA_HOME' in os.environ:
+ return join(os.environ['JAVA_HOME'], 'bin', 'javac' + GetExecutableExtension())
+ else:
+ return "javac"
+
+def GetJarToolPath():
+ if 'JAVA_HOME' in os.environ:
+ return join(os.environ['JAVA_HOME'], 'bin', 'jar' + GetExecutableExtension())
+ else:
+ return "jar"
+
+def GetExecutableExtension():
+ id = platform.system()
+ if id == "Windows" or id == "Microsoft":
+ return '.exe'
+ else:
+ return ''
+
def main():
(options, args) = GetOptions()
# Clean out everything whenever we do a build, guarantees that we don't have
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698