You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-commits@incubator.apache.org by br...@apache.org on 2014/02/27 05:29:45 UTC
svn commit: r1572435 -
/incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java
Author: brett
Date: Thu Feb 27 05:29:45 2014
New Revision: 1572435
URL: http://svn.apache.org/r1572435
Log:
[NPANDAY-609] add generated sources for XAML
Note that any includeSources listed for obj are now ignored, and that
these are picked up automatically, in contrast to previous behaviour.
Modified:
incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java
Modified: incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java?rev=1572435&r1=1572434&r2=1572435&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java (original)
+++ incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java Thu Feb 27 05:29:45 2014
@@ -37,6 +37,7 @@ import org.apache.maven.plugin.MojoExecu
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
+import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.FileUtils;
/**
@@ -278,6 +279,31 @@ public class MsbuildMojo
resource.addInclude( "**/*.resources" );
project.addResource( resource );
+ // Pick up generated source patterns to compile
+ DirectoryScanner scanner = new DirectoryScanner();
+ scanner.setBasedir( directory );
+ scanner.setIncludes(new String[] { "**/*.g.cs", "**/*.g.vb" });
+ scanner.scan();
+
+ String[] files = scanner.getIncludedFiles();
+ if ( files != null && files.length > 0 )
+ {
+ getLog().info( "Adding sources from " + directory + " generated by MSBuild" );
+ File generatedSourcesDirectory = new File( project.getBuild().getDirectory(), "generated-sources/msbuild" );
+ for ( String f : files )
+ {
+ File src = new File( directory, f );
+ File dest = new File( generatedSourcesDirectory, f );
+ dest.getParentFile().mkdirs();
+ try {
+ FileUtils.copyFile( src, dest );
+ } catch (IOException e) {
+ throw new MojoExecutionException("Unable to copy source file: " + e.getLocalizedMessage(), e);
+ }
+ }
+ project.addCompileSourceRoot( generatedSourcesDirectory.getAbsolutePath() );
+ }
+
if (attachXBAP) {
projectHelper.attachArtifact(project, "xbap", new File(directory, project.getArtifactId() + ".xbap"));
File manifest = new File(directory, project.getArtifactId() + ".exe.manifest");