Package org.gradle.api.tasks.compile

Examples of org.gradle.api.tasks.compile.CompileOptions


            return null;
        }
    }

    public static String tryGetCompilerVersion(JavaCompile compileTask) {
        CompileOptions options = compileTask.getOptions();
        if (options.isFork()) {
            ForkOptions forkOptions = options.getForkOptions();
            return tryGetCompilerVersion(forkOptions);
        }
        else {
            return System.getProperty("java.version");
        }
View Full Code Here


        this.compilerDaemonFactory = compilerDaemonManager;
        this.inProcessCompilerDaemonFactory = inProcessCompilerDaemonFactory;
    }

    public Compiler<GroovyJavaJointCompileSpec> newCompiler(GroovyJavaJointCompileSpec spec) {
        CompileOptions javaOptions = spec.getCompileOptions();
        GroovyCompileOptions groovyOptions = spec.getGroovyCompileOptions();
        Compiler<JavaCompileSpec> javaCompiler = javaCompilerFactory.createForJointCompilation(javaOptions);
        Compiler<GroovyJavaJointCompileSpec> groovyCompiler = new ApiGroovyCompiler(javaCompiler);
        CompilerDaemonFactory daemonFactory;
        if (groovyOptions.isFork()) {
View Full Code Here

    }

    private class JavaToolProvider implements ToolProvider {
        public <T extends CompileSpec> Compiler<T> newCompiler(T spec) {
            if (spec instanceof JavaCompileSpec) {
                CompileOptions options = ((JavaCompileSpec) spec).getCompileOptions();
                @SuppressWarnings("unchecked") Compiler<T> compiler = (Compiler<T>) compilerFactory.create(options);
                return compiler;
            }
            if (spec instanceof JavadocSpec) {
                @SuppressWarnings("unchecked") Compiler<T> compiler = (Compiler<T>) new JavadocGenerator(execActionFactory);
View Full Code Here

        List<String> options = new JavaCompilerArgumentsBuilder(spec).build();
        JavaCompiler compiler = findCompiler();
        if(compiler==null){
            throw new RuntimeException("Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.");
        }
        CompileOptions compileOptions = spec.getCompileOptions();
        StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, compileOptions.getEncoding() != null ? Charset.forName(compileOptions.getEncoding()) : null);
        Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(spec.getSource());
        return compiler.getTask(null, null, null, options, null, compilationUnits);
    }
View Full Code Here

        File destinationDir = spec.getDestinationDir();
        if (destinationDir != null) {
            args.add("-d");
            args.add(destinationDir.getPath());
        }
        CompileOptions compileOptions = spec.getCompileOptions();
        if (compileOptions.isVerbose()) {
            args.add("-verbose");
        }
        if (compileOptions.isDeprecation()) {
            args.add("-deprecation");
        }
        if (!compileOptions.isWarnings()) {
            args.add("-nowarn");
        }
        if (compileOptions.isDebug()) {
            if (compileOptions.getDebugOptions().getDebugLevel() != null) {
                args.add("-g:" + compileOptions.getDebugOptions().getDebugLevel().trim());
            } else {
                args.add("-g");
            }
        } else {
            args.add("-g:none");
        }
        if (compileOptions.getEncoding() != null) {
            args.add("-encoding");
            args.add(compileOptions.getEncoding());
        }
        if (compileOptions.getBootClasspath() != null) { //TODO: move bootclasspath to platform
            args.add("-bootclasspath");
            args.add(compileOptions.getBootClasspath());
        }
        if (compileOptions.getExtensionDirs() != null) {
            args.add("-extdirs");
            args.add(compileOptions.getExtensionDirs());
        }
        if (compileOptions.getCompilerArgs() != null) {
            args.addAll(compileOptions.getCompilerArgs());
        }
    }
View Full Code Here

TOP

Related Classes of org.gradle.api.tasks.compile.CompileOptions

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.