Skip to Content.
Sympa Menu

notify-dpml - r1466 - in trunk/main: depot/tools/builder/etc/prefs/xmls depot/tools/builder/src/main/net/dpml/tools depot/tools/builder/src/main/net/dpml/tools/impl depot/tools/builder/src/main/net/dpml/tools/tasks depot/tools/checkstyle/src/main/net/dpml/tools/checkstyle metro/tools/src/main/net/dpml/metro/tools

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r1466 - in trunk/main: depot/tools/builder/etc/prefs/xmls depot/tools/builder/src/main/net/dpml/tools depot/tools/builder/src/main/net/dpml/tools/impl depot/tools/builder/src/main/net/dpml/tools/tasks depot/tools/checkstyle/src/main/net/dpml/tools/checkstyle metro/tools/src/main/net/dpml/metro/tools
  • Date: Sun, 28 May 2006 19:49:51 +0200

Author: mcconnell
Date: 2006-05-28 19:49:29 +0200 (Sun, 28 May 2006)
New Revision: 1466

Added:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/Context.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/Processor.java

trunk/main/depot/tools/builder/src/main/net/dpml/tools/ProcessorNotFoundException.java

trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/AbstractProcessor.java

trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardProcess.java
Removed:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/model/
trunk/main/depot/tools/builder/src/main/net/dpml/tools/process/
Modified:
trunk/main/depot/tools/builder/etc/prefs/xmls/builder.xml

trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultContext.java

trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultWorkbench.java

trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuildListener.java

trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuilder.java

trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/GenericTask.java

trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/InitializationTask.java

trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/JUnitTestTask.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/JavacTask.java

trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/ModuleTask.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PartTask.java

trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PluginTask.java

trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PrepareTask.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/RMICTask.java

trunk/main/depot/tools/checkstyle/src/main/net/dpml/tools/checkstyle/CheckstyleTask.java
trunk/main/metro/tools/src/main/net/dpml/metro/tools/EntryDataType.java
trunk/main/metro/tools/src/main/net/dpml/metro/tools/TypesTask.java
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ValueDataType.java
Log:
rationalization of the builder project

Modified: trunk/main/depot/tools/builder/etc/prefs/xmls/builder.xml
===================================================================
--- trunk/main/depot/tools/builder/etc/prefs/xmls/builder.xml 2006-05-28
15:29:23 UTC (rev 1465)
+++ trunk/main/depot/tools/builder/etc/prefs/xmls/builder.xml 2006-05-28
17:49:29 UTC (rev 1466)
@@ -11,14 +11,6 @@
<listeners>
<listener name="standard"
class="net.dpml.tools.impl.StandardBuildListener" priority="0"/>
</listeners>
-
- <!--
- <processors>
- <processor name="jar" class="net.dpml.tools.process.JarProcess"/>
- <processor name="part" class="net.dpml.tools.process.PluginProcess"
depends="jar"/>
- <processor name="module" class="net.dpml.tools.process.ModuleProcess"/>
- </processors>
- -->

</builder>


Copied: trunk/main/depot/tools/builder/src/main/net/dpml/tools/Context.java
(from rev 1463,
trunk/main/depot/tools/builder/src/main/net/dpml/tools/model/Context.java)
===================================================================
--- trunk/main/depot/tools/builder/src/main/net/dpml/tools/model/Context.java
2006-05-27 06:27:11 UTC (rev 1463)
+++ trunk/main/depot/tools/builder/src/main/net/dpml/tools/Context.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -0,0 +1,290 @@
+/*
+ * Copyright 2005 Stephen J. McConnell.
+ *
+ * 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 net.dpml.tools;
+
+import java.io.File;
+
+import net.dpml.library.Library;
+import net.dpml.library.Resource;
+import net.dpml.library.info.Scope;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Path;
+
+/**
+ * Project context.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public interface Context
+{
+ /**
+ * Return the associated project.
+ * @return the ant project
+ */
+ Project getProject();
+
+ /**
+ * Return the value of a property.
+ * @param key the property key
+ * @return the property value or null if undefined
+ */
+ String getProperty( String key );
+
+ /**
+ * Return the value of a property. If the project contains a declaration
+ * for the property then that value will be returned, otherwise the
property
+ * will be resolved relative to the current resource.
+ *
+ * @param key the property key
+ * @param value the default value
+ * @return the property value or null if undefined
+ */
+ String getProperty( String key, String value );
+
+ /**
+ * Return an array of processors.
+ * @return the processor array
+ */
+ Processor[] getProcessors();
+
+ /**
+ *Initialize the context.
+ */
+ void init();
+
+ /**
+ * Return an Ant path suitable for compile or runtime usage. If the
supplied scope is
+ * less than Scope.RUNTIME a runtime path is returned otherwise the test
path is
+ * returned.
+ *
+ * @param scope the build scope
+ * @return the path object
+ */
+ Path getPath( Scope scope );
+
+ /**
+ * Return the active resource.
+ * @return the resource definition
+ */
+ Resource getResource();
+
+ /**
+ * Return the resource library.
+ * @return the library
+ */
+ Library getLibrary();
+
+ /**
+ * Return the project source directory.
+ * @return the directory
+ */
+ File getSrcDirectory();
+
+ /**
+ * Return the project source main directory.
+ * @return the directory
+ */
+ File getSrcMainDirectory();
+
+ /**
+ * Return the project source test directory.
+ * @return the directory
+ */
+ File getSrcTestDirectory();
+
+ /**
+ * Return the project source docs directory.
+ * @return the directory
+ */
+ File getSrcDocsDirectory();
+
+ /**
+ * Return the project etc directory.
+ * @return the directory
+ */
+ File getEtcDirectory();
+
+ /**
+ * Return the project etc/main directory.
+ * @return the directory
+ */
+ File getEtcMainDirectory();
+
+ /**
+ * Return the project etc/test directory.
+ * @return the directory
+ */
+ File getEtcTestDirectory();
+
+ /**
+ * Return the project etc/data directory.
+ * @return the directory
+ */
+ File getEtcDataDirectory();
+
+ /**
+ * Return the project target directory.
+ * @return the directory
+ */
+ File getTargetDirectory();
+
+ /**
+ * Return a directory within the target directory.
+ * @param path the path
+ * @return the directory
+ */
+ File getTargetDirectory( String path );
+
+ /**
+ * Return the project target temp directory.
+ * @return the directory
+ */
+ File getTargetTempDirectory();
+
+ /**
+ * Return the project target build directory.
+ * @return the directory
+ */
+ File getTargetBuildDirectory();
+
+ /**
+ * Return the project target build main directory.
+ * @return the directory
+ */
+ File getTargetBuildMainDirectory();
+
+ /**
+ * Return the project target build test directory.
+ * @return the directory
+ */
+ File getTargetBuildTestDirectory();
+
+ /**
+ * Return the project target build docs directory.
+ * @return the directory
+ */
+ File getTargetBuildDocsDirectory();
+
+ /**
+ * Return the project target root classes directory.
+ * @return the directory
+ */
+ File getTargetClassesDirectory();
+
+ /**
+ * Return the project target main classes directory.
+ * @return the directory
+ */
+ File getTargetClassesMainDirectory();
+
+ /**
+ * Return the project target test classes directory.
+ * @return the directory
+ */
+ File getTargetClassesTestDirectory();
+
+ /**
+ * Return the project target reports directory.
+ * @return the directory
+ */
+ File getTargetReportsDirectory();
+
+ /**
+ * Return the project target test reports directory.
+ * @return the directory
+ */
+ File getTargetReportsTestDirectory();
+
+ /**
+ * Return the project target main reports directory.
+ * @return the directory
+ */
+ File getTargetReportsMainDirectory();
+
+ /**
+ * Return the project target javadoc reports directory.
+ * @return the directory
+ */
+ File getTargetReportsJavadocDirectory();
+
+ /**
+ * Return the project target reports docs directory.
+ * @return the directory
+ */
+ File getTargetDocsDirectory();
+
+ /**
+ * Return the project target test directory.
+ * @return the directory
+ */
+ File getTargetTestDirectory();
+
+ /**
+ * Return the project target deliverables directory.
+ * @return the directory
+ */
+ File getTargetDeliverablesDirectory();
+
+ /**
+ * Return the project target deliverables directory.
+ * @param type the deliverable type
+ * @return the directory
+ */
+ File getTargetDeliverable( String type );
+
+ /**
+ * Create a file relative to the resource basedir.
+ * @param path the relative path
+ * @return the directory
+ */
+ File createFile( String path );
+
+ /**
+ * Return a filename using the layout strategy employed by the cache.
+ * @param id the artifact type
+ * @return the filename
+ */
+ String getLayoutPath( String id );
+
+ /**
+ * Utility operation to construct a new classpath path instance.
+ * @param scope the build scope
+ * @return the path
+ */
+ Path createPath( Scope scope );
+
+ /**
+ * Utility operation to construct a new path using a supplied array of
resources.
+ * @param resources the resource to use in path construction
+ * @return the path
+ */
+ Path createPath( Resource[] resources );
+
+ /**
+ * Utility operation to construct a new path using a supplied array of
resources.
+ * @param resources the resources to use in path construction
+ * @param resolve if true force local caching of the artifact
+ * @param filter if true restrict path entries to resources that produce
jars
+ * @return the path
+ */
+ Path createPath( Resource[] resources, boolean resolve, boolean filter );
+}
+

Copied: trunk/main/depot/tools/builder/src/main/net/dpml/tools/Processor.java
(from rev 1464,
trunk/main/depot/tools/builder/src/main/net/dpml/tools/model/Processor.java)
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/model/Processor.java
2006-05-28 15:17:18 UTC (rev 1464)
+++ trunk/main/depot/tools/builder/src/main/net/dpml/tools/Processor.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2005-2006 Stephen J. McConnell
+ *
+ * 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 net.dpml.tools;
+
+/**
+ * The Processor interface is implemented by phase-aware build processors.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public interface Processor
+{
+ /**
+ * Handle cleanup.
+ * @param context the working context
+ */
+ void clean( Context context );
+
+ /**
+ * Handle initialization.
+ * @param context the working context
+ */
+ void initialize( Context context );
+
+ /**
+ * Handle supplimentary codebase preparation.
+ * @param context the working context
+ */
+ void prepare( Context context );
+
+ /**
+ * Handle type-specific construction in preparation for
+ * data packaging.
+ * @param context the working context
+ */
+ void build( Context context );
+
+ /**
+ * Packaging of type-specific data.
+ * @param context the working context
+ */
+ void pack( Context context );
+
+ /**
+ * Datatype validation.
+ * @param context the working context
+ */
+ void validate( Context context );
+
+ /**
+ * Post installation actions.
+ * @param context the working context
+ */
+ void install( Context context );
+}

Copied:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/ProcessorNotFoundException.java
(from rev 1463,
trunk/main/depot/tools/builder/src/main/net/dpml/tools/model/ProcessorNotFoundException.java)
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/model/ProcessorNotFoundException.java
2006-05-27 06:27:11 UTC (rev 1463)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/ProcessorNotFoundException.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2005 Stephen J. McConnell
+ *
+ * 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 net.dpml.tools;
+
+/**
+ * A ProcessorNotFoundException is thrown when a requested for a named
+ * processor cannot be resolved.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class ProcessorNotFoundException extends Exception
+{
+ /**
+ * Creation of a new ProcessorNotFoundException.
+ * @param message the exception message
+ */
+ public ProcessorNotFoundException( String message )
+ {
+ this( message, null );
+ }
+
+ /**
+ * Creation of a new ProcessorNotFoundException.
+ * @param message the exception message
+ * @param cause the causal excetion
+ */
+ public ProcessorNotFoundException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+}

Copied:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/AbstractProcessor.java
(from rev 1465,
trunk/main/depot/tools/builder/src/main/net/dpml/tools/process/AbstractProcessor.java)
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/process/AbstractProcessor.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/AbstractProcessor.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2005 Stephen J. McConnell
+ *
+ * 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 net.dpml.tools.impl;
+
+import net.dpml.tools.Context;
+import net.dpml.tools.Processor;
+
+/**
+ * Abstract build processor.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class AbstractProcessor implements Processor
+{
+ /**
+ * Handle cleanup.
+ * @param context the working context
+ */
+ public void clean( Context context )
+ {
+ }
+
+ /**
+ * Handle initialization.
+ * @param context the working context
+ */
+ public void initialize( Context context )
+ {
+ }
+
+ /**
+ * Handle supplimentary codebase preparation.
+ * @param context the working context
+ */
+ public void prepare( Context context )
+ {
+ }
+
+ /**
+ * Handle type-specific construction in preparation for
+ * data packaging.
+ * @param context the working context
+ */
+ public void build( Context context )
+ {
+ }
+
+ /**
+ * Packaging of type-specific data.
+ * @param context the working context
+ */
+ public void pack( Context context )
+ {
+ }
+
+ /**
+ * Datatype validation.
+ * @param context the working context
+ */
+ public void validate( Context context )
+ {
+ }
+
+ /**
+ * Post installation actions.
+ * @param context the working context
+ */
+ public void install( Context context )
+ {
+ }
+}

Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultContext.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultContext.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultContext.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -39,8 +39,8 @@
import net.dpml.tools.info.ListenerDirective;
import net.dpml.tools.info.ProcessorDirective;

-import net.dpml.tools.model.Context;
-import net.dpml.tools.model.Processor;
+import net.dpml.tools.Context;
+import net.dpml.tools.Processor;

import net.dpml.transit.Artifact;
import net.dpml.transit.Transit;

Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultWorkbench.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultWorkbench.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultWorkbench.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -26,6 +26,7 @@
import net.dpml.library.Library;
import net.dpml.library.Resource;
import net.dpml.library.Type;
+
import net.dpml.tools.info.ProcessorDirective;

/**

Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuildListener.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuildListener.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuildListener.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -18,11 +18,9 @@

package net.dpml.tools.impl;

-import net.dpml.tools.model.Context;
-import net.dpml.tools.model.Processor;
+import net.dpml.tools.Context;
+import net.dpml.tools.Processor;

-import net.dpml.tools.process.StandardProcess;
-
import org.apache.tools.ant.BuildListener;
import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.Target;
@@ -30,8 +28,9 @@

/**
* Standard build listener. The implementation provides support
- * for codebase structure normalization, and delegation of type-specific
- * build functions to build processors.
+ * for codebase structure normalization and execution of common build
+ * procedures conditional to the presence of specific target directories
+ * and declared resource production types.
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
@@ -39,7 +38,7 @@
public class StandardBuildListener implements BuildListener
{
private final Context m_context;
- private final StandardProcess m_standard;
+ private final Processor m_standard;

/**
* Creation of a new standard build listener.
@@ -92,76 +91,40 @@
{
Target target = event.getTarget();
String targetName = target.getName();
- Processor[] processors = m_context.getProcessors();
if( "clean".equals( targetName ) )
{
event.getProject().log( "executing clenup phase",
Project.MSG_VERBOSE );
m_standard.clean( m_context );
- for( int i=0; i<processors.length; i++ )
- {
- Processor processor = processors[i];
- processor.clean( m_context );
- }
}
if( "init".equals( targetName ) )
{
event.getProject().log( "executing initialization phase",
Project.MSG_VERBOSE );
m_standard.initialize( m_context );
- for( int i=0; i<processors.length; i++ )
- {
- Processor processor = processors[i];
- processor.initialize( m_context );
- }
}
else if( "prepare".equals( targetName ) )
{
event.getProject().log( "executing preparation phase",
Project.MSG_VERBOSE );
m_standard.prepare( m_context );
- for( int i=0; i<processors.length; i++ )
- {
- Processor processor = processors[i];
- processor.prepare( m_context );
- }
}
else if( "build".equals( targetName ) )
{
event.getProject().log( "executing build phase",
Project.MSG_VERBOSE );
m_standard.build( m_context );
- for( int i=0; i<processors.length; i++ )
- {
- Processor processor = processors[i];
- processor.build( m_context );
- }
}
else if( "package".equals( targetName ) )
{
event.getProject().log( "executing packaging phase",
Project.MSG_VERBOSE );
m_standard.pack( m_context );
- for( int i=0; i<processors.length; i++ )
- {
- Processor processor = processors[i];
- processor.pack( m_context );
- }
}
else if( "test".equals( targetName ) )
{
event.getProject().log( "executing validation phase",
Project.MSG_VERBOSE );
m_standard.validate( m_context );
- for( int i=0; i<processors.length; i++ )
- {
- Processor processor = processors[i];
- processor.validate( m_context );
- }
}
else if( "install".equals( targetName ) )
{
event.getProject().log( "executing installation phase",
Project.MSG_VERBOSE );
m_standard.install( m_context );
- for( int i=0; i<processors.length; i++ )
- {
- Processor processor = processors[i];
- processor.install( m_context );
- }
}
}


Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuilder.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuilder.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardBuilder.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -27,7 +27,7 @@
import net.dpml.library.Library;
import net.dpml.library.Resource;

-import net.dpml.tools.model.Context;
+import net.dpml.tools.Context;
import net.dpml.tools.info.BuilderDirective;
import net.dpml.tools.info.BuilderDirectiveHelper;


Copied:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardProcess.java
(from rev 1465,
trunk/main/depot/tools/builder/src/main/net/dpml/tools/process/StandardProcess.java)
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/process/StandardProcess.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/StandardProcess.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -0,0 +1,298 @@
+/*
+ * Copyright 2005 Stephen J. McConnell
+ *
+ * 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 net.dpml.tools.impl;
+
+import java.io.File;
+
+import net.dpml.library.Resource;
+import net.dpml.library.Type;
+import net.dpml.library.info.Scope;
+import net.dpml.library.info.JarTypeDirective;
+
+import net.dpml.tools.Context;
+
+import net.dpml.tools.tasks.PrepareTask;
+import net.dpml.tools.tasks.InstallTask;
+import net.dpml.tools.tasks.JavacTask;
+import net.dpml.tools.tasks.JarTask;
+import net.dpml.tools.tasks.JUnitTestTask;
+import net.dpml.tools.tasks.ModuleTask;
+import net.dpml.tools.tasks.RMICTask;
+import net.dpml.tools.tasks.PartTask;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Delete;
+
+/**
+ * Standard process dealing with context initialization, codfebase
+ * normalization, and artifact installation.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class StandardProcess extends AbstractProcessor
+{
+ /**
+ * Handles context initialization during which path definitions
+ * for runtime and test concerns are bound to the active project.
+ *
+ * @param context the working context
+ */
+ public void initialize( Context context )
+ {
+ }
+
+ /**
+ * Handles normalization of a codebase during which a working copy of
+ * the codebase is created under the target/build directory. Global
+ * filters are applied and merging of the src/main with etc/main and
+ * src/test wityh etc/test is undertaken.
+ *
+ * @param context the working context
+ */
+ public void prepare( Context context )
+ {
+ context.init();
+ context.getProject().log( "commencing preparation",
Project.MSG_VERBOSE );
+ Project project = context.getProject();
+ final PrepareTask task = new PrepareTask();
+ task.setProject( project );
+ task.setTaskName( "prepare" );
+ task.init();
+ task.execute();
+ context.getProject().log( "preparation complete",
Project.MSG_VERBOSE );
+ }
+
+ /**
+ * Handles build related concerns based on the target directory layout
content.
+ *
+ * @param context the working context
+ */
+ public void build( Context context )
+ {
+ // If a target/build/main or target/build/test exists then we should
be
+ // triggering content compilation. Compilation requires project
input
+ // with respect to javac source selection and subsequent rmic
+ // postprocessing (both of which can be expressed as process data
associated
+ // with the target/build/main and target/build/test directories). In
addition
+ // there may be additional processes that need to be triggered (such
as
+ // type compilation which consumes compiled classes).
+
+ if( context.getTargetBuildMainDirectory().exists() )
+ {
+ // we need to add in here the aquisition of javac task
+ // parameters based on transformation directives associated
+ // with the target/classes/main directory
+
+ Project project = context.getProject();
+ final JavacTask task = new JavacTask( context );
+ task.setProject( project );
+ task.init();
+ task.execute();
+ }
+
+ // resolve rmic selection
+
+ Resource resource = context.getResource();
+ if( resource.isa( "jar" ) )
+ {
+ Type type = resource.getType( "jar" );
+ if( type instanceof JarTypeDirective )
+ {
+ JarTypeDirective directive = (JarTypeDirective) type;
+ String[] includes = directive.getRMICIncludes();
+ String[] excludes = directive.getRMICExcludes();
+ RMICTask rmicTask = new RMICTask( context );
+ Project project = context.getProject();
+ rmicTask.setProject( project );
+ rmicTask.setIncludes( includes );
+ rmicTask.setExcludes( excludes );
+ rmicTask.init();
+ rmicTask.execute();
+ }
+ }
+
+ // conditionaly compile test classes
+
+ File source = context.getTargetBuildTestDirectory();
+ if( source.exists() )
+ {
+ // we need to add in here the aquisition of javac task
+ // parameters based on transformation directives associated
+ // with the target/classes/main directory
+
+ Project project = context.getProject();
+ final JavacTask task = new JavacTask( context );
+ task.setProject( project );
+ File destination = context.getTargetClassesTestDirectory();
+ task.setSrc( source );
+ task.setDest( destination );
+ Path path = context.getPath( Scope.TEST );
+ File main = context.getTargetClassesMainDirectory();
+ if( main.exists() )
+ {
+ path.createPathElement().setLocation( main );
+ }
+ task.setClasspath( path );
+ task.init();
+ task.execute();
+ }
+ }
+
+ /**
+ * Packaging of type-specific data.
+ * @param context the working context
+ */
+ public void pack( Context context )
+ {
+ Project project = context.getProject();
+ Resource resource = context.getResource();
+
+ // handle jar file packaging
+
+ if( resource.isa( "jar" ) )
+ {
+ File base = context.getTargetClassesMainDirectory();
+ final File jar = getJarFile( context );
+ if( base.exists() )
+ {
+ final JarTask task = new JarTask();
+ task.setProject( project );
+ task.setTaskName( "jar" );
+ task.setSrc( base );
+ task.setDest( jar );
+ task.init();
+ task.execute();
+ }
+ }
+
+ // handle part production
+
+ if( resource.isa( "part" ) )
+ {
+ try
+ {
+ PartTask task = new PartTask();
+ task.setProject( project );
+ task.setTaskName( "part" );
+ task.init();
+ task.execute();
+ }
+ catch( BuildException e )
+ {
+ throw e;
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected failure during part externalization.";
+ throw new BuildException( error, e );
+ }
+ }
+
+ // handle module export
+
+ if( resource.isa( "module" ) )
+ {
+ final ModuleTask task = new ModuleTask();
+ task.setProject( project );
+ task.setTaskName( "module" );
+ task.init();
+ task.execute();
+ }
+ }
+
+ /**
+ * Datatype validation.
+ * @param context the working context
+ */
+ public void validate( Context context )
+ {
+ Project project = context.getProject();
+ File src = context.getTargetBuildTestDirectory();
+ if( src.exists() )
+ {
+ Path path = context.getPath( Scope.TEST );
+ final File jar = getJarFile( context );
+ if( jar.exists() )
+ {
+ path.createPathElement().setLocation( jar );
+ }
+ else if( context.getTargetClassesMainDirectory().exists() )
+ {
+ File main = context.getTargetClassesMainDirectory();
+ path.createPathElement().setLocation( main );
+ }
+ final File dest = context.getTargetClassesTestDirectory();
+ path.createPathElement().setLocation( dest );
+ final JUnitTestTask task = new JUnitTestTask();
+ task.setProject( project );
+ task.setTaskName( "junit" );
+ task.setSrc( src );
+ task.setClasspath( path );
+ task.init();
+ task.execute();
+ }
+ }
+
+ /**
+ * Handles replication of content under target/deliverables to the
+ * common cache directory - includes validation of the presence of
declared
+ * artifacts during execution.
+ *
+ * @param context the working context
+ */
+ public void install( Context context )
+ {
+ Project project = context.getProject();
+ final InstallTask task = new InstallTask();
+ task.setProject( project );
+ task.setTaskName( "install" );
+ task.init();
+ task.execute();
+ }
+
+ /**
+ * Handles cleanup of generated content.
+ *
+ * @param context the working context
+ */
+ public void clean( Context context )
+ {
+ File dir = context.getTargetDirectory();
+ Project project = context.getProject();
+ final Delete task = new Delete();
+ task.setProject( project );
+ task.setTaskName( "delete" );
+ task.setDir( dir );
+ task.init();
+ task.execute();
+ }
+
+ private File getJarFile( Context context )
+ {
+ Project project = context.getProject();
+ File deliverables = context.getTargetDeliverablesDirectory();
+ File jars = new File( deliverables, "jars" );
+ String filename = context.getLayoutPath( "jar" );
+ return new File( jars, filename );
+ }
+}

Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/GenericTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/GenericTask.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/GenericTask.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -20,7 +20,7 @@

import java.io.File;

-import net.dpml.tools.model.Context;
+import net.dpml.tools.Context;
import net.dpml.tools.impl.DefaultContext;

import net.dpml.library.Library;

Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/InitializationTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/InitializationTask.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/InitializationTask.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -20,7 +20,7 @@

import java.util.ArrayList;

-import net.dpml.tools.model.Context;
+import net.dpml.tools.Context;

/**
* General initialization during which context establishment is

Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/JUnitTestTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/JUnitTestTask.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/JUnitTestTask.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -23,7 +23,7 @@

import net.dpml.library.info.Scope;

-import net.dpml.tools.model.Context;
+import net.dpml.tools.Context;

import net.dpml.transit.Transit;


Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/JavacTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/JavacTask.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/JavacTask.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -23,7 +23,7 @@
import net.dpml.library.Resource;
import net.dpml.library.info.Scope;

-import net.dpml.tools.model.Context;
+import net.dpml.tools.Context;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;

Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/ModuleTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/ModuleTask.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/ModuleTask.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -27,7 +27,7 @@
import net.dpml.library.info.ModuleDirective;
import net.dpml.library.info.LibraryEncoder;

-import net.dpml.tools.model.Context;
+import net.dpml.tools.Context;

import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildException;

Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PartTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PartTask.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PartTask.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -38,7 +38,7 @@

import net.dpml.transit.Artifact;

-import net.dpml.tools.model.Context;
+import net.dpml.tools.Context;

import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildException;

Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PluginTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PluginTask.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PluginTask.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -22,7 +22,7 @@
import net.dpml.library.Resource;
import net.dpml.library.ResourceNotFoundException;

-import net.dpml.tools.model.Context;
+import net.dpml.tools.Context;

import org.apache.tools.ant.BuildException;


Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PrepareTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PrepareTask.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PrepareTask.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -22,7 +22,7 @@

import net.dpml.library.Resource;

-import net.dpml.tools.model.Context;
+import net.dpml.tools.Context;

import org.apache.tools.ant.Project;


Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/RMICTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/RMICTask.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/RMICTask.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -22,7 +22,7 @@

import net.dpml.library.info.Scope;

-import net.dpml.tools.model.Context;
+import net.dpml.tools.Context;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;

Modified:
trunk/main/depot/tools/checkstyle/src/main/net/dpml/tools/checkstyle/CheckstyleTask.java
===================================================================
---
trunk/main/depot/tools/checkstyle/src/main/net/dpml/tools/checkstyle/CheckstyleTask.java
2006-05-28 15:29:23 UTC (rev 1465)
+++
trunk/main/depot/tools/checkstyle/src/main/net/dpml/tools/checkstyle/CheckstyleTask.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -27,7 +27,7 @@
import net.dpml.library.Resource;
import net.dpml.library.Module;

-import net.dpml.tools.model.Context;
+import net.dpml.tools.Context;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.types.FileSet;

Modified:
trunk/main/metro/tools/src/main/net/dpml/metro/tools/EntryDataType.java
===================================================================
--- trunk/main/metro/tools/src/main/net/dpml/metro/tools/EntryDataType.java
2006-05-28 15:29:23 UTC (rev 1465)
+++ trunk/main/metro/tools/src/main/net/dpml/metro/tools/EntryDataType.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -21,9 +21,10 @@
import java.net.URI;
import java.net.URISyntaxException;

+import net.dpml.component.Directive;
+
import net.dpml.metro.info.PartReference;
import net.dpml.metro.data.ValueDirective;
-import net.dpml.component.Directive;
import net.dpml.metro.data.LookupDirective;
import net.dpml.metro.data.NullDirective;
import net.dpml.metro.data.FeatureDirective;

Modified: trunk/main/metro/tools/src/main/net/dpml/metro/tools/TypesTask.java
===================================================================
--- trunk/main/metro/tools/src/main/net/dpml/metro/tools/TypesTask.java
2006-05-28 15:29:23 UTC (rev 1465)
+++ trunk/main/metro/tools/src/main/net/dpml/metro/tools/TypesTask.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -26,13 +26,13 @@
import java.util.List;
import java.beans.IntrospectionException;

-import net.dpml.tools.tasks.GenericTask;
-
import net.dpml.library.info.Scope;

import net.dpml.metro.info.Type;
import net.dpml.metro.builder.ComponentTypeEncoder;

+import net.dpml.tools.tasks.GenericTask;
+
import org.apache.tools.ant.AntClassLoader;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DynamicElementNS;

Modified:
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ValueDataType.java
===================================================================
--- trunk/main/metro/tools/src/main/net/dpml/metro/tools/ValueDataType.java
2006-05-28 15:29:23 UTC (rev 1465)
+++ trunk/main/metro/tools/src/main/net/dpml/metro/tools/ValueDataType.java
2006-05-28 17:49:29 UTC (rev 1466)
@@ -21,10 +21,10 @@
import java.util.ArrayList;
import java.util.List;

+import net.dpml.lang.Value;
+
import net.dpml.metro.data.ValueDirective;

-import net.dpml.lang.Value;
-
import org.apache.tools.ant.BuildException;

/**




  • r1466 - in trunk/main: depot/tools/builder/etc/prefs/xmls depot/tools/builder/src/main/net/dpml/tools depot/tools/builder/src/main/net/dpml/tools/impl depot/tools/builder/src/main/net/dpml/tools/tasks depot/tools/checkstyle/src/main/net/dpml/tools/checkstyle metro/tools/src/main/net/dpml/metro/tools, mcconnell at BerliOS, 05/28/2006

Archive powered by MHonArc 2.6.24.

Top of Page