String scope = artifact.getScope();
if ( type.equals( ArtifactType.MODULE.getPackagingType() ) )
{
if ( !ArtifactScope.COMPILE.isMatchByString( scope ) )
{
throw new InitializationException( "Module must be of compile scope: Scope = " + scope );
}
moduleDependencies.add( artifact );
}
}
}
addLibraryArtifactsToTarget( project.getCompileArtifacts(), compileLibraryDependencies );
addLibraryArtifactsToTarget( project.getTestArtifacts(), testLibraryDependencies );
addLibraryArtifactsToTarget( project.getRuntimeArtifacts(), runtimeLibraryDependencies );
Enumeration<URL> resources =
this.getClass().getClassLoader().getResources( "/META-INF/nmaven/annotation-resources.txt" );
while ( resources.hasMoreElements() )
{
URL url = resources.nextElement();
BufferedReader reader = new BufferedReader( new InputStreamReader( url.openStream() ) );
String annotatedClass;
while ( ( annotatedClass = reader.readLine() ) != null )
{
String className = null;
try
{
Class c = Class.forName( annotatedClass );
className = c.getName();
CompilerAnnotation annotation = (CompilerAnnotation) c.getAnnotation( CompilerAnnotation.class );
if ( annotation != null && isMatchBetween( (DotnetCompilerConfig) compilerConfig, annotation ) )
{
classCompiler = (ClassCompiler) c.newInstance();
classCompiler.init( this );
}
}
catch ( ClassNotFoundException e )
{
throw new InitializationException(
"NMAVEN-061-007: Unable to create NetCompiler: Class Name = " + className, e );
}
catch ( InstantiationException e )
{
throw new InitializationException(
"NMAVEN-061-005: Unable to create NetCompiler: Class Name = " + className, e );
}
catch ( IllegalAccessException e )
{
throw new InitializationException(
"NMAVEN-061-006: Unable to create NetCompiler: Class Name = " + className, e );
}
}
}
if ( classCompiler == null && compilerExistsCheck )
{
throw new InitializationException( "Could not find compiler" );
}
String basedir =
project.getBuild().getDirectory() + File.separator + BuildDirectories.ASSEMBLY_RESOURCES + File.separator;
linkedResources = new File( basedir, "linkresource" ).exists() ? new HashSet<File>(
Arrays.asList( new File( basedir, "linkresource" ).listFiles() ) ) : new HashSet<File>();
embeddedResources = new File( basedir, "resource" ).exists() ? new HashSet<File>(
Arrays.asList( new File( basedir, "resource" ).listFiles() ) ) : new HashSet<File>();
win32resources = new File( basedir, "win32res" ).exists() ? new HashSet<File>(
Arrays.asList( new File( basedir, "win32res" ).listFiles() ) ) : new HashSet<File>();
File win32IconDir = new File( basedir, "win32icon" );
if ( win32IconDir.exists() )
{
File[] icons = win32IconDir.listFiles();
if ( icons.length > 1 )
{
throw new InitializationException(
"NMAVEN-061-002: There is more than one win32icon in resource directory: Number = " + icons
.length );
}
if ( icons.length == 1 )
{