notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r1614 - trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r1614 - trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl
- Date: Thu, 20 Jul 2006 08:23:24 +0200
Author: mcconnell
Date: 2006-07-20 08:22:37 +0200 (Thu, 20 Jul 2006)
New Revision: 1614
Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultContext.java
Log:
improve logic concerning association of values to the Ant project (resulting
in reduced verbose output)
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-07-19 18:32:54 UTC (rev 1613)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl/DefaultContext.java
2006-07-20 06:22:37 UTC (rev 1614)
@@ -91,7 +91,13 @@
Library library = resource.getLibrary();
project.addReference( "project.timestamp", new Date() );
- project.setBaseDir( resource.getBaseDir() );
+
+ File basedir = resource.getBaseDir();
+ if( !basedir.equals( project.getBaseDir() ) )
+ {
+ project.setBaseDir( resource.getBaseDir() );
+ }
+
project.addReference( "project.context", this );
String[] names = resource.getPropertyNames();
@@ -99,13 +105,14 @@
{
String name = names[i];
String value = resource.getProperty( name );
- project.setProperty( name, value );
+ setProperty( name, value );
}
- project.setProperty( "project.name", resource.getName() );
- project.setProperty( "project.version", resource.getVersion() );
- project.setProperty( "project.resource.path",
resource.getResourcePath() );
- project.setProperty( "project.basedir",
resource.getBaseDir().toString() );
+ setProperty( "project.name", resource.getName() );
+ setProperty( "project.version", resource.getVersion() );
+ setProperty( "project.resource.path", resource.getResourcePath() );
+ setProperty( "project.basedir", resource.getBaseDir().toString() );
+
Filter[] filters = resource.getFilters();
for( int i=0; i<filters.length; i++ )
{
@@ -124,11 +131,11 @@
}
}
- project.setNewProperty( "project.nl", "\n" );
- project.setNewProperty(
+ setProperty( "project.nl", "\n" );
+ setProperty(
"project.line",
"---------------------------------------------------------------------------\n"
);
- project.setNewProperty(
+ setProperty(
"project.info",
"---------------------------------------------------------------------------\n"
+ resource.getResourcePath()
@@ -136,22 +143,22 @@
+ resource.getVersion()
+
"\n---------------------------------------------------------------------------"
);
- project.setNewProperty( "project.src.dir",
getSrcDirectory().toString() );
- project.setNewProperty( "project.src.main.dir",
getSrcMainDirectory().toString() );
- project.setNewProperty( "project.src.test.dir",
getSrcTestDirectory().toString() );
- project.setNewProperty( "project.etc.dir",
getEtcDirectory().toString() );
- project.setNewProperty( "project.etc.main.dir",
getEtcMainDirectory().toString() );
- project.setNewProperty( "project.etc.test.dir",
getEtcTestDirectory().toString() );
- project.setNewProperty( "project.etc.data.dir",
getEtcDataDirectory().toString() );
+ setProperty( "project.src.dir", getSrcDirectory().toString() );
+ setProperty( "project.src.main.dir",
getSrcMainDirectory().toString() );
+ setProperty( "project.src.test.dir",
getSrcTestDirectory().toString() );
+ setProperty( "project.etc.dir", getEtcDirectory().toString() );
+ setProperty( "project.etc.main.dir",
getEtcMainDirectory().toString() );
+ setProperty( "project.etc.test.dir",
getEtcTestDirectory().toString() );
+ setProperty( "project.etc.data.dir",
getEtcDataDirectory().toString() );
- project.setNewProperty( "project.target.dir",
getTargetDirectory().toString() );
- project.setNewProperty( "project.target.build.main.dir",
getTargetBuildMainDirectory().toString() );
- project.setNewProperty( "project.target.build.test.dir",
getTargetBuildTestDirectory().toString() );
- project.setNewProperty( "project.target.classes.main.dir",
getTargetClassesMainDirectory().toString() );
- project.setNewProperty( "project.target.classes.test.dir",
getTargetClassesTestDirectory().toString() );
- project.setNewProperty( "project.target.deliverables.dir",
getTargetDeliverablesDirectory().toString() );
- project.setNewProperty( "project.target.test.dir",
getTargetTestDirectory().toString() );
- project.setNewProperty( "project.target.reports.dir",
getTargetReportsDirectory().toString() );
+ setProperty( "project.target.dir", getTargetDirectory().toString() );
+ setProperty( "project.target.build.main.dir",
getTargetBuildMainDirectory().toString() );
+ setProperty( "project.target.build.test.dir",
getTargetBuildTestDirectory().toString() );
+ setProperty( "project.target.classes.main.dir",
getTargetClassesMainDirectory().toString() );
+ setProperty( "project.target.classes.test.dir",
getTargetClassesTestDirectory().toString() );
+ setProperty( "project.target.deliverables.dir",
getTargetDeliverablesDirectory().toString() );
+ setProperty( "project.target.test.dir",
getTargetTestDirectory().toString() );
+ setProperty( "project.target.reports.dir",
getTargetReportsDirectory().toString() );
// add listeners declared in the builder configuration
@@ -167,6 +174,20 @@
}
}
+ private void setProperty( String key, String value )
+ {
+ Project project = getProject();
+ String v = project.getProperty( key );
+ if( null == v )
+ {
+ project.setProperty( key, value );
+ }
+ else if( !value.equals( v ) )
+ {
+ project.setProperty( key, value );
+ }
+ }
+
/**
* Initialize the context during which runtime and test path objects are
* established as project references.
- r1614 - trunk/main/depot/tools/builder/src/main/net/dpml/tools/impl, mcconnell at BerliOS, 07/20/2006
Archive powered by MHonArc 2.6.24.