HashSet<File> visited = new HashSet<File>();
monitor.setProgressMax(11);
File dir = null;
Package pkg = null;
if ((parseFilter & PARSE_DOCS) != 0) {
dir = new File(osSdkRoot, SdkConstants.FD_DOCS);
pkg = scanDoc(dir, monitor);
if (pkg != null) {
packages.add(pkg);
visited.add(dir);
}
}
monitor.incProgress(1);
if ((parseFilter & PARSE_TOOLS) != 0) {
dir = new File(osSdkRoot, SdkConstants.FD_TOOLS);
pkg = scanTools(dir, monitor);
if (pkg != null) {
packages.add(pkg);
visited.add(dir);
}
}
monitor.incProgress(1);
if ((parseFilter & PARSE_PLATFORM_TOOLS) != 0) {
dir = new File(osSdkRoot, SdkConstants.FD_PLATFORM_TOOLS);
pkg = scanPlatformTools(dir, monitor);
if (pkg != null) {
packages.add(pkg);
visited.add(dir);
}
}
monitor.incProgress(1);
if ((parseFilter & PARSE_BUILD_TOOLS) != 0) {
scanBuildTools(sdkManager, visited, packages, monitor);
}
monitor.incProgress(1);
// for platforms, add-ons and samples, rely on the SdkManager parser
if ((parseFilter & (PARSE_ADDONS | PARSE_PLATFORMS)) != 0) {
File samplesRoot = new File(osSdkRoot, SdkConstants.FD_SAMPLES);
for(IAndroidTarget target : sdkManager.getTargets()) {
Properties props = parseProperties(new File(target.getLocation(),
SdkConstants.FN_SOURCE_PROP));
try {
pkg = null;
if (target.isPlatform() && (parseFilter & PARSE_PLATFORMS) != 0) {
pkg = PlatformPackage.create(target, props);
if (samplesRoot.isDirectory()) {
// Get the samples dir for a platform if it is located in the new
// root /samples dir. We purposely ignore "old" samples that are
// located under the platform dir.
File samplesDir = new File(target.getPath(IAndroidTarget.SAMPLES));
if (samplesDir.exists() &&
samplesDir.getParentFile().equals(samplesRoot)) {
Properties samplesProps = parseProperties(
new File(samplesDir, SdkConstants.FN_SOURCE_PROP));
if (samplesProps != null) {
Package pkg2 = SamplePackage.create(target, samplesProps);
packages.add(pkg2);
}
visited.add(samplesDir);
}
}
} else if ((parseFilter & PARSE_ADDONS) != 0) {
pkg = AddonPackage.create(target, props);
}
if (pkg != null) {
for (ISystemImage systemImage : target.getSystemImages()) {
if (systemImage.getLocationType() == LocationType.IN_SYSTEM_IMAGE) {
File siDir = systemImage.getLocation();
if (siDir.isDirectory()) {
Properties siProps = parseProperties(
new File(siDir, SdkConstants.FN_SOURCE_PROP));
Package pkg2 = new SystemImagePackage(
target.getVersion(),
0 /*rev*/, // this will use the one from siProps
systemImage.getAbiType(),
siProps,
siDir.getAbsolutePath());