PackageParserUtils.getRevisionProperty(props, PkgProps.PKG_REVISION); if (rev == null) { continue; // skip, no revision PackageParserUtils.getProperty(props, PkgProps.EXTRA_OLD_PATHS, null);
/** * Try to find a platform-tools package at the given location. * Returns null if not found. */ private LocalPlatformToolPkgInfo scanPlatformTools(File ptFolder) { // Can we find some properties? Properties props = parseProperties(new File(ptFolder, SdkConstants.FN_SOURCE_PROP)); Revision rev = PackageParserUtils.getRevisionProperty(props, PkgProps.PKG_REVISION); if (rev == null) { return null; } // Since we used to require a complete revision rev = fullySpecifyRevision(rev); LocalPlatformToolPkgInfo info = new LocalPlatformToolPkgInfo(this, ptFolder, props, rev); return info; }
.parseSkinFolder(new File(p.getLocation(), SdkConstants.FD_SKINS), fop)) { skins.put(skin.getName(), skin);
/** * Utility method to parse the {@link PkgProps#PKG_REVISION} property as a revision * (major.minor.micro.preview). * * @param props The properties to parse. * @param propKey The name of the property. Must not be null. * @return A {@link Revision} or null if there is no such property or it couldn't be parsed. */ @Nullable public static Revision getRevisionProperty( @Nullable Properties props, @NonNull String propKey) { String revStr = getProperty(props, propKey, null); Revision rev = null; if (revStr != null) { try { rev = Revision.parseRevision(revStr); } catch (NumberFormatException ignore) { } } return rev; }
private void scanSamples(File collectionDir, Collection<LocalPkgInfo> outCollection) { for (File platformDir : mFileOp.listFiles(collectionDir)) { if (!shouldVisitDir(PkgType.PKG_SAMPLE, platformDir)) { continue; } Properties props = parseProperties(new File(platformDir, SdkConstants.FN_SOURCE_PROP)); Revision rev = PackageParserUtils.getRevisionProperty(props, PkgProps.PKG_REVISION); if (rev == null) { continue; // skip, no revision } Revision minToolsRev = PackageParserUtils.getRevisionProperty(props, PkgProps.MIN_TOOLS_REV); if (minToolsRev == null) { minToolsRev = Revision.NOT_SPECIFIED; } try { AndroidVersion vers = AndroidVersionHelper.create(props); LocalSamplePkgInfo pkgInfo = new LocalSamplePkgInfo(this, platformDir, props, vers, rev, minToolsRev); outCollection.add(pkgInfo); } catch (AndroidVersionException e) { continue; // skip invalid or missing android version. } } }
List<File> skinList = PackageParserUtils.parseSkinFolder(skinDir, mFop); skins = skinList.toArray(new File[skinList.size()]); } else {
private void scanPlatforms(File collectionDir, Collection<LocalPkgInfo> outCollection) { for (File platformDir : mFileOp.listFiles(collectionDir)) { if (!shouldVisitDir(PkgType.PKG_PLATFORM, platformDir)) { continue; } Properties props = parseProperties(new File(platformDir, SdkConstants.FN_SOURCE_PROP)); Revision rev = PackageParserUtils.getRevisionProperty(props, PkgProps.PKG_REVISION); if (rev == null) { continue; // skip, no revision } Revision minToolsRev = PackageParserUtils.getRevisionProperty(props, PkgProps.MIN_TOOLS_REV); if (minToolsRev == null) { minToolsRev = Revision.NOT_SPECIFIED; } try { AndroidVersion vers = AndroidVersionHelper.create(props); LocalPlatformPkgInfo pkgInfo = new LocalPlatformPkgInfo(this, platformDir, props, vers, rev, minToolsRev); outCollection.add(pkgInfo); } catch (AndroidVersionException e) { continue; // skip invalid or missing android version. } } }
.newTreeSet(PackageParserUtils.parseSkinFolder(getFile(IAndroidTarget.SKINS), fop));
/** * Try to find an NDK package at the given location. * Returns null if not found. */ @Nullable private LocalNdkPkgInfo scanNdk(@NonNull File ndkFolder) { // Can we find some properties? Properties props = parseProperties(new File(ndkFolder, SdkConstants.FN_SOURCE_PROP)); Revision rev = PackageParserUtils.getRevisionProperty(props, PkgProps.PKG_REVISION); if (rev == null) { return null; } return new LocalNdkPkgInfo(this, ndkFolder, props, rev); }
/** * Try to find an LLDB package at the given location. * Returns null if not found. */ @Nullable private LocalLLDBPkgInfo scanLLDB(@NonNull File lldbFolder) { File pinnedLLDBFolder = new File(lldbFolder, LocalLLDBPkgInfo.PINNED_REVISION.toString()); // Can we find some properties? Properties props = parseProperties(new File(pinnedLLDBFolder, SdkConstants.FN_SOURCE_PROP)); Revision rev = PackageParserUtils.getRevisionProperty(props, PkgProps.PKG_REVISION); if (rev == null) { return null; } return new LocalLLDBPkgInfo(this, pinnedLLDBFolder, props, rev); }
Revision rev = PackageParserUtils.getRevisionProperty(props, PkgProps.PKG_REVISION); if (rev == null) { return null; PackageParserUtils.getRevisionProperty(props, PkgProps.MIN_PLATFORM_TOOLS_REV); if (minPlatToolsRev == null) { minPlatToolsRev = Revision.NOT_SPECIFIED;
private void scanSources(File collectionDir, Collection<LocalPkgInfo> outCollection) { // The build-tool root folder contains a list of per-revision folders. for (File platformDir : mFileOp.listFiles(collectionDir)) { if (!shouldVisitDir(PkgType.PKG_SOURCE, platformDir)) { continue; } Properties props = parseProperties(new File(platformDir, SdkConstants.FN_SOURCE_PROP)); Revision rev = PackageParserUtils.getRevisionProperty(props, PkgProps.PKG_REVISION); if (rev == null) { continue; // skip, no revision } try { AndroidVersion vers = AndroidVersionHelper.create(props); LocalSourcePkgInfo pkgInfo = new LocalSourcePkgInfo(this, platformDir, props, vers, rev); outCollection.add(pkgInfo); } catch (AndroidVersionException e) { continue; // skip invalid or missing android version. } } }
private void scanBuildTools(File collectionDir, Collection<LocalPkgInfo> outCollection) { // The build-tool root folder contains a list of per-revision folders. for (File buildToolDir : mFileOp.listFiles(collectionDir)) { if (!shouldVisitDir(PkgType.PKG_BUILD_TOOLS, buildToolDir)) { continue; } Properties props = parseProperties(new File(buildToolDir, SdkConstants.FN_SOURCE_PROP)); Revision rev = PackageParserUtils.getRevisionProperty(props, PkgProps.PKG_REVISION); if (rev == null) { continue; // skip, no revision } // Since we used to require a complete revision rev = fullySpecifyRevision(rev); BuildToolInfo btInfo = BuildToolInfo.fromStandardDirectoryLayout(rev, buildToolDir); LocalBuildToolPkgInfo pkgInfo = new LocalBuildToolPkgInfo(this, buildToolDir, props, rev, btInfo); outCollection.add(pkgInfo); } }
/** * Try to find a docs package at the given location. * Returns null if not found. */ private LocalDocPkgInfo scanDoc(File docFolder) { // Can we find some properties? Properties props = parseProperties(new File(docFolder, SdkConstants.FN_SOURCE_PROP)); Revision rev = PackageParserUtils.getRevisionProperty(props, PkgProps.PKG_REVISION); if (rev == null) { return null; } try { AndroidVersion vers = AndroidVersionHelper.create(props); LocalDocPkgInfo info = new LocalDocPkgInfo(this, docFolder, props, vers, rev); // To start with, a doc folder should have an "index.html" to be acceptable. // We don't actually check the content of the file. if (!mFileOp.isFile(new File(docFolder, "index.html"))) { info.appendLoadError("Missing index.html"); } return info; } catch (AndroidVersionException e) { return null; // skip invalid or missing android version. } }
Revision rev = PackageParserUtils.getRevisionProperty(props, PkgProps.PKG_REVISION); if (rev == null) { continue; // skip, no revision
Revision rev = PackageParserUtils.getRevisionProperty(props, PkgProps.PKG_REVISION); if (rev == null) { continue; // skip, no revision