Author: jdcasey Date: Mon Oct 31 17:25:19 2005 New Revision: 329948 URL: http://svn.apache.org/viewcvs?rev=329948&view=rev Log: PR: MNG-897
Fixing abstract scripted mojo descriptor extractor to properly construct script resource directories. Also, cleaned up the usage integration test. Ant support works now, but we need to decide what version this should be released under. It will involve re-releasing the plugin-plugin, to take advantage of the new maven-plugin-tools-api, I think. Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/integration-tests/simpleUsage/plugin/pom.xml maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/integration-tests/simpleUsage/usage/pom.xml maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor/AbstractScriptedMojoDescriptorExtractor.java Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/integration-tests/simpleUsage/plugin/pom.xml URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/integration-tests/simpleUsage/plugin/pom.xml?rev=329948&r1=329947&r2=329948&view=diff ============================================================================== --- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/integration-tests/simpleUsage/plugin/pom.xml (original) +++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/integration-tests/simpleUsage/plugin/pom.xml Mon Oct 31 17:25:19 2005 @@ -25,6 +25,7 @@ </dependencies> <build> + <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory> <plugins> <plugin> <artifactId>maven-plugin-plugin</artifactId> Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/integration-tests/simpleUsage/usage/pom.xml URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/integration-tests/simpleUsage/usage/pom.xml?rev=329948&r1=329947&r2=329948&view=diff ============================================================================== --- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/integration-tests/simpleUsage/usage/pom.xml (original) +++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/integration-tests/simpleUsage/usage/pom.xml Mon Oct 31 17:25:19 2005 @@ -32,14 +32,14 @@ </dependency> </dependencies> - <!-- configuration> + <configuration> <name>Hani</name> - </configuration --> + </configuration> <executions> <execution> <id>test</id> - <phase>install</phase> + <phase>package</phase> <goals> <goal>test</goal> </goals> Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor/AbstractScriptedMojoDescriptorExtractor.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor/AbstractScriptedMojoDescriptorExtractor.java?rev=329948&r1=329947&r2=329948&view=diff ============================================================================== --- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor/AbstractScriptedMojoDescriptorExtractor.java (original) +++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor/AbstractScriptedMojoDescriptorExtractor.java Mon Oct 31 17:25:19 2005 @@ -31,13 +31,13 @@ String scriptExtension = getScriptFileExtension(); Map scriptFilesKeyedByBasedir = - gatherFilesByBasedir( project.getScriptSourceRoots(), scriptExtension ); - + gatherFilesByBasedir( project.getBasedir(), project.getScriptSourceRoots(), scriptExtension ); + List mojoDescriptors; if ( !StringUtils.isEmpty( metadataExtension ) ) { Map metadataFilesKeyedByBasedir = - gatherFilesByBasedir( project.getScriptSourceRoots(), metadataExtension ); + gatherFilesByBasedir( project.getBasedir(), project.getScriptSourceRoots(), metadataExtension ); mojoDescriptors = extractMojoDescriptorsFromMetadata( metadataFilesKeyedByBasedir, pluginDescriptor ); } @@ -100,7 +100,7 @@ } } - protected Map gatherFilesByBasedir( List directories, String scriptFileExtension ) + protected Map gatherFilesByBasedir( File basedir, List directories, String scriptFileExtension ) { Map sourcesByBasedir = new TreeMap(); @@ -109,7 +109,8 @@ Set sources = new HashSet(); String resourceDir = (String) it.next(); - File dir = new File( resourceDir ).getAbsoluteFile(); + + File dir = new File( basedir, resourceDir ).getAbsoluteFile(); resourceDir = dir.getPath(); @@ -119,6 +120,7 @@ scanner.setBasedir( dir ); scanner.addDefaultExcludes(); + scanner.setIncludes( new String[] { "**/*" + scriptFileExtension } ); scanner.scan(); String[] relativePaths = scanner.getIncludedFiles();