Skip to Content.
Sympa Menu

notify-dpml - r1721 - in trunk: main/depot/library/src/main/net/dpml/library main/depot/plugins/checkstyle/src/main/net/dpml/tools/checkstyle tutorials

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: r1721 - in trunk: main/depot/library/src/main/net/dpml/library main/depot/plugins/checkstyle/src/main/net/dpml/tools/checkstyle tutorials
  • Date: Mon, 7 Aug 2006 09:28:29 +0200

Author: mcconnell
Date: 2006-08-07 09:28:27 +0200 (Mon, 07 Aug 2006)
New Revision: 1721

Modified:
trunk/main/depot/library/src/main/net/dpml/library/Resource.java

trunk/main/depot/plugins/checkstyle/src/main/net/dpml/tools/checkstyle/CheckstyleTask.java
trunk/tutorials/build.xml
Log:
elimination of checkstyle errors and update to checkstyle task to handle
implicit expansion of includes

Modified: trunk/main/depot/library/src/main/net/dpml/library/Resource.java
===================================================================
--- trunk/main/depot/library/src/main/net/dpml/library/Resource.java
2006-08-07 05:00:39 UTC (rev 1720)
+++ trunk/main/depot/library/src/main/net/dpml/library/Resource.java
2006-08-07 07:28:27 UTC (rev 1721)
@@ -38,6 +38,9 @@
*/
public interface Resource extends Dictionary, Resolver
{
+ /**
+ * System property name used to declare the decimal versioning enabled
flag.
+ */
public static final String DECIMAL_VERSIONING_KEY =
"project.decimal.versioning.enabled";

/**

Modified:
trunk/main/depot/plugins/checkstyle/src/main/net/dpml/tools/checkstyle/CheckstyleTask.java
===================================================================
---
trunk/main/depot/plugins/checkstyle/src/main/net/dpml/tools/checkstyle/CheckstyleTask.java
2006-08-07 05:00:39 UTC (rev 1720)
+++
trunk/main/depot/plugins/checkstyle/src/main/net/dpml/tools/checkstyle/CheckstyleTask.java
2006-08-07 07:28:27 UTC (rev 1721)
@@ -29,6 +29,7 @@

import net.dpml.tools.Context;

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

@@ -54,6 +55,20 @@

private boolean m_init = false;
private Context m_context;
+ private boolean m_implicit = true;
+
+ /**
+ * Set the implicit inclusion of the current resource (and potentially
+ * the resources children if the resource is a module). If implicit
+ * file inclusion is disabled then resources must be declared using an
+ * explicit fileset.
+ *
+ * @param flag false if implicit inclusion is to be disabled
+ */
+ public void setImplicit( boolean flag )
+ {
+ m_implicit = flag;
+ }

/**
* Task initialization.
@@ -71,9 +86,7 @@
"Missing 'project.context' reference.";
throw new IllegalStateException( error );
}
- Resource resource = m_context.getResource();
- addTargetToFileset( resource );
-
+
String defaultFormat = "local:format:dpml/tools/dpml";
String spec = m_context.getProperty( FORMAT_KEY, FORMAT_VALUE );
if( !spec.startsWith( "local:" ) )
@@ -104,36 +117,61 @@
}
m_init = true;
}
-
- private void addTargetToFileset( Resource resource )
+
+ /**
+ * Execute the checkstyle check.
+ */
+ public void execute()
{
- File file = resource.getBaseDir();
- File main = new File( file, "target/build/main" );
- if( main.exists() )
+ Resource resource = m_context.getResource();
+ if( m_implicit )
{
- FileSet fileset = new FileSet();
- fileset.setDir( main );
- fileset.setIncludes( "**/*.java" );
- super.addFileset( fileset );
+ addTargetToFileset( resource );
}
- File test = new File( file, "target/build/test" );
- if( test.exists() )
+ super.execute();
+ }
+
+ private void addTargetToFileset( Resource resource )
+ {
+ try
{
- FileSet fileset = new FileSet();
- fileset.setDir( test );
- fileset.setIncludes( "**/*.java" );
- super.addFileset( fileset );
- }
- if( resource instanceof Module )
- {
- Module module = (Module) resource;
- Resource[] children = module.getResources();
- for( int i=0; i < children.length; i++ )
+ File file = resource.getBaseDir();
+ Project project = getProject();
+ //File main = new File( file, "target/build/main" );
+ File main = new File( file, "src/main" );
+ if( main.exists() )
{
- Resource child = children[i];
- addTargetToFileset( child );
+ FileSet fileset = new FileSet();
+ fileset.setDir( main );
+ fileset.setIncludes( "**/*.java" );
+ super.addFileset( fileset );
}
+ //File test = new File( file, "target/build/test" );
+ File test = new File( file, "src/test" );
+ if( test.exists() )
+ {
+ FileSet fileset = new FileSet();
+ fileset.setDir( test );
+ fileset.setIncludes( "**/*.java" );
+ super.addFileset( fileset );
+ }
+ if( resource instanceof Module )
+ {
+ Module module = (Module) resource;
+ Resource[] children = module.getResources();
+ for( int i=0; i < children.length; i++ )
+ {
+ Resource child = children[i];
+ addTargetToFileset( child );
+ }
+ }
}
+ catch( Exception e )
+ {
+ final String error =
+ "Internal error while attempting to construct implicit fileset
for the resource: " + resource;
+ throw new BuildException( error, e, getLocation() );
+ }
}

private Context getContext()

Modified: trunk/tutorials/build.xml
===================================================================
--- trunk/tutorials/build.xml 2006-08-07 05:00:39 UTC (rev 1720)
+++ trunk/tutorials/build.xml 2006-08-07 07:28:27 UTC (rev 1721)
@@ -31,12 +31,12 @@
<task class="net.dpml.tools.checkstyle.CheckstyleTask"
name="checkstyle"/>
</x:plugin>
<mkdir dir="${checkstyle.dir}"/>
- <checkstyle>
+ <checkstyle implicit="false">
<formatter type="xml" toFile="${checkstyle.data}"/>
<fileset dir=".">
+ <exclude name="**/target/**/*.*"/>
<include name="**/src/main/**/*.java"/>
<include name="**/src/test/**/*.java"/>
- <exclude name="**/target/**/*.*"/>
</fileset>
</checkstyle>
<xslt style="${dpml.prefs}/dpml/tools/xsls/checkstyle-frames.xsl"




  • r1721 - in trunk: main/depot/library/src/main/net/dpml/library main/depot/plugins/checkstyle/src/main/net/dpml/tools/checkstyle tutorials, mcconnell at BerliOS, 08/07/2006

Archive powered by MHonArc 2.6.24.

Top of Page