Package com.atlassian.maven.plugin.clover.internal.scanner

Examples of com.atlassian.maven.plugin.clover.internal.scanner.CloverSourceScanner


        return this.configuration;
    }

    public void instrument() throws MojoExecutionException
    {
        CloverSourceScanner scanner = getSourceScanner();
        Map filesToInstrument = scanner.getSourceFilesToInstrument();
        if ( filesToInstrument.isEmpty() )
        {
            getConfiguration().getLog().warn( "No Clover instrumentation done on source files as no "
                + "matching sources files found" );
        }
        else
        {
            instrumentSources( filesToInstrument, outputSourceDirectory );

        }

        // We need to copy excluded files as otherwise they won't be in the new Clover source directory and
        // thus won't be compiled by the compile plugin. This will lead to compilation errors if any other
        // Java file depends on any of these excluded files.
        copyExcludedFiles( scanner.getExcludedFiles(), outputSourceDirectory );

        //won't do its job when include files set is empty!
    }
View Full Code Here


     * @throws MojoExecutionException
     * @see com.atlassian.maven.plugin.clover.CloverInstrumentInternalMojo#calcIncludedFilesForGroovy()
     * @see com.atlassian.maven.plugin.clover.CloverInstrumentInternalMojo#redirectOutputDirectories()
     */
    public void instrument() throws MojoExecutionException {
        final CloverSourceScanner scanner = getSourceScanner();
        // get source files to be instrumented, but only for Java as they will be instrumented by CloverInstr
        final Map<String, String[]> javaFilesToInstrument = scanner.getSourceFilesToInstrument(LanguageFileExtensionFilter.JAVA_LANGUAGE, true);
        if (javaFilesToInstrument.isEmpty()) {
            getConfiguration().getLog().info("No Clover instrumentation done on source files in: "
                    + getCompileSourceRoots() + " as no matching sources files found (JAVA_LANGUAGE)");
        } else {
            instrumentSources(javaFilesToInstrument, outputSourceDirectory);
        }

        // find groovy files in all compilation roots and copy them
        //
        // 1) in case when 'src/main/java' (or 'src/test/java') contains *.groovy source files (this is a trick possible
        // with a groovy-eclipse-plugin, see http://groovy.codehaus.org/Groovy-Eclipse+compiler+plugin+for+Maven
        // "Setting up source folders / Do nothing") we must copy *.groovy files as well
        // reason: 'src/main/java' (or 'src/test/java') will be redirected to 'target/clover/src-instrumented'
        // (or 'target/clover/src-test-instrumented') and Groovy compiler must be able to find these groovy sources
        //
        // 2) however we shall not copy groovy files from 'src/(main|test)/groovy' because these source roots are not
        // being redirected to 'target/clover/src-(test-)instrumented'; furthermore groovy-eclipse-plugin has
        // 'src/(main|test)/groovy' location hardcoded, so copying files would end up with 'duplicate class' build error
        final Map<String, String[]> groovyFilesToInstrument = scanner.getSourceFilesToInstrument(LanguageFileExtensionFilter.GROOVY_LANGUAGE, true);

        // copy groovy files
        if (!groovyFilesToInstrument.isEmpty()) {
            copyExcludedFiles(groovyFilesToInstrument, outputSourceDirectory);
        }

        // We need to copy excluded files too as otherwise they won't be in the new Clover source directory and
        // thus won't be compiled by the compile plugin. This will lead to compilation errors if any other
        // file depends on any of these excluded files.
        if (configuration.copyExcludedFiles()) {
            final Map<String, String[]> explicitlyExcludedFiles = scanner.getExcludedFiles();
            // 'src/(main|test)/groovy' is already filtered-out in getExcludedFiles()
            copyExcludedFiles(explicitlyExcludedFiles, outputSourceDirectory);
        }
    }
View Full Code Here

        final List<String> sourceRoots = new ArrayList<String>(getCompileSourceRoots());

        // Clean all source roots to add them again in order to keep the same original order of source roots.
        getCompileSourceRoots().removeAll(sourceRoots);

        final CloverSourceScanner scanner = getSourceScanner();
        for (final String sourceRoot : sourceRoots) {
            if (new File(oldSourceDirectory).exists() && sourceRoot.equals(oldSourceDirectory)) {
                // if compilation root is the same as original source directory:
                // a) if it's a Java directory then use location of instrumented sources instead of the original source
                // root (e.g. 'src/main/java' -> 'target/clover/src-instrumented')
                // b) if it's a Groovy directory then don't change the location because we don't instrument Groovy on
                // a source level, so the Clover's instrumented folder is empty; Groovy files will be instrumented
                // during compilation on the AST level (e.g. 'src/main/groovy' -> 'src/main/groovy')
                if (scanner.isSourceRootForLanguage(sourceRoot, Language.Builtin.GROOVY))  {
                    addCompileSourceRoot(sourceRoot);
                } else {
                    addCompileSourceRoot(getSourceDirectory());
                }
            } else if ( !(getConfiguration().includesAllSourceRoots() && isGeneratedSourcesDirectory(sourceRoot)) ) {
View Full Code Here

     * @throws MojoExecutionException
     * @see com.atlassian.maven.plugin.clover.CloverInstrumentInternalMojo#calcIncludedFilesForGroovy()
     * @see com.atlassian.maven.plugin.clover.CloverInstrumentInternalMojo#redirectOutputDirectories()
     */
    public void instrument() throws MojoExecutionException {
        final CloverSourceScanner scanner = getSourceScanner();
        // get source files to be instrumented, but only for Java as they will be instrumented by CloverInstr
        final Map<String, String[]> javaFilesToInstrument = scanner.getSourceFilesToInstrument(LanguageFileExtensionFilter.JAVA_LANGUAGE, true);
        if (javaFilesToInstrument.isEmpty()) {
            getConfiguration().getLog().info("No Clover instrumentation done on source files in: "
                    + getCompileSourceRoots() + " as no matching sources files found (JAVA_LANGUAGE)");
        } else {
            instrumentSources(javaFilesToInstrument, outputSourceDirectory);
        }

        // find groovy files in all compilation roots and copy them
        //
        // 1) in case when 'src/main/java' (or 'src/test/java') contains *.groovy source files (this is a trick possible
        // with a groovy-eclipse-plugin, see http://groovy.codehaus.org/Groovy-Eclipse+compiler+plugin+for+Maven
        // "Setting up source folders / Do nothing") we must copy *.groovy files as well
        // reason: 'src/main/java' (or 'src/test/java') will be redirected to 'target/clover/src-instrumented'
        // (or 'target/clover/src-test-instrumented') and Groovy compiler must be able to find these groovy sources
        //
        // 2) however we shall not copy groovy files from 'src/(main|test)/groovy' because these source roots are not
        // being redirected to 'target/clover/src-(test-)instrumented'; furthermore groovy-eclipse-plugin has
        // 'src/(main|test)/groovy' location hardcoded, so copying files would end up with 'duplicate class' build error
        final Map<String, String[]> groovyFilesToInstrument = scanner.getSourceFilesToInstrument(LanguageFileExtensionFilter.GROOVY_LANGUAGE, true);

        // copy groovy files
        if (!groovyFilesToInstrument.isEmpty()) {
            copyExcludedFiles(groovyFilesToInstrument, outputSourceDirectory);
        }

        // We need to copy excluded files too as otherwise they won't be in the new Clover source directory and
        // thus won't be compiled by the compile plugin. This will lead to compilation errors if any other
        // file depends on any of these excluded files.
        if (configuration.copyExcludedFiles()) {
            final Map<String, String[]> explicitlyExcludedFiles = scanner.getExcludedFiles();
            // 'src/(main|test)/groovy' is already filtered-out in getExcludedFiles()
            copyExcludedFiles(explicitlyExcludedFiles, outputSourceDirectory);
        }
    }
View Full Code Here

        final List<String> sourceRoots = new ArrayList<String>(getCompileSourceRoots());

        // Clean all source roots to add them again in order to keep the same original order of source roots.
        getCompileSourceRoots().removeAll(sourceRoots);

        final CloverSourceScanner scanner = getSourceScanner();
        for (final String sourceRoot : sourceRoots) {
            if (new File(oldSourceDirectory).exists() && sourceRoot.equals(oldSourceDirectory)) {
                // if compilation root is the same as original source directory:
                // a) if it's a Java directory then use location of instrumented sources instead of the original source
                // root (e.g. 'src/main/java' -> 'target/clover/src-instrumented')
                // b) if it's a Groovy directory then don't change the location because we don't instrument Groovy on
                // a source level, so the Clover's instrumented folder is empty; Groovy files will be instrumented
                // during compilation on the AST level (e.g. 'src/main/groovy' -> 'src/main/groovy')
                if (scanner.isSourceRootForLanguage(sourceRoot, Language.Builtin.GROOVY))  {
                    addCompileSourceRoot(sourceRoot);
                } else {
                    addCompileSourceRoot(getSourceDirectory());
                }
            } else if ( !(getConfiguration().includesAllSourceRoots() && isGeneratedSourcesDirectory(sourceRoot)) ) {
View Full Code Here

        return this.configuration;
    }

    public void instrument() throws MojoExecutionException
    {
        final CloverSourceScanner scanner = getSourceScanner();
        Map filesToInstrument = scanner.getSourceFilesToInstrument();
        if ( filesToInstrument.isEmpty() )
        {
            getConfiguration().getLog().info( "No Clover instrumentation done on source files in: "
                    + getCompileSourceRoots() + " as no matching sources files found" );

        }
        else
        {
            instrumentSources( filesToInstrument, outputSourceDirectory );

        }

        // We need to copy excluded files as otherwise they won't be in the new Clover source directory and
        // thus won't be compiled by the compile plugin. This will lead to compilation errors if any other
        // Java file depends on any of these excluded files.

        if (configuration.copyExcludedFiles())
        {
            copyExcludedFiles( scanner.getExcludedFiles(), outputSourceDirectory );
        }

        //won't do its job when include files set is empty!
    }
View Full Code Here

        return this.configuration;
    }

    public void instrument() throws MojoExecutionException
    {
        final CloverSourceScanner scanner = getSourceScanner();
        Map filesToInstrument = scanner.getSourceFilesToInstrument();
        if ( filesToInstrument.isEmpty() )
        {
            getConfiguration().getLog().info( "No Clover instrumentation done on source files in: "
                    + getCompileSourceRoots() + " as no matching sources files found" );

        }
        else
        {
            instrumentSources( filesToInstrument, outputSourceDirectory );

        }

        // We need to copy excluded files as otherwise they won't be in the new Clover source directory and
        // thus won't be compiled by the compile plugin. This will lead to compilation errors if any other
        // Java file depends on any of these excluded files.
        copyExcludedFiles( scanner.getExcludedFiles(), outputSourceDirectory );

        //won't do its job when include files set is empty!
    }
View Full Code Here

        return this.configuration;
    }

    public void instrument() throws MojoExecutionException
    {
        CloverSourceScanner scanner = getSourceScanner();
        Map filesToInstrument = scanner.getSourceFilesToInstrument();
        if ( filesToInstrument.isEmpty() )
        {
            getConfiguration().getLog().warn( "No Clover instrumentation done on source files as no "
                + "matching sources files found" );
        }
        else
        {
            instrumentSources( filesToInstrument, outputSourceDirectory );

        }

        // We need to copy excluded files as otherwise they won't be in the new Clover source directory and
        // thus won't be compiled by the compile plugin. This will lead to compilation errors if any other
        // Java file depends on any of these excluded files.
        copyExcludedFiles( scanner.getExcludedFiles(), outputSourceDirectory );

        //won't do its job when include files set is empty!
    }
View Full Code Here

     * @throws MojoExecutionException when instrumentation fails
     * @see com.atlassian.maven.plugin.clover.CloverInstrumentInternalMojo#calcIncludedFilesForGroovy()
     * @see com.atlassian.maven.plugin.clover.CloverInstrumentInternalMojo#redirectOutputDirectories()
     */
    public void instrument() throws MojoExecutionException {
        final CloverSourceScanner scanner = getSourceScanner();
        // get source files to be instrumented, but only for Java as they will be instrumented by CloverInstr
        final Map<String, String[]> javaFilesToInstrument = scanner.getSourceFilesToInstrument(LanguageFileExtensionFilter.JAVA_LANGUAGE, true);
        if (javaFilesToInstrument.isEmpty()) {
            getConfiguration().getLog().info("No Clover instrumentation done on source files in: "
                    + getCompileSourceRoots() + " as no matching sources files found (JAVA_LANGUAGE)");
        } else {
            instrumentSources(javaFilesToInstrument, outputSourceDirectory);
        }

        // find groovy files in all compilation roots and copy them
        //
        // 1) in case when 'src/main/java' (or 'src/test/java') contains *.groovy source files (this is a trick possible
        // with a groovy-eclipse-plugin, see http://groovy.codehaus.org/Groovy-Eclipse+compiler+plugin+for+Maven
        // "Setting up source folders / Do nothing") we must copy *.groovy files as well
        // reason: 'src/main/java' (or 'src/test/java') will be redirected to 'target/clover/src-instrumented'
        // (or 'target/clover/src-test-instrumented') and Groovy compiler must be able to find these groovy sources
        //
        // 2) however we shall not copy groovy files from 'src/(main|test)/groovy' because these source roots are not
        // being redirected to 'target/clover/src-(test-)instrumented'; furthermore groovy-eclipse-plugin has
        // 'src/(main|test)/groovy' location hardcoded, so copying files would end up with 'duplicate class' build error
        final Map<String, String[]> groovyFilesToInstrument = scanner.getSourceFilesToInstrument(LanguageFileExtensionFilter.GROOVY_LANGUAGE, true);

        // copy groovy files
        if (!groovyFilesToInstrument.isEmpty()) {
            copyExcludedFiles(groovyFilesToInstrument, outputSourceDirectory);
        }

        // We need to copy excluded files too as otherwise they won't be in the new Clover source directory and
        // thus won't be compiled by the compile plugin. This will lead to compilation errors if any other
        // file depends on any of these excluded files.
        if (configuration.isCopyExcludedFiles()) {
            final Map<String, String[]> explicitlyExcludedFiles = scanner.getExcludedFiles();
            // 'src/(main|test)/groovy' is already filtered-out in getExcludedFiles()
            copyExcludedFiles(explicitlyExcludedFiles, outputSourceDirectory);
        }
    }
View Full Code Here

        final List<String> sourceRoots = new ArrayList<String>(getCompileSourceRoots());

        // Clean all source roots to add them again in order to keep the same original order of source roots.
        getCompileSourceRoots().removeAll(sourceRoots);

        final CloverSourceScanner scanner = getSourceScanner();
        for (final String sourceRoot : sourceRoots) {
            if (new File(oldSourceDirectory).exists() && sourceRoot.equals(oldSourceDirectory)) {
                // if compilation root is the same as original source directory:
                // a) if it's a Java directory then use location of instrumented sources instead of the original source
                // root (e.g. 'src/main/java' -> 'target/clover/src-instrumented')
                // b) if it's a Groovy directory then don't change the location because we don't instrument Groovy on
                // a source level, so the Clover's instrumented folder is empty; Groovy files will be instrumented
                // during compilation on the AST level (e.g. 'src/main/groovy' -> 'src/main/groovy')
                if (scanner.isSourceRootForLanguage(sourceRoot, Language.Builtin.GROOVY))  {
                    addCompileSourceRoot(sourceRoot);
                } else {
                    addCompileSourceRoot(getSourceDirectory());
                }
            } else if ( !(getConfiguration().isIncludesAllSourceRoots() && isGeneratedSourcesDirectory(sourceRoot)) ) {
View Full Code Here

TOP

Related Classes of com.atlassian.maven.plugin.clover.internal.scanner.CloverSourceScanner

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.