Mercurial > hg > graal-compiler
comparison mxtool/mx.py @ 16839:7eca83fd5419
generate distributions for projects that define annotation processors
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 14 Aug 2014 23:45:15 +0200 |
parents | 22b2950a0613 |
children | 1fd7bb00a77f |
comparison
equal
deleted
inserted
replaced
16838:27f457a47a44 | 16839:7eca83fd5419 |
---|---|
238 self.javaCompliance = JavaCompliance(javaCompliance) if javaCompliance is not None else None | 238 self.javaCompliance = JavaCompliance(javaCompliance) if javaCompliance is not None else None |
239 self.native = False | 239 self.native = False |
240 self.workingSets = workingSets | 240 self.workingSets = workingSets |
241 self.dir = d | 241 self.dir = d |
242 | 242 |
243 # The annotation processors defined by this project | |
244 self.definedAnnotationProcessors = None | |
245 self.definedAnnotationProcessorsDist = None | |
246 | |
247 | |
243 # Verify that a JDK exists for this project if its compliance level is | 248 # Verify that a JDK exists for this project if its compliance level is |
244 # less than the compliance level of the default JDK | 249 # less than the compliance level of the default JDK |
245 jdk = java(self.javaCompliance) | 250 jdk = java(self.javaCompliance) |
246 if jdk is None and self.javaCompliance < java().javaCompliance: | 251 if jdk is None and self.javaCompliance < java().javaCompliance: |
247 abort('Cannot find ' + str(self.javaCompliance) + ' JDK required by ' + name + '. ' + | 252 abort('Cannot find ' + str(self.javaCompliance) + ' JDK required by ' + name + '. ' + |
439 """Get the immutable set of Java packages defined by other Java projects that are | 444 """Get the immutable set of Java packages defined by other Java projects that are |
440 imported by the Java sources of this project.""" | 445 imported by the Java sources of this project.""" |
441 self._init_packages_and_imports() | 446 self._init_packages_and_imports() |
442 return self._imported_java_packages | 447 return self._imported_java_packages |
443 | 448 |
449 """ | |
450 Gets the list of projects defining the annotation processors that will be applied | |
451 when compiling this project. This includes the projects declared by the annotationProcessors property | |
452 of this project and any of its project dependencies. It also includes | |
453 any project dependencies that define an annotation processors. | |
454 """ | |
444 def annotation_processors(self): | 455 def annotation_processors(self): |
445 if not hasattr(self, '_annotationProcessors'): | 456 if not hasattr(self, '_annotationProcessors'): |
446 ap = set() | 457 aps = set() |
447 if hasattr(self, '_declaredAnnotationProcessors'): | 458 if hasattr(self, '_declaredAnnotationProcessors'): |
448 ap = set(self._declaredAnnotationProcessors) | 459 aps = set(self._declaredAnnotationProcessors) |
449 | 460 for ap in aps: |
450 # find dependencies that auto-inject themselves as annotation processors to all dependents | 461 if project(ap).definedAnnotationProcessorsDist is None: |
462 abort('Project ' + ap + ' declared in annotationProcessors property of ' + self.name + ' does not define any annotation processors') | |
463 | |
451 allDeps = self.all_deps([], includeLibs=False, includeSelf=False, includeAnnotationProcessors=False) | 464 allDeps = self.all_deps([], includeLibs=False, includeSelf=False, includeAnnotationProcessors=False) |
452 for p in allDeps: | 465 for p in allDeps: |
453 if hasattr(p, 'annotationProcessorForDependents') and p.annotationProcessorForDependents.lower() == 'true': | 466 # Add an annotation processor dependency |
454 ap.add(p.name) | 467 if p.definedAnnotationProcessorsDist is not None: |
455 self._annotationProcessors = list(ap) | 468 aps.add(p.name) |
469 | |
470 # Inherit annotation processors from dependencies | |
471 aps.update(p.annotation_processors()) | |
472 | |
473 self._annotationProcessors = list(aps) | |
456 return self._annotationProcessors | 474 return self._annotationProcessors |
475 | |
476 """ | |
477 Gets the class path composed of the distribution jars containing the | |
478 annotation processors that will be applied when compiling this project. | |
479 """ | |
480 def annotation_processors_path(self): | |
481 aps = [project(ap) for ap in self.annotation_processors()] | |
482 if len(aps): | |
483 return os.pathsep.join([ap.definedAnnotationProcessorsDist.path for ap in aps if ap.definedAnnotationProcessorsDist]) | |
484 return None | |
457 | 485 |
458 def update_current_annotation_processors_file(self): | 486 def update_current_annotation_processors_file(self): |
459 aps = self.annotation_processors() | 487 aps = self.annotation_processors() |
460 outOfDate = False | 488 outOfDate = False |
461 currentApsFile = join(self.suite.mxDir, 'currentAnnotationProcessors', self.name) | 489 currentApsFile = join(self.suite.mxDir, 'currentAnnotationProcessors', self.name) |
831 | 859 |
832 for name, attrs in projsMap.iteritems(): | 860 for name, attrs in projsMap.iteritems(): |
833 srcDirs = pop_list(attrs, 'sourceDirs') | 861 srcDirs = pop_list(attrs, 'sourceDirs') |
834 deps = pop_list(attrs, 'dependencies') | 862 deps = pop_list(attrs, 'dependencies') |
835 ap = pop_list(attrs, 'annotationProcessors') | 863 ap = pop_list(attrs, 'annotationProcessors') |
836 # deps += ap | |
837 javaCompliance = attrs.pop('javaCompliance', None) | 864 javaCompliance = attrs.pop('javaCompliance', None) |
838 subDir = attrs.pop('subDir', None) | 865 subDir = attrs.pop('subDir', None) |
839 if subDir is None: | 866 if subDir is None: |
840 d = join(self.dir, name) | 867 d = join(self.dir, name) |
841 else: | 868 else: |
880 exclDeps = pop_list(attrs, 'exclude') | 907 exclDeps = pop_list(attrs, 'exclude') |
881 distDeps = pop_list(attrs, 'distDependencies') | 908 distDeps = pop_list(attrs, 'distDependencies') |
882 d = Distribution(self, name, path, sourcesPath, deps, mainClass, exclDeps, distDeps) | 909 d = Distribution(self, name, path, sourcesPath, deps, mainClass, exclDeps, distDeps) |
883 d.__dict__.update(attrs) | 910 d.__dict__.update(attrs) |
884 self.dists.append(d) | 911 self.dists.append(d) |
912 | |
913 # Create a distribution for each project that defines annotation processors | |
914 for p in self.projects: | |
915 annotationProcessors = None | |
916 for srcDir in p.source_dirs(): | |
917 configFile = join(srcDir, 'META-INF', 'services', 'javax.annotation.processing.Processor') | |
918 if exists(configFile): | |
919 with open(configFile) as fp: | |
920 annotationProcessors = [ap.strip() for ap in fp] | |
921 if len(annotationProcessors) != 0: | |
922 for ap in annotationProcessors: | |
923 if not ap.startswith(p.name): | |
924 abort(ap + ' in ' + configFile + ' does not start with ' + p.name) | |
925 if annotationProcessors: | |
926 dname = p.name.replace('.', '_').upper() | |
927 apDir = join(p.dir, 'ap') | |
928 path = join(apDir, p.name + '.jar') | |
929 sourcesPath = None | |
930 deps = [p.name] | |
931 mainClass = None | |
932 exclDeps = [] | |
933 distDeps = [] | |
934 d = Distribution(self, dname, path, sourcesPath, deps, mainClass, exclDeps, distDeps) | |
935 d.subDir = os.path.relpath(os.path.dirname(p.dir), self.dir) | |
936 self.dists.append(d) | |
937 p.definedAnnotationProcessors = annotationProcessors | |
938 p.definedAnnotationProcessorsDist = d | |
939 d.definingProject = p | |
940 | |
941 # Restrict exported annotation processors to those explicitly defined by the project | |
942 def _refineAnnotationProcessorServiceConfig(dist): | |
943 aps = dist.definingProject.definedAnnotationProcessors | |
944 apsJar = dist.path | |
945 config = 'META-INF/services/javax.annotation.processing.Processor' | |
946 with zipfile.ZipFile(apsJar, 'r') as zf: | |
947 currentAps = zf.read(config).split() | |
948 if currentAps != aps: | |
949 logv('[updating ' + config + ' in ' + apsJar + ']') | |
950 with Archiver(apsJar) as arc, zipfile.ZipFile(apsJar, 'r') as lp: | |
951 for arcname in lp.namelist(): | |
952 if arcname == config: | |
953 arc.zf.writestr(arcname, '\n'.join(aps)) | |
954 else: | |
955 arc.zf.writestr(arcname, lp.read(arcname)) | |
956 d.add_update_listener(_refineAnnotationProcessorServiceConfig) | |
885 | 957 |
886 if self.name is None: | 958 if self.name is None: |
887 abort('Missing "suite=<name>" in ' + projectsFile) | 959 abort('Missing "suite=<name>" in ' + projectsFile) |
888 | 960 |
889 def _commands_name(self): | 961 def _commands_name(self): |
2051 argfile.write('\n'.join(self.javafilelist)) | 2123 argfile.write('\n'.join(self.javafilelist)) |
2052 argfile.close() | 2124 argfile.close() |
2053 | 2125 |
2054 processorArgs = [] | 2126 processorArgs = [] |
2055 | 2127 |
2056 aps = self.proj.annotation_processors() | 2128 processorPath = self.proj.annotation_processors_path() |
2057 if len(aps) > 0: | 2129 if processorPath: |
2058 processorPath = classpath(aps, resolve=True) | |
2059 genDir = self.proj.source_gen_dir() | 2130 genDir = self.proj.source_gen_dir() |
2060 if exists(genDir): | 2131 if exists(genDir): |
2061 shutil.rmtree(genDir) | 2132 shutil.rmtree(genDir) |
2062 os.mkdir(genDir) | 2133 os.mkdir(genDir) |
2063 processorArgs += ['-processorpath', join(processorPath), '-s', genDir] | 2134 processorArgs += ['-processorpath', join(processorPath), '-s', genDir] |
2132 else: | 2203 else: |
2133 jdtArgs += ['-properties', jdtProperties] | 2204 jdtArgs += ['-properties', jdtProperties] |
2134 jdtArgs.append('@' + argfile.name) | 2205 jdtArgs.append('@' + argfile.name) |
2135 | 2206 |
2136 run_java(jdtVmArgs + jdtArgs) | 2207 run_java(jdtVmArgs + jdtArgs) |
2208 | |
2209 # Create annotation processor jar for a project that defines annotation processors | |
2210 if self.proj.definedAnnotationProcessorsDist: | |
2211 self.proj.definedAnnotationProcessorsDist.make_archive() | |
2212 | |
2137 finally: | 2213 finally: |
2138 for n in toBeDeleted: | 2214 for n in toBeDeleted: |
2139 os.remove(n) | 2215 os.remove(n) |
2140 self.done = True | 2216 self.done = True |
2141 | 2217 |
2196 projects = _projects_opt_limit_to_suites(projects_from_names(projectNames)) | 2272 projects = _projects_opt_limit_to_suites(projects_from_names(projectNames)) |
2197 # N.B. Limiting to a suite only affects the starting set of projects. Dependencies in other suites will still be compiled | 2273 # N.B. Limiting to a suite only affects the starting set of projects. Dependencies in other suites will still be compiled |
2198 sortedProjects = sorted_project_deps(projects, includeAnnotationProcessors=True) | 2274 sortedProjects = sorted_project_deps(projects, includeAnnotationProcessors=True) |
2199 | 2275 |
2200 if args.java: | 2276 if args.java: |
2201 ideinit([], refreshOnly=True, buildProcessorJars=False) | 2277 ideinit([], refreshOnly=True) |
2202 | 2278 |
2203 def prepareOutputDirs(p, clean): | 2279 def prepareOutputDirs(p, clean): |
2204 outputDir = p.output_dir() | 2280 outputDir = p.output_dir() |
2205 if exists(outputDir): | 2281 if exists(outputDir): |
2206 if clean: | 2282 if clean: |
2215 for f in os.listdir(genDir): | 2291 for f in os.listdir(genDir): |
2216 shutil.rmtree(join(genDir, f)) | 2292 shutil.rmtree(join(genDir, f)) |
2217 return outputDir | 2293 return outputDir |
2218 | 2294 |
2219 tasks = {} | 2295 tasks = {} |
2296 updatedAnnotationProcessorDists = set() | |
2220 for p in sortedProjects: | 2297 for p in sortedProjects: |
2221 if p.native: | 2298 if p.native: |
2222 if args.native: | 2299 if args.native: |
2223 log('Calling GNU make {0}...'.format(p.dir)) | 2300 log('Calling GNU make {0}...'.format(p.dir)) |
2224 | 2301 |
2315 if len(javafilelist) == 0: | 2392 if len(javafilelist) == 0: |
2316 logv('[no Java sources for {0} - skipping]'.format(p.name)) | 2393 logv('[no Java sources for {0} - skipping]'.format(p.name)) |
2317 continue | 2394 continue |
2318 | 2395 |
2319 task = JavaCompileTask(args, p, buildReason, javafilelist, jdk, outputDir, jdtJar, taskDeps) | 2396 task = JavaCompileTask(args, p, buildReason, javafilelist, jdk, outputDir, jdtJar, taskDeps) |
2397 if p.definedAnnotationProcessorsDist: | |
2398 updatedAnnotationProcessorDists.add(p.definedAnnotationProcessorsDist) | |
2320 | 2399 |
2321 if args.parallelize: | 2400 if args.parallelize: |
2322 # Best to initialize class paths on main process | 2401 # Best to initialize class paths on main process |
2323 jdk.bootclasspath() | 2402 jdk.bootclasspath() |
2324 task.proc = None | 2403 task.proc = None |
2416 for t in failed: | 2495 for t in failed: |
2417 log('Compiling {} failed'.format(t.proj.name)) | 2496 log('Compiling {} failed'.format(t.proj.name)) |
2418 abort('{} Java compilation tasks failed'.format(len(failed))) | 2497 abort('{} Java compilation tasks failed'.format(len(failed))) |
2419 | 2498 |
2420 for dist in sorted_dists(): | 2499 for dist in sorted_dists(): |
2421 archive(['@' + dist.name]) | 2500 if dist not in updatedAnnotationProcessorDists: |
2501 archive(['@' + dist.name]) | |
2422 | 2502 |
2423 if suppliedParser: | 2503 if suppliedParser: |
2424 return args | 2504 return args |
2425 return None | 2505 return None |
2426 | 2506 |
2481 if not os.path.isfile(args.eclipse_exe): | 2561 if not os.path.isfile(args.eclipse_exe): |
2482 abort('File does not exist: ' + args.eclipse_exe) | 2562 abort('File does not exist: ' + args.eclipse_exe) |
2483 if not os.access(args.eclipse_exe, os.X_OK): | 2563 if not os.access(args.eclipse_exe, os.X_OK): |
2484 abort('Not an executable file: ' + args.eclipse_exe) | 2564 abort('Not an executable file: ' + args.eclipse_exe) |
2485 | 2565 |
2486 eclipseinit([], buildProcessorJars=False) | 2566 eclipseinit([]) |
2487 | 2567 |
2488 # build list of projects to be processed | 2568 # build list of projects to be processed |
2489 projects = sorted_deps() | 2569 projects = sorted_deps() |
2490 if args.projects is not None: | 2570 if args.projects is not None: |
2491 projects = [project(name) for name in args.projects.split(',')] | 2571 projects = [project(name) for name in args.projects.split(',')] |
2591 if args.backup: | 2671 if args.backup: |
2592 zf.close() | 2672 zf.close() |
2593 log('Wrote backup of {0} modified files to {1}'.format(len(modified), backup)) | 2673 log('Wrote backup of {0} modified files to {1}'.format(len(modified), backup)) |
2594 return 1 | 2674 return 1 |
2595 return 0 | 2675 return 0 |
2596 | |
2597 def processorjars(): | |
2598 for s in suites(True): | |
2599 _processorjars_suite(s) | |
2600 | |
2601 def _processorjars_suite(s): | |
2602 projs = set() | |
2603 candidates = sorted_project_deps(s.projects) | |
2604 for p in candidates: | |
2605 if _isAnnotationProcessorDependency(p): | |
2606 projs.add(p) | |
2607 | |
2608 if len(projs) <= 0: | |
2609 return [] | |
2610 | |
2611 pnames = [p.name for p in projs] | |
2612 build(['--jdt-warning-as-error', '--projects', ",".join(pnames)]) | |
2613 return archive(pnames) | |
2614 | 2676 |
2615 def pylint(args): | 2677 def pylint(args): |
2616 """run pylint (if available) over Python source files (found by 'hg locate' or by tree walk with -walk)""" | 2678 """run pylint (if available) over Python source files (found by 'hg locate' or by tree walk with -walk)""" |
2617 | 2679 |
2618 parser = ArgumentParser(prog='mx pylint') | 2680 parser = ArgumentParser(prog='mx pylint') |
2955 if get_os() == 'windows': | 3017 if get_os() == 'windows': |
2956 path = unicode("\\\\?\\" + dirPath) | 3018 path = unicode("\\\\?\\" + dirPath) |
2957 shutil.rmtree(path) | 3019 shutil.rmtree(path) |
2958 | 3020 |
2959 def _rmIfExists(name): | 3021 def _rmIfExists(name): |
2960 if os.path.isfile(name): | 3022 if name and os.path.isfile(name): |
2961 os.unlink(name) | 3023 os.unlink(name) |
2962 | 3024 |
2963 for p in projects_opt_limit_to_suites(): | 3025 for p in projects_opt_limit_to_suites(): |
2964 if p.native: | 3026 if p.native: |
2965 if args.native: | 3027 if args.native: |
3217 eclipseLaunches = join('mx', 'eclipse-launches') | 3279 eclipseLaunches = join('mx', 'eclipse-launches') |
3218 if not exists(eclipseLaunches): | 3280 if not exists(eclipseLaunches): |
3219 os.makedirs(eclipseLaunches) | 3281 os.makedirs(eclipseLaunches) |
3220 return update_file(join(eclipseLaunches, name + '.launch'), launch) | 3282 return update_file(join(eclipseLaunches, name + '.launch'), launch) |
3221 | 3283 |
3222 def eclipseinit(args, buildProcessorJars=True, refreshOnly=False): | 3284 def eclipseinit(args, refreshOnly=False): |
3223 """(re)generate Eclipse project configurations and working sets""" | 3285 """(re)generate Eclipse project configurations and working sets""" |
3224 for s in suites(True): | 3286 for s in suites(True): |
3225 _eclipseinit_suite(args, s, buildProcessorJars, refreshOnly) | 3287 _eclipseinit_suite(args, s, refreshOnly) |
3226 | 3288 |
3227 generate_eclipse_workingsets() | 3289 generate_eclipse_workingsets() |
3228 | 3290 |
3229 def _check_ide_timestamp(suite, configZip, ide): | 3291 def _check_ide_timestamp(suite, configZip, ide): |
3230 """return True if and only if the projects file, eclipse-settings files, and mx itself are all older than configZip""" | 3292 """return True if and only if the projects file, eclipse-settings files, and mx itself are all older than configZip""" |
3380 out.open('buildCommand') | 3442 out.open('buildCommand') |
3381 out.element('name', data=buildCommand) | 3443 out.element('name', data=buildCommand) |
3382 out.element('arguments', data='') | 3444 out.element('arguments', data='') |
3383 out.close('buildCommand') | 3445 out.close('buildCommand') |
3384 | 3446 |
3385 # The path should always be p.name/dir. independent of where the workspace actually is. | |
3386 # So we use the parent folder of the project, whatever that is, to generate such a relative path. | |
3387 logicalWorkspaceRoot = os.path.dirname(p.dir) | |
3388 binFolder = os.path.relpath(p.output_dir(), logicalWorkspaceRoot) | |
3389 | |
3390 if _isAnnotationProcessorDependency(p): | |
3391 refreshFile = os.path.relpath(join(p.dir, p.name + '.jar'), logicalWorkspaceRoot) | |
3392 _genEclipseBuilder(out, p, 'Jar', 'archive ' + p.name, refresh=True, refreshFile=refreshFile, relevantResources=[binFolder], async=True, xmlIndent='', xmlStandalone='no') | |
3393 | |
3394 out.close('buildSpec') | 3447 out.close('buildSpec') |
3395 out.open('natures') | 3448 out.open('natures') |
3396 out.element('nature', data='org.eclipse.jdt.core.javanature') | 3449 out.element('nature', data='org.eclipse.jdt.core.javanature') |
3397 if exists(csConfig): | 3450 if exists(csConfig): |
3398 out.element('nature', data='net.sf.eclipsecs.core.CheckstyleNature') | 3451 out.element('nature', data='net.sf.eclipsecs.core.CheckstyleNature') |
3444 content = content.replace('org.eclipse.jdt.core.compiler.processAnnotations=disabled', 'org.eclipse.jdt.core.compiler.processAnnotations=enabled') | 3497 content = content.replace('org.eclipse.jdt.core.compiler.processAnnotations=disabled', 'org.eclipse.jdt.core.compiler.processAnnotations=enabled') |
3445 update_file(join(settingsDir, name), content) | 3498 update_file(join(settingsDir, name), content) |
3446 if files: | 3499 if files: |
3447 files.append(join(settingsDir, name)) | 3500 files.append(join(settingsDir, name)) |
3448 | 3501 |
3449 if len(p.annotation_processors()) > 0: | 3502 processorPath = p.annotation_processors_path() |
3503 if processorPath: | |
3450 out = XMLDoc() | 3504 out = XMLDoc() |
3451 out.open('factorypath') | 3505 out.open('factorypath') |
3452 out.element('factorypathentry', {'kind' : 'PLUGIN', 'id' : 'org.eclipse.jst.ws.annotations.core', 'enabled' : 'true', 'runInBatchMode' : 'false'}) | 3506 out.element('factorypathentry', {'kind' : 'PLUGIN', 'id' : 'org.eclipse.jst.ws.annotations.core', 'enabled' : 'true', 'runInBatchMode' : 'false'}) |
3453 for ap in p.annotation_processors(): | 3507 for e in processorPath.split(os.pathsep): |
3454 for dep in dependency(ap).all_deps([], True): | 3508 out.element('factorypathentry', {'kind' : 'EXTJAR', 'id' : e, 'enabled' : 'true', 'runInBatchMode' : 'false'}) |
3455 if dep.isLibrary(): | |
3456 # Relative paths for "lib" class path entries have various semantics depending on the Eclipse | |
3457 # version being used (e.g. see https://bugs.eclipse.org/bugs/show_bug.cgi?id=274737) so it's | |
3458 # safest to simply use absolute paths. | |
3459 path = _make_absolute(dep.get_path(resolve=True), p.suite.dir) | |
3460 out.element('factorypathentry', {'kind' : 'EXTJAR', 'id' : path, 'enabled' : 'true', 'runInBatchMode' : 'false'}) | |
3461 if files: | |
3462 files.append(path) | |
3463 elif dep.isProject(): | |
3464 out.element('factorypathentry', {'kind' : 'WKSPJAR', 'id' : '/' + dep.name + '/' + dep.name + '.jar', 'enabled' : 'true', 'runInBatchMode' : 'false'}) | |
3465 out.close('factorypath') | 3509 out.close('factorypath') |
3466 update_file(join(p.dir, '.factorypath'), out.xml(indent='\t', newl='\n')) | 3510 update_file(join(p.dir, '.factorypath'), out.xml(indent='\t', newl='\n')) |
3467 if files: | 3511 if files: |
3468 files.append(join(p.dir, '.factorypath')) | 3512 files.append(join(p.dir, '.factorypath')) |
3469 | 3513 |
3470 def _eclipseinit_suite(args, suite, buildProcessorJars=True, refreshOnly=False): | 3514 def _eclipseinit_suite(args, suite, refreshOnly=False): |
3471 configZip = TimeStampFile(join(suite.mxDir, 'eclipse-config.zip')) | 3515 configZip = TimeStampFile(join(suite.mxDir, 'eclipse-config.zip')) |
3472 configLibsZip = join(suite.mxDir, 'eclipse-config-libs.zip') | 3516 configLibsZip = join(suite.mxDir, 'eclipse-config-libs.zip') |
3473 if refreshOnly and not configZip.exists(): | 3517 if refreshOnly and not configZip.exists(): |
3474 return | 3518 return |
3475 | 3519 |
3479 | 3523 |
3480 | 3524 |
3481 | 3525 |
3482 files = [] | 3526 files = [] |
3483 libFiles = [] | 3527 libFiles = [] |
3484 if buildProcessorJars: | |
3485 files += _processorjars_suite(suite) | |
3486 | 3528 |
3487 for p in suite.projects: | 3529 for p in suite.projects: |
3488 if p.native: | 3530 if p.native: |
3489 continue | 3531 continue |
3490 _eclipseinit_project(p) | 3532 _eclipseinit_project(p) |
3550 os.chmod(zipPath, 0o666 & ~currentUmask) | 3592 os.chmod(zipPath, 0o666 & ~currentUmask) |
3551 finally: | 3593 finally: |
3552 if exists(tmp): | 3594 if exists(tmp): |
3553 os.remove(tmp) | 3595 os.remove(tmp) |
3554 | 3596 |
3555 def _isAnnotationProcessorDependency(p): | |
3556 """ | |
3557 Determines if a given project is part of an annotation processor. | |
3558 """ | |
3559 return p in sorted_deps(annotation_processors()) | |
3560 | |
3561 def _genEclipseBuilder(dotProjectDoc, p, name, mxCommand, refresh=True, refreshFile=None, relevantResources=None, async=False, logToConsole=False, logToFile=False, appendToLogFile=True, xmlIndent='\t', xmlStandalone=None): | 3597 def _genEclipseBuilder(dotProjectDoc, p, name, mxCommand, refresh=True, refreshFile=None, relevantResources=None, async=False, logToConsole=False, logToFile=False, appendToLogFile=True, xmlIndent='\t', xmlStandalone=None): |
3562 externalToolDir = join(p.dir, '.externalToolBuilders') | 3598 externalToolDir = join(p.dir, '.externalToolBuilders') |
3563 launchOut = XMLDoc() | 3599 launchOut = XMLDoc() |
3564 consoleOn = 'true' if logToConsole else 'false' | 3600 consoleOn = 'true' if logToConsole else 'false' |
3565 launchOut.open('launchConfiguration', {'type' : 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'}) | 3601 launchOut.open('launchConfiguration', {'type' : 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'}) |
3792 wsdoc.open('workingSet', {'editPageID': 'org.eclipse.jdt.ui.JavaWorkingSetPage', 'factoryID': 'org.eclipse.ui.internal.WorkingSetFactory', 'id': 'wsid_' + ws, 'label': ws, 'name': ws}) | 3828 wsdoc.open('workingSet', {'editPageID': 'org.eclipse.jdt.ui.JavaWorkingSetPage', 'factoryID': 'org.eclipse.ui.internal.WorkingSetFactory', 'id': 'wsid_' + ws, 'label': ws, 'name': ws}) |
3793 | 3829 |
3794 def _workingset_element(wsdoc, p): | 3830 def _workingset_element(wsdoc, p): |
3795 wsdoc.element('item', {'elementID': '=' + p, 'factoryID': 'org.eclipse.jdt.ui.PersistableJavaElementFactory'}) | 3831 wsdoc.element('item', {'elementID': '=' + p, 'factoryID': 'org.eclipse.jdt.ui.PersistableJavaElementFactory'}) |
3796 | 3832 |
3797 def netbeansinit(args, refreshOnly=False, buildProcessorJars=True): | 3833 def netbeansinit(args, refreshOnly=False): |
3798 """(re)generate NetBeans project configurations""" | 3834 """(re)generate NetBeans project configurations""" |
3799 | 3835 |
3800 for suite in suites(True): | 3836 for suite in suites(True): |
3801 _netbeansinit_suite(args, suite, refreshOnly, buildProcessorJars) | 3837 _netbeansinit_suite(args, suite, refreshOnly) |
3802 | 3838 |
3803 def _netbeansinit_suite(args, suite, refreshOnly=False, buildProcessorJars=True): | 3839 def _netbeansinit_suite(args, suite, refreshOnly=False): |
3804 configZip = TimeStampFile(join(suite.mxDir, 'netbeans-config.zip')) | 3840 configZip = TimeStampFile(join(suite.mxDir, 'netbeans-config.zip')) |
3805 configLibsZip = join(suite.mxDir, 'eclipse-config-libs.zip') | 3841 configLibsZip = join(suite.mxDir, 'eclipse-config-libs.zip') |
3806 if refreshOnly and not configZip.exists(): | 3842 if refreshOnly and not configZip.exists(): |
3807 return | 3843 return |
3808 | 3844 |
4252 rm(join(p.dir, p.name + '.jar')) | 4288 rm(join(p.dir, p.name + '.jar')) |
4253 except: | 4289 except: |
4254 log("Error removing {0}".format(p.name + '.jar')) | 4290 log("Error removing {0}".format(p.name + '.jar')) |
4255 | 4291 |
4256 | 4292 |
4257 def ideinit(args, refreshOnly=False, buildProcessorJars=True): | 4293 def ideinit(args, refreshOnly=False): |
4258 """(re)generate Eclipse, NetBeans and Intellij project configurations""" | 4294 """(re)generate Eclipse, NetBeans and Intellij project configurations""" |
4259 eclipseinit(args, refreshOnly=refreshOnly, buildProcessorJars=buildProcessorJars) | 4295 eclipseinit(args, refreshOnly=refreshOnly) |
4260 netbeansinit(args, refreshOnly=refreshOnly, buildProcessorJars=buildProcessorJars) | 4296 netbeansinit(args, refreshOnly=refreshOnly) |
4261 intellijinit(args, refreshOnly=refreshOnly) | 4297 intellijinit(args, refreshOnly=refreshOnly) |
4262 if not refreshOnly: | 4298 if not refreshOnly: |
4263 fsckprojects([]) | 4299 fsckprojects([]) |
4264 | 4300 |
4265 def fsckprojects(args): | 4301 def fsckprojects(args): |