当前位置: 首页>>代码示例>>Java>>正文


Java ProcessOutputHandler类代码示例

本文整理汇总了Java中com.android.ide.common.process.ProcessOutputHandler的典型用法代码示例。如果您正苦于以下问题:Java ProcessOutputHandler类的具体用法?Java ProcessOutputHandler怎么用?Java ProcessOutputHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ProcessOutputHandler类属于com.android.ide.common.process包,在下文中一共展示了ProcessOutputHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import com.android.ide.common.process.ProcessOutputHandler; //导入依赖的package包/类
public static ProcessResult run(
            @NonNull DexProcessBuilder processBuilder,
            @NonNull DexOptions dexOptions,
            @NonNull ProcessOutputHandler outputHandler) throws IOException, ProcessException {
        ProcessOutput output = outputHandler.createOutput();
        int res;
        try {
//            DxConsole.out = outputHandler.createOutput().getStandardOutput();
//            DxConsole.err = outputHandler.createOutput().getErrorOutput();
            DxConsole dxConsole = new DxConsole();
            Main.Arguments args = buildArguments(processBuilder, dexOptions, dxConsole);
            res = new Main().run(args);
        } finally {
            output.close();
        }

        outputHandler.handleOutput(output);
        return new DexProcessResult(res);
    }
 
开发者ID:alibaba,项目名称:atlas,代码行数:20,代码来源:DexWrapperHook.java

示例2: convertByteCode

import com.android.ide.common.process.ProcessOutputHandler; //导入依赖的package包/类
@Override
public void convertByteCode(Collection<File> inputs,
                            File outDexFolder,
                            boolean multidex,
                            File mainDexList,
                            DexOptions dexOptions,
                            ProcessOutputHandler processOutputHandler)
    throws IOException, InterruptedException, ProcessException {

    boolean fastMultiDex = null != multiDexer;

    if (multidex) {
        super.convertByteCode(inputs, outDexFolder, multidex, mainDexList, dexOptions, processOutputHandler);
    } else {
        convertByteCode(inputs, outDexFolder, multidex, mainDexList, dexOptions, processOutputHandler, false);
    }

}
 
开发者ID:alibaba,项目名称:atlas,代码行数:19,代码来源:AtlasBuilder.java

示例3: AidlProcessor

import com.android.ide.common.process.ProcessOutputHandler; //导入依赖的package包/类
public AidlProcessor(
        @NonNull String aidlExecutable,
        @NonNull String frameworkLocation,
        @NonNull List<File> importFolders,
        @NonNull File sourceOutputDir,
        @Nullable File parcelableOutputDir,
        @NonNull DependencyFileProcessor dependencyFileProcessor,
        @NonNull ProcessExecutor processExecutor,
        @NonNull ProcessOutputHandler processOutputHandler) {
    mAidlExecutable = aidlExecutable;
    mFrameworkLocation = frameworkLocation;
    mImportFolders = importFolders;
    mSourceOutputDir = sourceOutputDir;
    mParcelableOutputDir = parcelableOutputDir;
    mDependencyFileProcessor = dependencyFileProcessor;
    mProcessExecutor = processExecutor;
    mProcessOutputHandler = processOutputHandler;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:AidlProcessor.java

示例4: AndroidBuilder

import com.android.ide.common.process.ProcessOutputHandler; //导入依赖的package包/类
/**
 * Creates an AndroidBuilder.
 * <p/>
 * <var>verboseExec</var> is needed on top of the ILogger due to remote exec tools not being
 * able to output info and verbose messages separately.
 *
 * @param createdBy the createdBy String for the apk manifest.
 * @param logger the Logger
 * @param verboseExec whether external tools are launched in verbose mode
 */
public AndroidBuilder(
        @NonNull String projectId,
        @Nullable String createdBy,
        @NonNull ProcessExecutor processExecutor,
        @NonNull JavaProcessExecutor javaProcessExecutor,
        @NonNull ProcessOutputHandler processOutputHandler,
        @NonNull EvaluationErrorReporter errorHandler,
        @NonNull ILogger logger,
        boolean verboseExec) {
    mProjectId = checkNotNull(projectId);
    mCreatedBy = createdBy;
    mProcessExecutor = checkNotNull(processExecutor);
    mJavaProcessExecutor = checkNotNull(javaProcessExecutor);
    mProcessOutputHandler = checkNotNull(processOutputHandler);
    mErrorHandler = checkNotNull(errorHandler);
    mLogger = checkNotNull(logger);
    mVerboseExec = verboseExec;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:AndroidBuilder.java

示例5: execute

import com.android.ide.common.process.ProcessOutputHandler; //导入依赖的package包/类
@NonNull
@Override
public ProcessResult execute(@NonNull JavaProcessInfo javaProcessInfo,
        @NonNull ProcessOutputHandler processOutputHandler) {
    try {
        Thread.sleep(1000);
        throw new IOException("foo");
    } catch (final Exception e) {
        return new ProcessResult() {
            @Override
            public ProcessResult assertNormalExitValue() throws ProcessException {
                return this;
            }

            @Override
            public int getExitValue() {
                return 0;
            }

            @Override
            public ProcessResult rethrowFailure() throws ProcessException {
                throw new ProcessException(null, e);
            }
        };
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:PreDexCacheTest.java

示例6: doTaskAction

import com.android.ide.common.process.ProcessOutputHandler; //导入依赖的package包/类
private void doTaskAction(@Nullable Collection<File> inputFiles,
                          @Nullable File inputDir,
                          boolean incremental) throws InterruptedException, ProcessException, IOException {

    File outFolder = getOutputFolder();
    if (!incremental) {
        emptyFolder(outFolder);
    }

    // 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();
    }
    ProcessOutputHandler outputHandler = new ParsingProcessOutputHandler(new ToolOutputParser(
        new DexParser(),
        Message.Kind.ERROR,
        getILogger()),
                                                                         new ToolOutputParser(
                                                                             new DexParser(),
                                                                             getILogger()),
                                                                         getBuilder().getErrorReporter());

    getBuilder().convertByteCode(inputFiles,
                                 getOutputFolder(),
                                 getMultiDexEnabled(),
                                 getMainDexListFile(),
                                 getDexOptions(),
                                 outputHandler);
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:35,代码来源:AwbDexTask.java

示例7: processAwbResources

import com.android.ide.common.process.ProcessOutputHandler; //导入依赖的package包/类
/**
 * Deal with awb resources
 *
 * @param aaptCommand
 * @param enforceUniquePackageName
 * @param processOutputHandler
 * @param mainSymbolFile
 */
public void processAwbResources(AaptPackageProcessBuilder aaptCommand,
                                boolean enforceUniquePackageName,
                                ProcessOutputHandler processOutputHandler,
                                File mainSymbolFile) throws IOException, InterruptedException, ProcessException {
    if (!atlasExtension.getTBuildConfig().getUseCustomAapt()) {
        throw new StopExecutionException("Must set useCustomAapt value to true for awb build!");
    }

    checkState(getTargetInfo() != null,
               "Cannot call processResources() before setTargetInfo() is called.");

    // launch aapt: create the command line
    ProcessInfo processInfo = aaptCommand.build(getTargetInfo().getBuildTools(),
                                                getTargetInfo().getTarget(),
                                                getLogger());

    processInfo = new TProcessInfo(processInfo, aaptCommand.getSymbolOutputDir());

    // Print log
    //        if (null != getLogger()) {
    //            getLogger().info("[Aapt]" + processInfo.getExecutable() + " "
    //                    + StringUtils.join(processInfo.getArgs(), " "));
    //        }

    ProcessResult result = getProcessExecutor().execute(processInfo, processOutputHandler);
    result.rethrowFailure().assertNormalExitValue();

    processAwbSymbols(aaptCommand, mainSymbolFile, enforceUniquePackageName);
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:38,代码来源:AtlasBuilder.java

示例8: AtlasAapt

import com.android.ide.common.process.ProcessOutputHandler; //导入依赖的package包/类
/**
 * Creates a new entry point to the original {@code aapt}.
 *
 * @param processExecutor      the executor for external processes
 * @param processOutputHandler the handler to process the executed process' output
 * @param buildToolInfo        the build tools to use
 * @param logger               logger to use
 * @param processMode          the process mode to run {@code aapt} on
 * @param cruncherProcesses    if using build tools that support crunching processes, how many
 *                             processes to use; if set to {@code 0}, the default number will be used
 */
public AtlasAapt(ProcessExecutor processExecutor,
                 ProcessOutputHandler processOutputHandler,
                 BuildToolInfo buildToolInfo,
                 ILogger logger,
                 PngProcessMode processMode,
                 int cruncherProcesses) {
    super(processExecutor,
          processOutputHandler,
          buildToolInfo,
          logger,
          processMode,
          cruncherProcesses);
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:25,代码来源:AtlasAapt.java

示例9: build

import com.android.ide.common.process.ProcessOutputHandler; //导入依赖的package包/类
public void build(
        @NonNull ProcessExecutor processExecutor,
        @NonNull ProcessOutputHandler processOutputHandler)
        throws InterruptedException, ProcessException, LoggedErrorException, IOException {

    // gather the files to compile
    FileGatherer fileGatherer = new FileGatherer();
    SourceSearcher searcher = new SourceSearcher(mSourceFolders, "rs", "fs");
    searcher.setUseExecutor(false);
    searcher.search(fileGatherer);

    List<File> renderscriptFiles = fileGatherer.getFiles();

    if (renderscriptFiles.isEmpty()) {
        return;
    }

    // get the env var
    Map<String, String> env = Maps.newHashMap();
    if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_DARWIN) {
        env.put("DYLD_LIBRARY_PATH", mBuildToolInfo.getLocation().getAbsolutePath());
    } else if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_LINUX) {
        env.put("LD_LIBRARY_PATH", mBuildToolInfo.getLocation().getAbsolutePath());
    }

    doMainCompilation(renderscriptFiles, processExecutor, processOutputHandler, env);

    if (mSupportMode) {
        createSupportFiles(processExecutor, processOutputHandler, env);
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:RenderScriptProcessor.java

示例10: createSupportObjFile

import com.android.ide.common.process.ProcessOutputHandler; //导入依赖的package包/类
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(mOptimLevel));

    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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:RenderScriptProcessor.java

示例11: createSupportLibFile

import com.android.ide.common.process.ProcessOutputHandler; //导入依赖的package包/类
private void createSupportLibFile(
        @NonNull File objFile,
        @NonNull Abi abi,
        @NonNull String soName,
        @NonNull File libAbiFolder,
        @NonNull ProcessExecutor processExecutor,
        @NonNull ProcessOutputHandler processOutputHandler,
        @NonNull Map<String, String> env) throws ProcessException {

    File intermediatesFolder = new File(mRsLib, "intermediates");
    File intermediatesAbiFolder = new File(intermediatesFolder, abi.mDevice);
    File packagedFolder = new File(mRsLib, "packaged");
    File packagedAbiFolder = new File(packagedFolder, abi.mDevice);

    ProcessInfoBuilder builder = new ProcessInfoBuilder();
    builder.setExecutable(mBuildToolInfo.getPath(abi.mLinker));
    builder.addEnvironments(env);

    builder.addArgs("--eh-frame-hdr")
            .addArgs(abi.mLinkerArgs)
            .addArgs("-shared", "-Bsymbolic", "-z", "noexecstack", "-z", "relro", "-z", "now");

    File outFile = new File(libAbiFolder, soName);
    builder.addArgs("-o", outFile.getAbsolutePath());

    builder.addArgs(
            "-L" + intermediatesAbiFolder.getAbsolutePath(),
            "-L" + packagedAbiFolder.getAbsolutePath(),
            "-soname",
            soName,
            objFile.getAbsolutePath(),
            new File(intermediatesAbiFolder, "libcompiler_rt.a").getAbsolutePath(),
            "-lRSSupport",
            "-lm",
            "-lc");

    processExecutor.execute(
            builder.createProcess(), processOutputHandler)
            .rethrowFailure().assertNormalExitValue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:RenderScriptProcessor.java

示例12: getCruncher

import com.android.ide.common.process.ProcessOutputHandler; //导入依赖的package包/类
@NonNull
private static PngCruncher getCruncher() {
    ILogger logger = new StdLogger(StdLogger.Level.VERBOSE);
    ProcessExecutor processExecutor = new DefaultProcessExecutor(logger);
    ProcessOutputHandler processOutputHandler = new LoggedProcessOutputHandler(logger);
    File aapt = NinePatchAaptProcessorTestUtils.getAapt(FullRevision.parseRevision("21"));
    return new AaptCruncher(aapt.getAbsolutePath(), processExecutor, processOutputHandler);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:NinePatchAaptProcessorTest.java

示例13: AaptCruncher

import com.android.ide.common.process.ProcessOutputHandler; //导入依赖的package包/类
public AaptCruncher(
        @NonNull String aaptLocation,
        @NonNull ProcessExecutor processExecutor,
        @NonNull ProcessOutputHandler processOutputHandler) {
    mAaptLocation = aaptLocation;
    mProcessExecutor = processExecutor;
    mProcessOutputHandler = processOutputHandler;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AaptCruncher.java

示例14: doFullTaskAction

import com.android.ide.common.process.ProcessOutputHandler; //导入依赖的package包/类
@Override
protected void doFullTaskAction() throws IOException {
    // we have to clean the source folder output in case the package name changed.
    File srcOut = getSourceOutputDir();
    if (srcOut != null) {
        // FileUtils.emptyFolder(srcOut);
        srcOut.delete();
        srcOut.mkdirs();
    }

    @Nullable
    File resOutBaseNameFile = getPackageOutputFile();

    // If are in instant run mode and we have an instant run enabled manifest

    File manifestFileToPackage = getManifestFile();

    // Add additional parameters required for the awb module to compile
    addAaptOptions();
    AaptPackageProcessBuilder aaptPackageCommandBuilder = new AaptPackageProcessBuilder(
        manifestFileToPackage,
        getAaptOptions()).setAssetsFolder(getAssetsDir())
        .setResFolder(getResDir())
        .setLibraries(getLibraries())
        .setPackageForR(getPackageForR())
        .setSourceOutputDir(absolutePath(srcOut))
        .setSymbolOutputDir(absolutePath(getTextSymbolOutputDir()))
        .setResPackageOutput(absolutePath(resOutBaseNameFile))
        .setProguardOutput(absolutePath(getProguardOutputFile()))
        .setType(getType())
        .setDebuggable(getDebuggable())
        .setPseudoLocalesEnabled(getPseudoLocalesEnabled())
        .setResourceConfigs(getResourceConfigs())
        .setSplits(getSplits())
        .setPreferredDensity(getPreferredDensity());

    @NonNull
    AtlasBuilder builder = (AtlasBuilder)getBuilder();

    // MergingLog mergingLog = new MergingLog(getMergeBlameLogFolder());
    //
    // ProcessOutputHandler processOutputHandler = new ParsingProcessOutputHandler(
    // new ToolOutputParser(new AaptOutputParser(), getILogger()),
    // builder.getErrorReporter());

    ProcessOutputHandler processOutputHandler = new LoggedProcessOutputHandler(getILogger());

    try {
        builder.processAwbResources(aaptPackageCommandBuilder,
                                    getEnforceUniquePackageName(),
                                    processOutputHandler,
                                    getMainSymbolFile());
    } catch (Throwable e) {
        throw new GradleException(e.getMessage(), e);
    }

}
 
开发者ID:alibaba,项目名称:atlas,代码行数:58,代码来源:ProcessAwoAndroidResources.java

示例15: processResources

import com.android.ide.common.process.ProcessOutputHandler; //导入依赖的package包/类
@Override
public void processResources(Aapt aapt,
                             Builder aaptConfigBuilder,
                             boolean enforceUniquePackageName)
    throws IOException, InterruptedException, ProcessException {

    if (aapt instanceof AaptV1) {
        try {

            getTargetInfo();

            AaptOptions aaptOptions = (AaptOptions)FieldUtils.readField(aaptConfigBuilder.build(),
                                                                        "mAaptOptions",
                                                                        true);

            ProcessExecutor processExecutor = (ProcessExecutor)FieldUtils.readField(aapt,
                                                                                    "mProcessExecutor",
                                                                                    true);
            ProcessOutputHandler processOutputHandler = (ProcessOutputHandler)FieldUtils.readField(
                aapt,
                "mProcessOutputHandler",
                true);
            BuildToolInfo buildToolInfo = (BuildToolInfo)FieldUtils.readField(aapt,
                                                                              "mBuildToolInfo",
                                                                              true);
            PngProcessMode processMode = (PngProcessMode)FieldUtils.readField(aapt,
                                                                              "mProcessMode",
                                                                              true);
            int cruncherProcesses = aaptOptions.getCruncherProcesses();

            aapt = new AtlasAapt(processExecutor,
                                 processOutputHandler,
                                 buildToolInfo,
                                 getLogger(),
                                 processMode,
                                 cruncherProcesses);
        } catch (Throwable e) {
            throw new GradleException("aapt exception", e);
        }
    }

    if (atlasExtension.getTBuildConfig().isIncremental()) {
        processResources2(aapt, aaptConfigBuilder, enforceUniquePackageName);
    } else {
        super.processResources(aapt, aaptConfigBuilder, enforceUniquePackageName);
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:48,代码来源:AtlasBuilder.java


注:本文中的com.android.ide.common.process.ProcessOutputHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。