brett 2003/12/09 15:41:16
Modified: src/java/org/apache/maven/plugin Tag: MAVEN-1_0-BRANCH
PluginManager.java
Log:
attain each main goal in its own werkz project
Revision Changes Path
No revision
No revision
1.70.4.5 +19 -21 maven/src/java/org/apache/maven/plugin/PluginManager.java
Index: PluginManager.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/plugin/PluginManager.java,v
retrieving revision 1.70.4.4
retrieving revision 1.70.4.5
diff -u -r1.70.4.4 -r1.70.4.5
--- PluginManager.java 7 Dec 2003 13:34:44 -0000 1.70.4.4
+++ PluginManager.java 9 Dec 2003 23:41:16 -0000 1.70.4.5
@@ -327,10 +327,10 @@
if ( plugin.hasScript() )
{
- JellyScriptHousing jellyScriptHousing = createJellyScriptHousing(
plugin );
+ JellyScriptHousing housing = createJellyScriptHousing( plugin );
// Store the plugin housing for future use.
- mapper.parse( new FileInputStream( plugin.getScriptFile() ),
jellyScriptHousing );
+ mapper.parse( new FileInputStream( plugin.getScriptFile() ), housing );
}
}
@@ -572,6 +572,7 @@
driver = getClass().getResourceAsStream( "/driver.jelly" );
transientMapper.parse( driver, driverHousing );
driver.close();
+ // TODO [RC2] remove - otherwise it gets run twice
runJellyScriptHousing( driverHousing, baseContext );
Project p = project;
@@ -579,11 +580,12 @@
// Project's Jelly script
while ( p != null && p.hasMavenXml() )
{
- File mavenXml = project.getMavenXml();
+ File mavenXml = p.getMavenXml();
- JellyScriptHousing jellyScriptHousing = createJellyScriptHousing(
project, null, mavenXml );
+ JellyScriptHousing jellyScriptHousing = createJellyScriptHousing( p,
null, mavenXml );
// TODO [RC2] stop reading all scripts 2 times
transientMapper.parse( new FileInputStream( mavenXml ),
jellyScriptHousing );
+ // TODO [RC2] remove - otherwise it gets run twice
runJellyScriptHousing( jellyScriptHousing, baseContext );
p = p.getParent();
@@ -607,6 +609,12 @@
{
String goalName = (String) i.next();
+ WerkzProject attainWerkzProject = buildWerkzProject( baseContext );
+ for ( Iterator j = werkzProject.getGoals().iterator(); j.hasNext(); ) {
+ Goal goal = ( Goal ) j.next();
+ attainWerkzProject.addGoal( goal );
+ }
+
// Now at this point we should be able to use the name of a goal to
lookup all
// the plugins (that are stored in the plugin housings) that need to be
executed
// in order to satisfy all the required preconditions for successful
goal attainment.
@@ -616,11 +624,6 @@
for ( Iterator j = plugins.iterator(); j.hasNext(); )
{
JellyScriptHousing housing = ( JellyScriptHousing ) j.next();
- // TODO [RC2] - this is crude hack to avoid double processing of
maven.xml.
- // Is this really correct? Should we just add them to the list of
plugins?
- if ( housing.getProject().getContext() == baseContext ) {
- continue;
- }
// FIXME: this is a bit nasty
File pluginDirectory =
housing.getProject().getFile().getParentFile();
@@ -633,12 +636,8 @@
// TODO [RC2]: this is looking messy: refactor
MavenJellyContext pluginContext = new MavenJellyContext(
baseContext );
housing.getProject().setContext( pluginContext );
-// MavenJellyContext pluginContext = new MavenJellyContext(
housing.getProject().getContext() );
pluginContext.setInherit( true );
- // pluginContext.setVariables(
housing.getProject().getContext().getVariables() );
- // pluginContext.setVariables( baseContext.getVariables() );
- // pluginContext.setVariable( "context", pluginContext );
- // pluginContext.setWerkzProject( werkzProject );
+ pluginContext.setVariable( "context", pluginContext );
// TODO [RC2] - integrate into original pluginContext
pluginContext.setVariable( "plugin", housing.getProject() );
@@ -646,11 +645,10 @@
pluginContext.setVariable( "plugin.resources",
new File( pluginDirectory, "plugin-resources" ) );
- // TODO [RC2]: this is where sourcesPresent gets set incorrectly
runJellyScriptHousing( housing, pluginContext );
}
- Goal goal = werkzProject.getGoal( goalName );
+ Goal goal = attainWerkzProject.getGoal( goalName );
if ( goal == null )
{
// TODO [RC2] - how can we even get this far? resolve isn't working
properly
@@ -834,23 +832,23 @@
*/
private void compareContexts( MavenJellyContext ctx1, MavenJellyContext ctx2 )
{
- System.err.println( "======== compare contexts ========" );
+ System.out.println( "======== compare contexts ========" );
for ( Iterator i = ctx1.getVariableNames(); i.hasNext(); )
{
String name = ( String ) i.next();
if ( ctx2.getVariable( name ) == null )
{
- System.err.println( name + " not in ctx2" );
+ System.out.println( name + " not in ctx2" );
}
else
{
if ( !ctx2.getVariable( name ).equals( ctx1.getVariable( name ) ) )
{
- System.err.println( name + " doesn't match: '" +
ctx1.getVariable( name ) + "' vs '" + ctx2.getVariable( name ) + "'" );
+ System.out.println( name + " doesn't match: '" +
ctx1.getVariable( name ) + "' vs '" + ctx2.getVariable( name ) + "'" );
}
}
}
- System.err.println( "======== comparison done ========" );
+ System.out.println( "======== comparison done ========" );
}
public String getGoalDescription( String goalName )
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]