diff options
author | Raphael Moll <ralf@android.com> | 2010-05-11 15:37:52 +0200 |
---|---|---|
committer | Raphael Moll <ralf@android.com> | 2010-05-11 15:37:52 +0200 |
commit | 690511460b553ee7fd91ed167dbc0acef122a979 (patch) | |
tree | 89aed2fee61d424839d89aff2f4674126d86f774 /eclipse/scripts/collect_sources_for_sdk.py | |
parent | 2cc3f070f6c52ecaa93aeb3d97383919ff5f1ceb (diff) | |
download | sdk-690511460b553ee7fd91ed167dbc0acef122a979.zip sdk-690511460b553ee7fd91ed167dbc0acef122a979.tar.gz sdk-690511460b553ee7fd91ed167dbc0acef122a979.tar.bz2 |
Fix collect_sources_for_sdk to collect dalvik core lib sources
SDK Bug 2065790
Change-Id: If818f0268e1361d58aaa2bdd7152222cf69f279a
Diffstat (limited to 'eclipse/scripts/collect_sources_for_sdk.py')
-rwxr-xr-x | eclipse/scripts/collect_sources_for_sdk.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/eclipse/scripts/collect_sources_for_sdk.py b/eclipse/scripts/collect_sources_for_sdk.py index 773070b..b95ae62 100755 --- a/eclipse/scripts/collect_sources_for_sdk.py +++ b/eclipse/scripts/collect_sources_for_sdk.py @@ -38,7 +38,7 @@ _RE_PKG = re.compile("^\s*package\s+([^\s;]+)\s*;.*") class Params(object): def __init__(self): self.DRY = False - self.DIR = "frameworks" + self.DIR = "frameworks libcore" self.SRC = None self.DST = None self.CNT_USED = 0 @@ -70,7 +70,7 @@ def usage(error=None): def parseArgs(argv): p = Params() error = None - + try: opts, args = getopt.getopt(argv[1:], "ns:", @@ -105,6 +105,10 @@ def parseArgs(argv): # Recursively parses the given directory and process java files found def parseSrcDir(p, srcdir): + if not os.path.exists(srcdir): + print >>sys.stderr, "Error: Skipping unknown directory", srcdir + return + for f in os.listdir(srcdir): fp = os.path.join(srcdir, f) if f.endswith(".java") and os.path.isfile(fp): @@ -138,6 +142,7 @@ def checkJavaFile(path): return None + # Create destination directory based on package name then copy the # source file in there def copy(p, fp, f, pkg): @@ -145,6 +150,7 @@ def copy(p, fp, f, pkg): _mkdir(p, dstdir) _cp(p, fp, os.path.join(dstdir, f)) + def _mkdir(p, dir): if not os.path.isdir(dir): if p.DRY: @@ -152,6 +158,7 @@ def _mkdir(p, dir): else: os.makedirs(dir) + def _cp(p, src, dst): if p.DRY: print "cp", src, dst @@ -161,10 +168,13 @@ def _cp(p, src, dst): def main(): p = parseArgs(sys.argv) - parseSrcDir(p, os.path.join(p.SRC, p.DIR)) + for d in p.DIR.split(): + if d: + parseSrcDir(p, os.path.join(p.SRC, d)) print "%d java files copied" % p.CNT_USED if p.CNT_NOPKG: print "%d java files ignored (no package)" % p.CNT_NOPKG if p.DRY: print "This was in *DRY* mode. No copies done." + if __name__ == "__main__": main() |