Mercurial > hg > graal-jvmci-8
diff mxtool/mx.py @ 18899:8e8b4a6a85f5
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 21 Jan 2015 19:01:13 +0100 |
parents | d199e643f23b f5cee3a0496c |
children | 7e500c20208c |
line wrap: on
line diff
--- a/mxtool/mx.py Wed Jan 21 19:00:46 2015 +0100 +++ b/mxtool/mx.py Wed Jan 21 19:01:13 2015 +0100 @@ -2,7 +2,7 @@ # # ---------------------------------------------------------------------------------------------------- # -# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -554,10 +554,17 @@ """ def annotation_processors_path(self): aps = [project(ap) for ap in self.annotation_processors()] - if len(aps): - return os.pathsep.join([ap.definedAnnotationProcessorsDist.path for ap in aps if ap.definedAnnotationProcessorsDist]) + libAps = [dep for dep in self.all_deps([], includeLibs=True, includeSelf=False) if dep.isLibrary() and hasattr(dep, 'annotationProcessor') and getattr(dep, 'annotationProcessor').lower() == 'true'] + if len(aps) + len(libAps): + return os.pathsep.join([ap.definedAnnotationProcessorsDist.path for ap in aps if ap.definedAnnotationProcessorsDist] + [lib.get_path(False) for lib in libAps]) return None + def uses_annotation_processor_library(self): + for dep in self.all_deps([], includeLibs=True, includeSelf=False): + if dep.isLibrary() and hasattr(dep, 'annotationProcessor'): + return True + return False + def update_current_annotation_processors_file(self): aps = self.annotation_processors() outOfDate = False @@ -2138,12 +2145,24 @@ self._extdirs = _filter_non_existant_paths(self._extdirs) self._endorseddirs = _filter_non_existant_paths(self._endorseddirs) + def __repr__(self): + return "JavaConfig(" + str(self.jdk) + ", " + str(self.debug_port) + ")" + + def __str__(self): + return "Java " + str(self.version) + " (" + str(self.javaCompliance) + ") from " + str(self.jdk) + def __hash__(self): return hash(self.jdk) def __cmp__(self, other): if isinstance(other, JavaConfig): - return cmp(self.javaCompliance, other.javaCompliance) + compilanceCmp = cmp(self.javaCompliance, other.javaCompliance) + if compilanceCmp: + return compilanceCmp + versionCmp = cmp(self.version, other.version) + if versionCmp: + return versionCmp + return cmp(self.jdk, other.jdk) raise TypeError() def format_cmd(self, args, addDefaultArgs): @@ -2445,7 +2464,10 @@ with open(jdtProperties) as fp: origContent = fp.read() content = origContent - if args.jdt_warning_as_error: + if self.proj.uses_annotation_processor_library(): + # unfortunately, the command line compiler doesn't let us ignore warnings for generated files only + content = content.replace('=warning', '=ignore') + elif args.jdt_warning_as_error: content = content.replace('=warning', '=error') if not args.jdt_show_task_tags: content = content + '\norg.eclipse.jdt.core.compiler.problem.tasks=ignore' @@ -3592,11 +3614,19 @@ os.mkdir(srcDir) out.element('classpathentry', {'kind' : 'src', 'path' : src}) - if len(p.annotation_processors()) > 0: + processorPath = p.annotation_processors_path() + if processorPath: genDir = p.source_gen_dir() if not exists(genDir): os.mkdir(genDir) - out.element('classpathentry', {'kind' : 'src', 'path' : 'src_gen'}) + out.open('classpathentry', {'kind' : 'src', 'path' : 'src_gen'}) + if p.uses_annotation_processor_library(): + # ignore warnings produced by third-party annotation processors + out.open('attributes') + out.element('attribute', {'name' : 'ignore_optional_problems', 'value' : 'true'}) + out.close('attributes') + out.close('classpathentry') + if files: files.append(genDir) @@ -3776,19 +3806,18 @@ # copy a possibly modified file to the project's .settings directory for name, path in esdict.iteritems(): # ignore this file altogether if this project has no annotation processors - if name == "org.eclipse.jdt.apt.core.prefs" and not len(p.annotation_processors()) > 0: + if name == "org.eclipse.jdt.apt.core.prefs" and not processorPath: continue with open(path) as f: content = f.read() content = content.replace('${javaCompliance}', str(p.javaCompliance)) - if len(p.annotation_processors()) > 0: + if processorPath: content = content.replace('org.eclipse.jdt.core.compiler.processAnnotations=disabled', 'org.eclipse.jdt.core.compiler.processAnnotations=enabled') update_file(join(settingsDir, name), content) if files: files.append(join(settingsDir, name)) - processorPath = p.annotation_processors_path() if processorPath: out = XMLDoc() out.open('factorypath')