/** * Checks whether the build-tool is valid by verifying that the expected binaries * are actually present. This checks that all known paths point to a valid file * or directory. * * @param log An optional logger. If non-null, errors will be printed there. * @return True if the build-tool folder contains all the expected tools. */ public boolean isValid(@Nullable ILogger log) { for (Map.Entry<PathId, String> entry : mPaths.entrySet()) { File f = new File(entry.getValue()); // check if file is missing. It's only ok if the revision of the build-tools // is lower than the min rev of the element. if (!f.exists() && entry.getKey().isPresentIn(mRevision)) { if (log != null) { log.warning("Build-tool %1$s is missing %2$s at %3$s", //$NON-NLS-1$ mRevision.toString(), entry.getKey(), f.getAbsolutePath()); } return false; } } return true; }
} else if (BCC_COMPAT.isPresentIn(revision)) { throw new IllegalArgumentException("BCC_COMPAT required in " + revision.toString()); } else if (LD_ARM.isPresentIn(revision)) { throw new IllegalArgumentException("LD_ARM required in " + revision.toString()); } else if (LD_ARM64.isPresentIn(revision)) { throw new IllegalArgumentException("LD_ARM64 required in " + revision.toString()); } else if (LD_X86.isPresentIn(revision)) { throw new IllegalArgumentException("LD_X86 required in " + revision.toString()); } else if (LD_X86_64.isPresentIn(revision)) { throw new IllegalArgumentException("LD_X86_64 required in " + revision.toString()); } else if (LD_MIPS.isPresentIn(revision)) { throw new IllegalArgumentException("LD_MIPS required in " + revision.toString()); } else if (AAPT2.isPresentIn(revision)) { throw new IllegalArgumentException("AAPT2 required in " + revision.toString());
BuildToolInfo.PathId.AAPT2.isPresentIn(buildTools.getRevision())) { return new OutOfProcessAaptV2( builder.getProcessExecutor(),
private String getPathString() { StringBuilder sb = new StringBuilder("{"); for (Map.Entry<PathId, String> entry : mPaths.entrySet()) { if (entry.getKey().isPresentIn(mRevision)) { if (sb.length() > 1) { sb.append(", "); } sb.append(entry.getKey()).append('=').append(entry.getValue()); } } sb.append('}'); return sb.toString(); } }
/** * Returns the path of a build-tool component. * * @param pathId the id representing the path to return. * @return The absolute path for that tool, with a / separator if it's a folder. * Null if the path-id is unknown. */ public String getPath(PathId pathId) { assert pathId.isPresentIn(mRevision); return mPaths.get(pathId); }