changeset 22057:62fa6ad33667

mx: abort on use of an Eclipse compiler that does not support annotation processing
author Doug Simon <doug.simon@oracle.com>
date Tue, 23 Jun 2015 01:16:35 +0200
parents 278d8233af3a
children 555c6a8db46b
files mxtool/mx.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mxtool/mx.py	Mon Jun 22 15:54:01 2015 -0700
+++ b/mxtool/mx.py	Tue Jun 23 01:16:35 2015 +0200
@@ -2903,7 +2903,7 @@
     parser.add_argument('--alt-javac', dest='alt_javac', help='path to alternative javac executable', metavar='<path>')
     compilerSelect = parser.add_mutually_exclusive_group()
     compilerSelect.add_argument('--error-prone', dest='error_prone', help='path to error-prone.jar', metavar='<path>')
-    compilerSelect.add_argument('--jdt', help='path to ecj.jar, the Eclipse batch compiler', default=_defaultEcjPath(), metavar='<path>')
+    compilerSelect.add_argument('--jdt', help='path to ecj.jar, the stand alone Eclipse batch compiler', default=_defaultEcjPath(), metavar='<path>')
     compilerSelect.add_argument('--force-javac', action='store_true', dest='javac', help='use javac whether ecj.jar is found or not')
 
     if suppliedParser:
@@ -2927,6 +2927,12 @@
                 jdtJar = None
             else:
                 abort('Eclipse batch compiler jar does not exist: ' + args.jdt)
+        else:
+            with zipfile.ZipFile(jdtJar, 'r') as zf:
+                if 'org/eclipse/jdt/internal/compiler/apt/' not in zf.namelist():
+                    abort('Specified Eclipse compiler does not include annotation processing support. ' +
+                          'Ensure you are using a stand alone ecj.jar, not org.eclipse.jdt.core_*.jar ' +
+                          'from within the plugins/ directory of an Eclipse IDE installation.')
 
     if args.only is not None:
         # N.B. This build will not include dependencies including annotation processor dependencies