Examples of CompilerConfiguration


Examples of org.codehaus.plexus.compiler.CompilerConfiguration

        // ----------------------------------------------------------------------
        // Create the compiler configuration
        // ----------------------------------------------------------------------

        CompilerConfiguration compilerConfiguration = new CompilerConfiguration();

        compilerConfiguration.setOutputLocation(getOutputDirectory()
                .getAbsolutePath());

        compilerConfiguration.setClasspathEntries(getClasspathElements());

        compilerConfiguration.setSourceLocations(compileSourceRoots);

        compilerConfiguration.setOptimize(optimize);

        compilerConfiguration.setDebug(debug);

        compilerConfiguration.setVerbose(verbose);

        compilerConfiguration.setShowWarnings(showWarnings);

        compilerConfiguration.setShowDeprecation(showDeprecation);

        compilerConfiguration.setSourceVersion(source);

        compilerConfiguration.setTargetVersion(target);

        compilerConfiguration.setSourceEncoding(encoding);

        if (compilerArguments != null) {
            LinkedHashMap cplrArgsCopy = new LinkedHashMap();
            for (Iterator i = compilerArguments.entrySet().iterator(); i
                    .hasNext();) {
                Map.Entry me = (Map.Entry) i.next();
                String key = (String) me.getKey();
                if (!key.startsWith("-")) {
                    key = "-" + key;
                }
                cplrArgsCopy.put(key, me.getValue());
            }
            compilerConfiguration.setCustomCompilerArguments(cplrArgsCopy);
        }

        compilerConfiguration.setFork(fork);

        compilerConfiguration.setExecutable(executable);

        compilerConfiguration.setWorkingDirectory(basedir);

        compilerConfiguration.setCompilerVersion(compilerVersion);

        compilerConfiguration.setBuildDirectory(buildDirectory);

        getLog().debug("output file name: " + getOutputFileName());
       
        compilerConfiguration.setOutputFileName(getOutputFileName());

        Set staleSources;

        boolean canUpdateTarget;

        try {
            staleSources = computeStaleSources(compilerConfiguration, compiler,
                    getSourceInclusionScanner(staleMillis));

            canUpdateTarget = compiler.canUpdateTarget(compilerConfiguration);

            if (compiler.getCompilerOutputStyle().equals(
                    CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES)
                    && !canUpdateTarget) {
                getLog().info("RESCANNING!");
                // TODO: This second scan for source files is sub-optimal
                String inputFileEnding = compiler
                        .getInputFileEnding(compilerConfiguration);

                Set sources = computeStaleSources(compilerConfiguration,
                        compiler, getSourceInclusionScanner(inputFileEnding));

                compilerConfiguration.setSourceFiles(sources);
            } else {
                compilerConfiguration.setSourceFiles(staleSources);
            }
        } catch (CompilerException e) {
            throw new MojoExecutionException(
                    "Error while computing stale sources.", e);
        }
View Full Code Here

Examples of org.codehaus.plexus.compiler.CompilerConfiguration

            classPathElements.add( getClasspath().get( i ).getAbsolutePath() );
        }

        org.codehaus.plexus.compiler.Compiler compiler = new JavacCompiler();

        CompilerConfiguration configuration = new CompilerConfiguration();
        configuration.setClasspathEntries( classPathElements );
        configuration.setSourceLocations(
            Arrays.asList( getTestPath( "src/test/verifiers/" + getName() ), generatedSources.getAbsolutePath() ) );
        configuration.setOutputLocation( getOutputClasses().getAbsolutePath() );// destinationDirectory.getAbsolutePath() );
        configuration.setDebug( true );
        configuration.setSourceVersion( "1.5" );
        configuration.setTargetVersion( "1.5" );

        List<CompilerMessage> messages = compiler.performCompile( configuration ).getCompilerMessages();

        int error = 0;
View Full Code Here

Examples of org.codehaus.plexus.compiler.CompilerConfiguration

        // ----------------------------------------------------------------------
        // Create the compiler configuration
        // ----------------------------------------------------------------------

        CompilerConfiguration compilerConfiguration = new CompilerConfiguration();

        compilerConfiguration.setOutputLocation( getOutputDirectory().getAbsolutePath() );

        compilerConfiguration.setClasspathEntries( getClasspathElements() );

        compilerConfiguration.setSourceLocations( compileSourceRoots );

        compilerConfiguration.setOptimize( optimize );

        compilerConfiguration.setDebug( debug );

        compilerConfiguration.setVerbose( verbose );

        compilerConfiguration.setShowWarnings( showWarnings );

        compilerConfiguration.setShowDeprecation( showDeprecation );

        compilerConfiguration.setSourceVersion( source );

        compilerConfiguration.setTargetVersion( target );

        compilerConfiguration.setSourceEncoding( encoding );

        if (( compilerArguments != null ) || ( compilerArgument != null ))
        {
            LinkedHashMap cplrArgsCopy = new LinkedHashMap();
            if ( compilerArguments != null )
            {
                for ( Iterator i = compilerArguments.entrySet().iterator(); i.hasNext(); )
                {
                    Map.Entry me = (Map.Entry) i.next();
                    String key = (String) me.getKey();
                    String value = (String) me.getValue();
                    if ( !key.startsWith( "-" ))
                    {
                        key = "-" + key;
                    }
                    cplrArgsCopy.put( key, value );
                }
            }
            if ( !StringUtils.isEmpty( compilerArgument) )
            {
                cplrArgsCopy.put( compilerArgument, null );
            }
            compilerConfiguration.setCustomCompilerArguments( cplrArgsCopy );
        }

        compilerConfiguration.setFork( fork );

        if( fork )
        {
            if ( !StringUtils.isEmpty( meminitial ) )
            {
                String value = getMemoryValue( meminitial );

                if ( value != null )
                {
                    compilerConfiguration.setMeminitial( value );
                }
                else
                {
                    getLog().info( "Invalid value for meminitial '" + meminitial + "'. Ignoring this option." );
                }
            }

            if ( !StringUtils.isEmpty( maxmem ) )
            {
                String value = getMemoryValue( maxmem );

                if ( value != null )
                {
                    compilerConfiguration.setMaxmem( value );
                }
                else
                {
                    getLog().info( "Invalid value for maxmem '" + maxmem + "'. Ignoring this option." );
                }
            }
        }

        compilerConfiguration.setExecutable( executable );

        compilerConfiguration.setWorkingDirectory( basedir );

        compilerConfiguration.setCompilerVersion( compilerVersion );

        compilerConfiguration.setBuildDirectory( buildDirectory );

        compilerConfiguration.setOutputFileName( outputFileName );

        // TODO: have an option to always compile (without need to clean)
        Set staleSources;

        boolean canUpdateTarget;

        try
        {
            staleSources =
                computeStaleSources( compilerConfiguration, compiler, getSourceInclusionScanner( staleMillis ) );

            canUpdateTarget = compiler.canUpdateTarget( compilerConfiguration );

            if ( compiler.getCompilerOutputStyle().equals( CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES ) &&
                !canUpdateTarget )
            {
                getLog().info( "RESCANNING!" );
                // TODO: This second scan for source files is sub-optimal
                String inputFileEnding = compiler.getInputFileEnding( compilerConfiguration );

                Set sources = computeStaleSources( compilerConfiguration, compiler,
                                                   getSourceInclusionScanner( inputFileEnding ) );

                compilerConfiguration.setSourceFiles( sources );
            }
            else
            {
                compilerConfiguration.setSourceFiles( staleSources );
            }
        }
        catch ( CompilerException e )
        {
            throw new MojoExecutionException( "Error while computing stale sources.", e );
        }

        if ( staleSources.isEmpty() )
        {
            getLog().info( "Nothing to compile - all classes are up to date" );

            return;
        }

        // ----------------------------------------------------------------------
        // Dump configuration
        // ----------------------------------------------------------------------

        if ( getLog().isDebugEnabled() )
        {
            getLog().debug( "Classpath:" );

            for ( Iterator it = getClasspathElements().iterator(); it.hasNext(); )
            {
                String s = (String) it.next();

                getLog().debug( " " + s );
            }

            getLog().debug( "Source roots:" );

            for ( Iterator it = getCompileSourceRoots().iterator(); it.hasNext(); )
            {
                String root = (String) it.next();

                getLog().debug( " " + root );
            }

            if ( fork )
            {
                try
                {
                    if ( compilerConfiguration.getExecutable() != null )
                    {
                        getLog().debug( "Excutable: " );
                        getLog().debug( " " + compilerConfiguration.getExecutable() );
                    }

                    String[] cl = compiler.createCommandLine( compilerConfiguration );
                    if ( cl != null && cl.length > 0 )
                    {
View Full Code Here

Examples of org.jetbrains.jps.CompilerConfiguration

  public ResourcesBuilder() {
  }

  public ExitCode build(final CompileContext context, ModuleChunk chunk) throws ProjectBuildException {
    CompilerConfiguration config = null;
    for (Module module : chunk.getModules()) {
      config = module.getProject().getCompilerConfiguration();
      break;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.