Package org.gradle.process.internal

Examples of org.gradle.process.internal.ExecAction


        JavaExecAction javaExecAction = ConfigureUtil.configure(cl, new DefaultJavaExecAction(fileResolver));
        return javaExecAction.execute();
    }

    public ExecResult exec(Closure cl) {
        ExecAction execAction = ConfigureUtil.configure(cl, new DefaultExecAction(fileResolver));
        return execAction.execute();
    }
View Full Code Here


            options.write(optionsFile);
        } catch (IOException e) {
            throw new GradleException("Faild to store javadoc options.", e);
        }

        ExecAction execAction = new DefaultExecAction();
        execAction.workingDir(execDirectory);
        execAction.executable(GUtil.elvis(executable, Jvm.current().getJavadocExecutable()));
        execAction.args("@" + optionsFile.getAbsolutePath());

        options.contributeCommandLineOptions(execAction);

        return execAction;
    }
View Full Code Here

    private void executeExternalJavadoc() {
        javadocExecHandleBuilder.setExecutable(executable);
        javadocExecHandleBuilder.execDirectory(getProject().getRootDir()).options(options).optionsFile(getOptionsFile());

        ExecAction execAction = javadocExecHandleBuilder.getExecHandle();
        if (!failOnError) {
            execAction.setIgnoreExitValue(true);
        }

        try {
            execAction.execute();
        } catch (ExecException e) {
            throw new GradleException("Javadoc generation failed.", e);
        }
    }
View Full Code Here

    private String getDescription() {
        return clang ? "Clang" : "GCC";
    }

    private String transform(File gccBinary, List<String> args) {
        ExecAction exec = execActionFactory.newExecAction();
        exec.executable(gccBinary.getAbsolutePath());
        exec.setWorkingDir(gccBinary.getParentFile());
        exec.args(args);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        exec.setStandardOutput(baos);
        exec.setErrorOutput(new ByteArrayOutputStream());
        exec.setIgnoreExitValue(true);
        ExecResult result = exec.execute();

        int exitValue = result.getExitValue();
        if (exitValue == 0) {
            return new String(baos.toByteArray());
        } else {
View Full Code Here

        this.executable = executable;
        this.execActionFactory = execActionFactory;
    }

    public void execute(CommandLineToolInvocation invocation) {
        ExecAction compiler = execActionFactory.newExecAction();
        compiler.executable(executable);
        if (invocation.getWorkDirectory() != null) {
            GFileUtils.mkdirs(invocation.getWorkDirectory());
            compiler.workingDir(invocation.getWorkDirectory());
        }

        compiler.args(invocation.getArgs());

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

        compiler.environment(invocation.getEnvironment());

        try {
            compiler.execute();
        } catch (ExecException e) {
            throw new GradleException(String.format("%s failed; see the error output for details.", action), e);
        }
    }
View Full Code Here

            options.write(optionsFile);
        } catch (IOException e) {
            throw new GradleException("Failed to store javadoc options.", e);
        }

        ExecAction execAction = execActionFactory.newExecAction();
        execAction.workingDir(execDirectory);
        execAction.executable(GUtil.elvis(executable, Jvm.current().getJavadocExecutable()));
        execAction.args("@" + optionsFile.getAbsolutePath());

        options.contributeCommandLineOptions(execAction);

        return execAction;
    }
View Full Code Here

    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);
        }
View Full Code Here

TOP

Related Classes of org.gradle.process.internal.ExecAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.