private String getPathForBuildTool( BuildToolInfo.PathId pathId ) { return getBuildToolInfo().getPath( pathId ); }
/** * Obtains the path for the {@code aapt} executable. * * @return the path */ @NonNull private String getAapt2ExecutablePath() { String aapt2 = mBuildToolInfo.getPath(BuildToolInfo.PathId.AAPT2); if (aapt2 == null || !new File(aapt2).isFile()) { throw new IllegalStateException("aapt2 is missing on '" + aapt2 + "'"); } return aapt2; }
/** * Obtains the path for the {@code aapt} executable. * * @return the path */ @NonNull private String getAaptExecutablePath() { String aapt = mBuildToolInfo.getPath(BuildToolInfo.PathId.AAPT); if (aapt == null || !new File(aapt).isFile()) { throw new IllegalStateException("aapt is missing on '" + aapt + "'"); } return aapt; } }
@NonNull public File getDxJar() { checkState(mTargetInfo != null, "Cannot call getDxJar() before setTargetInfo() is called."); return new File(mTargetInfo.getBuildTools().getPath(BuildToolInfo.PathId.DX_JAR)); }
@Override public File call() throws Exception { final TargetInfo info = androidBuilder.getTargetInfo(); if (info != null) { String path = info.getBuildTools().getPath(ZIP_ALIGN); if (path != null) { return new File(path); } } return null; } });
@Override public File call() throws Exception { final TargetInfo info = androidBuilder.getTargetInfo(); if (info == null) { return null; } String path = info.getBuildTools().getPath(ZIP_ALIGN); if (path == null) { return null; } return new File(path); } });
@InputFile public File getJackExe() { return new File( androidBuilder.getTargetInfo().getBuildTools().getPath(BuildToolInfo.PathId.JACK)); }
/** * Returns an {@link PngCruncher} using aapt underneath * @return an PngCruncher object */ @NonNull public PngCruncher getAaptCruncher() { checkState(mTargetInfo != null, "Cannot call getAaptCruncher() before setTargetInfo() is called."); return new AaptCruncher( mTargetInfo.getBuildTools().getPath(BuildToolInfo.PathId.AAPT), mProcessExecutor, mProcessOutputHandler); }
@Override public File call() throws Exception { final TargetInfo info = scope.getGlobalScope().getAndroidBuilder().getTargetInfo(); String path = info == null ? null : info.getBuildTools().getPath(SPLIT_SELECT); if (path != null) { File splitSelectExe = new File(path); return splitSelectExe.exists() ? splitSelectExe : null; } else { return null; } } });
@Override public File call() throws Exception { final TargetInfo info = scope.getGlobalScope().getAndroidBuilder().getTargetInfo(); String path = info == null ? null : info.getBuildTools().getPath(SPLIT_SELECT); if (path != null) { File splitSelectExe = new File(path); return splitSelectExe.exists() ? splitSelectExe : null; } else { return null; } } });
@Override public File call() throws Exception { final TargetInfo info = scope.getGlobalScope().getAndroidBuilder() .getTargetInfo(); String path = info == null ? null : info.getBuildTools().getPath(SPLIT_SELECT); if (path != null) { File splitSelectExe = new File(path); return splitSelectExe.exists() ? splitSelectExe : null; } else { return null; } } });
@NonNull @Override public Collection<SecondaryFile> getSecondaryFiles() { ImmutableList.Builder<SecondaryFile> builder = ImmutableList.builder(); builder.addAll( Iterables.transform(options.getProguardFiles(), SecondaryFile::nonIncremental)); builder.addAll( Iterables.transform(options.getJarJarRuleFiles(), SecondaryFile::nonIncremental)); builder.addAll( Iterables.transform( options.getAnnotationProcessorClassPath(), SecondaryFile::nonIncremental)); builder.addAll(Iterables.transform(getSourceFiles(), SecondaryFile::incremental)); builder.add( SecondaryFile.nonIncremental( new File(androidBuilder .getTargetInfo() .getBuildTools() .getPath(BuildToolInfo.PathId.JACK)))); return builder.build(); }
@Override public File call() throws Exception { String path = scope.getGlobalScope().getAndroidBuilder().getTargetInfo() .getBuildTools().getPath(ZIP_ALIGN); if (path != null) { return new File(path); } return null; } });
@Override public File call() throws Exception { final TargetInfo info = scope.getGlobalScope().getAndroidBuilder().getTargetInfo(); if (info == null) { return null; } String path = info.getBuildTools().getPath(ZIP_ALIGN); if (path == null) { return null; } return new File(path); } });
private ApkInfoParser.ApkInfo loadTestedApkInfo() { File aaptFile = new File(androidBuilder.getTargetInfo().getBuildTools() .getPath(BuildToolInfo.PathId.AAPT)); ApkInfoParser apkInfoParser = new ApkInfoParser(aaptFile, androidBuilder.getProcessExecutor()); try { return apkInfoParser.parseApk(getMainApk()); } catch (ProcessException e) { throw new RuntimeException(e); } }
private ApkInfoParser.ApkInfo loadTestedApkInfo() { File aaptFile = new File(androidBuilder.getTargetInfo().getBuildTools() .getPath(BuildToolInfo.PathId.AAPT)); ApkInfoParser apkInfoParser = new ApkInfoParser(aaptFile, androidBuilder.getProcessExecutor()); try { return apkInfoParser.parseApk(getMainApk()); } catch (ProcessException e) { throw new RuntimeException(e); } }
public Set<String> createMainDexList( @NonNull File allClassesJarFile, @NonNull File jarOfRoots) throws ProcessException { BuildToolInfo buildToolInfo = mTargetInfo.getBuildTools(); ProcessInfoBuilder builder = new ProcessInfoBuilder(); String dx = buildToolInfo.getPath(BuildToolInfo.PathId.DX_JAR); if (dx == null || !new File(dx).isFile()) { throw new IllegalStateException("dx.jar is missing"); } builder.setClasspath(dx); builder.setMain("com.android.multidex.ClassReferenceListBuilder"); builder.addArgs(jarOfRoots.getAbsolutePath()); builder.addArgs(allClassesJarFile.getAbsolutePath()); CachedProcessOutputHandler processOutputHandler = new CachedProcessOutputHandler(); mJavaProcessExecutor.execute(builder.createJavaProcess(), processOutputHandler) .rethrowFailure() .assertNormalExitValue(); String content = processOutputHandler.getProcessOutput().getStandardOutputAsString(); return Sets.newHashSet(Splitter.on('\n').split(content)); }
@NonNull private File getZipAlignExe() throws TransformException { final TargetInfo info = androidBuilder.getTargetInfo(); if (info == null) { throw new TransformException("Cannot find zipAlign executable, no target info set"); } String path1 = info.getBuildTools().getPath(ZIP_ALIGN); if (path1 == null) { throw new TransformException("Cannot find zipAlign executable for build tools " + info.getBuildTools().getLocation()); } return new File(path1); }
private File createSupportObjFile( @NonNull File bcFile, @NonNull Abi abi, @NonNull String objName, @NonNull File objAbiFolder, @NonNull ProcessExecutor processExecutor, @NonNull ProcessOutputHandler processOutputHandler, @NonNull Map<String, String> env) throws ProcessException { ProcessInfoBuilder builder = new ProcessInfoBuilder(); builder.setExecutable(mBuildToolInfo.getPath(BuildToolInfo.PathId.BCC_COMPAT)); builder.addEnvironments(env); builder.addArgs("-O" + Integer.toString(mOptimizationLevel)); File outFile = new File(objAbiFolder, objName); builder.addArgs("-o", outFile.getAbsolutePath()); builder.addArgs("-fPIC"); builder.addArgs("-shared"); builder.addArgs("-rt-path", mLibClCore.get(abi.mDevice).getAbsolutePath()); builder.addArgs("-mtriple", abi.mToolchain); builder.addArgs(bcFile.getAbsolutePath()); processExecutor.execute( builder.createProcess(), processOutputHandler) .rethrowFailure().assertNormalExitValue(); return outFile; }
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(); }