com.android.ide.common.process.LoggedProcessOutputHandler Java Examples

The following examples show how to use com.android.ide.common.process.LoggedProcessOutputHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Dex.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
private void doTaskAction(@Nullable Collection<File> inputFiles, @Nullable File inputDir) throws IOException, ProcessException, InterruptedException {
    File outFolder = getOutputFolder();
    FileUtils.emptyFolder(outFolder);


    File tmpFolder = getTmpFolder();
    tmpFolder.mkdirs();

    // if some of our .jar input files exist, just reset the inputDir to null
    for (File inputFile : inputFiles) {
        if (inputFile.exists()) {
            inputDir = null;
        }

    }

    if (inputDir != null) {
        inputFiles = getProject().files(inputDir).getFiles();
    }


    getBuilder().convertByteCode(inputFiles, getLibraries(), outFolder, getMultiDexEnabled(),
            getMainDexListFile(), getDexOptions(), getAdditionalParameters(), tmpFolder,
            false, getOptimize(), new LoggedProcessOutputHandler(getILogger()));
}
 
Example #2
Source File: MergeResources.java    From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static Aapt makeAapt(
        BuildToolInfo buildToolInfo,
        AaptGeneration aaptGeneration,
        AndroidBuilder builder,
        boolean crunchPng,
        MergingLog blameLog) {
    ProcessOutputHandler teeOutputHandler =
            new TeeProcessOutputHandler(
                    blameLog != null
                            ? new ParsingProcessOutputHandler(
                            new ToolOutputParser(
                                    aaptGeneration == AaptGeneration.AAPT_V1
                                            ? new AaptOutputParser()
                                            : new Aapt2OutputParser(),
                                    builder.getLogger()),
                            new MergingLogRewriter(blameLog::find, builder.getErrorReporter()))
                            : new LoggedProcessOutputHandler(
                            new AaptGradleFactory.FilteringLogger(builder.getLogger())),
                    new LoggedProcessOutputHandler(new AaptGradleFactory.FilteringLogger(builder.getLogger())));

    return new AaptV1(
            builder.getProcessExecutor(),
            teeOutputHandler,
            buildToolInfo,
            new AaptGradleFactory.FilteringLogger(builder.getLogger()),
            crunchPng ? AaptV1.PngProcessMode.ALL : AaptV1.PngProcessMode.NO_CRUNCH,
            0);
}
 
Example #3
Source File: MergeAwbResource.java    From atlas with Apache License 2.0 5 votes vote down vote up
@NonNull
private static Aapt makeAapt(
        @NonNull AaptGeneration aaptGeneration,
        @NonNull AndroidBuilder builder,
        @Nullable FileCache fileCache,
        boolean crunchPng,
        @NonNull VariantScope scope,
        @NonNull File intermediateDir,
        @Nullable MergingLog blameLog)
        throws IOException {
    return AaptGradleFactory.make(
            aaptGeneration,
            builder,
            blameLog != null
                    ? new ParsingProcessOutputHandler(
                    new ToolOutputParser(
                            aaptGeneration == AaptGeneration.AAPT_V1
                                    ? new AaptOutputParser()
                                    : new Aapt2OutputParser(),
                            builder.getLogger()),
                    new MergingLogRewriter(blameLog::find, builder.getErrorReporter()))
                    : new LoggedProcessOutputHandler(
                    new AaptGradleFactory.FilteringLogger(builder.getLogger())),
            fileCache,
            crunchPng,
            intermediateDir,
            scope.getGlobalScope().getExtension().getAaptOptions().getCruncherProcesses());
}
 
Example #4
Source File: TaobaoInstantRunDex.java    From atlas with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
protected void convertByteCode(List<File> inputFiles, File outputFolder)
        throws InterruptedException, ProcessException, IOException {
    dexByteCodeConverter
            .convertByteCode(
                    inputFiles,
                    outputFolder,
                    false /* multiDexEnabled */,
                    null /*getMainDexListFile */,
                    dexOptions,
                    new LoggedProcessOutputHandler(logger),
                    minSdkForDx);
}
 
Example #5
Source File: MergeResources.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private PngCruncher getCruncher() {
    if (getUseNewCruncher()) {
        return QueuedCruncher.Builder.INSTANCE.newCruncher(
                getBuilder().getTargetInfo().getBuildTools().getPath(
                        BuildToolInfo.PathId.AAPT), getILogger());
    }
    return getBuilder().getAaptCruncher(new LoggedProcessOutputHandler(getBuilder().getLogger()));
}
 
Example #6
Source File: AidlCompile.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Action methods to compile all the files.
 * <p>
 * The method receives a {@link DependencyFileProcessor} to be used by the
 * {@link com.android.builder.internal.compiler.SourceSearcher.SourceFileProcessor} during
 * the compilation.
 *
 * @param dependencyFileProcessor a DependencyFileProcessor
 */
private void compileAllFiles(DependencyFileProcessor dependencyFileProcessor)
        throws InterruptedException, ProcessException, LoggedErrorException, IOException {
    getBuilder().compileAllAidlFiles(
            getSourceDirs(),
            getSourceOutputDir(),
            getAidlParcelableDir(),
            getImportDirs(),
            dependencyFileProcessor,
            new LoggedProcessOutputHandler(getILogger()));
}
 
Example #7
Source File: GenerateSplitAbiRes.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@TaskAction
protected void doFullTaskAction() throws IOException, InterruptedException, ProcessException {

    for (String split : getSplits()) {
        String resPackageFileName = getOutputFileForSplit(split).getAbsolutePath();

        File tmpDirectory = new File(getOutputDirectory(), getOutputBaseName());
        tmpDirectory.mkdirs();

        File tmpFile = new File(tmpDirectory, "AndroidManifest.xml");

        String versionNameToUse = getVersionName();
        if (versionNameToUse == null) {
            versionNameToUse = String.valueOf(getVersionCode());
        }

        OutputStreamWriter fileWriter = new OutputStreamWriter(new FileOutputStream(tmpFile), "UTF-8");
        try {
            fileWriter.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
                    + "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n"
                    + "      package=\"" + getApplicationId() + "\"\n"
                    + "      android:versionCode=\"" + getVersionCode() + "\"\n"
                    + "      android:versionName=\"" + versionNameToUse + "\"\n"
                    + "      split=\"lib_" + getOutputBaseName() + "\">\n"
                    + "       <uses-sdk android:minSdkVersion=\"21\"/>\n" + "</manifest> ");
            fileWriter.flush();
        } finally {
            fileWriter.close();
        }

        AaptPackageProcessBuilder aaptPackageCommandBuilder =
                new AaptPackageProcessBuilder(tmpFile, getAaptOptions())
                    .setDebuggable(isDebuggable())
                    .setResPackageOutput(resPackageFileName);

        getBuilder().processResources(
                aaptPackageCommandBuilder,
                false /* enforceUniquePackageName */,
                new LoggedProcessOutputHandler(getILogger()));
    }
}