You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2003/01/21 07:35:08 UTC
cvs commit: jakarta-turbine-maven/src/plugins-build/plexus/templates classworlds.vm plexus.vm
jvanzyl 2003/01/20 22:35:08
Modified: . build-bootstrap.xml project.xml
src/java/org/apache/maven/plugin PluginCacheManager.java
PluginManager.java
src/plugins-build/plexus plugin.properties project.xml
src/plugins-build/plexus/src/test-data
plexus-roles-test.conf
Added: src/plugins-build/plexus/src/plugin-resources/templates
classworlds.vm plexus.vm
Removed: src/plugins-build/plexus/src/conf plexus.conf
src/plugins-build/plexus/templates classworlds.vm plexus.vm
Log:
o Adding switch to the plugin cache manager that allows optional clearing
of found goals in plugins and dyna tag declarations.
o Cleaning up plexus plugin and placing all plugin resources in a single
directory.
Revision Changes Path
1.187 +2 -1 jakarta-turbine-maven/build-bootstrap.xml
Index: build-bootstrap.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/build-bootstrap.xml,v
retrieving revision 1.186
retrieving revision 1.187
diff -u -r1.186 -r1.187
--- build-bootstrap.xml 13 Jan 2003 04:18:44 -0000 1.186
+++ build-bootstrap.xml 21 Jan 2003 06:35:07 -0000 1.187
@@ -117,6 +117,7 @@
<!-- a) java -->
<!-- b) test -->
<!-- c) touchstone -->
+ <!-- d) touchstone-partner -->
<!-- ===================================================================== -->
<echo>
@@ -181,7 +182,7 @@
<fileset dir="src/plugins-build">
<include name="java/**"/>
<include name="test/**"/>
- <include name="touchstone/**"/>
+ <include name="touchstone*/**"/>
<exclude name="**/maven.xml"/>
<exclude name="**/target/**"/>
</fileset>
1.238 +5 -0 jakarta-turbine-maven/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/project.xml,v
retrieving revision 1.237
retrieving revision 1.238
diff -u -r1.237 -r1.238
--- project.xml 18 Jan 2003 06:47:53 -0000 1.237
+++ project.xml 21 Jan 2003 06:35:07 -0000 1.238
@@ -354,6 +354,11 @@
<email>Kuisong.Tong@vtradex.com</email>
</contributor>
+ <contributor>
+ <name>Ben Walding</name>
+ <email>ben@walding.com</email>
+ </contributor>
+
</contributors>
<!-- Need to mark these as compile-time/run-time -->
1.5 +90 -51 jakarta-turbine-maven/src/java/org/apache/maven/plugin/PluginCacheManager.java
Index: PluginCacheManager.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/plugin/PluginCacheManager.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PluginCacheManager.java 6 Jan 2003 06:18:03 -0000 1.4
+++ PluginCacheManager.java 21 Jan 2003 06:35:08 -0000 1.5
@@ -53,6 +53,7 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -73,7 +74,7 @@
/**
*/
public class PluginCacheManager
- extends DefaultHandler
+ extends DefaultHandler
{
/** Plug-in cache */
public static final String PLUGINS_CACHE = "plugins.cache";
@@ -86,11 +87,16 @@
/** Taglibs cache */
public static final String DYNAMIC_TAGLIBS_CACHE = "dynatag.cache";
- public static final String PLUGIN_DEPS_CACHE = "plugin-dynatag-deps.cache";
-
+ /** Plugin -> dynatag dependencies. */
+ public static final String PLUGIN_DYNATAG_DEPS_CACHE = "plugin-dynatag-deps.cache";
+ /** Currently executing plugin script. */
private File pluginScript;
+
+ /** Parent directory of the currently executing plugin script. */
private String pluginScriptDirectory;
+
+ /** Currently executing plugin name. */
private String pluginName;
/**
@@ -138,11 +144,39 @@
*/
private Properties callbackCache = new Properties();
- private Properties pluginDepsCache = new Properties();
+ /**
+ * Plugin dependencies on dyna tags. So, for example, the junit plugin
+ * depends on the 'doc' dynatag which provides the mechanism to perform
+ * a JSL transformation.
+ */
+ private Properties pluginDynaTagDepsCache = new Properties();
+ /** Goals that have been encountered while processing a plugin. */
private Set pluginGoals = new HashSet();
+
+ /** Dyna tag lib declarations encountered in a plugin. */
private Set dynaTagLibDecls = new HashSet();
+ /**
+ * Flag that tells the cache manager to clear plugin goals and dyna tag
+ * lib decls when the plugin script is changed.
+ */
+ private boolean clear = true;
+
+ /** Default constructor. */
+ public PluginCacheManager()
+ {
+ }
+
+ /**
+ *
+ * @param clear
+ */
+ public PluginCacheManager( boolean clear )
+ {
+ this.clear = clear;
+ }
+
// ----------------------------------------------------------------------
// A C C E S S O R S
// ----------------------------------------------------------------------
@@ -219,6 +253,7 @@
return callbackCache;
}
+
/**
*
* @param pluginScript
@@ -229,10 +264,14 @@
pluginScriptDirectory = pluginScript.getParentFile().getName();
pluginName = pluginScriptDirectory;
- // When we set a new plugin script to parse clear all our cached
- // values and start anew.
- pluginGoals.clear();
- dynaTagLibDecls.clear();
+
+ if ( clear )
+ {
+ // When we set a new plugin script to parse clear all our cached
+ // values and start anew.
+ pluginGoals.clear();
+ dynaTagLibDecls.clear();
+ }
}
/**
@@ -267,23 +306,23 @@
}
/**
- * Set the pluginDepsCache attribute.
+ * Set the pluginDynaTagDepsCache attribute.
*
- * @param pluginDepsCache
+ * @param pluginDynaTagDepsCache
*/
- public void setPluginDepsCache( Properties pluginDepsCache )
+ public void setPluginDynaTagDepsCache( Properties pluginDynaTagDepsCache )
{
- this.pluginDepsCache = pluginDepsCache;
+ this.pluginDynaTagDepsCache = pluginDynaTagDepsCache;
}
/**
- * Get the pluginDepsCache attribute.
+ * Get the pluginDynaTagDepsCache attribute.
*
* @return The
*/
- public Properties getPluginDepsCache()
+ public Properties getPluginDynaTagDepsCache()
{
- return pluginDepsCache;
+ return pluginDynaTagDepsCache;
}
public Set getDynaTagLibDecls()
@@ -304,10 +343,10 @@
SAXParserFactory saxFactory = SAXParserFactory.newInstance();
saxFactory.setNamespaceAware( true );
SAXParser parser = saxFactory.newSAXParser();
- InputSource is = new InputSource(new FileInputStream( getPluginScript() ) );
- parser.parse(is, this);
+ InputSource is = new InputSource( new FileInputStream( getPluginScript() ) );
+ parser.parse( is, this );
}
- catch (Exception e)
+ catch ( Exception e )
{
e.printStackTrace();
}
@@ -328,8 +367,8 @@
getDynaTagLibCache().store(
new FileOutputStream( new File( getPluginsDir(), DYNAMIC_TAGLIBS_CACHE ) ), "taglibs cache" );
- getPluginDepsCache().store(
- new FileOutputStream( new File( getPluginsDir(), PLUGIN_DEPS_CACHE ) ), "plugin deps cache" );
+ getPluginDynaTagDepsCache().store(
+ new FileOutputStream( new File( getPluginsDir(), PLUGIN_DYNATAG_DEPS_CACHE ) ), "plugin deps cache" );
}
/**
@@ -381,11 +420,11 @@
// ignore, new cache;
}
- pluginDepsCache = new Properties();
+ pluginDynaTagDepsCache = new Properties();
try
{
- pluginDepsCache.load( new FileInputStream( new File( getPluginsDir(), PLUGIN_DEPS_CACHE ) ) );
+ pluginDynaTagDepsCache.load( new FileInputStream( new File( getPluginsDir(), PLUGIN_DYNATAG_DEPS_CACHE ) ) );
}
catch ( IOException e )
{
@@ -408,19 +447,19 @@
*/
public void startPrefixMapping( String prefix, String uri )
{
- if ( uri.startsWith("jelly:") == false
- && uri.startsWith("dummy") == false
- && uri.equals("") == false )
+ if ( uri.startsWith( "jelly:" ) == false
+ && uri.startsWith( "dummy" ) == false
+ && uri.equals( "" ) == false )
{
dynaTagLibDecls.add( uri );
- String p = pluginDepsCache.getProperty( pluginName );
+ String p = pluginDynaTagDepsCache.getProperty( pluginName );
if ( p != null )
{
// Prevent duplicate uri entries from being added.
- if ( p.indexOf(uri) >= 0 )
+ if ( p.indexOf( uri ) >= 0 )
{
return;
}
@@ -431,16 +470,16 @@
{
p = uri;
}
- pluginDepsCache.setProperty( pluginName, p );
+ pluginDynaTagDepsCache.setProperty( pluginName, p );
}
}
/**
* Handles opening elements of the xml file.
*/
- public void startElement(String uri, String localName, String rawName, Attributes attributes)
+ public void startElement( String uri, String localName, String rawName, Attributes attributes )
{
- if( rawName.equals("goal") )
+ if ( rawName.equals( "goal" ) )
{
String name = attributes.getValue( "name" );
String prereqs = attributes.getValue( "prereqs" );
@@ -453,19 +492,19 @@
goalProperty += prereqs;
}
- goalCache.setProperty( name , goalProperty );
+ goalCache.setProperty( name, goalProperty );
pluginCache.setProperty( name, pluginScriptDirectory );
pluginGoals.add( name );
}
- else if( rawName.equals( "preGoal" ) )
+ else if ( rawName.equals( "preGoal" ) )
{
String name = attributes.getValue( "name" );
callbackCache.setProperty( name + ".pre", pluginScriptDirectory );
}
- else if( rawName.equals( "postGoal" ) )
+ else if ( rawName.equals( "postGoal" ) )
{
String name = attributes.getValue( "name" );
@@ -492,8 +531,8 @@
// and it's dependency on the doc plugin. I need to selectively remove
// an individual entry in the CSV list and not the whole thing.
- else if( localName.equals( "taglib" )
- && uri.equals( "jelly:define" ) )
+ else if ( localName.equals( "taglib" )
+ && uri.equals( "jelly:define" ) )
{
String tagLibUri = attributes.getValue( "uri" );
dynaTagLibCache.setProperty( tagLibUri, pluginScriptDirectory );
@@ -502,18 +541,18 @@
// the same jelly script where it's used.
if ( dynaTagLibDecls.contains( tagLibUri ) )
{
- String prop = (String) pluginDepsCache.get( pluginName );
+ String prop = (String) pluginDynaTagDepsCache.get( pluginName );
int tl = tagLibUri.length();
// If there is only one dependency then just remove the whole entry.
- if ( prop.indexOf(",") < 0 )
+ if ( prop.indexOf( "," ) < 0 )
{
- pluginDepsCache.remove( pluginName );
+ pluginDynaTagDepsCache.remove( pluginName );
}
else
{
int i = prop.indexOf( tagLibUri + "," );
- if ( i == 0)
+ if ( i == 0 )
{
// First
prop = prop.substring( tl + 1 );
@@ -521,14 +560,14 @@
else if ( i > 0 )
{
// Middle
- prop = prop.substring( 0, i ) + prop.substring( i + tl + 1 ) ;
+ prop = prop.substring( 0, i ) + prop.substring( i + tl + 1 );
}
else
{
// The last entry
prop = prop.substring( 0, prop.length() - tl - 1 );
}
- pluginDepsCache.put( pluginName, prop );
+ pluginDynaTagDepsCache.put( pluginName, prop );
}
}
}
@@ -539,9 +578,9 @@
*
* @param spe The parse exception that caused the callback to be invoked.
*/
- public void warning(SAXParseException spe)
+ public void warning( SAXParseException spe )
{
- printParseError("Warning", spe);
+ printParseError( "Warning", spe );
}
/**
@@ -549,9 +588,9 @@
*
* @param spe The parse exception that caused the callback to be invoked.
*/
- public void error(SAXParseException spe)
+ public void error( SAXParseException spe )
{
- printParseError("Error", spe);
+ printParseError( "Error", spe );
}
/**
@@ -559,18 +598,18 @@
*
* @param spe The parse exception that caused the callback to be invoked.
*/
- public void fatalError(SAXParseException spe)
+ public void fatalError( SAXParseException spe )
{
- printParseError("Fatal Error", spe);
+ printParseError( "Fatal Error", spe );
}
/**
* Description of the Method
*/
- private final void printParseError(String type, SAXParseException spe)
+ private final void printParseError( String type, SAXParseException spe )
{
- System.err.println(type + " [line " + spe.getLineNumber() +
- ", row " + spe.getColumnNumber() + "]: " +
- spe.getMessage());
+ System.err.println( type + " [line " + spe.getLineNumber() +
+ ", row " + spe.getColumnNumber() + "]: " +
+ spe.getMessage() );
}
}
1.36 +4 -4 jakarta-turbine-maven/src/java/org/apache/maven/plugin/PluginManager.java
Index: PluginManager.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/plugin/PluginManager.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- PluginManager.java 17 Jan 2003 00:10:26 -0000 1.35
+++ PluginManager.java 21 Jan 2003 06:35:08 -0000 1.36
@@ -169,8 +169,8 @@
this.mavenSession = mavenSession;
loadedPlugins = new HashSet();
- cacheManager = new PluginCacheManager();
- transientCacheManager = new PluginCacheManager();
+ cacheManager = new PluginCacheManager( true );
+ transientCacheManager = new PluginCacheManager( true );
}
// ----------------------------------------------------------------------
@@ -522,7 +522,7 @@
throws Exception
{
- String depPlugins = cacheManager.getPluginDepsCache().getProperty( pluginName );
+ String depPlugins = cacheManager.getPluginDynaTagDepsCache().getProperty( pluginName );
if ( depPlugins == null )
{
1.2 +1 -1 jakarta-turbine-maven/src/plugins-build/plexus/plugin.properties
Index: plugin.properties
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/plexus/plugin.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- plugin.properties 18 Nov 2002 22:28:02 -0000 1.1
+++ plugin.properties 21 Jan 2003 06:35:08 -0000 1.2
@@ -15,6 +15,6 @@
maven.plexus.work = ${maven.plexus.runtimeDirectory}/work
maven.plexus.componentBuilds = ${basedir}/component-builds
-maven.plexus.templatePath = ${plugin.dir}/templates
+maven.plexus.templatePath = ${plugin.dir}/plugin-resources/templates
maven.plexus.launcherConfigurationTemplate = classworlds.vm
maven.plexus.launcherConfiguration = classworlds.conf
1.9 +2 -9 jakarta-turbine-maven/src/plugins-build/plexus/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/plexus/project.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- project.xml 8 Jan 2003 20:25:02 -0000 1.8
+++ project.xml 21 Jan 2003 06:35:08 -0000 1.9
@@ -207,15 +207,8 @@
<resources>
<resource>
- <directory>${basedir}</directory>
- <excludes>
- <exclude>target/**</exclude>
- <exclude>xdocs/**</exclude>
- <exclude>maven.xml</exclude>
- <exclude>maven.log</exclude>
- <exclude>velocity.log</exclude>
- <exclude>.cvsignore</exclude>
- </excludes>
+ <directory>${basedir}/src/plugin-resources</directory>
+ <targetPath>plugin-resources</targetPath>
</resource>
</resources>
1.1 jakarta-turbine-maven/src/plugins-build/plexus/src/plugin-resources/templates/classworlds.vm
Index: classworlds.vm
===================================================================
main is org.apache.plexus.Plexus from core
[core]
#foreach ($jar in $project.dependencies)
#if (!$jar.id.startsWith("classworlds") && !$jar.id.startsWith("junit"))
load ${lib}/${jar.artifact}
#end
#end
load ${lib}/${project.id}-${project.currentVersion}.jar
1.1 jakarta-turbine-maven/src/plugins-build/plexus/src/plugin-resources/templates/plexus.vm
Index: plexus.vm
===================================================================
#! /bin/sh
CLASSWORLDS_VERSION=1.0-beta-1
MAIN_CLASS=com.werken.classworlds.Launcher
PLEXUS_OPTS="-Xmx128m"
# OS specific support. $var _must_ be set to either true or false.
cygwin=false
darwin=false;
case "`uname`" in
CYGWIN*) cygwin=true;;
Darwin*) darwin=true ;;
esac
# Checking for JAVA_HOME is required on *nix due
# to some distributions stupidly including kaffe in /usr/bin
if [ "$JAVA_HOME" = "" ] ; then
echo "ERROR: JAVA_HOME not found in your environment."
echo
echo "Please, set the JAVA_HOME variable in your environment to match the"
echo "location of the Java Virtual Machine you want to use."
exit 1
fi
# resolve links - $0 may be a softlink
THIS_PROG="$0"
while [ -h "$THIS_PROG" ]; do
ls=`ls -ld "$THIS_PROG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
THIS_PROG="$link"
else
THIS_PROG=`dirname "$THIS_PROG"`/"$link"
fi
done
# Get standard environment variables
PRGDIR=`dirname "$THIS_PROG"`
PLEXUS_HOME=`cd "$PRGDIR/.." ; pwd`
PLEXUS_CONF=`cd "$PLEXUS_HOME/conf" ; pwd`
unset THIS_PROG
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$PLEXUS_HOME" ] &&
PLEXUS_HOME=`cygpath --unix "$PLEXUS_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
if [ -z "$PLEXUS_TMPDIR" ] ; then
PLEXUS_TMPDIR="$PLEXUS_HOME"/temp
mkdir -p "$PLEXUS_TMPDIR"
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
else
JAVACMD=java
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly."
echo " We cannot execute $JAVACMD"
exit
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
echo " If build fails because sun.* classes could not be found"
echo " you will need to set the JAVA_HOME environment variable"
echo " to the installation directory of java."
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
PLEXUS_HOME=`cygpath --path --windows "$PLEXUS_HOME"`
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
fi
# For Darwin, use classes.jar for TOOLS_JAR
TOOLS_JAR="${JAVA_HOME}/lib/tools.jar"
if $darwin; then
TOOLS_JAR="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes/classes.jar"
fi
# ----- Execute The Requested Command -----------------------------------------
echo "Using PLEXUS_HOME: $PLEXUS_HOME"
echo "Using PLEXUS_CONF: $PLEXUS_CONF"
echo "Using PLEXUS_TMPDIR: $PLEXUS_TMPDIR"
echo "Using JAVA_HOME: $JAVA_HOME"
if [ "$1" = "" ]
then
CONF=${PLEXUS_CONF}/plexus.conf
else
CONF=$1
fi
$JAVACMD \
$PLEXUS_OPTS \
-classpath ${PLEXUS_HOME}/lib/classworlds-${CLASSWORLDS_VERSION}.jar \
-Dclassworlds.conf=${PLEXUS_HOME}/conf/classworlds.conf \
-Dlib=${PLEXUS_HOME}/lib \
-Dtools.jar=$TOOLS_JAR \
-Dplexus.home=${PLEXUS_HOME} \
$MAIN_CLASS ${CONF}
1.2 +0 -6 jakarta-turbine-maven/src/plugins-build/plexus/src/test-data/plexus-roles-test.conf
Index: plexus-roles-test.conf
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/plexus/src/test-data/plexus-roles-test.conf,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- plexus-roles-test.conf 7 Jan 2003 08:32:23 -0000 1.1
+++ plexus-roles-test.conf 21 Jan 2003 06:35:08 -0000 1.2
@@ -165,12 +165,6 @@
<agent>com.werken.werkflow.agent.ScriptAgent</agent>
<configuration>
<trigger>supplier.accept</trigger>
-<!--
- <pause>3</pause>
- <trigger>supplier.amend</trigger>
- <pause>3</pause>
- <trigger>supplier.accept</trigger>
--->
</configuration>
</bind>
</configuration>