Merge branch 'stable-2.14'

* stable-2.14:
  Remove unneeded variable definition
  Remove unneeded imports
  Remove unneeded method
  project.py: Remove need to define classpath target

Change-Id: I850262a7121c9a5aa6c23c53ca72eb7e0e667041
diff --git a/tools/eclipse/project.py b/tools/eclipse/project.py
index f2d34bf..c34eba5 100755
--- a/tools/eclipse/project.py
+++ b/tools/eclipse/project.py
@@ -20,21 +20,17 @@
 # ...
 # optparse.OptionParser
 from optparse import OptionParser
-from os import environ, path, makedirs
+from os import path
 from subprocess import CalledProcessError, check_call, check_output
 from xml.dom import minidom
 import re
 import sys
 
-MAIN = '//tools/eclipse:classpath'
 JRE = '/'.join([
   'org.eclipse.jdt.launching.JRE_CONTAINER',
   'org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType',
   'JavaSE-1.8',
 ])
-cp_targets = {
-  MAIN: '//tools/eclipse:main_classpath_collect',
-}
 
 opts = OptionParser()
 opts.add_option('-r', '--root', help='Root directory entry')
@@ -54,16 +50,14 @@
 def retrieve_ext_location():
   return check_output(['bazel', 'info', 'output_base']).strip()
 
-def _query_classpath(target):
-  deps = []
-  t = cp_targets[target]
+def _query_classpath():
+  t = '//tools/eclipse:main_classpath_collect'
   try:
     check_call(['bazel', 'build', t])
   except CalledProcessError:
     exit(1)
   name = 'bazel-bin/tools/eclipse/' + t.split(':')[1] + '.runtime_classpath'
-  deps = [line.rstrip('\n') for line in open(name)]
-  return deps
+  return [line.rstrip('\n') for line in open(name)]
 
 def gen_project(name, root=ROOT):
   p = path.join(root, '.project')
@@ -111,7 +105,7 @@
 
   java_library = re.compile('bazel-out/(?:.*)-fastbuild/bin(.*)/[^/]+[.]jar$')
   srcs = re.compile('(.*/external/[^/]+)/jar/(.*)[.]jar')
-  for p in _query_classpath(MAIN):
+  for p in _query_classpath():
     m = java_library.match(p)
     if m:
       src.add(m.group(1).lstrip('/'))
@@ -164,20 +158,6 @@
   with open(p, 'w') as fd:
     doc.writexml(fd, addindent='\t', newl='\n', encoding='UTF-8')
 
-def gen_factorypath(ext):
-  doc = minidom.getDOMImplementation().createDocument(None, 'factorypath', None)
-  for jar in _query_classpath(AUTO):
-    e = doc.createElement('factorypathentry')
-    e.setAttribute('kind', 'EXTJAR')
-    e.setAttribute('id', path.join(ext, jar))
-    e.setAttribute('enabled', 'true')
-    e.setAttribute('runInBatchMode', 'false')
-    doc.documentElement.appendChild(e)
-
-  p = path.join(ROOT, '.factorypath')
-  with open(p, 'w') as fd:
-    doc.writexml(fd, addindent='\t', newl='\n', encoding='UTF-8')
-
 def excluded(lib):
   if args.exclude:
     for x in args.exclude:
@@ -190,10 +170,6 @@
   gen_project(name)
   gen_classpath(retrieve_ext_location())
 
-  try:
-    check_call(['bazel', 'build', MAIN])
-  except CalledProcessError:
-    exit(1)
 except KeyboardInterrupt:
   print('Interrupted by user', file=sys.stderr)
   exit(1)