return compilerContext.getCompilerConfig().getVendor().equals( Vendor.MICROSOFT );
}
public List<String> getCommands()
{
DotnetCompilerConfig config = (DotnetCompilerConfig) compilerContext.getCompilerConfig();
Set<Artifact> references;
if ( compilerContext.getCompilerConfig().isTestCompile() )
{
references = compilerContext.getLibraryDependenciesFor( ArtifactScope.TEST );
references.add( compilerContext.getMavenProject().getArtifact() );
}
else
{
references = compilerContext.getLibraryDependenciesFor( ArtifactScope.COMPILE );
}
Set<Artifact> modules = compilerContext.getDirectModuleDependencies();
File sourceDirectory = config.getCompilerDirectory();
String targetArtifactType = config.getArtifactType().getTargetCompileType();
List<String> commands = new ArrayList<String>();
commands.add( "/out:" + compiledArtifact.getAbsolutePath() );
commands.add( "/target:" + targetArtifactType );
commands.add( "/recurse:" + sourceDirectory + File.separator + "**" );
if ( modules != null && !modules.isEmpty() )
{
StringBuffer sb = new StringBuffer();
for ( Iterator i = modules.iterator(); i.hasNext(); )
{
Artifact artifact = (Artifact) i.next();
String path = artifact.getFile().getAbsolutePath();
sb.append( path );
if ( i.hasNext() )
{
sb.append( ";" );
}
}
commands.add( "/addmodule:" + sb.toString() );
}
if ( !references.isEmpty() )
{
for ( Artifact artifact : references )
{
String path = artifact.getFile().getAbsolutePath();
commands.add( "/reference:" + path );
}
}
for ( File file : compilerContext.getEmbeddedResources() )
{
commands.add( "/resource:" + file.getAbsolutePath() );
}
for ( File file : compilerContext.getLinkedResources() )
{
commands.add( "/linkresource:" + file.getAbsolutePath() );
}
for ( File file : compilerContext.getWin32Resources() )
{
commands.add( "/win32res:" + file.getAbsolutePath() );
}
if ( compilerContext.getWin32Icon() != null )
{
commands.add( "/win32icon:" + compilerContext.getWin32Icon().getAbsolutePath() );
}
if ( config.getVendor().equals( Vendor.MICROSOFT ) )
{
commands.add( "/nologo" );
}
if ( config.getVendor().equals( Vendor.MICROSOFT ) &&
config.getCompilerPlatformVersion().equals( DotnetCompilerPlatformVersion.VERSION_3_0 ) )
{
String wcfRef = "/reference:" + System.getenv( "SystemRoot" ) +
"\\Microsoft.NET\\Framework\\v3.0\\Windows Communication Foundation\\";
// TODO: This is a hard-coded path: Don't have a registry value either.
commands.add( wcfRef + "System.ServiceModel.dll" );
commands.add( wcfRef + "Microsoft.Transactions.Bridge.dll" );
commands.add( wcfRef + "Microsoft.Transactions.Bridge.Dtc.dll" );
commands.add( wcfRef + "System.ServiceModel.Install.dll" );
commands.add( wcfRef + "System.ServiceModel.WasHosting.dll" );
commands.add( wcfRef + "System.Runtime.Serialization.dll" );
commands.add( wcfRef + "SMDiagnostics.dll" );
}
if ( config.getKeyInfo() != null )
{
if ( config.getKeyInfo().getKeyFileUri() != null )
{
commands.add( "/keyfile:" + new File( config.getKeyInfo().getKeyFileUri() ).getAbsolutePath() );
}
else if ( config.getKeyInfo().getKeyContainerName() != null )
{
commands.add( "/keycontainer:" + config.getKeyInfo().getKeyContainerName() );
}
}
/*
* if ( config.getCommands() != null ) { commands.addAll( config.getCommands() ); }
*/
commands.add( "/warnaserror-" );
if ( config.getVendor().equals( Vendor.NOVELL ) )
{
commands.add( "/reference:System.Drawing" );
commands.add( "/reference:System.Windows.Forms" );
commands.add( "/reference:System.Web.Services" );
}
if ( !config.isTestCompile() )
{
commands.add( "/doc:" + new File( config.getTargetDirectory(), "comments.xml" ).getAbsolutePath() );
}
return commands;
}