dion 2003/08/18 21:25:40
Modified: src/java/org/apache/maven/jelly/tags/maven PomTag.java
ConcatTag.java ReactorTag.java
SnapshotSignature.java AddPathTag.java
MavenTagLibrary.java WerkzDependencyResolver.java
CopyResources.java MavenTag.java
Added: src/java/org/apache/maven/jelly/tags/maven
MakeRelativePathTag.java MakeAbsolutePathTag.java
Removed: src/java/org/apache/maven/jelly/tags/maven
PluginPropertyTag.java Exists.java DisplayTag.java
Log:
Switch stable branch back to HEAD
Revision Changes Path
1.14 +6 -2 maven/src/java/org/apache/maven/jelly/tags/maven/PomTag.java
Index: PomTag.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/PomTag.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- PomTag.java 31 Jul 2003 05:27:58 -0000 1.13
+++ PomTag.java 19 Aug 2003 04:25:39 -0000 1.14
@@ -61,6 +61,7 @@
import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.XMLOutput;
+import org.apache.maven.MavenUtils;
import org.apache.maven.jelly.tags.BaseTagSupport;
/**
@@ -114,7 +115,10 @@
try
{
- context.setVariable( var, getMaven().getProject( projectDescriptor,
false ) );
+ context.setVariable( var,
+ MavenUtils.getProject( projectDescriptor,
+ getMavenContext(),
+ false ) );
}
catch ( Exception e )
{
1.10 +1 -1 maven/src/java/org/apache/maven/jelly/tags/maven/ConcatTag.java
Index: ConcatTag.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/ConcatTag.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
1.35 +30 -27 maven/src/java/org/apache/maven/jelly/tags/maven/ReactorTag.java
Index: ReactorTag.java
===================================================================
RCS file:
/home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/ReactorTag.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- ReactorTag.java 31 Jul 2003 05:27:58 -0000 1.34
+++ ReactorTag.java 19 Aug 2003 04:25:39 -0000 1.35
@@ -59,6 +59,7 @@
import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.XMLOutput;
+import org.apache.maven.MavenUtils;
import org.apache.maven.project.Project;
import java.io.File;
@@ -304,7 +305,10 @@
List projects = null;
try
{
- projects = getMaven().getProjects( getBasedir(), projectIncludes,
getExcludes() );
+ projects = MavenUtils.getProjects( getBasedir(),
+ projectIncludes,
+ getExcludes(),
+
getMavenContext().getMavenSession().getRootContext() );
}
catch ( Exception anException )
{
@@ -321,7 +325,7 @@
}
catch ( Exception anException )
{
- onDependencyResolutionException( anException );
+ onDependencyResolutionException(anException);
throw new JellyTagException( anException );
}
// null out references, as this is a long running method potentially
@@ -343,43 +347,42 @@
// We just need the descriptor.
Project project = (Project) i.next();
- beforeProject( project );
+ beforeProject(project);
try
{
final long MEG = 1024 * 1024;
System.out.println( "+----------------------------------------" );
System.out.println( "| " + getBanner() + " " + project.getName() );
- System.out.println( "| Memory: " + ( ( r.totalMemory() -
r.freeMemory() ) / MEG ) + "M/" + ( r.totalMemory() / MEG ) + "M" );
+ System.out.println( "| Memory: " + ((r.totalMemory() -
r.freeMemory()) / MEG) + "M/" + (r.totalMemory() / MEG) + "M");
System.out.println( "+----------------------------------------" );
- /*
// If an additional Jelly script has been specified load it as well.
if ( getReactorXml() != null )
{
- getMaven().getPluginManager().loadJellyScript( getReactorXml(),
project, getMavenContext() );
+ project.loadJellyScript( getReactorXml() );
}
- */
// We only try to attain goals if they have been set. The reactor
// might be in use to collect project information for the purpose
// of, say, generating a sites from a set of components.
if ( getGoals() != null )
{
- beforeLaunchGoals( project );
- getMaven().attainGoals( project, getGoals() );
- afterLaunchGoals( project );
+ project.setGoalNames( getGoals() );
+ beforeLaunchGoals(project);
+ getMavenContext().getMavenSession().attainGoals( project );
+ afterLaunchGoals(project);
}
}
catch ( Exception e )
{
- onException( project, e );
+ onException(project, e);
if ( !isIgnoreFailures() )
{
throw new JellyTagException( e.fillInStackTrace() );
}
}
- afterProject( project );
-
+ afterProject(project);
+
if ( getPostProcessing() )
{
reactorProjects.add( project );
@@ -395,55 +398,55 @@
getContext().setVariable( "reactorProjects", reactorProjects );
}
-
+
/**
* This method is running before launching a project.
* @param project the currentProject
*/
- public void beforeProject( Project project )
+ public void beforeProject(Project project)
{
}
-
+
/**
* This method is running before launching project goals.
* @param project the currentProject
*/
- public void beforeLaunchGoals( Project project )
+ public void beforeLaunchGoals(Project project)
{
}
-
+
/**
* This method is running after launching project goals.
* @param project the currentProject
*/
- public void afterLaunchGoals( Project project )
+ public void afterLaunchGoals(Project project)
{
}
-
+
/**
* This method is running after launching a project.
* @param project the currentProject
*/
- public void afterProject( Project project )
+ public void afterProject(Project project)
{
}
-
+
/**
* This method is running when an exception occurs whatever
* the ignoreFailures value.
* @param project the currentProject
* @param e the exception
*/
- public void onException( Project project, Exception e )
+ public void onException(Project project, Exception e)
{
}
-
+
/**
* This method is running when an exception occurs in
* dependency resolution.
* @param e the exception
*/
- public void onDependencyResolutionException( Exception e )
+ public void onDependencyResolutionException(Exception e)
{
}
}
1.9 +1 -1
maven/src/java/org/apache/maven/jelly/tags/maven/SnapshotSignature.java
Index: SnapshotSignature.java
===================================================================
RCS file:
/home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/SnapshotSignature.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
1.13 +11 -30 maven/src/java/org/apache/maven/jelly/tags/maven/AddPathTag.java
Index: AddPathTag.java
===================================================================
RCS file:
/home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/AddPathTag.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- AddPathTag.java 31 Jul 2003 04:37:00 -0000 1.12
+++ AddPathTag.java 19 Aug 2003 04:25:39 -0000 1.13
@@ -61,6 +61,7 @@
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.XMLOutput;
import org.apache.maven.jelly.tags.BaseTagSupport;
+import org.apache.tools.ant.types.Path;
/**
* This class takes a given path using an <code>id</code> and appends another
@@ -75,40 +76,33 @@
/** the id of the path to be appended to. */
private String id;
- /** The reference to the path to append */
+ /** the path to append */
private String refid;
- /** A path to append. */
- private String path;
-
/**
* Perform the tag processing. Look up the path by [EMAIL PROTECTED] #id} and
append
* the [EMAIL PROTECTED] #refid other path} to it.
*
* @param output used to write output
- * @throws JellyTagException when anything goes wrong. FIXME
+ * @throws JellyTagException when anything goes wrong.
*/
public void doTag( XMLOutput output )
throws MissingAttributeException, JellyTagException
{
- GrantProject project = getMavenContext().getAntProject();
+ GrantProject project = getMavenContext().getProject().getAntProject();
if ( project == null )
{
throw new JellyTagException( "cannot find ant project" );
}
-
+
checkAttribute( getId(), "id" );
- checkAttribute( getPath(), "path" );
+ checkAttribute( getRefid(), "refid" );
- if ( getId().equals( "maven.compile.src.set" ) )
- {
- getMavenContext().getProject().addCompileSourceRoot( getPath() );
- }
- else if ( getId().equals( "maven.test.compile.src.set" ) )
- {
- getMavenContext().getProject().addTestCompileSourceRoot( getPath() );
- }
+
+ Path path = (Path) project.getReferences().get( getId() );
+ Path addPath = (Path) project.getReferences().get( getRefid() );
+ path.append( addPath );
}
/**
@@ -154,17 +148,4 @@
{
return refid;
}
-
- public String getPath()
- {
- return path;
- }
-
- public void setPath( String path )
- {
- System.out.println( "path = " + path );
-
- this.path = path;
- }
}
-
1.10 +3 -4
maven/src/java/org/apache/maven/jelly/tags/maven/MavenTagLibrary.java
Index: MavenTagLibrary.java
===================================================================
RCS file:
/home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/MavenTagLibrary.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- MavenTagLibrary.java 31 Jul 2003 06:46:07 -0000 1.9
+++ MavenTagLibrary.java 19 Aug 2003 04:25:39 -0000 1.10
@@ -75,14 +75,13 @@
{
registerTag( "snapshot", SnapshotSignature.class );
registerTag( "addPath", AddPathTag.class );
+ registerTag( "make-absolute-path", MakeAbsolutePathTag.class );
+ registerTag( "make-relative-path", MakeRelativePathTag.class );
registerTag( "maven", MavenTag.class );
registerTag( "pom", PomTag.class );
registerTag( "reactor", ReactorTag.class );
registerTag( "concat", ConcatTag.class );
registerTag( "input", InputTag.class );
- registerTag( "exists", Exists.class );
- registerTag( "display", DisplayTag.class );
- registerTag( "set-plugin-property", PluginPropertyTag.class );
registerTag( "user-check", UserCheck.class);
registerTag( "param-check", ParamCheck.class);
registerTag( "copy-resources", CopyResources.class);
1.7 +46 -48
maven/src/java/org/apache/maven/jelly/tags/maven/WerkzDependencyResolver.java
Index: WerkzDependencyResolver.java
===================================================================
RCS file:
/home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/WerkzDependencyResolver.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- WerkzDependencyResolver.java 27 Jul 2003 23:33:57 -0000 1.6
+++ WerkzDependencyResolver.java 19 Aug 2003 04:25:39 -0000 1.7
@@ -81,7 +81,7 @@
private Goal doItAll = null;
private WerkzProject wproject = null;
- /**
+ /**
* @see org.apache.maven.jelly.tags.maven.DependencyResolverInterface#clear()
*/
public void clear()
@@ -93,7 +93,7 @@
/**
* @see
org.apache.maven.jelly.tags.maven.DependencyResolverInterface#setProjects(java.util.List)
*/
- public void setProjects( List projects )
+ public void setProjects(List projects)
{
this.projects = projects;
}
@@ -101,16 +101,16 @@
/**
* Retrieves the existing goal for a project (based on Id).
* If no goal exists, an exception is thrown.
- * @param project
+ * @param project
* @return ProjectGoal
*/
- protected ProjectGoal getExistingGoal( Project project )
+ protected ProjectGoal getExistingGoal(Project project)
{
- ProjectGoal goal = (ProjectGoal) wproject.getGoal( project.getId() );
+ ProjectGoal goal = (ProjectGoal) wproject.getGoal(project.getId());
- if ( goal == null )
+ if (goal == null)
{
- throw new NullPointerException( "No goal exists : " + project.getId() );
+ throw new NullPointerException("No goal exists : " + project.getId());
}
else
{
@@ -125,14 +125,14 @@
* @param sourceBuild
* @return ProjectGoal
*/
- protected ProjectGoal getOrCreateGoal( Project project, boolean sourceBuild )
+ protected ProjectGoal getOrCreateGoal(Project project, boolean sourceBuild)
{
- ProjectGoal goal = (ProjectGoal) wproject.getGoal( project.getId() );
- if ( goal == null )
+ ProjectGoal goal = (ProjectGoal) wproject.getGoal(project.getId());
+ if (goal == null)
{
- goal = new ProjectGoal( project, sourceBuild );
- goal.setAction( new ListAddAction( goal, sortedGoals ) );
- wproject.addGoal( goal );
+ goal = new ProjectGoal(project, sourceBuild);
+ goal.setAction(new ListAddAction(goal, sortedGoals));
+ wproject.addGoal(goal);
}
return goal;
}
@@ -143,7 +143,7 @@
*/
public void buildGraph() throws Exception
{
- if ( doItAll != null )
+ if (doItAll != null)
{
return;
}
@@ -152,38 +152,38 @@
{
wproject = new WerkzProject();
- doItAll = wproject.getGoal( "DO_IT_ALL", true );
- doItAll.setAction( new DummyAction() );
+ doItAll = new Goal("DO_IT_ALL");
+ doItAll.setAction(new DummyAction());
//Initialise all the true goals of the system
Iterator iter = projects.iterator();
- while ( iter.hasNext() )
+ while (iter.hasNext())
{
Project project = (Project) iter.next();
- Goal projectGoal = getOrCreateGoal( project, true );
- doItAll.addPrecursor( projectGoal );
+ Goal projectGoal = getOrCreateGoal(project, true);
+ doItAll.addPrecursor(projectGoal);
}
//Now add the dependencies
iter = projects.iterator();
- while ( iter.hasNext() )
+ while (iter.hasNext())
{
Project project = (Project) iter.next();
- Goal projectGoal = getExistingGoal( project );
+ Goal projectGoal = getExistingGoal(project);
Iterator depIter = project.getDependencies().iterator();
- while ( depIter.hasNext() )
+ while (depIter.hasNext())
{
Dependency dep = (Dependency) depIter.next();
Project depProject = new Project();
- depProject.setId( dep.getId() );
+ depProject.setId(dep.getId());
- Goal depGoal = getOrCreateGoal( depProject, false );
- projectGoal.addPrecursor( depGoal );
+ Goal depGoal = getOrCreateGoal(depProject, false);
+ projectGoal.addPrecursor(depGoal);
}
}
}
- catch ( Exception e )
+ catch (Exception e)
{
doItAll = null;
wproject = new WerkzProject();
@@ -195,31 +195,31 @@
/**
* @see
org.apache.maven.jelly.tags.maven.DependencyResolverInterface#getSortedDependencies(org.apache.maven.project.Project)
*/
- public List getSortedDependencies( Project project ) throws Exception
+ public List getSortedDependencies(Project project) throws Exception
{
- return getSortedDependencies( project, false );
+ return getSortedDependencies(project, false);
}
/**
* Filters the given list of goals, and returns the associated projects
- *
+ *
* If param:sourceBuild == true, include goal
* If param:sourceBuild == false, include goal if goal:sourceBuild == true
* @param goals
* @param sourceBuild
* @return List
*/
- public List getProjects( List goals, boolean sourceBuild )
+ public List getProjects(List goals, boolean sourceBuild)
{
List result = new ArrayList();
Iterator iter = goals.iterator();
- while ( iter.hasNext() )
+ while (iter.hasNext())
{
ProjectGoal goal = (ProjectGoal) iter.next();
- if ( ( sourceBuild ) || ( !sourceBuild && goal.getSourceBuild() ) )
+ if ((sourceBuild) || (!sourceBuild && goal.getSourceBuild()))
{
- result.add( ( goal ).getProject() );
+ result.add((goal).getProject());
}
}
@@ -229,27 +229,27 @@
/**
* @see
org.apache.maven.jelly.tags.maven.DependencyResolverInterface#getSortedDependencies(org.apache.maven.project.Project,
boolean)
*/
- public List getSortedDependencies( Project project, boolean sourceBuild )
throws Exception
+ public List getSortedDependencies(Project project, boolean sourceBuild) throws
Exception
{
buildGraph();
sortedGoals.clear();
Session session = new Session();
- ProjectGoal g = getExistingGoal( project );
- g.attain( session );
+ ProjectGoal g = getExistingGoal(project);
+ g.attain(session);
- return getProjects( sortedGoals, sourceBuild );
+ return getProjects(sortedGoals, sourceBuild);
}
/**
* @see
org.apache.maven.jelly.tags.maven.DependencyResolverInterface#getSortedDependencies(boolean)
*/
- public List getSortedDependencies( boolean sourceBuild ) throws Exception
+ public List getSortedDependencies(boolean sourceBuild) throws Exception
{
buildGraph();
sortedGoals.clear();
Session session = new Session();
- doItAll.attain( session );
- return getProjects( sortedGoals, sourceBuild );
+ doItAll.attain(session);
+ return getProjects(sortedGoals, sourceBuild);
}
}
@@ -261,8 +261,7 @@
{
private List list;
private Goal goal;
-
- public ListAddAction( Goal goal, List list )
+ public ListAddAction(Goal goal, List list)
{
this.list = list;
this.goal = goal;
@@ -275,12 +274,12 @@
public void performAction( Session session ) throws Exception
{
- list.add( goal );
+ list.add(goal);
}
public void performAction() throws Exception
{
- list.add( goal );
+ list.add(goal);
}
}
@@ -311,10 +310,9 @@
{
private final Project project;
private final boolean sourceBuild;
-
- public ProjectGoal( Project project, boolean sourceBuild )
+ public ProjectGoal(Project project, boolean sourceBuild)
{
- super( project.getId(), new WerkzProject() );
+ super(project.getId());
this.project = project;
this.sourceBuild = sourceBuild;
}
1.2 +1 -1
maven/src/java/org/apache/maven/jelly/tags/maven/CopyResources.java
Index: CopyResources.java
===================================================================
RCS file:
/home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/CopyResources.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
1.10 +16 -3 maven/src/java/org/apache/maven/jelly/tags/maven/MavenTag.java
Index: MavenTag.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/MavenTag.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- MavenTag.java 31 Jul 2003 04:29:00 -0000 1.9
+++ MavenTag.java 19 Aug 2003 04:25:40 -0000 1.10
@@ -59,7 +59,9 @@
import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.XMLOutput;
+import org.apache.maven.MavenUtils;
import org.apache.maven.jelly.tags.BaseTagSupport;
+import org.apache.maven.project.Project;
import java.io.File;
@@ -91,7 +93,7 @@
* goals and verify.
*
* @param output for providing xml output
- * @throws JellyTagException if anything goes wrong. FIXME
+ * @throws JellyTagException if anything goes wrong.
*/
public void doTag( XMLOutput output )
throws MissingAttributeException, JellyTagException
@@ -100,7 +102,18 @@
try
{
- getMaven().attainGoals( getDescriptor(), getGoals() );
+ Project project = MavenUtils.getProject( getDescriptor(),
+
getMavenContext().getMavenSession().getRootContext() );
+ project.verifyDependencies();
+ project.processDependencies();
+
+ // Set the project goals if they have been specified.
+ if ( getGoals() != null )
+ {
+ project.setGoalNames( getGoals() );
+ }
+
+ getMavenContext().getMavenSession().attainGoals( project );
}
catch ( Exception e )
{
1.2 +131 -0
maven/src/java/org/apache/maven/jelly/tags/maven/MakeRelativePathTag.java
1.2 +130 -0
maven/src/java/org/apache/maven/jelly/tags/maven/MakeAbsolutePathTag.java
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]