You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ni...@apache.org on 2004/05/29 20:55:20 UTC
svn commit: rev 20603 - in avalon/trunk/tools/magic: test test/src/dist xdoc/src/dist
Author: niclas
Date: Sat May 29 11:55:20 2004
New Revision: 20603
Added:
avalon/trunk/tools/magic/test/magic.properties
avalon/trunk/tools/magic/test/src/dist/magic.bsh
avalon/trunk/tools/magic/test/src/dist/magic.properties
Modified:
avalon/trunk/tools/magic/xdoc/src/dist/magic.bsh
avalon/trunk/tools/magic/xdoc/src/dist/magic.properties
Log:
Breaking out the project/product specifics in the Theme, so it can be used in other projects.
Added: avalon/trunk/tools/magic/test/magic.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/magic/test/magic.properties Sat May 29 11:55:20 2004
@@ -0,0 +1,4 @@
+
+project.name = test
+
+project.system = ../../../central/system
Added: avalon/trunk/tools/magic/test/src/dist/magic.bsh
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/magic/test/src/dist/magic.bsh Sat May 29 11:55:20 2004
@@ -0,0 +1,112 @@
+/*
+Copyright 2004 The Apache Software Foundation
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied.
+
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+import java.io.File;
+import java.io.IOException;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.apache.avalon.magic.AbstractPlugin;
+import org.apache.avalon.magic.Artifact;
+import org.apache.avalon.magic.Plugin;
+import org.apache.avalon.magic.PluginContext;
+
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceException;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.taskdefs.Copy;
+import org.apache.tools.ant.taskdefs.Jar;
+
+public class JUnitPlugin extends AbstractPlugin
+ implements Serviceable
+{
+ private Object m_PreparePlugin;
+ private Object m_ArtifactPlugin;
+ private Object m_JavacPlugin;
+
+ public void service( ServiceManager man )
+ throws ServiceException
+ {
+ m_PreparePlugin = man.lookup( "prepare" );
+ m_ArtifactPlugin = man.lookup( "artifact" );
+ m_JavacPlugin = man.lookup( "java" );
+ }
+
+ public void junit()
+ {
+ Logger logger = getLogger();
+ if( logger.isDebugEnabled() )
+ logger.debug( "Starting Junit plugin." );
+
+ String classpath = m_Context.getProperty( "junit.class.path" );
+
+ File destDir = compileTests( classpath );
+
+ runTests( classpath, destDir );
+ }
+
+ private void compileTests( String classpath )
+ {
+ String destdirname = m_Context.getProperty( "junit.build.dest.dir" );
+ File toDir = new File( destdirname );
+ toDir.mkdirs();
+
+ String srcdirname = m_Context.getProperty( "junit.build.src.dir" );
+ File fromDir = new File( srcdirname );
+
+ JavacPlugin javac = (JavacPlugin) m_JavacPlugin;
+
+ javac.compile( classpath, toDir, fromDir );
+
+ return toDir;
+ }
+
+ private void runTests( String classpath, File testClasses )
+ {
+ int count = getNumberOfElements( classpath );
+ URL urls = new URL[ count + 1];
+
+ ArrayList pathelements = new ArrayList();
+ pathelements.add( testClasses.toURL() );
+
+ StringTokenizer st = new StringTokenizer( classpath, ":", false );
+ while( st.hasMoreTokens() )
+ {
+ String token = st.nextToken();
+ URL url = new URL( token );
+ }
+ }
+
+ private int getNumberOfElements( String classpath )
+ {
+ if( classpath == null || "".equals( classpath ) )
+ return 0;
+
+ int counter = 1;
+ for( int i=0 ; i < classpath.length() ; i++ )
+ {
+ if( classpath.charAt(i) == ':' )
+ counter++;
+ }
+ return counter;
+ }
+}
Added: avalon/trunk/tools/magic/test/src/dist/magic.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/magic/test/src/dist/magic.properties Sat May 29 11:55:20 2004
@@ -0,0 +1,6 @@
+
+test.src.dir = ${prepare.src.dir}/test
+
+test.build.src.dir = ${prepare.build.src.dir}/test-src
+
+test.build.dest.dir = ${prepare.dest.dir}/test-classes
Modified: avalon/trunk/tools/magic/xdoc/src/dist/magic.bsh
==============================================================================
--- avalon/trunk/tools/magic/xdoc/src/dist/magic.bsh (original)
+++ avalon/trunk/tools/magic/xdoc/src/dist/magic.bsh Sat May 29 11:55:20 2004
@@ -1,5 +1,4 @@
-
/*
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
@@ -106,7 +105,8 @@
String srcDir = m_Context.getProperty( "xdoc.src.dir" );
File fromDir = new File( srcDir );
File toDir = new File( m_Context.getProperty( "xdoc.build.src.dir" ) );
- transformTrax( fromDir, toDir, xslFile, "^.*/navigation.xml$", "", ".xml", "xml" );
+ String sep = File.separatorChar == '\\' ? "\\\\" : File.separator;
+ transformTrax( fromDir, toDir, xslFile, "^.*" + sep + "navigation.xml$", "", ".xml", "xml" );
}
private void copySources()
@@ -121,12 +121,14 @@
private void transformXdocs( File themeDir )
throws BuildException
{
+ getLogger().debug( "Converting XML documents." );
File xslFile = new File( themeDir, "transform.xsl" );
String srcDir = m_Context.getProperty( "xdoc.build.src.dir" );
File fromDir = new File( srcDir );
File toDir = new File( m_Context.getProperty( "xdoc.dest.dir" ) );
String output = m_Context.getProperty( "xdoc.output.format" );
- transformTrax( fromDir, toDir, xslFile, "^.*\\.xml$", "^.*/navigation.xml$", "." + output, "html" );
+ String sep = File.separatorChar == '\\' ? "\\\\" : File.separator;
+ transformTrax( fromDir, toDir, xslFile, "^.*\\.xml$", "^.*" + sep + "navigation.xml$", "." + output, "html" );
}
private void copyResources( File themeDir )
@@ -161,7 +163,6 @@
processed document
*/
- getLogger().debug( "Converting XML documents." );
try
{
TransformerFactory factory = TransformerFactory.newInstance();
@@ -212,8 +213,16 @@
transformer.setParameter( "directory", getRelToPath( toDir ) );
transformer.setParameter( "fullpath", getRelToPath( newDest ) );
transformer.setParameter( "file", base );
- transformer.setParameter( "copyright", m_Context.getProperty( "xdoc.footer.copyright" ) );
transformer.setParameter( "svn-location", svnSource );
+ transformer.setParameter( "copyright", m_Context.getProperty( "xdoc.footer.copyright" ).trim() );
+ transformer.setParameter( "logoright_file", m_Context.getProperty( "xdoc.logo.right.file" ).trim() );
+ transformer.setParameter( "logoright_url", m_Context.getProperty( "xdoc.logo.right.url" ).trim() );
+ transformer.setParameter( "logoleft_file", m_Context.getProperty( "xdoc.logo.left.file" ).trim() );
+ transformer.setParameter( "logoleft_url", m_Context.getProperty( "xdoc.logo.left.url" ).trim() );
+ transformer.setParameter( "logomiddle_file", m_Context.getProperty( "xdoc.logo.middle.file" ).trim() );
+ transformer.setParameter( "logomiddle_url", m_Context.getProperty( "xdoc.logo.middle.url" ).trim() );
+ transformer.setParameter( "brand_name", m_Context.getProperty( "xdoc.brand.name" ).trim() );
+
try
{
Modified: avalon/trunk/tools/magic/xdoc/src/dist/magic.properties
==============================================================================
--- avalon/trunk/tools/magic/xdoc/src/dist/magic.properties (original)
+++ avalon/trunk/tools/magic/xdoc/src/dist/magic.properties Sat May 29 11:55:20 2004
@@ -18,3 +18,14 @@
xdoc.svn.root.xdocs = https://svn.apache.org/repos/asf/avalon/trunk/central/site/src/xdocs
xdoc.footer.copyright = Copyright ${magic.year}, The Apache Software Foundation. All rights reserved.
+
+xdoc.logo.left.file = feather.jpg
+xdoc.logo.left.url =
+
+xdoc.logo.right.file =
+xdoc.logo.right.url =
+
+xdoc.logo.middle.file =
+xdoc.logo.middle.url =
+
+xdoc.brand.name = Apache Avalon
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org