pax_global_header 0000666 0000000 0000000 00000000064 12022156743 0014514 g ustar 00root root 0000000 0000000 52 comment=36a1fb07afa3e18efda5c4e317fda0eb4e5e1da6
plexus-compiler-plexus-compiler-1.9.2/ 0000775 0000000 0000000 00000000000 12022156743 0020003 5 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/.gitignore 0000664 0000000 0000000 00000000070 12022156743 0021770 0 ustar 00root root 0000000 0000000 target/
.project
.classpath
.settings/
bin
.idea
*.iml
plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/ 0000775 0000000 0000000 00000000000 12022156743 0023702 5 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/pom.xml 0000664 0000000 0000000 00000001543 12022156743 0025222 0 ustar 00root root 0000000 0000000
4.0.0
org.codehaus.plexus
plexus-compiler
1.9.2
plexus-compiler-api
Plexus Compiler Api
Plexus Compilers component's API to manipulate compilers.
org.codehaus.plexus
plexus-utils
junit
junit
plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/ 0000775 0000000 0000000 00000000000 12022156743 0024471 5 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/ 0000775 0000000 0000000 00000000000 12022156743 0025415 5 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/ 0000775 0000000 0000000 00000000000 12022156743 0026336 5 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/ 0000775 0000000 0000000 00000000000 12022156743 0027125 5 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/ 0000775 0000000 0000000 00000000000 12022156743 0030720 5 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/ 0000775 0000000 0000000 00000000000 12022156743 0032240 5 ustar 00root root 0000000 0000000 0000775 0000000 0000000 00000000000 12022156743 0033773 5 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler AbstractCompiler.java 0000664 0000000 0000000 00000021065 12022156743 0040100 0 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler package org.codehaus.plexus.compiler;
/**
* The MIT License
*
* Copyright (c) 2005, The Codehaus
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.DirectoryScanner;
import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @author Jason van Zyl
* @author Michal Maczka
* @author Trygve Laugstøl
* @version $Id$
*/
public abstract class AbstractCompiler
extends AbstractLogEnabled
implements Compiler
{
protected static final String EOL = System.getProperty( "line.separator" );
protected static final String PS = System.getProperty( "path.separator" );
private CompilerOutputStyle compilerOutputStyle;
private String inputFileEnding;
private String outputFileEnding;
private String outputFile;
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
protected AbstractCompiler( CompilerOutputStyle compilerOutputStyle, String inputFileEnding,
String outputFileEnding, String outputFile )
{
this.compilerOutputStyle = compilerOutputStyle;
this.inputFileEnding = inputFileEnding;
this.outputFileEnding = outputFileEnding;
this.outputFile = outputFile;
}
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
public CompilerOutputStyle getCompilerOutputStyle()
{
return compilerOutputStyle;
}
public String getInputFileEnding( CompilerConfiguration configuration )
throws CompilerException
{
return inputFileEnding;
}
public String getOutputFileEnding( CompilerConfiguration configuration )
throws CompilerException
{
if ( compilerOutputStyle != CompilerOutputStyle.ONE_OUTPUT_FILE_PER_INPUT_FILE )
{
throw new RuntimeException( "This compiler implementation doesn't have one output file per input file." );
}
return outputFileEnding;
}
public String getOutputFile( CompilerConfiguration configuration )
throws CompilerException
{
if ( compilerOutputStyle != CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES )
{
throw new RuntimeException( "This compiler implementation doesn't have one output file for all files." );
}
return outputFile;
}
public boolean canUpdateTarget( CompilerConfiguration configuration )
throws CompilerException
{
return true;
}
// ----------------------------------------------------------------------
// Utility Methods
// ----------------------------------------------------------------------
public static String getPathString( List pathElements )
{
StringBuilder sb = new StringBuilder();
for ( String pathElement : pathElements )
{
sb.append( pathElement ).append( File.pathSeparator );
}
return sb.toString();
}
protected static Set getSourceFilesForSourceRoot( CompilerConfiguration config, String sourceLocation )
{
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir( sourceLocation );
Set includes = config.getIncludes();
if ( includes != null && !includes.isEmpty() )
{
String[] inclStrs = includes.toArray( new String[includes.size()] );
scanner.setIncludes( inclStrs );
}
else
{
scanner.setIncludes( new String[]{ "**/*.java" } );
}
Set excludes = config.getExcludes();
if ( excludes != null && !excludes.isEmpty() )
{
String[] exclStrs = excludes.toArray( new String[excludes.size()] );
scanner.setIncludes( exclStrs );
}
scanner.scan();
String[] sourceDirectorySources = scanner.getIncludedFiles();
Set sources = new HashSet();
for ( int j = 0; j < sourceDirectorySources.length; j++ )
{
File f = new File( sourceLocation, sourceDirectorySources[j] );
sources.add( f.getPath() );
}
return sources;
}
protected static String[] getSourceFiles( CompilerConfiguration config )
{
Set sources = new HashSet();
Set sourceFiles = config.getSourceFiles();
if ( sourceFiles != null && !sourceFiles.isEmpty() )
{
for ( File sourceFile : sourceFiles )
{
sources.add( sourceFile.getAbsolutePath() );
}
}
else
{
for ( String sourceLocation : config.getSourceLocations() )
{
sources.addAll( getSourceFilesForSourceRoot( config, sourceLocation ) );
}
}
String[] result;
if ( sources.isEmpty() )
{
result = new String[0];
}
else
{
result = (String[]) sources.toArray( new String[sources.size()] );
}
return result;
}
protected static String makeClassName( String fileName, String sourceDir )
throws CompilerException
{
File origFile = new File( fileName );
String canonical = null;
if ( origFile.exists() )
{
canonical = getCanonicalPath( origFile ).replace( '\\', '/' );
}
if ( sourceDir != null )
{
String prefix = getCanonicalPath( new File( sourceDir ) ).replace( '\\', '/' );
if ( canonical != null )
{
if ( canonical.startsWith( prefix ) )
{
String result = canonical.substring( prefix.length() + 1, canonical.length() - 5 );
result = result.replace( '/', '.' );
return result;
}
}
else
{
File t = new File( sourceDir, fileName );
if ( t.exists() )
{
String str = getCanonicalPath( t ).replace( '\\', '/' );
return str.substring( prefix.length() + 1, str.length() - 5 ).replace( '/', '.' );
}
}
}
if ( fileName.endsWith( ".java" ) )
{
fileName = fileName.substring( 0, fileName.length() - 5 );
}
fileName = fileName.replace( '\\', '.' );
return fileName.replace( '/', '.' );
}
private static String getCanonicalPath( File origFile )
throws CompilerException
{
try
{
return origFile.getCanonicalPath();
}
catch ( IOException e )
{
throw new CompilerException(
"Error while getting the canonical path of '" + origFile.getAbsolutePath() + "'.", e );
}
}
/**
* @deprecated use (String[]) arguments.toArray( new String[ arguments.size() ] ); instead
*/
protected static String[] toStringArray( List arguments )
{
String[] args = new String[arguments.size()];
int argLength = arguments.size();
for ( int i = 0; i < argLength; i++ )
{
args[i] = arguments.get( i );
}
return args;
}
}
Compiler.java 0000664 0000000 0000000 00000005173 12022156743 0036416 0 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler package org.codehaus.plexus.compiler;
/**
* The MIT License
*
* Copyright (c) 2004, The Codehaus
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import java.util.List;
/**
* @author Jason van Zyl
* @author Trygve Laugstøl
* @author Matthew Pocock
* @version $Id$
*/
public interface Compiler
{
String ROLE = Compiler.class.getName();
CompilerOutputStyle getCompilerOutputStyle();
String getInputFileEnding( CompilerConfiguration configuration )
throws CompilerException;
String getOutputFileEnding( CompilerConfiguration configuration )
throws CompilerException;
String getOutputFile( CompilerConfiguration configuration )
throws CompilerException;
boolean canUpdateTarget( CompilerConfiguration configuration )
throws CompilerException;
List compile( CompilerConfiguration configuration )
throws CompilerException;
/**
* Create the command line that would be executed using this configuration.
* If this particular compiler has no concept of a command line then returns
* null.
*
* @param config the CompilerConfiguration describing the
* compilation
* @return an array of Strings that make up the command line, or null if
* this compiler has no concept of command line
* @throws CompilerException if there was an error generating the command
* line
*/
String[] createCommandLine(CompilerConfiguration config )
throws CompilerException;
}
CompilerConfiguration.java 0000664 0000000 0000000 00000031710 12022156743 0041142 0 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler package org.codehaus.plexus.compiler;
/**
* The MIT License
*
* Copyright (c) 2004, The Codehaus
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import java.io.File;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author jdcasey
* @version $Id$
*/
public class CompilerConfiguration
{
private String outputLocation;
private List classpathEntries = new LinkedList();
// ----------------------------------------------------------------------
// Source Files
// ----------------------------------------------------------------------
private Set sourceFiles = new HashSet();
private List sourceLocations = new LinkedList();
private Set includes = new HashSet();
private Set excludes = new HashSet();
// ----------------------------------------------------------------------
// Compiler Settings
// ----------------------------------------------------------------------
private boolean debug;
private String debugLevel;
private boolean showWarnings = true;
private boolean showDeprecation;
private String sourceVersion;
private String targetVersion;
private String sourceEncoding;
private Map customCompilerArguments = new LinkedHashMap();
private boolean fork;
private boolean optimize;
private String meminitial;
private String maxmem;
private String executable;
private File workingDirectory;
private String compilerVersion;
private boolean verbose = false;
/**
* A build temporary directory, eg target/.
*
* Used by the compiler implementation to put temporary files.
*/
private File buildDirectory;
/**
* Used to control the name of the output file when compiling a set of
* sources to a single file.
*/
private String outputFileName;
/**
* in jdk 1.6+, used to hold value of the -s path parameter.
*/
private File generatedSourcesDirectory;
/**
* value of the -proc parameter in jdk 1.6+
*/
private String proc;
/**
* -processor parameters in jdk 1.6+
*/
private String[] annotationProcessors;
/**
* default value {@link CompilerReuseStrategy.ReuseCreated}
*
* @since 1.9
*/
private CompilerReuseStrategy compilerReuseStrategy = CompilerReuseStrategy.ReuseCreated;
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
public void setOutputLocation( String outputLocation )
{
this.outputLocation = outputLocation;
}
public String getOutputLocation()
{
return outputLocation;
}
// ----------------------------------------------------------------------
// Class path
// ----------------------------------------------------------------------
public void addClasspathEntry( String classpathEntry )
{
classpathEntries.add( classpathEntry );
}
public void setClasspathEntries( List classpathEntries )
{
if ( classpathEntries == null )
{
this.classpathEntries = Collections.emptyList();
}
else
{
this.classpathEntries = new LinkedList( classpathEntries );
}
}
public List getClasspathEntries()
{
return Collections.unmodifiableList( classpathEntries );
}
// ----------------------------------------------------------------------
// Source files
// ----------------------------------------------------------------------
public void setSourceFiles( Set sourceFiles )
{
if ( sourceFiles == null )
{
this.sourceFiles = Collections.emptySet();
}
else
{
this.sourceFiles = new HashSet( sourceFiles );
}
}
public Set getSourceFiles()
{
return sourceFiles;
}
public void addSourceLocation( String sourceLocation )
{
sourceLocations.add( sourceLocation );
}
public void setSourceLocations( List sourceLocations )
{
if ( sourceLocations == null )
{
this.sourceLocations = Collections.emptyList();
}
else
{
this.sourceLocations = new LinkedList( sourceLocations );
}
}
public List getSourceLocations()
{
return Collections.unmodifiableList( sourceLocations );
}
public void addInclude( String include )
{
includes.add( include );
}
public void setIncludes( Set includes )
{
if ( includes == null )
{
this.includes = Collections.emptySet();
}
else
{
this.includes = new HashSet( includes );
}
}
public Set getIncludes()
{
return Collections.unmodifiableSet( includes );
}
public void addExclude( String exclude )
{
excludes.add( exclude );
}
public void setExcludes( Set excludes )
{
if ( excludes == null )
{
this.excludes = Collections.emptySet();
}
else
{
this.excludes = new HashSet( excludes );
}
}
public Set getExcludes()
{
return Collections.unmodifiableSet( excludes );
}
// ----------------------------------------------------------------------
// Compiler Settings
// ----------------------------------------------------------------------
public void setDebug( boolean debug )
{
this.debug = debug;
}
public boolean isDebug()
{
return debug;
}
public void setDebugLevel( String debugLevel )
{
this.debugLevel = debugLevel;
}
public String getDebugLevel()
{
return debugLevel;
}
public void setShowWarnings( boolean showWarnings )
{
this.showWarnings = showWarnings;
}
public boolean isShowWarnings()
{
return showWarnings;
}
public boolean isShowDeprecation()
{
return showDeprecation;
}
public void setShowDeprecation( boolean showDeprecation )
{
this.showDeprecation = showDeprecation;
}
public String getSourceVersion()
{
return sourceVersion;
}
public void setSourceVersion( String sourceVersion )
{
this.sourceVersion = sourceVersion;
}
public String getTargetVersion()
{
return targetVersion;
}
public void setTargetVersion( String targetVersion )
{
this.targetVersion = targetVersion;
}
public String getSourceEncoding()
{
return sourceEncoding;
}
public void setSourceEncoding( String sourceEncoding )
{
this.sourceEncoding = sourceEncoding;
}
public void addCompilerCustomArgument( String customArgument, String value )
{
customCompilerArguments.put( customArgument, value );
}
/**
* @deprecated will be removed in 2.X use #getCustomCompilerArgumentsAsMap
* @return
*/
public LinkedHashMap getCustomCompilerArguments()
{
return new LinkedHashMap( customCompilerArguments );
}
/**
* @deprecated will be removed in 2.X use #setCustomCompilerArgumentsAsMap
* @param customCompilerArguments
*/
public void setCustomCompilerArguments( LinkedHashMap customCompilerArguments )
{
if ( customCompilerArguments == null )
{
this.customCompilerArguments = new LinkedHashMap();
}
else
{
this.customCompilerArguments = customCompilerArguments;
}
}
public Map getCustomCompilerArgumentsAsMap()
{
return new LinkedHashMap( customCompilerArguments );
}
public void setCustomCompilerArgumentsAsMap( Map customCompilerArguments )
{
if ( customCompilerArguments == null )
{
this.customCompilerArguments = new LinkedHashMap();
}
else
{
this.customCompilerArguments = customCompilerArguments;
}
}
public boolean isFork()
{
return fork;
}
public void setFork( boolean fork )
{
this.fork = fork;
}
public String getMeminitial()
{
return meminitial;
}
public void setMeminitial( String meminitial )
{
this.meminitial = meminitial;
}
public String getMaxmem()
{
return maxmem;
}
public void setMaxmem( String maxmem )
{
this.maxmem = maxmem;
}
public String getExecutable()
{
return executable;
}
public void setExecutable( String executable )
{
this.executable = executable;
}
public File getWorkingDirectory()
{
return workingDirectory;
}
public void setWorkingDirectory( File workingDirectory )
{
this.workingDirectory = workingDirectory;
}
public File getBuildDirectory()
{
return buildDirectory;
}
public void setBuildDirectory( File buildDirectory )
{
this.buildDirectory = buildDirectory;
}
public String getOutputFileName()
{
return outputFileName;
}
public void setOutputFileName( String outputFileName )
{
this.outputFileName = outputFileName;
}
public boolean isOptimize()
{
return optimize;
}
public void setOptimize( boolean optimize )
{
this.optimize = optimize;
}
public String getCompilerVersion()
{
return compilerVersion;
}
public void setCompilerVersion( String compilerVersion )
{
this.compilerVersion = compilerVersion;
}
public boolean isVerbose()
{
return verbose;
}
public void setVerbose( boolean verbose )
{
this.verbose = verbose;
}
public void setProc( String proc )
{
this.proc = proc;
}
public void setGeneratedSourcesDirectory( File generatedSourcesDirectory )
{
this.generatedSourcesDirectory = generatedSourcesDirectory;
}
public File getGeneratedSourcesDirectory()
{
return generatedSourcesDirectory;
}
public String getProc()
{
return proc;
}
public void setAnnotationProcessors( String[] annotationProcessors )
{
this.annotationProcessors = annotationProcessors;
}
public String[] getAnnotationProcessors()
{
return annotationProcessors;
}
public CompilerReuseStrategy getCompilerReuseStrategy()
{
return compilerReuseStrategy;
}
public void setCompilerReuseStrategy( CompilerReuseStrategy compilerReuseStrategy )
{
this.compilerReuseStrategy = compilerReuseStrategy;
}
/**
* re use strategy of the compiler (implement for java only)
*/
public enum CompilerReuseStrategy
{
/**
* always reuse the same
* default strategy
*/
ReuseSame( "reuseSame" ),
/**
* re create a new compiler for each use
*/
AlwaysNew( "alwaysNew" ),
/**
* re use already created compiler, create new one if non already exists
* Will mimic a kind of pool to prevent different threads use the same
*/
ReuseCreated( "reuseCreated" );
private String strategy;
CompilerReuseStrategy( String strategy )
{
this.strategy = strategy;
}
public String getStrategy()
{
return strategy;
}
@Override
public String toString()
{
return "CompilerReuseStrategy:" + this.strategy;
}
}
}
CompilerError.java 0000664 0000000 0000000 00000014340 12022156743 0037424 0 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler package org.codehaus.plexus.compiler;
/**
* The MIT License
*
* Copyright (c) 2005, The Codehaus
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This class encapsulates an error message produced by a programming language
* processor (whether interpreted or compiled)
* @author Stefano Mazzocchi
* @version $Id$
* @since 2.0
*/
public class CompilerError
{
/**
* Is this a severe error or a warning?
*/
private boolean error;
/**
* The start line number of the offending program text
*/
private int startline;
/**
* The start column number of the offending program text
*/
private int startcolumn;
/**
* The end line number of the offending program text
*/
private int endline;
/**
* The end column number of the offending program text
*/
private int endcolumn;
/**
* The name of the file containing the offending program text
*/
private String file;
/**
* The actual error text produced by the language processor
*/
private String message;
/**
* The error message constructor.
*
* @param file The name of the file containing the offending program text
* @param error Is this a severe error or a warning?
* @param startline The start line number of the offending program text
* @param startcolumn The start column number of the offending program text
* @param endline The end line number of the offending program text
* @param endcolumn The end column number of the offending program text
* @param message The actual error text produced by the language processor
*/
public CompilerError( String file,
boolean error,
int startline,
int startcolumn,
int endline,
int endcolumn,
String message )
{
this.file = file;
this.error = error;
this.startline = startline;
this.startcolumn = startcolumn;
this.endline = endline;
this.endcolumn = endcolumn;
this.message = message;
}
/**
* The warning message constructor.
*
* @param message The actual error text produced by the language processor
*/
public CompilerError( String message )
{
this.message = message;
}
/**
* The error message constructor.
*
* @param message The actual error text produced by the language processor
* @param error whether it was an error or informational
*/
public CompilerError( String message, boolean error )
{
this.message = message;
this.error = error;
}
/**
* Return the filename associated with this compiler error.
*
* @return The filename associated with this compiler error
*/
public String getFile()
{
return file;
}
/**
* Assert whether this is a severe error or a warning
*
* @return Whether the error is severe
*/
public boolean isError()
{
return error;
}
/**
* Return the starting line number of the program text originating this error
*
* @return The starting line number of the program text originating this error
*/
public int getStartLine()
{
return startline;
}
/**
* Return the starting column number of the program text originating this
* error
*
* @return The starting column number of the program text originating this
* error
*/
public int getStartColumn()
{
return startcolumn;
}
/**
* Return the ending line number of the program text originating this error
*
* @return The ending line number of the program text originating this error
*/
public int getEndLine()
{
return endline;
}
/**
* Return the ending column number of the program text originating this
* error
*
* @return The ending column number of the program text originating this
* error
*/
public int getEndColumn()
{
return endcolumn;
}
/**
* Return the message produced by the language processor
*
* @return The message produced by the language processor
*/
public String getMessage()
{
return message;
}
public String toString()
{
if ( file != null )
{
return file + ":" + "[" + startline + "," + startcolumn + "] " + message;
}
else
{
return message;
}
}
}
CompilerException.java 0000664 0000000 0000000 00000002772 12022156743 0040277 0 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler package org.codehaus.plexus.compiler;
/**
* The MIT License
*
* Copyright (c) 2004, The Codehaus
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* @author Trygve Laugstøl
* @version $Id$
*/
public class CompilerException
extends Exception
{
public CompilerException( String message )
{
super( message );
}
public CompilerException( String message, Throwable cause )
{
super( message, cause );
}
}
CompilerOutputStyle.java 0000664 0000000 0000000 00000004522 12022156743 0040655 0 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler package org.codehaus.plexus.compiler;
/**
* The MIT License
*
* Copyright (c) 2004, The Codehaus
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* @author Trygve Laugstøl
* @version $Id$
*/
public final class CompilerOutputStyle
{
public final static CompilerOutputStyle ONE_OUTPUT_FILE_PER_INPUT_FILE = new CompilerOutputStyle( "one-output-file-per-input-file" );
public final static CompilerOutputStyle ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES = new CompilerOutputStyle( "one-output-file" );
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
private String id;
private CompilerOutputStyle( String id )
{
this.id = id;
}
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
public String toString()
{
return id;
}
public boolean equals( Object other )
{
if ( other == null || !(other instanceof CompilerOutputStyle) )
{
return false;
}
return id.equals( ((CompilerOutputStyle)other ).id );
}
public int hashCode()
{
return id.hashCode();
}
}
0000775 0000000 0000000 00000000000 12022156743 0034750 5 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util StreamPumper.java 0000664 0000000 0000000 00000004657 12022156743 0040253 0 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util package org.codehaus.plexus.compiler.util;
/**
* The MIT License
*
* Copyright (c) 2005, The Codehaus
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* @author Jason van Zyl
* @version $Id$
*/
public class StreamPumper
extends Thread
{
private static final int BUFFER_SIZE = 512;
private BufferedInputStream stream;
private boolean endOfStream = false;
private int SLEEP_TIME = 5;
private OutputStream out;
public StreamPumper( BufferedInputStream is, OutputStream out )
{
this.stream = is;
this.out = out;
}
public void pumpStream()
throws IOException
{
byte[] buf = new byte[BUFFER_SIZE];
if ( !endOfStream )
{
int bytesRead = stream.read( buf, 0, BUFFER_SIZE );
if ( bytesRead > 0 )
{
out.write( buf, 0, bytesRead );
}
else if ( bytesRead == -1 )
{
endOfStream = true;
}
}
}
public void run()
{
try
{
while ( !endOfStream )
{
pumpStream();
sleep( SLEEP_TIME );
}
}
catch ( Exception e )
{
// getLogger().warn("Jikes.run()", e);
}
}
}
0000775 0000000 0000000 00000000000 12022156743 0035674 5 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan AbstractSourceInclusionScanner.java 0000664 0000000 0000000 00000004407 12022156743 0044666 0 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan package org.codehaus.plexus.compiler.util.scan;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping;
import org.codehaus.plexus.util.DirectoryScanner;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
/**
* @author jdcasey
* @version $Id$
*/
public abstract class AbstractSourceInclusionScanner
implements SourceInclusionScanner
{
private final List sourceMappings = new ArrayList();
public final void addSourceMapping( SourceMapping sourceMapping )
{
sourceMappings.add( sourceMapping );
}
protected final List getSourceMappings()
{
return Collections.unmodifiableList( sourceMappings );
}
protected String[] scanForSources( File sourceDir, Set sourceIncludes, Set sourceExcludes )
{
DirectoryScanner ds = new DirectoryScanner();
ds.setFollowSymlinks( true );
ds.setBasedir( sourceDir );
String[] includes;
if ( sourceIncludes.isEmpty() )
{
includes = new String[0];
}
else
{
includes = sourceIncludes.toArray( new String[sourceIncludes.size()] );
}
ds.setIncludes( includes );
String[] excludes;
if ( sourceExcludes.isEmpty() )
{
excludes = new String[0];
}
else
{
excludes = sourceExcludes.toArray( new String[sourceExcludes.size()] );
}
ds.setExcludes( excludes );
ds.addDefaultExcludes();
ds.scan();
return ds.getIncludedFiles();
}
}
InclusionScanException.java 0000664 0000000 0000000 00000001726 12022156743 0043174 0 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan package org.codehaus.plexus.compiler.util.scan;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author jdcasey
* @version $Id$
*/
public class InclusionScanException
extends Exception
{
public InclusionScanException( String message )
{
super( message );
}
public InclusionScanException( String message, Throwable cause )
{
super( message, cause );
}
}
SimpleSourceInclusionScanner.java 0000664 0000000 0000000 00000005073 12022156743 0044354 0 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan package org.codehaus.plexus.compiler.util.scan;
/**
* The MIT License
*
* Copyright (c) 2005, The Codehaus
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping;
import java.io.File;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @author Trygve Laugstøl
* @version $Id$
*/
public class SimpleSourceInclusionScanner
extends AbstractSourceInclusionScanner
{
private Set sourceIncludes;
private Set sourceExcludes;
public SimpleSourceInclusionScanner( Set sourceIncludes, Set sourceExcludes )
{
this.sourceIncludes = sourceIncludes;
this.sourceExcludes = sourceExcludes;
}
public Set getIncludedSources( File sourceDir, File targetDir )
throws InclusionScanException
{
List srcMappings = getSourceMappings();
if ( srcMappings.isEmpty() )
{
return Collections.emptySet();
}
String[] potentialSources = scanForSources( sourceDir, sourceIncludes, sourceExcludes );
Set matchingSources = new HashSet( potentialSources != null ? potentialSources.length : 0 );
if ( potentialSources != null )
{
for ( String potentialSource : potentialSources )
{
matchingSources.add( new File( sourceDir, potentialSource ) );
}
}
return matchingSources;
}
}
SourceInclusionScanner.java 0000664 0000000 0000000 00000002256 12022156743 0043202 0 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan package org.codehaus.plexus.compiler.util.scan;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping;
import java.io.File;
import java.util.Set;
/**
* @author jdcasey
* @version $Id$
*/
public interface SourceInclusionScanner
{
void addSourceMapping( SourceMapping sourceMapping );
/**
*
* @param sourceDir
* @param targetDir
* @return Set
of File
objects
* @throws InclusionScanException
*/
Set getIncludedSources( File sourceDir, File targetDir )
throws InclusionScanException;
}
StaleSourceScanner.java 0000664 0000000 0000000 00000006707 12022156743 0042314 0 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan package org.codehaus.plexus.compiler.util.scan;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping;
import java.io.File;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @author jdcasey
* @version $Id$
*/
public class StaleSourceScanner
extends AbstractSourceInclusionScanner
{
private final long lastUpdatedWithinMsecs;
private final Set sourceIncludes;
private final Set sourceExcludes;
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
public StaleSourceScanner()
{
this( 0, Collections.singleton( "**/*" ), Collections.emptySet() );
}
public StaleSourceScanner( long lastUpdatedWithinMsecs )
{
this( lastUpdatedWithinMsecs, Collections.singleton( "**/*" ), Collections.emptySet() );
}
public StaleSourceScanner( long lastUpdatedWithinMsecs, Set sourceIncludes, Set sourceExcludes )
{
this.lastUpdatedWithinMsecs = lastUpdatedWithinMsecs;
this.sourceIncludes = sourceIncludes;
this.sourceExcludes = sourceExcludes;
}
// ----------------------------------------------------------------------
// SourceInclusionScanner Implementation
// ----------------------------------------------------------------------
public Set getIncludedSources( File sourceDir, File targetDir )
throws InclusionScanException
{
List srcMappings = getSourceMappings();
if ( srcMappings.isEmpty() )
{
return Collections.emptySet();
}
String[] potentialIncludes = scanForSources( sourceDir, sourceIncludes, sourceExcludes );
Set matchingSources = new HashSet();
for ( String path : potentialIncludes )
{
File sourceFile = new File( sourceDir, path );
staleSourceFileTesting:
for ( SourceMapping mapping : srcMappings )
{
Set targetFiles = mapping.getTargetFiles( targetDir, path );
// never include files that don't have corresponding target mappings.
// the targets don't have to exist on the filesystem, but the
// mappers must tell us to look for them.
for ( File targetFile : targetFiles )
{
if ( !targetFile.exists()
|| ( targetFile.lastModified() + lastUpdatedWithinMsecs < sourceFile.lastModified() ) )
{
matchingSources.add( sourceFile );
break staleSourceFileTesting;
}
}
}
}
return matchingSources;
}
}
0000775 0000000 0000000 00000000000 12022156743 0037327 5 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/mapping SingleTargetSourceMapping.java 0000664 0000000 0000000 00000004103 12022156743 0045255 0 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/mapping package org.codehaus.plexus.compiler.util.scan.mapping;
/**
* The MIT License
*
* Copyright (c) 2005, The Codehaus
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
import java.util.Set;
import java.util.Collections;
import java.io.File;
/**
* Maps a set of input files to a single output file.
*
* @author Trygve Laugstøl
* @version $Id$
*/
public class SingleTargetSourceMapping
implements SourceMapping
{
private String sourceSuffix;
private String outputFile;
public SingleTargetSourceMapping( String sourceSuffix, String outputFile )
{
this.sourceSuffix = sourceSuffix;
this.outputFile = outputFile;
}
public Set getTargetFiles( File targetDir, String source )
throws InclusionScanException
{
if ( !source.endsWith( sourceSuffix ) )
{
return Collections.emptySet();
}
return Collections.singleton( new File( targetDir, outputFile ) );
}
}
SourceMapping.java 0000664 0000000 0000000 00000001716 12022156743 0042753 0 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/mapping package org.codehaus.plexus.compiler.util.scan.mapping;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
import java.io.File;
import java.util.Set;
/**
* @author jdcasey
* @version $Id$
*/
public interface SourceMapping
{
Set getTargetFiles( File targetDir, String source )
throws InclusionScanException;
}
SuffixMapping.java 0000664 0000000 0000000 00000003475 12022156743 0042763 0 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/mapping package org.codehaus.plexus.compiler.util.scan.mapping;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.File;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/**
* @author jdcasey
* @version $Id$
*/
public final class SuffixMapping
implements SourceMapping
{
private final String sourceSuffix;
private final Set targetSuffixes;
public SuffixMapping( String sourceSuffix, String targetSuffix )
{
this.sourceSuffix = sourceSuffix;
this.targetSuffixes = Collections.singleton( targetSuffix );
}
public SuffixMapping( String sourceSuffix, Set targetSuffixes )
{
this.sourceSuffix = sourceSuffix;
this.targetSuffixes = Collections.unmodifiableSet( targetSuffixes );
}
public Set getTargetFiles( File targetDir, String source )
{
Set targetFiles = new HashSet();
if ( source.endsWith( sourceSuffix ) )
{
String base = source.substring( 0, source.length() - sourceSuffix.length() );
for ( String suffix : targetSuffixes )
{
targetFiles.add( new File( targetDir, base + suffix ) );
}
}
return targetFiles;
}
}
plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/site/ 0000775 0000000 0000000 00000000000 12022156743 0025435 5 ustar 00root root 0000000 0000000 plexus-compiler-plexus-compiler-1.9.2/plexus-compiler-api/src/site/site.xml 0000664 0000000 0000000 00000001126 12022156743 0027123 0 ustar 00root root 0000000 0000000