Skip to Content.
Sympa Menu

notify-dpml - r1706 - in trunk: . central/site/src/docs/about/download main main/depot/build/src/main/net/dpml/library/console main/depot/library main/depot/library/src/main/net/dpml/library main/depot/library/src/main/net/dpml/library/impl main/depot/library/src/test/net/dpml/library/impl main/depot/tools main/depot/tools/src/main/net/dpml/tools/tasks

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: r1706 - in trunk: . central/site/src/docs/about/download main main/depot/build/src/main/net/dpml/library/console main/depot/library main/depot/library/src/main/net/dpml/library main/depot/library/src/main/net/dpml/library/impl main/depot/library/src/test/net/dpml/library/impl main/depot/tools main/depot/tools/src/main/net/dpml/tools/tasks
  • Date: Thu, 3 Aug 2006 09:35:48 +0200

Author: mcconnell
Date: 2006-08-03 09:35:29 +0200 (Thu, 03 Aug 2006)
New Revision: 1706

Modified:
trunk/central/site/src/docs/about/download/archive.xml
trunk/index.xml
trunk/main/BUILD.TXT
trunk/main/bootstrap
trunk/main/bootstrap.bat
trunk/main/bootstrap.xml
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
trunk/main/depot/library/bootstrap.xml
trunk/main/depot/library/src/main/net/dpml/library/Dictionary.java
trunk/main/depot/library/src/main/net/dpml/library/Resource.java

trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java

trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultResourceTestCase.java
trunk/main/depot/tools/bootstrap.xml
trunk/main/depot/tools/build.xml
trunk/main/depot/tools/src/main/net/dpml/tools/tasks/InstallTask.java
Log:
1. Add support in the Depot build tool for decimal version handling.
2. Update bootstrap procedure to exclusively generate a BOOTSTRAP versioned
build.

Modified: trunk/central/site/src/docs/about/download/archive.xml
===================================================================
--- trunk/central/site/src/docs/about/download/archive.xml 2006-08-02
19:59:28 UTC (rev 1705)
+++ trunk/central/site/src/docs/about/download/archive.xml 2006-08-03
07:35:29 UTC (rev 1706)
@@ -20,6 +20,70 @@
<subsection name="Build @VERSION@">

<p>
+ Eenhancements:
+ </p>
+
+ <ul>
+ <li>Support in the Depot build tool for multiple versioning
schemes.</li>
+ </ul>
+
+ <table>
+ <tr>
+ <td>Windows NSIS Installer</td>
+ <td>
+ <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-win32-@VERSION@.exe";>
+ dpml-sdk-win32-@VERSION@.exe</a>
+ </td>
+ <td>
+ <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-win32-@VERSION@.exe.md5";>
+ MD5</a>
+ </td>
+ </tr>
+ <tr>
+ <td>Windows Zip Archive</td>
+ <td>
+ <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-win32-@VERSION@.zip";>
+ dpml-sdk-win32-@VERSION@.zip</a>
+ </td>
+ <td>
+ <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-win32-@VERSION@.zip.md5";>
+ MD5</a>
+ </td>
+ </tr>
+ <tr>
+ <td>Linux Archive</td>
+ <td>
+ <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-linux-@VERSION@.tar.gz";>
+ dpml-sdk-linux-@VERSION@.tar.gz</a>
+ </td>
+ <td>
+ <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-linux-@VERSION@.tar.gz.md5";>
+ MD5</a>
+ </td>
+ </tr>
+ <tr>
+ <td>Documentation Archive</td>
+ <td>
+ <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-docs-@VERSION@.zip";>
+ dpml-sdk-docs-@VERSION@.zip</a>
+ </td>
+ <td>
+ <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-docs-@VERSION@.zip.md5";>
+ MD5</a>
+ </td>
+ </tr>
+ </table>
+
+ <p>
+ Online <a href="http://api.dpml.net/dpml/@VERSION@";>Javadoc</a> and
+ <a href="http://www.dpml.net/reports/@VERSION@/junit";>JUnit</a>
reports are available.
+ </p>
+
+ </subsection>
+
+ <subsection name="Build 1.0.0">
+
+ <p>
Resolved issues and/or enhancements:
</p>

@@ -51,52 +115,52 @@
<tr>
<td>Windows NSIS Installer</td>
<td>
- <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-win32-@VERSION@.exe";>
- dpml-sdk-win32-@VERSION@.exe</a>
+ <a
href="http://download.dpml.net/milestones/1.0.0/dpml-sdk-win32-1.0.0.exe";>
+ dpml-sdk-win32-1.0.0.exe</a>
</td>
<td>
- <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-win32-@VERSION@.exe.md5";>
+ <a
href="http://download.dpml.net/milestones/1.0.0/dpml-sdk-win32-1.0.0.exe.md5";>
MD5</a>
</td>
</tr>
<tr>
<td>Windows Zip Archive</td>
<td>
- <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-win32-@VERSION@.zip";>
- dpml-sdk-win32-@VERSION@.zip</a>
+ <a
href="http://download.dpml.net/milestones/1.0.0/dpml-sdk-win32-1.0.0.zip";>
+ dpml-sdk-win32-1.0.0.zip</a>
</td>
<td>
- <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-win32-@VERSION@.zip.md5";>
+ <a
href="http://download.dpml.net/milestones/1.0.0/dpml-sdk-win32-1.0.0.zip.md5";>
MD5</a>
</td>
</tr>
<tr>
<td>Linux Archive</td>
<td>
- <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-linux-@VERSION@.tar.gz";>
- dpml-sdk-linux-@VERSION@.tar.gz</a>
+ <a
href="http://download.dpml.net/milestones/1.0.0/dpml-sdk-linux-1.0.0.tar.gz";>
+ dpml-sdk-linux-1.0.0.tar.gz</a>
</td>
<td>
- <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-linux-@VERSION@.tar.gz.md5";>
+ <a
href="http://download.dpml.net/milestones/1.0.0/dpml-sdk-linux-1.0.0.tar.gz.md5";>
MD5</a>
</td>
</tr>
<tr>
<td>Documentation Archive</td>
<td>
- <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-docs-@VERSION@.zip";>
- dpml-sdk-docs-@VERSION@.zip</a>
+ <a
href="http://download.dpml.net/milestones/1.0.0/dpml-sdk-docs-1.0.0.zip";>
+ dpml-sdk-docs-1.0.0.zip</a>
</td>
<td>
- <a
href="http://download.dpml.net/milestones/@VERSION@/dpml-sdk-docs-@VERSION@.zip.md5";>
+ <a
href="http://download.dpml.net/milestones/1.0.0/dpml-sdk-docs-1.0.0.zip.md5";>
MD5</a>
</td>
</tr>
</table>

<p>
- Online <a href="http://api.dpml.net/dpml/@VERSION@";>Javadoc</a> and
- <a href="http://www.dpml.net/reports/@VERSION@/junit";>JUnit</a>
reports are available.
+ Online <a href="http://api.dpml.net/dpml/1.0.0";>Javadoc</a> and
+ <a href="http://www.dpml.net/reports/1.0.0/junit";>JUnit</a> reports
are available.
</p>

</subsection>

Modified: trunk/index.xml
===================================================================
--- trunk/index.xml 2006-08-02 19:59:28 UTC (rev 1705)
+++ trunk/index.xml 2006-08-03 07:35:29 UTC (rev 1706)
@@ -22,8 +22,6 @@

<properties>
<property name="java.util.logging.config.class" value="dpml"/>
- <property name="project.version-prefix.enabled" value="true"/>
- <property name="project.version-postfix.enabled" value="false"/>
<property name="project.major.version" value="1"/>
<property name="project.minor.version" value="0"/>
<property name="project.micro.version" value="1"/>

Modified: trunk/main/BUILD.TXT
===================================================================
--- trunk/main/BUILD.TXT 2006-08-02 19:59:28 UTC (rev 1705)
+++ trunk/main/BUILD.TXT 2006-08-03 07:35:29 UTC (rev 1706)
@@ -31,12 +31,32 @@
%DPML_HOME%/share/bin. To successfull invoke the build command the bin
directory must be included in your PATH environment variable.

- $ build
+Several options are now available concerning version handling of the
+full build.

+ a) SNAPSHOT
+
+ To create a SNAPSHOT build, use the following command:
+
+ $ build
+
+ b) Explict build versioning:
+
+ To create a versioned build using an explicit build id, use:
+
+ $ build -version ABC
+
+ c) Decimal versioning (release mode).
+
+ To create a versioned build using major, minor and micro
+ version values declared in project defintions (as is typically
+ used in release generation), use:
+
+ $ build -decimal
+
The build procedure will build approximately 42 projects during which a
number
of downloads may occur. On completion the %DPML_HOME%\data\dist directory
will
contain the distribution archives for the installation. Unpack the archive
corresponding to your platform into the %DPML_HOME% root directory.

-
-
+/DMPL

Modified: trunk/main/bootstrap
===================================================================
--- trunk/main/bootstrap 2006-08-02 19:59:28 UTC (rev 1705)
+++ trunk/main/bootstrap 2006-08-03 07:35:29 UTC (rev 1706)
@@ -2,20 +2,17 @@
#
# Utility script that executes the bootstrap build.
#
-# The following command will bootstrap using the SNAPSHOT version identifier.
+# The following command will initate a bootstrap build using the BOOTSTRAP
+# version identifier.
#
# $ bootstrap
#
-# Versioned builds can be invoked using the following command (where '1.0.0'
is the prefix and '123' is the version postfix):
-#
-# $ bootstrap 1.0.0 123
-#

build()
{
STATUS=99
while [ "$STATUS" -eq 99 ] ; do
- ant $BUILD_ID "$@"
+ ant -Ddpml.signature=BOOTSTRAP "$@"
STATUS="$?"
done
if [ "$STATUS" == 0 ] ; then
@@ -116,18 +113,17 @@
depotBuild()
{
cd depot/build
- build clean install
+ build -f bootstrap.xml clean install
cd ../..
}

depotCore()
{
cd depot/core
- build clean install
+ build -f bootstrap.xml clean install
cd ../..
}

-ID=$1
antlibCleanup
xmlSetup
dpmlModule

Modified: trunk/main/bootstrap.bat
===================================================================
--- trunk/main/bootstrap.bat 2006-08-02 19:59:28 UTC (rev 1705)
+++ trunk/main/bootstrap.bat 2006-08-03 07:35:29 UTC (rev 1706)
@@ -144,7 +144,7 @@
@echo on
CD
@echo off
-CALL ant %*
+CALL ant -Dbuild.signature=BOOTSTRAP %*
goto :EOF



Modified: trunk/main/bootstrap.xml
===================================================================
--- trunk/main/bootstrap.xml 2006-08-02 19:59:28 UTC (rev 1705)
+++ trunk/main/bootstrap.xml 2006-08-03 07:35:29 UTC (rev 1706)
@@ -185,8 +185,8 @@
-->

<target name="init" depends="setup">
- <property name="project.version" value="SNAPSHOT"/>
- <property name="build.signature" value="SNAPSHOT"/>
+ <property name="project.version" value="BOOTSTRAP"/>
+ <property name="build.signature" value="BOOTSTRAP"/>
<property name="project.filename"
value="${project.name}-${project.version}.${project.type}"/>
<echo>

#----------------------------------------------------------------------------------

Modified:
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
===================================================================
---
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
2006-08-02 19:59:28 UTC (rev 1705)
+++
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
2006-08-03 07:35:29 UTC (rev 1706)
@@ -111,6 +111,15 @@
}
}

+ if( line.hasOption( DECIMAL_OPTION ) )
+ {
+ System.setProperty( Resource.DECIMAL_VERSIONING_KEY, "true" );
+ if( m_verbose )
+ {
+ getLogger().info( "Enabling decimal versioning." );
+ }
+ }
+
m_library = new DefaultLibrary( logger );

try
@@ -286,6 +295,11 @@
*/
private boolean process( CommandLine line, Resource[] resources ) throws
Exception
{
+ boolean validation = line.hasOption( VALIDATE_OPTION );
+ if( validation )
+ {
+ System.setProperty( "project.validation.enabled", "true" );
+ }
URI uri = (URI) line.getValue( BUILDER_URI_OPTION, ANT_BUILDER_URI );
if( resources.length > 1 )
{
@@ -548,10 +562,17 @@
.withRequired( false )
.create();

+ private static final Option VALIDATE_OPTION =
+ OPTION_BUILDER
+ .withShortName( "validate" )
+ .withDescription( "Enable deliverable validation." )
+ .withRequired( false )
+ .create();
+
private static final Option VERSION_OPTION =
OPTION_BUILDER
.withShortName( "version" )
- .withDescription( "Build output artifact version." )
+ .withDescription( "Build version." )
.withRequired( false )
.withArgument(
ARGUMENT_BUILDER
@@ -562,6 +583,13 @@
.create() )
.create();

+ private static final Option DECIMAL_OPTION =
+ OPTION_BUILDER
+ .withShortName( "decimal" )
+ .withDescription( "Enable decimal versioning." )
+ .withRequired( false )
+ .create();
+
private static final Option BUILDER_URI_OPTION =
OPTION_BUILDER
.withShortName( "plugin" )
@@ -598,6 +626,8 @@
.withOption( VERBOSE_OPTION )
.withOption( BUILDER_URI_OPTION )
.withOption( VERSION_OPTION )
+ .withOption( DECIMAL_OPTION )
+ .withOption( VALIDATE_OPTION )
.withOption( PROPERTY_OPTION )
.create();


Modified: trunk/main/depot/library/bootstrap.xml
===================================================================
--- trunk/main/depot/library/bootstrap.xml 2006-08-02 19:59:28 UTC (rev
1705)
+++ trunk/main/depot/library/bootstrap.xml 2006-08-03 07:35:29 UTC (rev
1706)
@@ -17,9 +17,9 @@

<target name="setup-path" depends="bootstrap.setup-path">
<transit:get property="junit.path" uri="${junit.uri}"/>
- <transit:get property="transit.path"
uri="artifact:jar:dpml/transit/dpml-transit-main#SNAPSHOT"/>
+ <transit:get property="transit.path"
uri="artifact:jar:dpml/transit/dpml-transit-main#BOOTSTRAP"/>
<path id="project.main.path">
- <pathelement
location="${dpml.local.cache}/dpml/transit/jars/dpml-transit-main-SNAPSHOT.jar"/>
+ <pathelement
location="${dpml.local.cache}/dpml/transit/jars/dpml-transit-main-BOOTSTRAP.jar"/>
<pathelement location="${target.classes.dir}"/>
</path>
<path id="project.test.path">

Modified: trunk/main/depot/library/src/main/net/dpml/library/Dictionary.java
===================================================================
--- trunk/main/depot/library/src/main/net/dpml/library/Dictionary.java
2006-08-02 19:59:28 UTC (rev 1705)
+++ trunk/main/depot/library/src/main/net/dpml/library/Dictionary.java
2006-08-03 07:35:29 UTC (rev 1706)
@@ -54,6 +54,22 @@
String getProperty( String key, String value );

/**
+ * Return an boolean property value.
+ * @param key the property key
+ * @param value the default value
+ * @return the property value as an boolean
+ */
+ boolean getBooleanProperty( String key, boolean value );
+
+ /**
+ * Return an integer property value.
+ * @param key the property key
+ * @param value the default value
+ * @return the property value as an integer
+ */
+ int getIntegerProperty( String key, int value );
+
+ /**
* Evaluate and expand any symbolic references in the supplied value.
* @param value the value to resolve
* @return the resolved value

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-02 19:59:28 UTC (rev 1705)
+++ trunk/main/depot/library/src/main/net/dpml/library/Resource.java
2006-08-03 07:35:29 UTC (rev 1706)
@@ -38,6 +38,8 @@
*/
public interface Resource extends Dictionary, Resolver
{
+ public static final String DECIMAL_VERSIONING_KEY =
"project.decimal.versioning.enabled";
+
/**
* Return the singleton library.
* @return the library

Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
2006-08-02 19:59:28 UTC (rev 1705)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
2006-08-03 07:35:29 UTC (rev 1706)
@@ -321,27 +321,16 @@
}

/**
- * Return the decimal version. If version prefixing is enabled
- * via the <tt>project.version-prefix.enabled</tt> property then the value
- * returned will be derived from the project major, minor and micro
version
- * properties, otherwise a null value will be returned.
+ * Return the decimal version.
*
* @return the version
*/
public Version getDecimalVersion()
{
- boolean flag = getBooleanProperty( "project.version-prefix.enabled",
false );
- if( flag )
- {
- int major = getMajorVersion();
- int minor = getMinorVersion();
- int micro = getMicroVersion();
- return new Version( major, minor, micro );
- }
- else
- {
- return null;
- }
+ int major = getMajorVersion();
+ int minor = getMinorVersion();
+ int micro = getMicroVersion();
+ return new Version( major, minor, micro );
}

/**
@@ -1400,19 +1389,52 @@
// version utilities

//----------------------------------------------------------------------------

+ private static final String DECIMAL_VERSIONING_KEY =
"project.decimal.versioning.enabled";
+
private String getStandardVersion()
{
- String value = getBuildSignature();
- if( value.equals( SNAPSHOT ) )
+ String signature = getBuildSignature();
+ if( BOOTSTRAP.equals( signature ) )
{
- return value;
+ return BOOTSTRAP;
}
- else if( value.equals( BOOTSTRAP ) )
+
+ boolean decimalFlag = Boolean.getBoolean( DECIMAL_VERSIONING_KEY );
+ boolean isDecimal = getBooleanProperty( DECIMAL_VERSIONING_KEY,
decimalFlag );
+ if( isDecimal )
{
+ Version decimal = getDecimalVersion();
+ String spec = decimal.toString();
+ if( null == signature )
+ {
+ return spec;
+ }
+ else
+ {
+ return spec + "-" + signature;
+ }
+ }
+ else
+ {
+ if( null == signature )
+ {
+ return SNAPSHOT;
+ }
+ else
+ {
+ return signature;
+ }
+ }
+
+ /*
+ String value = getBuildSignature();
+ if( value.equals( SNAPSHOT ) || value.equals( BOOTSTRAP ) )
+ {
return value;
}
else
{
+
Version decimal = getDecimalVersion();
if( null != decimal )
{
@@ -1431,11 +1453,19 @@
return value;
}
}
+ */
}

private String getBuildSignature()
{
String system = System.getProperty( "build.signature", null );
+ return getProperty( "build.signature", system );
+ }
+
+ /*
+ private String getBuildSignature()
+ {
+ String system = System.getProperty( "build.signature", null );
String value = getProperty( "build.signature", system );
if( null == value )
{
@@ -1450,6 +1480,7 @@
return value;
}
}
+ */

private int getMajorVersion()
{

Modified:
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultResourceTestCase.java
===================================================================
---
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultResourceTestCase.java
2006-08-02 19:59:28 UTC (rev 1705)
+++
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultResourceTestCase.java
2006-08-03 07:35:29 UTC (rev 1706)
@@ -58,19 +58,6 @@
}

/**
- * Test assigned build signature version.
- * @exception Exception if a test error occurs
- */
- public void testBuildSignatureVersion() throws Exception
- {
- System.setProperty( "build.signature", "project.timestamp" );
- Resource resource = getLibrary().getResource(
"dpml/metro/dpml-composition-runtime" );
- String version = resource.getVersion();
- assertEquals( "version", "YYYYMMDD.HHMMSS".length(),
version.length() );
- System.getProperties().remove( "build.signature" );
- }
-
- /**
* Test resource version.
* @exception Exception if a test error occurs
*/

Modified: trunk/main/depot/tools/bootstrap.xml
===================================================================
--- trunk/main/depot/tools/bootstrap.xml 2006-08-02 19:59:28 UTC (rev
1705)
+++ trunk/main/depot/tools/bootstrap.xml 2006-08-03 07:35:29 UTC (rev
1706)
@@ -21,20 +21,20 @@

value="artifact:part:${project.group}/dpml-depot-checkstyle#SNAPSHOT"/>
<filter token="DEPOT-CHECKSTYLE-PLUGIN-LINK-URI"
value="link:part:${project.group}/dpml-depot-checkstyle"/>
- <filter token="TRANSIT-CORE-VERSION" value="SNAPSHOT"/>
- <filter token="TRANSIT-TOOLS-VERSION" value="SNAPSHOT"/>
- <filter token="LIBRARY-VERSION" value="SNAPSHOT"/>
+ <filter token="TRANSIT-CORE-VERSION" value="BOOTSTRAP"/>
+ <filter token="TRANSIT-TOOLS-VERSION" value="BOOTSTRAP"/>
+ <filter token="LIBRARY-VERSION" value="BOOTSTRAP"/>
</target>

<target name="setup-path" depends="bootstrap.setup-path">
<transit:get property="junit.path" uri="${junit.uri}"/>
<transit:get property="library.path"
- uri="artifact:jar:dpml/depot/dpml-library#SNAPSHOT"/>
+ uri="artifact:jar:dpml/depot/dpml-library#BOOTSTRAP"/>
<transit:get property="transit.path"
- uri="artifact:jar:dpml/transit/dpml-transit-main#SNAPSHOT"/>
+ uri="artifact:jar:dpml/transit/dpml-transit-main#BOOTSTRAP"/>
<path id="project.main.path">
<pathelement
-
location="${dpml.local.cache}/dpml/transit/jars/dpml-transit-main-SNAPSHOT.jar"/>
+
location="${dpml.local.cache}/dpml/transit/jars/dpml-transit-main-BOOTSTRAP.jar"/>
<pathelement location="${library.path}"/>
<pathelement location="${target.classes.dir}"/>
</path>

Modified: trunk/main/depot/tools/build.xml
===================================================================
--- trunk/main/depot/tools/build.xml 2006-08-02 19:59:28 UTC (rev 1705)
+++ trunk/main/depot/tools/build.xml 2006-08-03 07:35:29 UTC (rev 1706)
@@ -6,8 +6,6 @@

<transit:import uri="local:template:dpml/tools/standard"/>

- <!--
- -->
<target name="install" depends="standard.install">
<property name="tools.prefs" location="${dpml.prefs}/dpml/tools"/>
<mkdir dir="${tools.prefs}"/>

Modified:
trunk/main/depot/tools/src/main/net/dpml/tools/tasks/InstallTask.java
===================================================================
--- trunk/main/depot/tools/src/main/net/dpml/tools/tasks/InstallTask.java
2006-08-02 19:59:28 UTC (rev 1705)
+++ trunk/main/depot/tools/src/main/net/dpml/tools/tasks/InstallTask.java
2006-08-03 07:35:29 UTC (rev 1706)
@@ -66,6 +66,7 @@
String resourceVersion = resource.getVersion();
boolean snapshot = "SNAPSHOT".equals( resourceVersion );
boolean bootstrap = "BOOTSTRAP".equals( resourceVersion );
+ boolean validation = resource.getBooleanProperty(
"project.validation.enabled", false );
Type[] types = resource.getTypes();
if( types.length == 0 )
{
@@ -97,7 +98,7 @@
throw new BuildException( error, getLocation() );
}

- if( !snapshot && !bootstrap )
+ if( !snapshot && !bootstrap && validation )
{
try
{
@@ -106,7 +107,8 @@
File file = (File) url.getContent( new
Class[]{File.class} );
if( file.exists() )
{
- compare( file, target );
+ log( "validating " + target.getName() );
+ compare( file, target, id );
}
}
catch( ArtifactNotFoundException anfe )
@@ -221,29 +223,53 @@
}
}

- private void compare( File old, File target )
+ private void compare( File old, File target, String id )
{
String oldValue = getChecksum( old );
String newValue = getChecksum( target );
if( !oldValue.equals( newValue ) )
{
+ String path = getContext().getLayoutFilename( id );
final String error =
- "Produced resource has the same id as an existing resource but
MD5s are not equal."
- + "\n Existing: " + oldValue
- + "\n New: " + newValue;
+ "A versioned resource created in this build has a different
MD5 signature "
+ + "compared to an existing resource of the same name in the
cache directory. "
+ + "If the cached resource is a published resource a
possibility exists that "
+ + "this build artifact will be introducing a modification to
an existing published "
+ + "contract. If the resource has not been published then you
can rebuild without "
+ + "deliverable validation. Otherwise, consider assigning an
alternative "
+ + "(non-conflicting) version identifier."
+ + "\n"
+ + "\n\tProduced Type: " + path
+ + "\n\tCached Resource: " + getCanonicalPath( old )
+ + "\n";
throw new BuildException( error, getLocation() );
}
}

+ private String getCanonicalPath( File file )
+ {
+ try
+ {
+ return file.getCanonicalPath();
+ }
+ catch( IOException e )
+ {
+ final String error =
+ "Internal error while attempting to resolve a canonical path
for the file: " + file;
+ throw new BuildException( error, e, getLocation() );
+ }
+ }
+
private String getChecksum( File file )
{
+ final String key = "checksum.property." + file.toString();
final Checksum checksum = (Checksum) getProject().createTask(
"checksum" );
checksum.setTaskName( getTaskName() );
checksum.setFile( file );
- checksum.setProperty( "checksum.property" );
+ checksum.setProperty( key );
checksum.init();
checksum.execute();
- return getProject().getProperty( "checksum.property" );
+ return getProject().getProperty( key );
}

/**




  • r1706 - in trunk: . central/site/src/docs/about/download main main/depot/build/src/main/net/dpml/library/console main/depot/library main/depot/library/src/main/net/dpml/library main/depot/library/src/main/net/dpml/library/impl main/depot/library/src/test/net/dpml/library/impl main/depot/tools main/depot/tools/src/main/net/dpml/tools/tasks, mcconnell at BerliOS, 08/03/2006

Archive powered by MHonArc 2.6.24.

Top of Page