Author: mcconnell Date: Tue Jun 8 06:23:58 2004 New Revision: 20907 Added: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/AnnounceTask.java (contents, props changed) avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ArtifactTask.java (contents, props changed) avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/FilterTask.java (contents, props changed) avalon/trunk/tools/project/core/src/test/projects/gizmo/src/main/example.properties (contents, props changed) Modified: avalon/trunk/tools/project/core/build.xml avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/antlib.xml avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/Info.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/PluginRef.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/Policy.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/ProjectRef.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/ResourceRef.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/builder/XMLDefinitionBuilder.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/DeclareTask.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JavacTask.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ReactorTask.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/XdocTask.java avalon/trunk/tools/project/core/src/test/projects/demo/build.properties avalon/trunk/tools/project/core/src/test/projects/gizmo/build.properties avalon/trunk/tools/project/core/src/test/projects/gizmo/build.xml avalon/trunk/tools/project/core/src/test/projects/sample/build.properties avalon/trunk/tools/project/core/src/test/projects/widget/build.properties avalon/trunk/tools/project/core/src/test/standard.xml Log: Update project tasks to include a filter generator and an artifact .meta plugin.
Modified: avalon/trunk/tools/project/core/build.xml ============================================================================== --- avalon/trunk/tools/project/core/build.xml (original) +++ avalon/trunk/tools/project/core/build.xml Tue Jun 8 06:23:58 2004 @@ -60,7 +60,8 @@ </target> <target name="test" depends="test-prepare"> - <ant dir="${target.test.dir}" /> + <!--<ant dir="${target.test.dir}" />--> + <ant dir="${target.test.dir}/projects/gizmo" /> </target> <target name="clean"> Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/antlib.xml ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/antlib.xml (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/antlib.xml Tue Jun 8 06:23:58 2004 @@ -14,5 +14,8 @@ <taskdef name="plugin" classname="org.apache.avalon.tools.tasks.PluginTask"/> <taskdef name="xdoc" classname="org.apache.avalon.tools.tasks.XdocTask"/> <taskdef name="reactor" classname="org.apache.avalon.tools.tasks.ReactorTask"/> + <taskdef name="filter" classname="org.apache.avalon.tools.tasks.FilterTask"/> + <taskdef name="info" classname="org.apache.avalon.tools.tasks.AnnounceTask"/> + <taskdef name="artifact" classname="org.apache.avalon.tools.tasks.ArtifactTask"/> </antlib> Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/Info.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/Info.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/Info.java Tue Jun 8 06:23:58 2004 @@ -27,6 +27,8 @@ */ public class Info { + public static final String PROTOCOL = "artifact"; + public static Info create( String id ) { int i = id.indexOf( ":" ); @@ -113,7 +115,8 @@ public String getURI() { - StringBuffer buffer = new StringBuffer(); + StringBuffer buffer = new StringBuffer( PROTOCOL ); + buffer.append( ":" ); buffer.append( getType() ); buffer.append( ":" ); buffer.append( getGroup() ); @@ -126,7 +129,6 @@ } return buffer.toString(); } - public String toString() { Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/PluginRef.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/PluginRef.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/PluginRef.java Tue Jun 8 06:23:58 2004 @@ -25,9 +25,9 @@ */ public class PluginRef extends ProjectRef { - public PluginRef( String key, Policy policy ) + public PluginRef( String key, Policy policy, String tag ) { - super( key, policy ); + super( key, policy, tag ); } public String toString() Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/Policy.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/Policy.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/Policy.java Tue Jun 8 06:23:58 2004 @@ -33,6 +33,11 @@ private final boolean m_test; private final boolean m_runtime; + public Policy() + { + this( true, true, true ); + } + public Policy( boolean build, boolean test, boolean runtime ) { m_build = build; Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/ProjectRef.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/ProjectRef.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/ProjectRef.java Tue Jun 8 06:23:58 2004 @@ -25,9 +25,9 @@ */ public class ProjectRef extends ResourceRef { - public ProjectRef( String key, Policy policy ) + public ProjectRef( String key, Policy policy, String tag ) { - super( key, policy ); + super( key, policy, tag ); } public String toString() Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/ResourceRef.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/ResourceRef.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/ResourceRef.java Tue Jun 8 06:23:58 2004 @@ -27,16 +27,39 @@ { private String m_key; private Policy m_policy; + private String m_tag; - public ResourceRef( String key, Policy policy ) + public ResourceRef( String key ) + { + this( key, new Policy(), null ); + } + + public ResourceRef( String key, Policy policy, String tag ) { m_key = key; m_policy = policy; + if( null == tag ) + { + m_tag = "impl"; + } + else if( "".equals( tag ) ) + { + m_tag = "impl"; + } + else + { + m_tag = tag; + } } public String getKey() { return m_key; + } + + public String getTag() + { + return m_tag; } public Policy getPolicy() Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/builder/XMLDefinitionBuilder.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/builder/XMLDefinitionBuilder.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/builder/XMLDefinitionBuilder.java Tue Jun 8 06:23:58 2004 @@ -180,8 +180,9 @@ { Element child = children[i]; String key = child.getAttribute( "key" ); + String tag = child.getAttribute( "tag" ); Policy policy = createPolicy( child ); - refs[i] = new ResourceRef( key, policy ); + refs[i] = new ResourceRef( key, policy, tag ); } return refs; } @@ -195,8 +196,9 @@ { Element child = children[i]; String key = child.getAttribute( "key" ); + String tag = child.getAttribute( "tag" ); Policy policy = createPolicy( child ); - refs[i] = new ProjectRef( key, policy ); + refs[i] = new ProjectRef( key, policy, tag ); } return refs; } @@ -210,8 +212,9 @@ { Element child = children[i]; String key = child.getAttribute( "key" ); + String tag = child.getAttribute( "tag" ); Policy policy = createPolicy( child ); - refs[i] = new PluginRef( key, policy ); + refs[i] = new PluginRef( key, policy, tag ); } return refs; } Added: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/AnnounceTask.java ============================================================================== --- (empty file) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/AnnounceTask.java Tue Jun 8 06:23:58 2004 @@ -0,0 +1,45 @@ +/* + * Copyright 2004 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. + */ + +package org.apache.avalon.tools.tasks; + +import java.io.File; + +import org.apache.tools.ant.Project; +import org.apache.tools.ant.BuildException; + + +/** + * Announce the initiation of a build. + * + * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> + * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $ + */ +public class AnnounceTask extends ContextualTask +{ + public static final String BANNER = + "------------------------------------------------------------------------"; + + public void execute() throws BuildException + { + Project project = getProject(); + String name = project.getProperty( "project.name" ); + project.log( BANNER ); + project.log( "name: " + name ); + project.log( BANNER ); + } +} Added: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ArtifactTask.java ============================================================================== --- (empty file) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ArtifactTask.java Tue Jun 8 06:23:58 2004 @@ -0,0 +1,344 @@ +/* + * Copyright 2004 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. + */ + +package org.apache.avalon.tools.tasks; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.SimpleTimeZone; +import java.util.TimeZone; + +import org.apache.tools.ant.Task; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.BuildException; + +import org.apache.avalon.tools.home.Home; +import org.apache.avalon.tools.home.Context; +import org.apache.avalon.tools.project.Info; +import org.apache.avalon.tools.project.Definition; +import org.apache.avalon.tools.project.ResourceRef; +import org.apache.avalon.tools.project.Resource; +import org.apache.avalon.tools.project.Policy; + +/** + * Create a repository plugin meta data descriptor in the form of a + * properties file. + * + * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> + * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $ + */ +public class ArtifactTask extends SystemTask +{ + public static final String SUFFIX = "meta"; + public static final String VERSION = "1.1"; + public static final String FACTORY_KEY = "avalon.artifact.factory"; + public static final String EXPORT_KEY = "avalon.artifact.export"; + + public void execute() throws BuildException + { + String key = getContext().getKey(); + Definition def = getHome().getDefinition( key ); + File artifact = getArtifactFile( def ); + writeMetaFile( def, artifact ); + } + + private void writeMetaFile( Definition def, File artifact ) + { + String path = artifact.toString(); + final File file = new File( path + "." + SUFFIX ); + + if( file.exists() ) + { + if( file.lastModified() > artifact.lastModified() ) + { + return; + } + } + + try + { + + log( "Creating meta directive" ); + + file.createNewFile(); + final OutputStream output = new FileOutputStream( file ); + + try + { + writeMetaDescriptor( output, def, artifact ); + } + finally + { + closeStream( output ); + } + } + catch( Throwable e ) + { + throw new BuildException( e ); + } + } + + private File getMetaFile( Definition def ) + { + String artifact = getArtifactFile( def ).toString(); + return new File( artifact + "." + SUFFIX ); + } + + private File getArtifactFile( Definition def ) + { + Info info = def.getInfo(); + String type = info.getType(); + + File dir = getContext().getDeliverablesDirectory(); + File types = new File( dir, type + "s" ); + + String filename = getFilename( info ); + return new File( types, filename ); + } + + private String getFilename( Info info ) + { + String version = info.getVersion(); + if( null == version ) + { + return info.getName() + "." + info.getType() ; + } + else + { + return info.getName() + "-" + version + "." + info.getType(); + } + } + + public void writeMetaDescriptor( final OutputStream output, final Definition def, File artifact ) + throws IOException + { + final Writer writer = new OutputStreamWriter( output ); + writeHeader( writer ); + writeDescriptor( writer, def, artifact ); + writeProperties( writer ); + writeClasspath( writer, def ); + writeTail( writer ); + writer.flush(); + } + + /** + * Write the properties header. + * @param writer the writer + * @throws IOException if unable to write xml + */ + private void writeHeader( final Writer writer ) + throws IOException + { + writer.write( "\n#" ); + writer.write( "\n# Meta classifier." ); + writer.write( "\n#" ); + writer.write( "\nmeta.domain = avalon" ); + writer.write( "\nmeta.version = " + VERSION ); + } + + /** + * Write the artifact descriptor. + * @param writer the writer + * @throws IOException if unable to write xml + */ + private void writeDescriptor( + final Writer writer, final Definition def, File artifact ) + throws IOException + { + Info info = def.getInfo(); + + writer.write( "\n" ); + writer.write( "\n#" ); + writer.write( "\n# Artifact descriptor." ); + writer.write( "\n#" ); + writer.write( "\navalon.artifact.group = " + info.getGroup() ); + writer.write( "\navalon.artifact.name = " + info.getName() ); + writer.write( "\navalon.artifact.version = " + info.getVersion() ); + writer.write( "\navalon.artifact.signature = " + getSignature( artifact ) ); + } + + private String getSignature( File file ) + { + if( !file.exists() ) + { + final String error = + "Cannot create artifact descriptor due to missing resource: " + + file; + throw new BuildException( error ); + } + SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMdd.HHmmss" ); + sdf.setTimeZone( TimeZone.getTimeZone( "UTC" ) ); + Date created = new Date( file.lastModified() ); + return sdf.format( created ); + } + + private void writeClasspath( final Writer writer, final Definition def ) + throws IOException + { + ResourceRef[] refs = getRuntimeRefs( def ); + ResourceRef[] apis = getRefs( refs, "api" ); + if( apis.length > 0 ) + { + writer.write( "\n" ); + writer.write( "\n#" ); + writer.write( "\n# API dependencies." ); + writer.write( "\n#" ); + String lead = "avalon.artifact.dependency.api"; + writeRefs( writer, apis, lead ); + } + ResourceRef[] spis = getRefs( refs, "spi" ); + if( spis.length > 0 ) + { + writer.write( "\n" ); + writer.write( "\n#" ); + writer.write( "\n# SPI dependencies." ); + writer.write( "\n#" ); + String lead = "avalon.artifact.dependency.spi"; + writeRefs( writer, spis, lead ); + } + + ResourceRef[] impl = getRefs( refs, "impl" ); + if( impl.length > 0 ) + { + writer.write( "\n" ); + writer.write( "\n#" ); + writer.write( "\n# Implementation dependencies." ); + writer.write( "\n#" ); + String lead = "avalon.artifact.dependency"; + writeRefs( writer, impl, lead ); + } + } + + private ResourceRef[] getRuntimeRefs( final Definition def ) + { + ArrayList list = new ArrayList(); + ResourceRef[] resources = getHome().getRepository().getResourceRefs( def ); + for( int i=0; i<resources.length; i++ ) + { + ResourceRef ref = resources[i]; + Policy policy = ref.getPolicy(); + if( policy.isRuntimeEnabled() ) + { + list.add( ref ); + } + } + return (ResourceRef[]) list.toArray( new ResourceRef[0] ); + } + + private ResourceRef[] getRefs( final ResourceRef[] refs, String category ) + { + ArrayList list = new ArrayList(); + for( int i=0; i<refs.length; i++ ) + { + ResourceRef ref = refs[i]; + String tag = ref.getTag(); + if( category.equals( tag ) ) + { + list.add( ref ); + } + } + return (ResourceRef[]) list.toArray( new ResourceRef[0] ); + } + + private void writeRefs( + final Writer writer, final ResourceRef[] refs, String lead ) + throws IOException + { + for( int i=0; i<refs.length; i++ ) + { + ResourceRef ref = refs[i]; + Resource resource = getHome().getResource( ref ); + writer.write( "\n" ); + writer.write( lead ); + writer.write( "." + i ); + writer.write( " = " ); + writer.write( resource.getInfo().getURI() ); + } + } + + /** + * Write the factory class. + * @param writer the writer + * @throws IOException if unable to write xml + */ + private void writeProperties( final Writer writer ) + throws IOException + { + String factory = getProject().getProperty( FACTORY_KEY ); + if( null == factory ) + { + final String error = + "Required artifact property '" + FACTORY_KEY + "' is undefined."; + throw new BuildException( error ); + } + writer.write( "\n" ); + writer.write( "\n#" ); + writer.write( "\n# Factory classname." ); + writer.write( "\n#" ); + writer.write( "\n" + FACTORY_KEY + " = " + factory); + + String export = getProject().getProperty( EXPORT_KEY ); + if( null == export ) + { + return; + } + writer.write( "\n" ); + writer.write( "\n#" ); + writer.write( "\n# Service export." ); + writer.write( "\n#" ); + writer.write( "\n" + EXPORT_KEY + " = " + export ); + + + } + + /** + * Write the tail. + * @param writer the writer + * @throws IOException if unable to write xml + */ + private void writeTail( final Writer writer ) + throws IOException + { + writer.write( "\n" ); + writer.write( "\n#" ); + writer.write( "\n# EOF." ); + writer.write( "\n#" ); + writer.write( "\n" ); + } + + private void closeStream( final OutputStream output ) + { + if( null != output ) + { + try + { + output.close(); + } + catch( IOException e ) + { + // ignore + } + } + } +} Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/DeclareTask.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/DeclareTask.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/DeclareTask.java Tue Jun 8 06:23:58 2004 @@ -112,7 +112,7 @@ /** * Write the XML header. * @param writer the writer - * @throws IOException if unable to write xml + * @throws IOException if unable to write xml */ private void writeHeader( final Writer writer ) throws IOException Added: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/FilterTask.java ============================================================================== --- (empty file) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/FilterTask.java Tue Jun 8 06:23:58 2004 @@ -0,0 +1,131 @@ +/* + * Copyright 2004 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. + */ + +package org.apache.avalon.tools.tasks; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import org.apache.tools.ant.Task; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.taskdefs.Filter; + +import org.apache.avalon.tools.home.Context; +import org.apache.avalon.tools.home.Home; +import org.apache.avalon.tools.project.Resource; +import org.apache.avalon.tools.project.Definition; +import org.apache.avalon.tools.project.ResourceRef; +import org.apache.avalon.tools.project.ProjectRef; +import org.apache.avalon.tools.project.PluginRef; + +/** + * Build a set of projects taking into account dependencies within the + * supplied fileset. + * + * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> + * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $ + */ +public class FilterTask extends SystemTask +{ + private String m_key; + private String m_feature; + private String m_token; + + public void init() + { + if( !isInitialized() ) + { + super.init(); + } + } + + public void setKey( String key ) + { + m_key = key; + } + + public void setFeature( String feature ) + { + m_feature = feature; + } + + public void setToken( String token ) + { + m_token = token; + } + + public void execute() throws BuildException + { + if( null == m_key ) + { + m_key = getContext().getKey(); + } + if( null == m_feature ) + { + log( "Ignoring request due to missing 'feature' attribute." ); + return; + } + if( null == m_token ) + { + log( "Ignoring request due to missing 'token' attribute." ); + return; + } + + String value = getFeature(); + if( null != value ) + { + Filter filter = (Filter) getProject().createTask( "filter" ); + filter.init(); + filter.setToken( m_token ); + filter.setValue( value ); + filter.execute(); + } + else + { + log( "Unrecognized or unsupported feature [" + m_feature + "]." ); + } + } + + private String getFeature() + { + ResourceRef ref = new ResourceRef( m_key ); + Resource resource = getHome().getResource( ref ); + if( m_feature.equals( "name" ) ) + { + return resource.getInfo().getName(); + } + else if( m_feature.equals( "group" ) ) + { + return resource.getInfo().getGroup(); + } + else if( m_feature.equals( "version" ) ) + { + return resource.getInfo().getVersion(); + } + else if( m_feature.equals( "uri" ) ) + { + return resource.getInfo().getURI(); + } + return null; + } +} Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java Tue Jun 8 06:23:58 2004 @@ -70,6 +70,8 @@ public static final String HALT_ON_FAILURE_KEY = "project.test.halt-on-failure"; public static final boolean HALT_ON_FAILURE_VALUE = true; + public static final String CACHE_PATH_KEY = "project.repository.cache.path"; + private static final String ERROR_KEY = "project.test.error"; private static final String FAILURE_KEY = "project.test.failure"; @@ -274,10 +276,28 @@ basedir.setValue( base.toString() ); junit.addSysproperty( basedir ); + Environment.Variable cache = new Environment.Variable(); + cache.setKey( CACHE_PATH_KEY ); + cache.setValue( getCachePath() ); + junit.addSysproperty( cache ); + junit.setErrorProperty( ERROR_KEY ); junit.setFailureProperty( FAILURE_KEY ); junit.execute(); + } + + private String getCachePath() + { + String value = getProject().getProperty( CACHE_PATH_KEY ); + if( null != value ) + { + return value; + } + else + { + return getHome().getRepository().getCacheDirectory().toString(); + } } private boolean getDebugProperty() Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JavacTask.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JavacTask.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JavacTask.java Tue Jun 8 06:23:58 2004 @@ -92,10 +92,32 @@ copy.addFileset( fileset ); copy.init(); copy.execute(); + + copyMainResource( classes ); } else { log( "no src main to compile : " + main.toString() ); + } + } + + private void copyMainResource( File dest ) + { + File build = getContext().getBuildDirectory(); + File etc = new File( build, "etc" ); + File src = new File( etc, "main" ); + if( src.exists() ) + { + mkDir( dest ); + Copy copy = (Copy) getProject().createTask( "copy" ); + copy.setPreserveLastModified( true ); + copy.setTodir( dest ); + + FileSet fileset = new FileSet(); + fileset.setDir( src ); + copy.addFileset( fileset ); + copy.init(); + copy.execute(); } } Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ReactorTask.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ReactorTask.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ReactorTask.java Tue Jun 8 06:23:58 2004 @@ -62,7 +62,11 @@ public void init() { - m_path = new Path( getProject() ); + if( !isInitialized() ) + { + super.init(); + m_path = new Path( getProject() ); + } } public void addConfigured( final Path path ) Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/XdocTask.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/XdocTask.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/XdocTask.java Tue Jun 8 06:23:58 2004 @@ -1,3 +1,20 @@ +/* + * Copyright 2004 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. + */ + package org.apache.avalon.tools.tasks; import java.io.File; Modified: avalon/trunk/tools/project/core/src/test/projects/demo/build.properties ============================================================================== --- avalon/trunk/tools/project/core/src/test/projects/demo/build.properties (original) +++ avalon/trunk/tools/project/core/src/test/projects/demo/build.properties Tue Jun 8 06:23:58 2004 @@ -1,3 +1,2 @@ project.name = demo project.home = ../.. -project.gpg.exe = gpg \ No newline at end of file Modified: avalon/trunk/tools/project/core/src/test/projects/gizmo/build.properties ============================================================================== --- avalon/trunk/tools/project/core/src/test/projects/gizmo/build.properties (original) +++ avalon/trunk/tools/project/core/src/test/projects/gizmo/build.properties Tue Jun 8 06:23:58 2004 @@ -1,3 +1,2 @@ project.name = gizmo project.home = ../.. -project.gpg.exe = gpg \ No newline at end of file Modified: avalon/trunk/tools/project/core/src/test/projects/gizmo/build.xml ============================================================================== --- avalon/trunk/tools/project/core/src/test/projects/gizmo/build.xml (original) +++ avalon/trunk/tools/project/core/src/test/projects/gizmo/build.xml Tue Jun 8 06:23:58 2004 @@ -2,8 +2,14 @@ <project name="gizmo" default="dist" basedir="." xmlns:x="antlib:org.apache.avalon.tools"> - <property file="build.properties"/> <import file="${project.home}/standard.xml"/> + + <target name="init" depends="standard.init"> + <x:filter key="widget" feature="name" token="WIDGET_NAME"/> + <x:filter key="widget" feature="group" token="WIDGET_GROUP"/> + <x:filter key="widget" feature="version" token="WIDGET_VERSION"/> + <x:filter key="widget" feature="uri" token="WIDGET_URI"/> + </target> </project> Added: avalon/trunk/tools/project/core/src/test/projects/gizmo/src/main/example.properties ============================================================================== --- (empty file) +++ avalon/trunk/tools/project/core/src/test/projects/gizmo/src/main/example.properties Tue Jun 8 06:23:58 2004 @@ -0,0 +1,8 @@ + +# +# example properties file +# +widget.name = @WIDGET_NAME@ +widget.group = @WIDGET_GROUP@ +widget.version = @WIDGET_VERSION@ +widget.uri = @WIDGET_URI@ Modified: avalon/trunk/tools/project/core/src/test/projects/sample/build.properties ============================================================================== --- avalon/trunk/tools/project/core/src/test/projects/sample/build.properties (original) +++ avalon/trunk/tools/project/core/src/test/projects/sample/build.properties Tue Jun 8 06:23:58 2004 @@ -1,3 +1,2 @@ project.name = sample project.home = ../.. -project.gpg.exe = gpg \ No newline at end of file Modified: avalon/trunk/tools/project/core/src/test/projects/widget/build.properties ============================================================================== --- avalon/trunk/tools/project/core/src/test/projects/widget/build.properties (original) +++ avalon/trunk/tools/project/core/src/test/projects/widget/build.properties Tue Jun 8 06:23:58 2004 @@ -1,3 +1,2 @@ project.name = widget project.home = ../.. -project.gpg.exe = gpg \ No newline at end of file Modified: avalon/trunk/tools/project/core/src/test/standard.xml ============================================================================== --- avalon/trunk/tools/project/core/src/test/standard.xml (original) +++ avalon/trunk/tools/project/core/src/test/standard.xml Tue Jun 8 06:23:58 2004 @@ -3,11 +3,15 @@ <x:home/> - <target name="clean"> + <target name="init"> + <x:info/> + </target> + + <target name="clean" depends="init"> <x:clean/> </target> - <target name="prepare" depends=""> + <target name="prepare" depends="init"> <x:prepare/> </target> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]