Java 类org.gradle.api.internal.tasks.SimpleWorkResult 实例源码

项目:Reer    文件:JavadocGenerator.java   
@Override
public WorkResult execute(JavadocSpec spec) {
    JavadocExecHandleBuilder javadocExecHandleBuilder = new JavadocExecHandleBuilder(execActionFactory);
    javadocExecHandleBuilder.setExecutable(spec.getExecutable());
    javadocExecHandleBuilder.execDirectory(spec.getWorkingDir()).options(spec.getOptions()).optionsFile(spec.getOptionsFile());

    ExecAction execAction = javadocExecHandleBuilder.getExecHandle();
    if (spec.isIgnoreFailures()) {
        execAction.setIgnoreExitValue(true);
    }

    try {
        execAction.execute();
    } catch (ExecException e) {
        LOG.info("Problems generating Javadoc."
                + "\n  Command line issued: " + execAction.getCommandLine()
                + "\n  Generated Javadoc options file has following contents:\n------\n{}------", GFileUtils.readFileQuietly(spec.getOptionsFile()));
        throw new GradleException(String.format("Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '%s'", spec.getOptionsFile()), e);
    }

    return new SimpleWorkResult(true);
}
项目:Reer    文件:SyncCopyActionDecorator.java   
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited, preserveSpec);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
项目:Pushjet-Android    文件:SyncCopyActionDecorator.java   
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
项目:Pushjet-Android    文件:NativeCompiler.java   
public WorkResult execute(T spec) {
    boolean didWork = false;
    boolean windowsPathLimitation = OperatingSystem.current().isWindows();

    String objectFileExtension = OperatingSystem.current().isWindows() ? ".obj" : ".o";
    for (File sourceFile : spec.getSourceFiles()) {
        String objectFileName = FilenameUtils.removeExtension(sourceFile.getName()) + objectFileExtension;
        WorkResult result = commandLineTool.inWorkDirectory(spec.getObjectFileDir())
                .withArguments(new SingleSourceCompileArgTransformer<T>(sourceFile,
                                        objectFileName,
                                        new ShortCircuitArgsTransformer(argsTransfomer),
                                        windowsPathLimitation,
                                        false))
                .execute(spec);
        didWork = didWork || result.getDidWork();
    }
    return new SimpleWorkResult(didWork);
}
项目:Pushjet-Android    文件:SyncCopyActionDecorator.java   
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
项目:Reer    文件:GccLinker.java   
@Override
public WorkResult execute(final LinkerSpec spec) {
    List<String> args = argsTransformer.transform(spec);
    invocationContext.getArgAction().execute(args);
    if (useCommandFile) {
        new GccOptionsFileArgsWriter(spec.getTempDir()).execute(args);
    }
    final CommandLineToolInvocation invocation = invocationContext.createInvocation(
            "linking " + spec.getOutputFile().getName(), args, spec.getOperationLogger());

    buildOperationProcessor.run(commandLineToolInvocationWorker, new Action<BuildOperationQueue<CommandLineToolInvocation>>() {
        @Override
        public void execute(BuildOperationQueue<CommandLineToolInvocation> buildQueue) {
            buildQueue.setLogLocation(spec.getOperationLogger().getLogLocation());
            buildQueue.add(invocation);
        }
    });

    return new SimpleWorkResult(true);
}
项目:Reer    文件:ArStaticLibraryArchiver.java   
@Override
public WorkResult execute(final StaticLibraryArchiverSpec spec) {
    deletePreviousOutput(spec);

    List<String> args = argsTransformer.transform(spec);
    invocationContext.getArgAction().execute(args);
    final CommandLineToolInvocation invocation = invocationContext.createInvocation(
            "archiving " + spec.getOutputFile().getName(), args, spec.getOperationLogger());

    buildOperationProcessor.run(commandLineToolInvocationWorker, new Action<BuildOperationQueue<CommandLineToolInvocation>>() {
        @Override
        public void execute(BuildOperationQueue<CommandLineToolInvocation> buildQueue) {
            buildQueue.setLogLocation(spec.getOperationLogger().getLogLocation());
            buildQueue.add(invocation);
        }
    });
    return new SimpleWorkResult(true);
}
项目:Reer    文件:LibExeStaticLibraryArchiver.java   
@Override
public WorkResult execute(final StaticLibraryArchiverSpec spec) {
    final StaticLibraryArchiverSpec transformedSpec = specTransformer.transform(spec);
    final List<String> args = argsTransformer.transform(transformedSpec);
    invocationContext.getArgAction().execute(args);
    new VisualCppOptionsFileArgsWriter(spec.getTempDir()).execute(args);
    final CommandLineToolInvocation invocation = invocationContext.createInvocation(
            "archiving " + spec.getOutputFile().getName(), args, spec.getOperationLogger());

    buildOperationProcessor.run(commandLineToolInvocationWorker, new Action<BuildOperationQueue<CommandLineToolInvocation>>() {
        @Override
        public void execute(BuildOperationQueue<CommandLineToolInvocation> buildQueue) {
            buildQueue.setLogLocation(spec.getOperationLogger().getLogLocation());
            buildQueue.add(invocation);
        }
    });

    return new SimpleWorkResult(true);
}
项目:Reer    文件:LinkExeLinker.java   
@Override
public WorkResult execute(final LinkerSpec spec) {
    LinkerSpec transformedSpec = specTransformer.transform(spec);
    List<String> args = argsTransformer.transform(transformedSpec);
    invocationContext.getArgAction().execute(args);
    new VisualCppOptionsFileArgsWriter(spec.getTempDir()).execute(args);
    final CommandLineToolInvocation invocation = invocationContext.createInvocation(
            "linking " + spec.getOutputFile().getName(), args, spec.getOperationLogger());

    buildOperationProcessor.run(commandLineToolInvocationWorker, new Action<BuildOperationQueue<CommandLineToolInvocation>>() {
        @Override
        public void execute(BuildOperationQueue<CommandLineToolInvocation> buildQueue) {
            buildQueue.setLogLocation(spec.getOperationLogger().getLogLocation());
            buildQueue.add(invocation);
        }
    });

    return new SimpleWorkResult(true);
}
项目:Reer    文件:NativeCompiler.java   
@Override
public WorkResult execute(final T spec) {
    final T transformedSpec = specTransformer.transform(spec);
    final List<String> genericArgs = getArguments(transformedSpec);

    final File objectDir = transformedSpec.getObjectFileDir();
    buildOperationProcessor.run(commandLineToolInvocationWorker, new Action<BuildOperationQueue<CommandLineToolInvocation>>() {
        @Override
        public void execute(BuildOperationQueue<CommandLineToolInvocation> buildQueue) {
            buildQueue.setLogLocation(spec.getOperationLogger().getLogLocation());
            for (File sourceFile : transformedSpec.getSourceFiles()) {
                CommandLineToolInvocation perFileInvocation =
                    createPerFileInvocation(genericArgs, sourceFile, objectDir, spec);
                buildQueue.add(perFileInvocation);
            }
        }
    });

    return new SimpleWorkResult(!transformedSpec.getSourceFiles().isEmpty());
}
项目:Reer    文件:IncrementalNativeCompiler.java   
protected WorkResult doCleanIncrementalCompile(T spec) {
    boolean deleted = cleanPreviousOutputs(spec);
    WorkResult compileResult = delegateCompiler.execute(spec);
    if (deleted && !compileResult.getDidWork()) {
        return new SimpleWorkResult(deleted);
    }
    return compileResult;
}
项目:Reer    文件:TwirlCompiler.java   
@Override
public WorkResult execute(TwirlCompileSpec spec) {
    ArrayList<File> outputFiles = Lists.newArrayList();
    try {
        ClassLoader cl = getClass().getClassLoader();
        ScalaMethod compile = adapter.getCompileMethod(cl);
        Iterable<RelativeFile> sources = spec.getSources();
        for (RelativeFile sourceFile : sources) {
            Object result = compile.invoke(adapter.createCompileParameters(cl, sourceFile.getFile(), sourceFile.getBaseDir(), spec.getDestinationDir(), spec.getDefaultImports()));
            ScalaOptionInvocationWrapper<File> maybeFile = new ScalaOptionInvocationWrapper<File>(result);
            if (maybeFile.isDefined()) {
                outputFiles.add(maybeFile.get());
            }
        }
    } catch (Exception e) {
        throw new RuntimeException("Error invoking Play Twirl template compiler.", e);
    }

    return new SimpleWorkResult(!outputFiles.isEmpty());
}
项目:Pushjet-Android    文件:ZincScalaCompiler.java   
static WorkResult execute(ScalaJavaJointCompileSpec spec) {
    LOGGER.info("Compiling with Zinc Scala compiler.");

    xsbti.Logger logger = new SbtLoggerAdapter();

    com.typesafe.zinc.Compiler compiler = createCompiler(spec.getScalaClasspath(), spec.getZincClasspath(), logger);
    List<String> scalacOptions = new ScalaCompilerArgumentsGenerator().generate(spec);
    List<String> javacOptions = new JavaCompilerArgumentsBuilder(spec).includeClasspath(false).build();
    Inputs inputs = Inputs.create(ImmutableList.copyOf(spec.getClasspath()), ImmutableList.copyOf(spec.getSource()), spec.getDestinationDir(),
            scalacOptions, javacOptions, spec.getScalaCompileOptions().getIncrementalOptions().getAnalysisFile(), spec.getAnalysisMap(), "mixed", getIncOptions(), true);
    if (LOGGER.isDebugEnabled()) {
        Inputs.debug(inputs, logger);
    }

    try {
        compiler.compile(inputs, logger);
    } catch (xsbti.CompileFailed e) {
        throw new CompilationFailedException(e);
    }

    return new SimpleWorkResult(true);
}
项目:Pushjet-Android    文件:ArStaticLibraryArchiver.java   
public WorkResult execute(StaticLibraryArchiverSpec spec) {
    deletePreviousOutput(spec);

    MutableCommandLineToolInvocation invocation = baseInvocation.copy();
    invocation.setArgs(arguments.transform(spec));
    commandLineTool.execute(invocation);
    return new SimpleWorkResult(true);
}
项目:Pushjet-Android    文件:NativeCompiler.java   
public WorkResult execute(T spec) {
    boolean windowsPathLimitation = OperatingSystem.current().isWindows();

    MutableCommandLineToolInvocation invocation = baseInvocation.copy();
    invocation.setWorkDirectory(spec.getObjectFileDir());
    if (useCommandFile) {
        invocation.addPostArgsAction(new GccOptionsFileArgTransformer(spec.getTempDir()));
    }

    Transformer<List<String>, File> outputFileArgTransformer = new Transformer<List<String>, File>() {
        public List<String> transform(File outputFile) {
            return Arrays.asList("-o", outputFile.getAbsolutePath());
        }
    };

    for (File sourceFile : spec.getSourceFiles()) {
        SingleSourceCompileArgTransformer<T> argTransformer = new SingleSourceCompileArgTransformer<T>(sourceFile,
                objectFileSuffix,
                new ShortCircuitArgsTransformer<T>(argsTransfomer),
                windowsPathLimitation,
                outputFileArgTransformer);
        invocation.setArgs(argTransformer.transform(spec));
        commandLineTool.execute(invocation);
    }
    return new SimpleWorkResult(!spec.getSourceFiles().isEmpty());
}
项目:Pushjet-Android    文件:NativeCompiler.java   
public WorkResult execute(T spec) {
    MutableCommandLineToolInvocation invocation = baseInvocation.copy();
    invocation.addPostArgsAction(new VisualCppOptionsFileArgTransformer(spec.getTempDir()));

    Transformer<List<String>, File> outputFileArgTransformer = new Transformer<List<String>, File>(){
        public List<String> transform(File outputFile) {
            return Arrays.asList("/Fo"+ outputFile.getAbsolutePath());
        }
    };
    for (File sourceFile : spec.getSourceFiles()) {
        String objectFileNameSuffix = ".obj";
        SingleSourceCompileArgTransformer<T> argTransformer = new SingleSourceCompileArgTransformer<T>(sourceFile,
                objectFileNameSuffix,
                new ShortCircuitArgsTransformer<T>(argsTransFormer),
                true,
                outputFileArgTransformer);
        invocation.setArgs(argTransformer.transform(specTransformer.transform(spec)));
        invocation.setWorkDirectory(spec.getObjectFileDir());
        commandLineTool.execute(invocation);
    }
    return new SimpleWorkResult(!spec.getSourceFiles().isEmpty());
}
项目:Pushjet-Android    文件:JavadocGenerator.java   
public WorkResult execute(JavadocSpec spec) {
    JavadocExecHandleBuilder javadocExecHandleBuilder = new JavadocExecHandleBuilder(execActionFactory);
    javadocExecHandleBuilder.setExecutable(spec.getExecutable());
    javadocExecHandleBuilder.execDirectory(spec.getWorkingDir()).options(spec.getOptions()).optionsFile(spec.getOptionsFile());

    ExecAction execAction = javadocExecHandleBuilder.getExecHandle();
    if (spec.isIgnoreFailures()) {
        execAction.setIgnoreExitValue(true);
    }

    try {
        execAction.execute();
    } catch (ExecException e) {
        LOG.info("Problems generating Javadoc. The generated Javadoc options file used by Gradle has following contents:\n------\n{}------", GFileUtils.readFileQuietly(spec.getOptionsFile()));
        throw new GradleException(String.format("Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '%s'", spec.getOptionsFile()), e);
    }

    return new SimpleWorkResult(true);
}
项目:Pushjet-Android    文件:IncrementalNativeCompiler.java   
protected WorkResult doCleanIncrementalCompile(NativeCompileSpec spec) {
    boolean deleted = cleanPreviousOutputs(spec);
    WorkResult compileResult = delegateCompiler.execute(spec);
    if (deleted && !compileResult.getDidWork()) {
        return new SimpleWorkResult(deleted);
    }
    return compileResult;
}
项目:Pushjet-Android    文件:WindowsResourceCompiler.java   
public WorkResult execute(WindowsResourceCompileSpec spec) {
    boolean didWork = false;
    boolean windowsPathLimitation = OperatingSystem.current().isWindows();
    CommandLineTool<WindowsResourceCompileSpec> commandLineAssembler = commandLineTool.inWorkDirectory(spec.getObjectFileDir());
    for (File sourceFile : spec.getSourceFiles()) {
        WorkResult result = commandLineAssembler.withArguments(new RcCompilerArgsTransformer(sourceFile, windowsPathLimitation)).execute(spec);
        didWork |= result.getDidWork();
    }
    return new SimpleWorkResult(didWork);
}
项目:Pushjet-Android    文件:Assembler.java   
public WorkResult execute(AssembleSpec spec) {
    boolean didWork = false;
    CommandLineTool<AssembleSpec> commandLineAssembler = commandLineTool.inWorkDirectory(spec.getObjectFileDir());
    for (File sourceFile : spec.getSourceFiles()) {
        WorkResult result = commandLineAssembler.withArguments(new AssemblerArgsTransformer(sourceFile)).execute(spec);
        didWork = didWork || result.getDidWork();
    }
    return new SimpleWorkResult(didWork);
}
项目:Pushjet-Android    文件:NativeCompiler.java   
public WorkResult execute(T spec) {
    boolean didWork = false;
    for (File sourceFile : spec.getSourceFiles()) {
        String objectFileName = FilenameUtils.removeExtension(sourceFile.getName()) + ".obj";
        WorkResult result = commandLineTool.inWorkDirectory(spec.getObjectFileDir())
                .withArguments(new SingleSourceCompileArgTransformer<T>(sourceFile,
                                                                        objectFileName,
                                                                        new ShortCircuitArgsTransformer<T>(argsTransFormer),
                                                                        true,
                                                                        true))
                .execute(spec);
        didWork = didWork || result.getDidWork();
    }
    return new SimpleWorkResult(didWork);
}
项目:Pushjet-Android    文件:CommandLineTool.java   
public WorkResult execute(T spec) {
    ExecAction compiler = execActionFactory.newExecAction();
    compiler.executable(executable);
    if (workDir != null) {
        compiler.workingDir(workDir);
    }

    List<String> args = specToArgs.transform(specTransformer.transform(spec));
    compiler.args(args);

    if (!path.isEmpty()) {
        String pathVar = OperatingSystem.current().getPathVar();
        String compilerPath = Joiner.on(File.pathSeparator).join(path);
        compilerPath = compilerPath + File.pathSeparator + System.getenv(pathVar);
        compiler.environment(pathVar, compilerPath);
    }

    compiler.environment(environment);

    try {
        compiler.execute();
    } catch (ExecException e) {
        throw new GradleException(String.format("%s failed; see the error output for details.", action), e);
    }
    return new SimpleWorkResult(true);
}
项目:Pushjet-Android    文件:CleanCompilingNativeCompiler.java   
@Override
protected WorkResult doIncrementalCompile(IncrementalCompileProcessor processor, NativeCompileSpec spec) {
    processor.processSourceFiles(spec.getSourceFiles());
    boolean deleted = cleanPreviousOutputs(spec);
    WorkResult compileResult = delegateCompiler.execute(spec);
    if (deleted && !compileResult.getDidWork()) {
        return new SimpleWorkResult(deleted);
    }
    return compileResult;
}
项目:Pushjet-Android    文件:ZincScalaCompiler.java   
static WorkResult execute(ScalaJavaJointCompileSpec spec) {
    LOGGER.info("Compiling with Zinc Scala compiler.");

    xsbti.Logger logger = new SbtLoggerAdapter();

    com.typesafe.zinc.Compiler compiler = createCompiler(spec.getScalaClasspath(), spec.getZincClasspath(), logger);
    List<String> scalacOptions = new ScalaCompilerArgumentsGenerator().generate(spec);
    List<String> javacOptions = new JavaCompilerArgumentsBuilder(spec).includeClasspath(false).build();
    Inputs inputs = Inputs.create(ImmutableList.copyOf(spec.getClasspath()), ImmutableList.copyOf(spec.getSource()), spec.getDestinationDir(),
            scalacOptions, javacOptions, spec.getScalaCompileOptions().getIncrementalOptions().getAnalysisFile(), spec.getAnalysisMap(), "mixed", getIncOptions(), true);
    if (LOGGER.isDebugEnabled()) {
        Inputs.debug(inputs, logger);
    }

    try {
        compiler.compile(inputs, logger);
    } catch (xsbti.CompileFailed e) {
        throw new CompilationFailedException(e);
    }

    return new SimpleWorkResult(true);
}
项目:gradle-gzjar-plugin    文件:GzJarCopyAction.java   
public WorkResult execute(final CopyActionProcessingStream stream) {
    ZipOutputStream zipOutStr;

    try {
        zipOutStr = new ZipOutputStream(new FileOutputStream(zipFile));
    } catch (Exception e) {
        throw new GradleException(String.format("Could not create ZIP '%s'.", zipFile), e);
    }

    IoActions.withResource(zipOutStr, new Action<ZipOutputStream>() {
        public void execute(ZipOutputStream outputStream) {
            stream.process(new StreamAction(outputStream));
        }
    });

    return new SimpleWorkResult(true);
}
项目:Reer    文件:NormalizingGroovyCompiler.java   
private WorkResult delegateAndHandleErrors(GroovyJavaJointCompileSpec spec) {
    try {
        return delegate.execute(spec);
    } catch (CompilationFailedException e) {
        if (spec.getCompileOptions().isFailOnError()) {
            throw e;
        }
        LOGGER.debug("Ignoring compilation failure.");
        return new SimpleWorkResult(false);
    }
}
项目:Reer    文件:CommandLineJavaCompiler.java   
@Override
public WorkResult execute(JavaCompileSpec spec) {
    String executable = spec.getCompileOptions().getForkOptions().getExecutable();
    LOGGER.info("Compiling with Java command line compiler '{}'.", executable);

    ExecHandle handle = createCompilerHandle(executable, spec);
    executeCompiler(handle);

    return new SimpleWorkResult(true);
}
项目:Reer    文件:JdkJavaCompiler.java   
@Override
public WorkResult execute(JavaCompileSpec spec) {
    LOGGER.info("Compiling with JDK Java compiler API.");

    JavaCompiler.CompilationTask task = createCompileTask(spec);
    boolean success = task.call();
    if (!success) {
        throw new CompilationFailedException();
    }

    return new SimpleWorkResult(true);
}
项目:Reer    文件:ZincScalaCompiler.java   
static WorkResult execute(final Iterable<File> scalaClasspath, final Iterable<File> zincClasspath, File gradleUserHome, final ScalaJavaJointCompileSpec spec) {
    LOGGER.info("Compiling with Zinc Scala compiler.");

    final xsbti.Logger logger = new SbtLoggerAdapter();

    com.typesafe.zinc.Compiler compiler = ZincScalaCompilerFactory.createParallelSafeCompiler(scalaClasspath, zincClasspath, logger, gradleUserHome);

    List<String> scalacOptions = new ZincScalaCompilerArgumentsGenerator().generate(spec);
    List<String> javacOptions = new JavaCompilerArgumentsBuilder(spec).includeClasspath(false).build();
    Inputs inputs = Inputs.create(ImmutableList.copyOf(spec.getClasspath()), ImmutableList.copyOf(spec.getSource()), spec.getDestinationDir(),
            scalacOptions, javacOptions, spec.getScalaCompileOptions().getIncrementalOptions().getAnalysisFile(), spec.getAnalysisMap(), "mixed", getIncOptions(), true);
    if (LOGGER.isDebugEnabled()) {
        Inputs.debug(inputs, logger);
    }

    if (spec.getScalaCompileOptions().isForce()) {
        GFileUtils.deleteDirectory(spec.getDestinationDir());
    }

    try {
        compiler.compile(inputs, logger);
    } catch (xsbti.CompileFailed e) {
        throw new CompilationFailedException(e);
    }

    return new SimpleWorkResult(true);
}
项目:Reer    文件:NormalizingScalaCompiler.java   
private WorkResult delegateAndHandleErrors(ScalaJavaJointCompileSpec spec) {
    try {
        return delegate.execute(spec);
    } catch (CompilationFailedException e) {
        if (spec.getScalaCompileOptions().isFailOnError()) {
            throw e;
        }
        LOGGER.debug("Ignoring compilation failure.");
        return new SimpleWorkResult(false);
    }
}
项目:Reer    文件:Deleter.java   
public WorkResult delete(Action<? super DeleteSpec> action) {
    boolean didWork = false;
    DeleteSpecInternal deleteSpec = new DefaultDeleteSpec();
    action.execute(deleteSpec);
    Object[] paths = deleteSpec.getPaths();
    for (File file : fileResolver.resolveFiles(paths)) {
        if (!file.exists()) {
            continue;
        }
        LOGGER.debug("Deleting {}", file);
        didWork = true;
        doDeleteInternal(file, deleteSpec);
    }
    return new SimpleWorkResult(didWork);
}
项目:Reer    文件:GoogleClosureCompiler.java   
@Override
public WorkResult execute(JavaScriptCompileSpec spec) {
    JavaScriptCompileDestinationCalculator destinationCalculator = new JavaScriptCompileDestinationCalculator(spec.getDestinationDir());
    List<String> allErrors = Lists.newArrayList();

    for (RelativeFile sourceFile : spec.getSources()) {
        allErrors.addAll(compile(sourceFile, spec, destinationCalculator));
    }

    if (allErrors.isEmpty()) {
        return new SimpleWorkResult(true);
    } else {
        throw new SourceTransformationException(String.format("Minification failed with the following errors:\n\t%s", StringUtils.join(allErrors, "\n\t")), null);
    }
}
项目:Pushjet-Android    文件:NormalizingScalaCompiler.java   
private WorkResult delegateAndHandleErrors(ScalaJavaJointCompileSpec spec) {
    try {
        return delegate.execute(spec);
    } catch (CompilationFailedException e) {
        if (spec.getScalaCompileOptions().isFailOnError()) {
            throw e;
        }
        LOGGER.debug("Ignoring compilation failure.");
        return new SimpleWorkResult(false);
    }
}
项目:Pushjet-Android    文件:NormalizingGroovyCompiler.java   
private WorkResult delegateAndHandleErrors(GroovyJavaJointCompileSpec spec) {
    try {
        return delegate.execute(spec);
    } catch (CompilationFailedException e) {
        if (spec.getCompileOptions().isFailOnError()) {
            throw e;
        }
        LOGGER.debug("Ignoring compilation failure.");
        return new SimpleWorkResult(false);
    }
}
项目:Pushjet-Android    文件:GccLinker.java   
public WorkResult execute(LinkerSpec spec) {
    MutableCommandLineToolInvocation invocation = baseInvocation.copy();
    if (useCommandFile) {
        invocation.addPostArgsAction(new GccOptionsFileArgTransformer(spec.getTempDir()));
    }
    invocation.setArgs(argsTransformer.transform(spec));
    commandLineTool.execute(invocation);
    return new SimpleWorkResult(true);
}
项目:Pushjet-Android    文件:Assembler.java   
public WorkResult execute(AssembleSpec spec) {
    MutableCommandLineToolInvocation invocation = baseInvocation.copy();
    invocation.setWorkDirectory(spec.getObjectFileDir());
    for (File sourceFile : spec.getSourceFiles()) {
        ArgsTransformer<AssembleSpec> arguments = new AssembleSpecToArgsList(sourceFile, spec.getObjectFileDir(), outputFileSuffix);
        invocation.setArgs(arguments.transform(spec));
        commandLineTool.execute(invocation);
    }
    return new SimpleWorkResult(!spec.getSourceFiles().isEmpty());
}
项目:Pushjet-Android    文件:WindowsResourceCompiler.java   
public WorkResult execute(WindowsResourceCompileSpec spec) {
    boolean windowsPathLimitation = OperatingSystem.current().isWindows();
    MutableCommandLineToolInvocation invocation = baseInvocation.copy();
    spec = specTransformer.transform(spec);
    for (File sourceFile : spec.getSourceFiles()) {
        RcCompilerArgsTransformer argsTransformer = new RcCompilerArgsTransformer(sourceFile, windowsPathLimitation);
        invocation.setArgs(argsTransformer.transform(spec));
        invocation.setWorkDirectory(spec.getObjectFileDir());
        commandLineTool.execute(invocation);
    }
    return new SimpleWorkResult(!spec.getSourceFiles().isEmpty());
}
项目:Pushjet-Android    文件:Assembler.java   
public WorkResult execute(AssembleSpec spec) {
    MutableCommandLineToolInvocation invocation = baseInvocation.copy();
    invocation.setWorkDirectory(spec.getObjectFileDir());
    for (File sourceFile : spec.getSourceFiles()) {
        invocation.setArgs(new AssemblerArgsTransformer(sourceFile).transform(spec));
        commandLineTool.execute(invocation);
    }
    return new SimpleWorkResult(!spec.getSourceFiles().isEmpty());
}
项目:Pushjet-Android    文件:LibExeStaticLibraryArchiver.java   
public WorkResult execute(StaticLibraryArchiverSpec spec) {
    MutableCommandLineToolInvocation invocation = baseInvocation.copy();
    invocation.addPostArgsAction(new VisualCppOptionsFileArgTransformer(spec.getTempDir()));
    invocation.setArgs(args.transform(spec));
    commandLineTool.execute(invocation);
    return new SimpleWorkResult(true);
}
项目:Pushjet-Android    文件:LinkExeLinker.java   
public WorkResult execute(LinkerSpec spec) {
    MutableCommandLineToolInvocation invocation = baseInvocation.copy();
    invocation.addPostArgsAction(new VisualCppOptionsFileArgTransformer(spec.getTempDir()));
    invocation.setArgs(argsTransformer.transform(specTransformer.transform(spec)));
    commandLineTool.execute(invocation);
    return new SimpleWorkResult(true);
}