incubator-npanday-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfall...@apache.org
Subject svn commit: r1142146 - /incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DefaultCompiler.java
Date Sat, 02 Jul 2011 02:41:21 GMT
Author: jfallows
Date: Sat Jul  2 02:41:21 2011
New Revision: 1142146

URL: http://svn.apache.org/viewvc?rev=1142146&view=rev
Log:
Fix for NPANDAY-449 making Visual Studio build tasks optional rather than required references
during compilation

Modified:
    incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DefaultCompiler.java

Modified: incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DefaultCompiler.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DefaultCompiler.java?rev=1142146&r1=1142145&r2=1142146&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DefaultCompiler.java
(original)
+++ incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DefaultCompiler.java
Sat Jul  2 02:41:21 2011
@@ -23,6 +23,7 @@ import org.codehaus.plexus.util.FileUtil
 
 import java.util.Date;
 import java.util.List;
+import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.io.File;
@@ -178,12 +179,18 @@ public final class DefaultCompiler
         if ( compilerContext.getCompilerRequirement().getVendor().equals( Vendor.MICROSOFT
) &&
             compilerContext.getCompilerRequirement().getFrameworkVersion().equals( "4.0"
) )
         {
-            String wcfRef = "/reference:" + System.getenv( "SystemRoot" ) +
-                "\\Microsoft.NET\\Framework\\v4.0.30319\\";
+            String frameworkPath = System.getenv( "SystemRoot" ) + "\\Microsoft.NET\\Framework\\v4.0.30319\\";
             //TODO: This is a hard-coded path: Don't have a registry value either.
-            commands.add( wcfRef + "Microsoft.Build.Tasks.v4.0.dll" );
-            commands.add( wcfRef + "Microsoft.Data.Entity.Build.Tasks.dll" );
-            commands.add( wcfRef + "Microsoft.VisualC.STLCLR.dll" );
+            List<String> libraryNames = Arrays.asList("Microsoft.Build.Tasks.v4.0.dll",

+                "Microsoft.Data.Entity.Build.Tasks.dll", "Microsoft.VisualC.STLCLR.dll");
+            for (String libraryName : libraryNames) 
+            {
+                String libraryFullName = frameworkPath + libraryName;
+                if (new File( libraryFullName ).exists())
+                {
+                    commands.add( "/reference:" + libraryFullName );
+                }
+            }
         } 
         if ( compilerContext.getKeyInfo().getKeyFileUri() != null )
         {



Mime
View raw message