@Input public String getBuildToolsVersion() { return getBuildTools().getRevision().toString(); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Key)) { return false; } Key key = (Key) o; if (!mBuildToolsRevision.equals(key.mBuildToolsRevision)) { return false; } if (!mSourceFile.equals(key.mSourceFile)) { return false; } return true; }
@Nullable private FullRevision getPlatformToolsRevision(@NonNull File platformToolsFolder) { if (!platformToolsFolder.isDirectory()) { return null; } Reader reader = null; try { reader = new InputStreamReader( new FileInputStream(new File(platformToolsFolder, FN_SOURCE_PROP)), Charsets.UTF_8); Properties props = new Properties(); props.load(reader); String value = props.getProperty(PkgProps.PKG_REVISION); return FullRevision.parseRevision(value); } catch (FileNotFoundException ignore) { // return null below. } catch (IOException ignore) { // return null below. } catch (NumberFormatException ignore) { // return null below. } finally { try { Closeables.close(reader, true /* swallowIOException */); } catch (IOException e) { // cannot happen } } return null; }
|| buildToolInfo.getRevision().compareTo(MIN_MULTIDEX_BUILD_TOOLS_REV) >= 0, "Multi dex requires Build Tools " + MIN_MULTIDEX_BUILD_TOOLS_REV.toString() + " / Current: " + buildToolInfo.getRevision().toShortString()); if (buildToolInfo.getRevision().compareTo(MIN_MULTI_THREADED_DEX_BUILD_TOOLS_REV) >= 0) { Integer threadCount = dexOptions.getThreadCount(); if (threadCount == null) {
.compareTo(MIN_BUILD_TOOLS_REVISION_FOR_DEX_INPUT_LIST) >= 0) { File inputListFile = new File(mTempInputFolder, "inputList.txt");
if (buildToolInfo.getRevision().getMajor() >= 21) { builder.addArgs("--pseudo-localize"); } else { if (buildToolInfo.getRevision().getMajor() > 20) { builder.addArgs("--error-on-missing-config-entry"); } else { resourceConfigs.addAll(mResourceConfigs); if (buildToolInfo.getRevision().getMajor() < 21 && mPreferredDensity != null) { resourceConfigs.add(mPreferredDensity); List<String> densityResourceConfigs = new ArrayList<String>(); if (!resourceConfigs.isEmpty()) { if (buildToolInfo.getRevision().getMajor() >= 21) { for (String resourceConfig : resourceConfigs) { if (Density.getEnum(resourceConfig) != null) { if (buildToolInfo.getRevision().getMajor() >= 21 && mPreferredDensity != null) { if (!isNullOrEmpty(mResourceConfigs)) { Collection<String> densityResConfig = getDensityResConfigs(mResourceConfigs); if (buildToolInfo.getRevision().getMajor() < 21 && mPreferredDensity != null) { logger.warning(String.format("Warning : Project is building density based multiple APKs" + " but using tools version %1$s, you should upgrade to build-tools 21 or above" + " to ensure proper packaging of resources.", buildToolInfo.getRevision().getMajor()));
@VisibleForTesting @Nullable static String getPlatformVersion(@NonNull LintClient client) { LocalSdk sdk = client.getSdk(); if (sdk != null) { LocalPkgInfo pkgInfo = sdk.getPkgInfo(PkgType.PKG_PLATFORM_TOOLS); if (pkgInfo != null) { FullRevision version = pkgInfo.getDesc().getFullRevision(); if (version != null) { return version.toShortString(); } } } return null; }
private static final FullRevision MIN_BUILD_TOOLS_REV = new FullRevision(19, 1, 0); private static final DependencyFileProcessor sNoOpDependencyFileProcessor = new DependencyFileProcessor() { @Override
/** * Sets the SdkInfo and the targetInfo on the builder. This is required to actually * build (some of the steps). * * @param sdkInfo the SdkInfo * @param targetInfo the TargetInfo * * @see com.android.builder.sdk.SdkLoader */ public void setTargetInfo( @NonNull SdkInfo sdkInfo, @NonNull TargetInfo targetInfo, @NonNull Collection<LibraryRequest> libraryRequests) { mSdkInfo = sdkInfo; mTargetInfo = targetInfo; if (mTargetInfo.getBuildTools().getRevision().compareTo(MIN_BUILD_TOOLS_REV) < 0) { throw new IllegalArgumentException(String.format( "The SDK Build Tools revision (%1$s) is too low for project '%2$s'. Minimum required is %3$s", mTargetInfo.getBuildTools().getRevision(), mProjectId, MIN_BUILD_TOOLS_REV)); } mLibraryRequests = ImmutableList.copyOf(libraryRequests); }
private PngCruncher getCruncher() { if (getUseNewCruncher()) { if (getBuilder().getTargetInfo().getBuildTools().getRevision().getMajor() >= 22) { return QueuedCruncher.Builder.INSTANCE.newCruncher( getBuilder().getTargetInfo().getBuildTools().getPath( BuildToolInfo.PathId.AAPT), getILogger()); } getLogger().info("New PNG cruncher will be enabled with build tools 22 and above."); } return getBuilder().getAaptCruncher(); }
@Input public String getBuildToolsVersion() { return getBuildTools().getRevision().toString(); }
checkArgument(extension.getBuildToolsRevision().compareTo( MergeResources.NORMALIZE_RESOURCES_BUILD_TOOLS) >= 0, "To preprocess resources, you have to use build tools >= %1$s",
if (getExtension().getBuildToolsRevision().getMajor() < 21) { throw new RuntimeException("Pure splits can only be used with buildtools 21 and later");
@NonNull private Optional<LoadedBuildTool> findVersion(FullRevision version) { for (LoadedBuildTool loadedBuildTool : loadedBuildTools) { if (loadedBuildTool.version.equals(version)) { return Optional.of(loadedBuildTool); } } return Optional.absent(); }
FullRevision revision = FullRevision.parseRevision(attrMap.getNamedItem( ATTR_REVISION).getNodeValue());
@Input String getBuildToolsVersion() { return getBuildTools().getRevision().toString(); }
mergeResourcesTask.normalizeResources = scope.getGlobalScope().getExtension().getBuildToolsRevision() .compareTo(NORMALIZE_RESOURCES_BUILD_TOOLS) < 0;
attr.setValue(itemKey.getBuildToolsRevision().toString()); itemNode.getAttributes().setNamedItem(attr);