Java 类org.gradle.api.tasks.WorkResult 实例源码

项目: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    文件:DefaultScalaJavaJointCompiler.java   
public WorkResult execute(ScalaJavaJointCompileSpec spec) {
    scalaCompiler.execute(spec);

    PatternFilterable patternSet = new PatternSet();
    patternSet.include("**/*.java");
    FileTree javaSource = spec.getSource().getAsFileTree().matching(patternSet);
    if (!javaSource.isEmpty()) {
        spec.setSource(javaSource);
        javaCompiler.execute(spec);
    }

    return new WorkResult() {
        public boolean getDidWork() {
            return true;
        }
    };
}
项目:Reer    文件:AbstractLinkTask.java   
@TaskAction
public void link() {
    SimpleStaleClassCleaner cleaner = new SimpleStaleClassCleaner(getOutputs());
    cleaner.setDestinationDir(getDestinationDir());
    cleaner.execute();

    if (getSource().isEmpty()) {
        setDidWork(false);
        return;

    }


    LinkerSpec spec = createLinkerSpec();
    spec.setTargetPlatform(getTargetPlatform());
    spec.setTempDir(getTemporaryDir());
    spec.setOutputFile(getOutputFile());

    spec.objectFiles(getSource());
    spec.libraries(getLibs());
    spec.args(getLinkerArgs());

    BuildOperationLogger operationLogger = getOperationLoggerFactory().newOperationLogger(getName(), getTemporaryDir());
    spec.setOperationLogger(operationLogger);

    Compiler<LinkerSpec> compiler = Cast.uncheckedCast(toolChain.select(targetPlatform).newCompiler(spec.getClass()));
    compiler = BuildOperationLoggingCompilerDecorator.wrap(compiler);
    WorkResult result = compiler.execute(spec);
    setDidWork(result.getDidWork());
}
项目:Reer    文件:CreateStaticLibrary.java   
@TaskAction
public void link() {

    StaticLibraryArchiverSpec spec = new DefaultStaticLibraryArchiverSpec();
    spec.setTempDir(getTemporaryDir());
    spec.setOutputFile(getOutputFile());
    spec.objectFiles(getSource());
    spec.args(getStaticLibArgs());

    BuildOperationLogger operationLogger = getOperationLoggerFactory().newOperationLogger(getName(), getTemporaryDir());
    spec.setOperationLogger(operationLogger);

    Compiler<StaticLibraryArchiverSpec> compiler = Cast.uncheckedCast(toolChain.select(targetPlatform).newCompiler(spec.getClass()));
    WorkResult result = BuildOperationLoggingCompilerDecorator.wrap(compiler).execute(spec);
    setDidWork(result.getDidWork());
}
项目: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    文件:SelectiveCompiler.java   
@Override
public WorkResult execute(JavaCompileSpec spec) {
    Timer clock = Timers.startTimer();
    JarClasspathSnapshot jarClasspathSnapshot = jarClasspathSnapshotProvider.getJarClasspathSnapshot(spec.getClasspath());
    RecompilationSpec recompilationSpec = recompilationSpecProvider.provideRecompilationSpec(inputs, previousCompilation, jarClasspathSnapshot);

    if (recompilationSpec.isFullRebuildNeeded()) {
        LOG.lifecycle("Full recompilation is required because {}. Analysis took {}.", recompilationSpec.getFullRebuildCause(), clock.getElapsed());
        return cleaningCompiler.execute(spec);
    }

    incrementalCompilationInitilizer.initializeCompilation(spec, recompilationSpec.getClassNames());
    if (spec.getSource().isEmpty()) {
        LOG.lifecycle("None of the classes needs to be compiled! Analysis took {}. ", clock.getElapsed());
        return new RecompilationNotNecessary();
    }

    try {
        //use the original compiler to avoid cleaning up all the files
        return cleaningCompiler.getCompiler().execute(spec);
    } finally {
        LOG.lifecycle("Incremental compilation of {} classes completed in {}.", recompilationSpec.getClassNames().size(), clock.getElapsed());
    }
}
项目:Reer    文件:IncrementalNativeCompiler.java   
@Override
public WorkResult execute(final T spec) {
    PersistentStateCache<CompilationState> compileStateCache = compilationStateCacheFactory.create(task.getPath());
    DefaultSourceIncludesParser sourceIncludesParser = new DefaultSourceIncludesParser(sourceParser, importsAreIncludes);
    IncrementalCompileProcessor processor = createProcessor(compileStateCache, sourceIncludesParser, spec.getIncludeRoots());
    IncrementalCompilation compilation = processor.processSourceFiles(spec.getSourceFiles());

    spec.setSourceFileIncludeDirectives(mapIncludes(spec.getSourceFiles(), compilation.getFinalState()));

    handleDiscoveredInputs(spec, compilation, spec.getDiscoveredInputRecorder());

    WorkResult workResult;
    if (spec.isIncrementalCompile()) {
        workResult = doIncrementalCompile(compilation, spec);
    } else {
        workResult = doCleanIncrementalCompile(spec);
    }

    compileStateCache.set(compilation.getFinalState());

    return workResult;
}
项目: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    文件:WindowsResourceCompile.java   
@TaskAction
public void compile(IncrementalTaskInputs inputs) {
    BuildOperationLogger operationLogger = getOperationLoggerFactory().newOperationLogger(getName(), getTemporaryDir());

    NativeCompileSpec spec = new DefaultWindowsResourceCompileSpec();
    spec.setTempDir(getTemporaryDir());
    spec.setObjectFileDir(getOutputDir());
    spec.include(getIncludes());
    spec.source(getSource());
    spec.setMacros(getMacros());
    spec.args(getCompilerArgs());
    spec.setIncrementalCompile(inputs.isIncremental());
    spec.setDiscoveredInputRecorder((DiscoveredInputRecorder) inputs);
    spec.setOperationLogger(operationLogger);

    PlatformToolProvider platformToolProvider = toolChain.select(targetPlatform);
    WorkResult result = doCompile(spec, platformToolProvider);
    setDidWork(result.getDidWork());
}
项目:Reer    文件:Assemble.java   
@TaskAction
public void assemble() {
    BuildOperationLogger operationLogger = getOperationLoggerFactory().newOperationLogger(getName(), getTemporaryDir());
    SimpleStaleClassCleaner cleaner = new SimpleStaleClassCleaner(getOutputs());
    cleaner.setDestinationDir(getObjectFileDir());
    cleaner.execute();

    DefaultAssembleSpec spec = new DefaultAssembleSpec();
    spec.setTempDir(getTemporaryDir());

    spec.setObjectFileDir(getObjectFileDir());
    spec.source(getSource());
    spec.args(getAssemblerArgs());
    spec.setOperationLogger(operationLogger);

    Compiler<AssembleSpec> compiler = toolChain.select(targetPlatform).newCompiler(AssembleSpec.class);
    WorkResult result = BuildOperationLoggingCompilerDecorator.wrap(compiler).execute(spec);
    setDidWork(result.getDidWork());
}
项目: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) {
    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    文件:SelectiveCompiler.java   
public WorkResult execute(JavaCompileSpec spec) {
    Clock clock = new Clock();
    JarClasspathSnapshot jarClasspathSnapshot = jarClasspathSnapshotProvider.getJarClasspathSnapshot(spec.getClasspath());
    RecompilationSpec recompilationSpec = recompilationSpecProvider.provideRecompilationSpec(inputs, previousCompilation, jarClasspathSnapshot);

    if (recompilationSpec.isFullRebuildNeeded()) {
        LOG.lifecycle("Full recompilation is required because {}. Analysis took {}.", recompilationSpec.getFullRebuildCause(), clock.getTime());
        return cleaningCompiler.execute(spec);
    }

    incrementalCompilationInitilizer.initializeCompilation(spec, recompilationSpec.getClassNames());
    if (spec.getSource().isEmpty()) {
        LOG.lifecycle("None of the classes needs to compiled! Analysis took {}. ", clock.getTime());
        return new RecompilationNotNecessary();
    }

    try {
        //use the original compiler to avoid cleaning up all the files
        return cleaningCompiler.getCompiler().execute(spec);
    } finally {
        LOG.lifecycle("Incremental compilation of {} classes completed in {}.", recompilationSpec.getClassNames().size(), clock.getTime());
    }
}
项目: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    文件: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    文件: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    文件:DefaultScalaJavaJointCompiler.java   
public WorkResult execute(ScalaJavaJointCompileSpec spec) {
    scalaCompiler.execute(spec);

    PatternFilterable patternSet = new PatternSet();
    patternSet.include("**/*.java");
    FileTree javaSource = spec.getSource().getAsFileTree().matching(patternSet);
    if (!javaSource.isEmpty()) {
        spec.setSource(javaSource);
        javaCompiler.execute(spec);
    }

    return new WorkResult() {
        public boolean getDidWork() {
            return true;
        }
    };
}
项目:Pushjet-Android    文件:GroovyCompile.java   
@TaskAction
protected void compile() {
    checkGroovyClasspathIsNonEmpty();
    DefaultGroovyJavaJointCompileSpec spec = new DefaultGroovyJavaJointCompileSpec();
    spec.setSource(getSource());
    spec.setDestinationDir(getDestinationDir());
    spec.setClasspath(getClasspath());
    spec.setSourceCompatibility(getSourceCompatibility());
    spec.setTargetCompatibility(getTargetCompatibility());
    spec.setGroovyClasspath(getGroovyClasspath());
    spec.setCompileOptions(compileOptions);
    spec.setGroovyCompileOptions(groovyCompileOptions);
    if (spec.getGroovyCompileOptions().getStubDir() == null) {
        File dir = tempFileProvider.newTemporaryFile("groovy-java-stubs");
        GFileUtils.mkdirs(dir);
        spec.getGroovyCompileOptions().setStubDir(dir);
    }
    WorkResult result = compiler.execute(spec);
    setDidWork(result.getDidWork());
}
项目:Reer    文件:RhinoCoffeeScriptCompiler.java   
public WorkResult compile(CoffeeScriptCompileSpec spec) {
    CoffeeScriptCompilerProtocol compiler = rhinoWorkerHandleFactory.create(rhinoClasspath, CoffeeScriptCompilerProtocol.class, CoffeeScriptCompilerWorker.class, logLevel, workingDir);

    compiler.process(new SerializableCoffeeScriptCompileSpec(spec));

    return new WorkResult() {
        public boolean getDidWork() {
            return true;
        }
    };
}
项目:Reer    文件:GroovyCompile.java   
@Override
@TaskAction
protected void compile() {
    checkGroovyClasspathIsNonEmpty();
    DefaultGroovyJavaJointCompileSpec spec = createSpec();
    WorkResult result = getCompiler(spec).execute(spec);
    setDidWork(result.getDidWork());
}
项目:Reer    文件:NormalizingGroovyCompiler.java   
@Override
public WorkResult execute(GroovyJavaJointCompileSpec spec) {
    resolveAndFilterSourceFiles(spec);
    resolveClasspath(spec);
    resolveNonStringsInCompilerArgs(spec);
    logSourceFiles(spec);
    logCompilerArguments(spec);
    return delegateAndHandleErrors(spec);
}
项目: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    文件:BuildOperationLoggingCompilerDecorator.java   
@Override
public WorkResult execute(T spec) {
    spec.getOperationLogger().start();
    try {
        return delegate.execute(spec);
    } finally {
        spec.getOperationLogger().done();
    }
}
项目:Reer    文件:AbstractDaemonCompiler.java   
@Override
public WorkResult execute(T spec) {
    DaemonForkOptions daemonForkOptions = toDaemonOptions(spec);
    WorkerDaemon daemon = compilerDaemonFactory.getDaemon(CompilerDaemonServer.class, daemonWorkingDir, daemonForkOptions);
    WorkerDaemonResult result = daemon.execute(adapter(delegate), spec);
    if (result.isSuccess()) {
        return result;
    }
    throw UncheckedException.throwAsUncheckedException(result.getException());
}
项目:Reer    文件:NormalizingJavaCompiler.java   
@Override
public WorkResult execute(JavaCompileSpec spec) {
    resolveAndFilterSourceFiles(spec);
    resolveClasspath(spec);
    resolveNonStringsInCompilerArgs(spec);
    logSourceFiles(spec);
    logCompilerArguments(spec);
    return delegateAndHandleErrors(spec);
}
项目: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    文件:IncrementalCompilationFinalizer.java   
@Override
public WorkResult execute(JavaCompileSpec spec) {
    WorkResult out = delegate.execute(spec);

    if (!(out instanceof RecompilationNotNecessary)) {
        //if recompilation was skipped
        //there's no point in updating because we have exactly the same output classes)
        updater.updateAnalysis(spec);
    }

    writer.storeJarSnapshots(spec.getClasspath());

    return out;
}