You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2003/12/02 04:59:07 UTC
cvs commit: maven/src/java/org/apache/maven/plugin JellyPlugin.java PluginManager.java
brett 2003/12/01 19:59:07
Modified: src/java/org/apache/maven/plugin Tag: MAVEN-1_0-BRANCH
JellyPlugin.java PluginManager.java
Log:
Updated to fix bootstrap, extra commenting on tasks
Revision Changes Path
No revision
No revision
1.3.4.2 +16 -3 maven/src/java/org/apache/maven/plugin/Attic/JellyPlugin.java
Index: JellyPlugin.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/plugin/Attic/JellyPlugin.java,v
retrieving revision 1.3.4.1
retrieving revision 1.3.4.2
diff -u -r1.3.4.1 -r1.3.4.2
--- JellyPlugin.java 26 Nov 2003 11:45:17 -0000 1.3.4.1
+++ JellyPlugin.java 2 Dec 2003 03:59:06 -0000 1.3.4.2
@@ -119,8 +119,16 @@
JellyPlugin(File pluginFile)
{
String directory = pluginFile.getName();
- this.id = directory.substring( 0, directory.indexOf( ".jar" ) );
- this.jarFile = pluginFile;
+ int index = directory.indexOf( ".jar" );
+ if ( index >= 0 )
+ {
+ this.id = directory.substring( 0, index );
+ this.jarFile = pluginFile;
+ }
+ else
+ {
+ this.id = directory;
+ }
}
/**
@@ -140,6 +148,11 @@
*/
void unpack( File unpackDirectory ) throws MavenException
{
+ if ( jarFile == null )
+ {
+ return;
+ }
+
File unzipDir = new File( unpackDirectory, id );
// if there's no directory, or the jar is newer, expand the jar
1.70.4.2 +48 -7 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.1
retrieving revision 1.70.4.2
diff -u -r1.70.4.1 -r1.70.4.2
--- PluginManager.java 26 Nov 2003 11:45:17 -0000 1.70.4.1
+++ PluginManager.java 2 Dec 2003 03:59:06 -0000 1.70.4.2
@@ -215,6 +215,8 @@
private JellyPlugin processPluginFile( File pluginFile ) throws MavenException
{
+ // TODO [RC2] - refactor whole method
+ // TODO [RC2] - need to make sure nothing gets loaded twice!
// Only unpack the JAR if it hasn't been already, or is newer
// than the plugin directory
if ( pluginFile.getName().endsWith( ".jar" ) )
@@ -235,6 +237,30 @@
plugins.put( plugin.getProject().getArtifactId(), plugin );
return plugin;
}
+ else if ( pluginFile.isDirectory() )
+ {
+ // TODO: what if it isn't a Jelly plugin?
+ JellyPlugin plugin = new JellyPlugin( pluginFile );
+ // TODO [RC2] - very nasty now. Maybe pass unpackDirectory to constructor
+ plugin.setUnpackDirectory( pluginFile.getParentFile() );
+ if ( !plugin.getDescriptor().exists() )
+ {
+ // check it really is a plugin
+ return null;
+ }
+ // TODO [RC2] - cleanup. Needed here so project != null
+ try
+ {
+ loadPlugin( plugin, pluginFile.getParentFile() );
+ }
+ catch ( Exception e )
+ {
+ throw new MavenException( "error", e );
+ }
+ // TODO [RC2]: fix id stuff
+ plugins.put( plugin.getProject().getArtifactId(), plugin );
+ return plugin;
+ }
else
{
return null;
@@ -283,9 +309,12 @@
private void loadPlugin( JellyPlugin plugin ) throws Exception
{
- // TODO [RC2] - remove debugging
- System.err.println( "loading plugin " + plugin.getId() );
- plugin.setUnpackDirectory( getUnpackedPluginsDir() );
+ loadPlugin( plugin, getUnpackedPluginsDir() );
+ }
+
+ private void loadPlugin( JellyPlugin plugin, File unpackedDir ) throws Exception
+ {
+ plugin.setUnpackDirectory( unpackedDir );
plugin.setParentClassLoader( mavenRootClassLoader );
plugin.load();
@@ -437,7 +466,7 @@
MavenJellyContext baseContext = new MavenJellyContext( mavenSession.getRootContext() );
baseContext.setInherit( true );
baseContext.setVariables( project.getContext().getVariables() );
- baseContext.setVariable("context", baseContext);
+ baseContext.setVariable( "context", baseContext );
project.setContext( baseContext );
baseContext.setProject( project );
return baseContext;
@@ -501,6 +530,8 @@
// Set up the ant project.
AntProjectBuilder.build( project, baseContext );
+// TODO [RC2] - I think this needs to be reverted afterwards (antTagLibrary)
+
Session session = getJellySession(baseContext);
// add the global session to the pluginContext so that it can be used by tags
baseContext.setVariable( GLOBAL_SESSION_KEY, session );
@@ -586,19 +617,29 @@
// FIXME: this is a bit nasty
File pluginDirectory = housing.getProject().getFile().getParentFile();
- // TODO [RC2] - should this integrate into pluginContext?
+ // TODO [RC2] - integrate into original pluginContext
MavenUtils.integrateMapInContext(
getPluginProperties( pluginDirectory ),
baseContext );
+ // TODO [RC2]: necessary to create a new one every time?
+ // 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 );
+
+ // TODO [RC2] - integrate into original pluginContext
pluginContext.setVariable( "plugin", housing.getProject() );
pluginContext.setVariable( "plugin.dir", pluginDirectory );
pluginContext.setVariable( "plugin.resources",
new File( pluginDirectory, "plugin-resources" ) );
+ // TODO [RC2]: this is where sourcesPresent gets set incorrectly
runJellyScriptHousing( housing, pluginContext );
}
@@ -732,7 +773,7 @@
* @param project
* @param classLoader
*/
- private void displayClassLoaderContents( Project project, ForeheadClassLoader classLoader )
+ static void displayClassLoaderContents( Project project, ForeheadClassLoader classLoader )
{
URL[] urls = classLoader.getURLs();
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org