comparison mxtool/mx.py @ 7913:0df252296c8d

added fsckproject command to mx for removing directories corresponding to deleted projects. This command is also called from the ideinit command (GRAAL-90)
author Doug Simon <doug.simon@oracle.com>
date Sat, 02 Mar 2013 13:52:56 +0400
parents 2865133eeef2
children 0dea5ef60303
comparison
equal deleted inserted replaced
7912:06ecee106195 7913:0df252296c8d
2472 2472
2473 def ideinit(args, suite=None): 2473 def ideinit(args, suite=None):
2474 """(re)generate Eclipse and NetBeans project configurations""" 2474 """(re)generate Eclipse and NetBeans project configurations"""
2475 eclipseinit(args, suite) 2475 eclipseinit(args, suite)
2476 netbeansinit(args, suite) 2476 netbeansinit(args, suite)
2477 fsckprojects([])
2478
2479 def fsckprojects(args):
2480 """find directories corresponding to deleted Java projects and delete them"""
2481 for suite in suites():
2482 projectDirs = [p.dir for p in suite.projects]
2483 for root, dirnames, files in os.walk(suite.dir):
2484 currentDir = join(suite.dir, root)
2485 if currentDir in projectDirs:
2486 # don't traverse subdirs of an existing project
2487 dirnames[:] = []
2488 else:
2489 projectConfigFiles = frozenset(['.classpath', 'nbproject'])
2490 indicators = projectConfigFiles.intersection(files)
2491 if len(indicators) != 0:
2492 response = raw_input(currentDir + ' looks like a removed project -- delete it? [yn]: ')
2493 if 'y' == response:
2494 shutil.rmtree(currentDir)
2495 log('Deleted ' + currentDir)
2477 2496
2478 def javadoc(args, parser=None, docDir='javadoc', includeDeps=True): 2497 def javadoc(args, parser=None, docDir='javadoc', includeDeps=True):
2479 """generate javadoc for some/all Java projects""" 2498 """generate javadoc for some/all Java projects"""
2480 2499
2481 parser = ArgumentParser(prog='mx javadoc') if parser is None else parser 2500 parser = ArgumentParser(prog='mx javadoc') if parser is None else parser
2924 'canonicalizeprojects': [canonicalizeprojects, ''], 2943 'canonicalizeprojects': [canonicalizeprojects, ''],
2925 'clean': [clean, ''], 2944 'clean': [clean, ''],
2926 'eclipseinit': [eclipseinit, ''], 2945 'eclipseinit': [eclipseinit, ''],
2927 'eclipseformat': [eclipseformat, ''], 2946 'eclipseformat': [eclipseformat, ''],
2928 'findclass': [findclass, ''], 2947 'findclass': [findclass, ''],
2948 'fsckprojects': [fsckprojects, ''],
2929 'help': [help_, '[command]'], 2949 'help': [help_, '[command]'],
2930 'ideclean': [ideclean, ''], 2950 'ideclean': [ideclean, ''],
2931 'ideinit': [ideinit, ''], 2951 'ideinit': [ideinit, ''],
2932 'projectgraph': [projectgraph, ''], 2952 'projectgraph': [projectgraph, ''],
2933 'javap': [javap, ''], 2953 'javap': [javap, ''],