/** * Creates a {@link BuildToolInfo} from a {@link LocalPackage}. */ @NonNull public static BuildToolInfo fromLocalPackage(@NonNull LocalPackage localPackage) { checkNotNull(localPackage, "localPackage"); checkArgument( localPackage.getPath().contains(SdkConstants.FD_BUILD_TOOLS), "%s package required.", SdkConstants.FD_BUILD_TOOLS); return fromStandardDirectoryLayout(localPackage.getVersion(), localPackage.getLocation()); }
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); } }
mergeResourcesTask.buildToolInfo = () -> BuildToolInfo.fromStandardDirectoryLayout( androidExtension.getBuildToolsRevision(), androidExtension.getBuildToolsDir());