From 86009cc055af74069148cbb8a8bed37e79e97e43 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 15 May 2007 19:59:55 +0000
Subject: [PATCH] Make a number of administrative types of updates:
---
opends/src/build-tools/org/opends/build/tools/CreateVersionString.java | 98 +++++
opends/src/server/org/opends/server/core/DirectoryServer.java | 25
/dev/null | 202 -----------
opends/src/build-tools/org/opends/build/tools/CheckPrecommit.java | 390 ++++++++++++++++++++++
opends/build.xml | 115 ++----
opends/src/server/org/opends/server/monitors/VersionMonitorProvider.java | 127 ++++++
opends/PRODUCT | 11
opends/resource/DynamicConstants.java.stubs | 24
8 files changed, 672 insertions(+), 320 deletions(-)
diff --git a/opends/PRODUCT b/opends/PRODUCT
index 90f5f66..c447dab 100644
--- a/opends/PRODUCT
+++ b/opends/PRODUCT
@@ -11,16 +11,12 @@
MINOR_VERSION=9
# The point version number for the Directory Server. It must be an integer.
-# The point version will generally not be displayed to the end user but may be
-# used to determine ordering among builds with the same major and minor
-# versions but different qualifiers.
POINT_VERSION=0
# The version qualifier string for the Directory Server. It should be blank
-# for the first official release with a new major and minor version number
-# but may include additional text like "BETA1" or "SP2" for updates that do not
-# warrant incrementing the major or minor version. However, the point version
-# should be incremented every time a new qualifier is used.
+# for the first official release with a new major, minor, and point version
+# number but may include additional text like "BETA1" or "HOTFIX2" for updates
+# that do not warrant incrementing the version number.
VERSION_QUALIFIER=
# A comma-delimited list of bug IDs for fixes included in this build. This
@@ -28,3 +24,4 @@
# specific problem or set of problems identified in the corresponding official
# release.
FIX_IDS=
+
diff --git a/opends/build.xml b/opends/build.xml
index f839d7a..e5d28de 100644
--- a/opends/build.xml
+++ b/opends/build.xml
@@ -145,7 +145,7 @@
<!-- The build target that should be used before committing code. -->
- <target name="precommit" depends="checkstyle,clean,copyrightdates,eolstyle,dsml,javadoc,testwithcoverage"
+ <target name="precommit" depends="checkstyle,clean,checkprecommit,dsml,testwithcoverage"
description="Perform all processing needed before committing code.">
</target>
@@ -171,7 +171,7 @@
<!-- The build target that should be used to build everything. -->
<target name="all"
- depends="checkstyle,clean,copyrightdates,eolstyle,dsml,javadoc,testallwithcoverage"
+ depends="checkstyle,clean,checkprecommit,dsml,javadoc,testallwithcoverage"
description="Build using all defined targets.">
</target>
@@ -298,15 +298,34 @@
<getsvnrevision property="REVISION_NUMBER" />
+ <!-- Construct the version number string -->
+ <taskdef name="getversionnumber"
+ classname="org.opends.build.tools.CreateVersionString">
+ <classpath>
+ <fileset dir="${build.dir}/build-tools">
+ <include name="*.jar" />
+ </fileset>
+ </classpath>
+ </taskdef>
+
+ <getversionnumber property="VERSION_NUMBER_STRING" />
+
+
<!-- Generate the DynamicConstants.java file.
Be warned that the .stubs file references the following properties
PRODUCT_NAME, SHORT_NAME, MAJOR_VERSION, MINOR_VERSION, POINT_VERSION,
VERSION_QUALIFIER, FIX_IDS, timestamp, user.name, java.version,
java.vendor, java.vm.version, JVM_VENDOR, DEBUG_BUILD, REVISION_NUMBER,
- WEAVE_ENABLED
+ WEAVE_ENABLED, VERSION_NUMBER_STRING
If you change the name of any of those properties in this build.xml
you'll need to reflect the same change in the .stubs file
-->
+ <condition property="BUILD_NUMBER" value="-1">
+ <not>
+ <isset property="BUILD_NUMBER" />
+ </not>
+ </condition>
+
<copy file="${dynconstants.stubfile}"
tofile="${dynconstants.file}"
overwrite="true" >
@@ -319,11 +338,12 @@
- <!-- Check modified files to see if any copyright updates are needed. -->
- <target name="copyrightdates" depends="buildtools"
- description="Ensure updated files have the correct copyright year" >
- <taskdef name="checkcopyrightdates"
- classname="org.opends.build.tools.CheckCopyrightDates">
+ <!-- Check modified files to see if any svn:eol-style or copyright updates
+ are needed. -->
+ <target name="checkprecommit" depends="buildtools"
+ description="Ensure updated files eol-style and copyright info">
+ <taskdef name="checkprecommit"
+ classname="org.opends.build.tools.CheckPrecommit">
<classpath>
<fileset dir="${build.dir}/build-tools">
<include name="*.jar" />
@@ -334,62 +354,11 @@
</classpath>
</taskdef>
- <checkcopyrightdates>
- <fileset dir="${basedir}" includes="**/*.java" excludes="build/**/*,src/admin/generated/**/*" />
- <fileset dir="${basedir}" includes="**/*.xml" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.xsd" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.xsl" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.html" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.sh" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.bat" excludes="build/**/* " />
- <fileset dir="${basedir}" includes="**/*.ldif" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.txt" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.c" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.h" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.mc" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/Makefile" excludes="build/**/*" />
- <fileset dir="${scripts.dir}" includes="**/*" />
- </checkcopyrightdates>
+ <checkprecommit />
</target>
- <!-- Check added files to see if any svn:eol-style updates are needed. -->
- <target name="eolstyle" depends="buildtools"
- description="Ensure added files have the correct svn:eol-style" >
- <taskdef name="checkeolstyle"
- classname="org.opends.build.tools.CheckEOLStyle">
- <classpath>
- <fileset dir="${build.dir}/build-tools">
- <include name="*.jar" />
- </fileset>
- <fileset dir="${svnkit.dir}">
- <include name="*.jar" />
- </fileset>
- </classpath>
- </taskdef>
-
- <checkeolstyle>
- <fileset dir="${basedir}" includes="**/*.java" excludes="build/**/*,src/admin/generated/**/*" />
- <fileset dir="${basedir}" includes="**/*.xml" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.xsd" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.xsl" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.html" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.sh" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.bat" excludes="build/**/* " />
- <fileset dir="${basedir}" includes="**/*.ldif" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.txt" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.c" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.h" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/*.mc" excludes="build/**/*" />
- <fileset dir="${basedir}" includes="**/Makefile" excludes="build/**/*" />
- <fileset dir="${scripts.dir}" includes="**/*" />
- </checkeolstyle>
- </target>
-
-
-
-
<!-- Ensure that the source code meets basic style requirements. -->
<target name="checkstyle" description="Perform basic source style checks">
<mkdir dir="${checkstyle.cache.dir}" />
@@ -592,10 +561,8 @@
</condition>
<!-- Set properties needed to find the packaged files -->
- <property name="pkgversion"
- value="${MAJOR_VERSION}.${MINOR_VERSION}${VERSION_QUALIFIER}" />
<property name="pdir"
- location="${package.dir}/OpenDS-${pkgversion}" />
+ location="${package.dir}/OpenDS-${VERSION_NUMBER_STRING}" />
<!-- Clean up a minimal set of files/directories for the rebuild. -->
<delete dir="${classes.dir}" />
@@ -708,10 +675,8 @@
<!-- Populate the Directory Server package, but don't zip it up. -->
<target name="prepackage" depends="cleancompile"
description="Prepare the Directory Server package structure.">
- <property name="pkgversion"
- value="${MAJOR_VERSION}.${MINOR_VERSION}${VERSION_QUALIFIER}" />
<property name="pdir"
- location="${package.dir}/OpenDS-${pkgversion}" />
+ location="${package.dir}/OpenDS-${VERSION_NUMBER_STRING}" />
<mkdir dir="${pdir}" />
<mkdir dir="${pdir}/bak" />
@@ -817,19 +782,19 @@
<!-- Package the Directory Server for distribution. -->
<target name="package" depends="prepackage"
description="Package the Directory Server for distribution.">
- <zip destfile="${package.dir}/OpenDS-${pkgversion}.zip">
- <zipfileset dir="${package.dir}" includes="OpenDS-${pkgversion}/**/*"
- excludes="OpenDS-${pkgversion}/bin/*,OpenDS-${pkgversion}/lib/_client-script.sh,OpenDS-${pkgversion}/lib/_server-script.sh,OpenDS-${pkgversion}/setup,OpenDS-${pkgversion}/uninstall"
+ <zip destfile="${package.dir}/OpenDS-${VERSION_NUMBER_STRING}.zip">
+ <zipfileset dir="${package.dir}" includes="OpenDS-${VERSION_NUMBER_STRING}/**/*"
+ excludes="OpenDS-${VERSION_NUMBER_STRING}/bin/*,OpenDS-${VERSION_NUMBER_STRING}/lib/_client-script.sh,OpenDS-${VERSION_NUMBER_STRING}/lib/_server-script.sh,OpenDS-${VERSION_NUMBER_STRING}/setup,OpenDS-${VERSION_NUMBER_STRING}/uninstall"
filemode="644" dirmode="755" />
<zipfileset dir="${package.dir}"
- includes="OpenDS-${pkgversion}/lib/_client-script.sh,OpenDS-${pkgversion}/lib/_server-script.sh"
+ includes="OpenDS-${VERSION_NUMBER_STRING}/lib/_client-script.sh,OpenDS-${VERSION_NUMBER_STRING}/lib/_server-script.sh"
filemode="755" dirmode="755" />
- <zipfileset dir="${package.dir}" includes="OpenDS-${pkgversion}/bin/*"
- excludes="OpenDS-${pkgversion}/bin/README_WINDOWS.txt"
+ <zipfileset dir="${package.dir}" includes="OpenDS-${VERSION_NUMBER_STRING}/bin/*"
+ excludes="OpenDS-${VERSION_NUMBER_STRING}/bin/README_WINDOWS.txt"
filemode="755" dirmode="755" />
- <zipfileset dir="${package.dir}" includes="OpenDS-${pkgversion}/bin/README_WINDOWS.txt"
+ <zipfileset dir="${package.dir}" includes="OpenDS-${VERSION_NUMBER_STRING}/bin/README_WINDOWS.txt"
filemode="644" dirmode="755" />
- <zipfileset dir="${package.dir}" includes="OpenDS-${pkgversion}/setup,OpenDS-${pkgversion}/uninstall"
+ <zipfileset dir="${package.dir}" includes="OpenDS-${VERSION_NUMBER_STRING}/setup,OpenDS-${VERSION_NUMBER_STRING}/uninstall"
filemode="755" dirmode="755" />
</zip>
</target>
@@ -884,7 +849,7 @@
</classpath>
</javac>
- <war destfile="${classes.dir}/OpenDS-${pkgversion}-DSML.war"
+ <war destfile="${classes.dir}/OpenDS-${VERSION_NUMBER_STRING}-DSML.war"
webxml="${dsml.dir}/webapp/web.xml">
<fileset file="${dsml.dir}/webapp/server.properties" />
diff --git a/opends/resource/DynamicConstants.java.stubs b/opends/resource/DynamicConstants.java.stubs
index c254d3d..9ae679f 100644
--- a/opends/resource/DynamicConstants.java.stubs
+++ b/opends/resource/DynamicConstants.java.stubs
@@ -59,6 +59,11 @@
public static final int POINT_VERSION = ${POINT_VERSION};
/**
+ * The official build number for the Directory Server.
+ */
+ public static final int BUILD_NUMBER = ${BUILD_NUMBER};
+
+ /**
* The version qualifier string for the Directory Server.
*/
public static final String VERSION_QUALIFIER = "${VERSION_QUALIFIER}";
@@ -123,21 +128,24 @@
public static final boolean WEAVE_ENABLED = ${WEAVE_ENABLED};
/**
+ * A string representation of the version number.
+ */
+ public static final String VERSION_NUMBER_STRING =
+ "${VERSION_NUMBER_STRING}";
+
+ /**
* A compact version string for this product, suitable for use in path
* names and similar cases.
*/
public static final String COMPACT_VERSION_STRING =
- SHORT_NAME + "-" + MAJOR_VERSION + "." + MINOR_VERSION +
- (((VERSION_QUALIFIER != null) && (VERSION_QUALIFIER.length() > 0))
- ? VERSION_QUALIFIER
- : "");
+ SHORT_NAME + "-" + VERSION_NUMBER_STRING;
/**
* A full version string for this product.
*/
public static final String FULL_VERSION_STRING =
- PRODUCT_NAME + " " + MAJOR_VERSION + "." + MINOR_VERSION +
- (((VERSION_QUALIFIER != null) && (VERSION_QUALIFIER.length() > 0))
- ? VERSION_QUALIFIER
- : "." + POINT_VERSION);
+ PRODUCT_NAME + " " + VERSION_NUMBER_STRING +
+ (((FIX_IDS != null) && (FIX_IDS.length() > 0))
+ ? "+" + FIX_IDS
+ : "");
}
diff --git a/opends/src/build-tools/org/opends/build/tools/CheckCopyrightDates.java b/opends/src/build-tools/org/opends/build/tools/CheckCopyrightDates.java
deleted file mode 100644
index b8ca8f8..0000000
--- a/opends/src/build-tools/org/opends/build/tools/CheckCopyrightDates.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2007 Sun Microsystems, Inc.
- */
-package org.opends.build.tools;
-
-
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.GregorianCalendar;
-import java.util.LinkedList;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.types.FileSet;
-
-import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.SVNStatus;
-import org.tmatesoft.svn.core.wc.SVNStatusClient;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
-
-
-
-/**
- * This class provides an implementation of an Ant task that may be used to
- * verify that the copyright dates of all modified files in the workspace have
- * been updated to include the current year. In particular, for all files in
- * one of the specified filesets that have been created or modified in the
- * local workspace, it will parse the file for any line which appears to be
- * a comment and contains the word "copyright". If the line does not also
- * contain the current year, then it will be flagged as a potential violation to
- * be addressed.
- */
-public class CheckCopyrightDates
- extends Task
-{
- /**
- * The name of the system property that may be used to prevent copyright date
- * problems from failing the build.
- */
- public static final String IGNORE_ERRORS_PROPERTY =
- "org.opends.server.IgnoreCopyrightDateErrors";
-
-
-
- // A list of all the filesets to be checked.
- private LinkedList<FileSet> filesetList = new LinkedList<FileSet>();
-
- // The path to the root of the Subversion workspace to check.
- private String workspace = null;
-
-
-
- /**
- * Adds the provided fileset to the list of filesets that should be checked.
- *
- * @param fileset A fileset containing a list of files that should be
- * checked.
- */
- public void addFileset(FileSet fileset)
- {
- filesetList.add(fileset);
- }
-
-
-
- /**
- * Specifies the path to the root of the Subversion workspace for which to
- * retrieve the revision number.
- *
- * @param workspace The path to the root of the Subversion workspace for
- * which to retrieve the revision number.
- */
- public void setWorkspace(String workspace)
- {
- this.workspace = workspace;
- }
-
-
-
- /**
- * Performs the appropriate processing needed for this task. In this case,
- * it uses SVNKit to identify all modified files in the current workspace.
- * For all source files, look for comment lines containing the word
- * "copyright" and make sure at least one of them contains the current year.
- */
- @Override()
- public void execute()
- {
- // Make sure that at least one fileset was provided.
- if (filesetList.isEmpty())
- {
- throw new BuildException("ERROR: No filesets were specified to " +
- "indicate which files should be checked.");
- }
-
-
- File workspacePath;
- if ((workspace == null) || (workspace.length() == 0))
- {
- workspacePath = getProject().getBaseDir();
- }
- else
- {
- workspacePath = new File(workspace);
- }
- String workspacePathString = workspacePath.getAbsolutePath() +
- File.separator;
-
-
- // Get the year to use in the determination.
- GregorianCalendar calendar = new GregorianCalendar();
- int year = calendar.get(GregorianCalendar.YEAR);
- String yearString = String.valueOf(year);
-
-
- // Get the current status for all files in the fileset. For any files with
- // local changes, see if there are any files that potentially have the wrong
- // copyright year.
- SVNStatusClient svnClient = new SVNStatusClient(null, null);
-
- LinkedList<String> problemFiles = new LinkedList<String>();
- for (FileSet fileSet : filesetList)
- {
- DirectoryScanner scanner = fileSet.getDirectoryScanner(getProject());
- for (String relativePath : scanner.getIncludedFiles())
- {
- String filePath = scanner.getBasedir() + File.separator + relativePath;
-
- try
- {
- SVNStatus svnStatus = svnClient.doStatus(new File(filePath), false);
- if (svnStatus == null)
- {
- System.err.println("WARNING: Could not determine Subversion " +
- "status for file " + filePath);
- System.err.println("No further copyright date checking will be " +
- "performed.");
- return;
- }
-
- SVNStatusType statusType = svnStatus.getContentsStatus();
- if ((statusType == SVNStatusType.STATUS_ADDED) ||
- (statusType == SVNStatusType.STATUS_MODIFIED) ||
- (statusType == SVNStatusType.STATUS_UNVERSIONED))
- {
- BufferedReader reader = null;
- try
- {
- boolean copyrightFound = false;
- boolean correctYearFound = false;
- reader = new BufferedReader(new FileReader(filePath));
- String line = reader.readLine();
- while (line != null)
- {
- String lowerLine = line.toLowerCase().trim();
- if (isCommentLine(lowerLine))
- {
- int copyrightPos = lowerLine.indexOf("copyright");
- if (copyrightPos > 0)
- {
- copyrightFound = true;
- if (lowerLine.indexOf(yearString) > 0)
- {
- correctYearFound = true;
- break;
- }
- }
- }
-
- line = reader.readLine();
- }
-
- if (copyrightFound && (! correctYearFound))
- {
- if (filePath.startsWith(workspacePathString))
- {
- problemFiles.add(filePath.substring(
- workspacePathString.length()));
- }
- else
- {
- problemFiles.add(filePath);
- }
- }
- }
- catch (IOException ioe)
- {
- System.err.println("ERROR: Could not read file " + filePath +
- " to check copyright date.");
- System.err.println("No further copyright date checking will be " +
- "performed.");
- return;
- }
- finally
- {
- try
- {
- if (reader != null)
- {
- reader.close();
- }
- } catch (Exception e) {}
- }
- }
- }
- catch (SVNException svnException)
- {
- System.err.println("WARNING: Could not determine Subversion " +
- "status for file " + filePath + ": " +
- svnException);
- System.err.println("No further copyright date checking will be " +
- "performed.");
- return;
- }
- }
- }
-
-
- if (! problemFiles.isEmpty())
- {
- System.err.println("WARNING: Potential copyright year updates needed " +
- "for the following files:");
- for (String filename : problemFiles)
- {
- System.err.println(" " + filename);
- }
-
- String ignoreStr = getProject().getProperty(IGNORE_ERRORS_PROPERTY);
- if ((ignoreStr == null) || (! ignoreStr.equalsIgnoreCase("true")))
- {
- throw new BuildException("Fix copyright date problems before " +
- "proceeding, or use '-D" +
- IGNORE_ERRORS_PROPERTY + "=true' to " +
- "ignore copyright warnings.");
- }
- }
- }
-
-
-
- /**
- * Indicates whether the provided line appears to be a comment line. It will
- * check for a number of common comment indicators in Java source files,
- * shell scripts, XML files, and LDIF files.
- *
- * @param lowerLine The line to be checked. It should have been coverted to
- * all lowercase characters and any leading spaces
- * removed.
- *
- * @return {@code true} if it appears that the line is a comment line, or
- * {@code false} if not.
- */
- private static boolean isCommentLine(String lowerLine)
- {
- if (lowerLine.startsWith("/*") ||
- lowerLine.startsWith("*") ||
- lowerLine.startsWith("//") ||
- lowerLine.startsWith("#") ||
- lowerLine.startsWith("rem") ||
- lowerLine.startsWith("<!--") ||
- lowerLine.startsWith("!"))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-}
-
diff --git a/opends/src/build-tools/org/opends/build/tools/CheckEOLStyle.java b/opends/src/build-tools/org/opends/build/tools/CheckEOLStyle.java
deleted file mode 100644
index 30645a5..0000000
--- a/opends/src/build-tools/org/opends/build/tools/CheckEOLStyle.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2007 Sun Microsystems, Inc.
- */
-package org.opends.build.tools;
-
-
-
-import java.io.File;
-import java.util.LinkedList;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.types.FileSet;
-
-import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.SVNPropertyData;
-import org.tmatesoft.svn.core.wc.SVNRevision;
-import org.tmatesoft.svn.core.wc.SVNStatus;
-import org.tmatesoft.svn.core.wc.SVNStatusClient;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
-import org.tmatesoft.svn.core.wc.SVNWCClient;
-
-
-
-/**
- * This class provides an implementation of an Ant task that may be used to
- * verify that any file marked for addition to the repository has the
- * "svn:eol-style" property set with a value of "native".
- */
-public class CheckEOLStyle
- extends Task
-{
- /**
- * The name of the system property that may be used to prevent property
- * errors from failing the build.
- */
- public static final String IGNORE_ERRORS_PROPERTY =
- "org.opends.server.IgnoreEOLStyleErrors";
-
-
-
- // A list of all the filesets to be checked.
- private LinkedList<FileSet> filesetList = new LinkedList<FileSet>();
-
- // The path to the root of the Subversion workspace to check.
- private String workspace = null;
-
-
-
- /**
- * Adds the provided fileset to the list of filesets that should be checked.
- *
- * @param fileset A fileset containing a list of files that should be
- * checked.
- */
- public void addFileset(FileSet fileset)
- {
- filesetList.add(fileset);
- }
-
-
-
- /**
- * Specifies the path to the root of the Subversion workspace to check.
- *
- * @param workspace The path to the root of the Subversion workspace to
- * check.
- */
- public void setWorkspace(String workspace)
- {
- this.workspace = workspace;
- }
-
-
-
- /**
- * Performs the appropriate processing needed for this task. In this case,
- * it uses SVNKit to identify all files marked for addition to the Subversion
- * repository and verify that the file has the svn:eol-style property set with
- * a value of native.
- */
- @Override()
- public void execute()
- {
- // Make sure that at least one fileset was provided.
- if (filesetList.isEmpty())
- {
- throw new BuildException("ERROR: No filesets were specified to " +
- "indicate which files should be checked.");
- }
-
-
- File workspacePath;
- if ((workspace == null) || (workspace.length() == 0))
- {
- workspacePath = getProject().getBaseDir();
- }
- else
- {
- workspacePath = new File(workspace);
- }
- String workspacePathString = workspacePath.getAbsolutePath() +
- File.separator;
-
-
- // Get the current status for all files in the fileset. For any files
- // marked for addition, check the svn:eol-style property.
- SVNStatusClient statusClient = new SVNStatusClient(null, null);
- SVNWCClient propertyClient = new SVNWCClient(null, null);
-
- LinkedList<String> problemFiles = new LinkedList<String>();
- for (FileSet fileSet : filesetList)
- {
- DirectoryScanner scanner = fileSet.getDirectoryScanner(getProject());
- for (String relativePath : scanner.getIncludedFiles())
- {
- String filePath = scanner.getBasedir() + File.separator + relativePath;
- File targetFile = new File(filePath);
-
- try
- {
- SVNStatus svnStatus = statusClient.doStatus(targetFile, false);
- if (svnStatus == null)
- {
- System.err.println("WARNING: Could not determine Subversion " +
- "status for file " + filePath);
- System.err.println("No further EOL style checking will be " +
- "performed.");
- return;
- }
-
- SVNStatusType statusType = svnStatus.getContentsStatus();
- if (statusType == SVNStatusType.STATUS_ADDED)
- {
- SVNPropertyData propertyData =
- propertyClient.doGetProperty(targetFile, "svn:eol-style",
- SVNRevision.BASE,
- SVNRevision.WORKING, false);
- if ((propertyData == null) ||
- (! propertyData.getValue().equals("native")))
- {
- problemFiles.add(filePath);
- }
- }
- }
- catch (SVNException svnException)
- {
- System.err.println("WARNING: Could not check eol-style property " +
- "for file " + filePath + ": " + svnException);
- System.err.println("No further EOL style checking will be " +
- "performed.");
- return;
- }
- }
- }
-
-
- if (! problemFiles.isEmpty())
- {
- System.err.println("WARNING: Property 'svn:eol-style' not set to " +
- "'native' for the following files:");
- for (String filename : problemFiles)
- {
- System.err.println(" " + filename);
- }
-
- String ignoreStr = getProject().getProperty(IGNORE_ERRORS_PROPERTY);
- if ((ignoreStr == null) || (! ignoreStr.equalsIgnoreCase("true")))
- {
- throw new BuildException("Fix these reported problems before " +
- "proceeding, or use '-D" +
- IGNORE_ERRORS_PROPERTY + "=true' to " +
- "ignore svn:eol-style warnings.");
- }
- }
- }
-}
-
diff --git a/opends/src/build-tools/org/opends/build/tools/CheckPrecommit.java b/opends/src/build-tools/org/opends/build/tools/CheckPrecommit.java
new file mode 100644
index 0000000..1a02c54
--- /dev/null
+++ b/opends/src/build-tools/org/opends/build/tools/CheckPrecommit.java
@@ -0,0 +1,390 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2007 Sun Microsystems, Inc.
+ */
+package org.opends.build.tools;
+
+
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.GregorianCalendar;
+import java.util.HashSet;
+import java.util.LinkedList;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.FileSet;
+
+import org.tmatesoft.svn.core.SVNErrorMessage;
+import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.wc.SVNPropertyData;
+import org.tmatesoft.svn.core.wc.SVNRevision;
+import org.tmatesoft.svn.core.wc.ISVNStatusHandler;
+import org.tmatesoft.svn.core.wc.SVNStatus;
+import org.tmatesoft.svn.core.wc.SVNStatusClient;
+import org.tmatesoft.svn.core.wc.SVNStatusType;
+import org.tmatesoft.svn.core.wc.SVNWCClient;
+
+
+
+/**
+ * This class provides an implementation of an Ant task that may be used to
+ * perform various checks to deteermine whether a file is suitable to be
+ * committed. This includes:
+ * <UL>
+ * <LI>Make sure that the file has the correct "svn:eol-style" property
+ * value.</LI>
+ * <LI>If a file contains a line that appears to be a comment and includes the
+ * word "copyright", then it should contain the current year.</LI>
+ * </UL>
+ */
+public class CheckPrecommit
+ extends Task
+ implements ISVNStatusHandler
+{
+ /**
+ * The name of the system property that may be used to prevent copyright date
+ * problems from failing the build.
+ */
+ public static final String IGNORE_COPYRIGHT_ERRORS_PROPERTY =
+ "org.opends.server.IgnoreCopyrightDateErrors";
+
+
+
+ /**
+ * The name of the system property that may be used to prevent copyright date
+ * problems from failing the build.
+ */
+ public static final String IGNORE_EOLSTYLE_ERRORS_PROPERTY =
+ "org.opends.server.IgnoreEOLStyleErrors";
+
+
+
+ /**
+ *
+ */
+ public static final HashSet<String> CHECKED_EXTENSIONS =
+ new HashSet<String>();
+ static
+ {
+ CHECKED_EXTENSIONS.add("java");
+ CHECKED_EXTENSIONS.add("xml");
+ CHECKED_EXTENSIONS.add("xsd");
+ CHECKED_EXTENSIONS.add("xsl");
+ CHECKED_EXTENSIONS.add("html");
+ CHECKED_EXTENSIONS.add("sh");
+ CHECKED_EXTENSIONS.add("bat");
+ CHECKED_EXTENSIONS.add("ldif");
+ CHECKED_EXTENSIONS.add("txt");
+ CHECKED_EXTENSIONS.add("c");
+ CHECKED_EXTENSIONS.add("h");
+ CHECKED_EXTENSIONS.add("mc");
+ CHECKED_EXTENSIONS.add("Makefile");
+ }
+
+
+
+ // The path to the directory that is the base of the workspace.
+ private File workspacePath;
+
+ // The set of files that appear to have problems with the EOL style.
+ private LinkedList<String> eolStyleProblemFiles = new LinkedList<String>();
+
+ // The set of files that appear to have problems with the copyright date.
+ private LinkedList<String> copyrightProblemFiles = new LinkedList<String>();
+
+ // The path to the root of the Subversion workspace to check.
+ private String workspace = null;
+
+ // The string representation of the current year.
+ private String yearString;
+
+ // The property client used to look at file properties.
+ private SVNWCClient propertyClient;
+
+
+
+ /**
+ * Specifies the path to the root of the Subversion workspace for which to
+ * retrieve the revision number.
+ *
+ * @param workspace The path to the root of the Subversion workspace for
+ * which to retrieve the revision number.
+ */
+ public void setWorkspace(String workspace)
+ {
+ this.workspace = workspace;
+ }
+
+
+
+ /**
+ * Performs the appropriate processing needed for this task. In this case,
+ * it uses SVNKit to identify all modified files in the current workspace.
+ * For all source files, look for comment lines containing the word
+ * "copyright" and make sure at least one of them contains the current year.
+ */
+ @Override()
+ public void execute()
+ {
+ if ((workspace == null) || (workspace.length() == 0))
+ {
+ workspacePath = getProject().getBaseDir();
+ }
+ else
+ {
+ workspacePath = new File(workspace);
+ }
+
+
+ // Get the year to use in the determination.
+ GregorianCalendar calendar = new GregorianCalendar();
+ int year = calendar.get(GregorianCalendar.YEAR);
+ yearString = String.valueOf(year);
+
+
+ // Process the base directory and all of its subdirectories.
+ SVNStatusClient svnClient = new SVNStatusClient(null, null);
+ propertyClient = new SVNWCClient(null, null);
+
+ try
+ {
+ svnClient.doStatus(workspacePath, true, false, false, false, false, this);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err.println("WARNING: Encountered an error while examining " +
+ "Subversion status: " + e);
+ System.err.println("No further checks will be performed.");
+ return;
+ }
+
+ boolean fail = false;
+
+ if (! eolStyleProblemFiles.isEmpty())
+ {
+ fail = true;
+ System.err.println("WARNING: Potential svn:eol-style updates needed " +
+ "for the following files:");
+ for (String filename : eolStyleProblemFiles)
+ {
+ System.err.println(" " + filename);
+ }
+
+ System.err.println("Fix svn:eol-style problems before proceeding, or " +
+ "use '-D" + IGNORE_EOLSTYLE_ERRORS_PROPERTY +
+ "=true' to ignore copyright warnings.");
+ }
+
+ if (! copyrightProblemFiles.isEmpty())
+ {
+ fail = true;
+ System.err.println("WARNING: Potential copyright year updates needed " +
+ "for the following files:");
+ for (String filename : copyrightProblemFiles)
+ {
+ System.err.println(" " + filename);
+ }
+
+ System.err.println("Fix copyright date problems before proceeding, or " +
+ "use '-D" + IGNORE_COPYRIGHT_ERRORS_PROPERTY +
+ "=true' to ignore copyright warnings.");
+ }
+
+ if (fail)
+ {
+ throw new BuildException();
+ }
+ }
+
+
+
+ /**
+ * Examines the provided status item to determine whether the associated file
+ * is acceptable.
+ *
+ * @param status The SVN status information for the file of interest.
+ */
+ public void handleStatus(SVNStatus status)
+ {
+ File file = status.getFile();
+ if ((! file.exists()) || (! file.isFile()))
+ {
+ // The file doesn't exist (which probably means it's been deleted) or
+ // isn't a regular file, so we'll ignore it.
+ return;
+ }
+
+ String fileName = file.getName();
+ int lastPeriodPos = fileName.lastIndexOf('.');
+ if (lastPeriodPos > 0)
+ {
+ String extension = fileName.substring(lastPeriodPos+1);
+ if (! CHECKED_EXTENSIONS.contains(extension.toLowerCase()))
+ {
+ // The file doesn't have an extension that we care about, so skip it.
+ return;
+ }
+ }
+ else
+ {
+ // The file doesn't have an extension. We'll still want to check it if
+ // it's in a resource/bin directory.
+ File parentDirectory = file.getParentFile();
+ if ((parentDirectory == null) ||
+ (! parentDirectory.getName().equals("bin")))
+ {
+ return;
+ }
+
+ parentDirectory = parentDirectory.getParentFile();
+ if ((parentDirectory == null) ||
+ (! parentDirectory.getName().equals("resource")))
+ {
+ return;
+ }
+ }
+
+
+ String filePath = file.getAbsolutePath();
+ if (filePath.startsWith(workspacePath.getPath()))
+ {
+ filePath = filePath.substring(workspacePath.getPath().length());
+ }
+
+
+ // Check to make sure that the file has the correct EOL style.
+ try
+ {
+ SVNPropertyData propertyData =
+ propertyClient.doGetProperty(file, "svn:eol-style",
+ SVNRevision.BASE,
+ SVNRevision.WORKING, false);
+ if ((propertyData == null) ||
+ (! propertyData.getValue().equals("native")))
+ {
+ eolStyleProblemFiles.add(filePath);
+ }
+ }
+ catch (SVNException se)
+ {
+ // This could happen if the file isn't under version control. If so, then
+ // we can't check the eol-style but we should at least be able to check
+ // the copyright dates, so keep going.
+ }
+
+
+ // Check to see whether the file has a comment line containing a copyright
+ // without the current year.
+ BufferedReader reader = null;
+ try
+ {
+ boolean copyrightFound = false;
+ boolean correctYearFound = false;
+ reader = new BufferedReader(new FileReader(file));
+ String line = reader.readLine();
+ while (line != null)
+ {
+ String lowerLine = line.toLowerCase().trim();
+ if (isCommentLine(lowerLine))
+ {
+ int copyrightPos = lowerLine.indexOf("copyright");
+ if (copyrightPos > 0)
+ {
+ copyrightFound = true;
+ if (lowerLine.indexOf(yearString) > 0)
+ {
+ correctYearFound = true;
+ break;
+ }
+ }
+ }
+
+ line = reader.readLine();
+ }
+
+ if (copyrightFound && (! correctYearFound))
+ {
+ copyrightProblemFiles.add(filePath);
+ }
+ }
+ catch (IOException ioe)
+ {
+ System.err.println("ERROR: Could not read file " + filePath +
+ " to check copyright date.");
+ System.err.println("No further copyright date checking will be " +
+ "performed.");
+ throw new RuntimeException();
+ }
+ finally
+ {
+ try
+ {
+ if (reader != null)
+ {
+ reader.close();
+ }
+ } catch (Exception e) {}
+ }
+ }
+
+
+
+ /**
+ * Indicates whether the provided line appears to be a comment line. It will
+ * check for a number of common comment indicators in Java source files,
+ * shell scripts, XML files, and LDIF files.
+ *
+ * @param lowerLine The line to be checked. It should have been coverted to
+ * all lowercase characters and any leading spaces
+ * removed.
+ *
+ * @return {@code true} if it appears that the line is a comment line, or
+ * {@code false} if not.
+ */
+ private static boolean isCommentLine(String lowerLine)
+ {
+ if (lowerLine.startsWith("/*") ||
+ lowerLine.startsWith("*") ||
+ lowerLine.startsWith("//") ||
+ lowerLine.startsWith("#") ||
+ lowerLine.startsWith("rem") ||
+ lowerLine.startsWith("<!--") ||
+ lowerLine.startsWith("!"))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+}
+
diff --git a/opends/src/build-tools/org/opends/build/tools/CreateVersionString.java b/opends/src/build-tools/org/opends/build/tools/CreateVersionString.java
new file mode 100644
index 0000000..d0b0db6
--- /dev/null
+++ b/opends/src/build-tools/org/opends/build/tools/CreateVersionString.java
@@ -0,0 +1,98 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2007 Sun Microsystems, Inc.
+ */
+package org.opends.build.tools;
+
+
+
+import java.text.DecimalFormat;
+
+import org.apache.tools.ant.Task;
+
+
+
+/**
+ * This class provides an implemenation of an Ant task that may be used to
+ * construct the full version number string that the Directory Server should
+ * use. The value of the version number string will be stored in an Ant
+ * property.
+ */
+public class CreateVersionString
+ extends Task
+{
+ // The name of the property in which the revision number should be set.
+ private String propertyName = null;
+
+
+
+ /**
+ * Specifies the name of the Ant property into which the Subversion revision
+ * number will be stored.
+ *
+ * @param propertyName The name of the Ant property into which the
+ * Subversion revision number will be stored.
+ */
+ public void setProperty(String propertyName)
+ {
+ this.propertyName = propertyName;
+ }
+
+
+
+ /**
+ * Performs the appropriate processing needed for this task. In this case,
+ * it uses SVNKit to identify the current revision number for the local
+ * workspace and store it in a specified property.
+ */
+ @Override()
+ public void execute()
+ {
+ StringBuilder versionString = new StringBuilder();
+
+ versionString.append(getProject().getProperty("MAJOR_VERSION"));
+ versionString.append(".");
+ versionString.append(getProject().getProperty("MINOR_VERSION"));
+ versionString.append(".");
+ versionString.append(getProject().getProperty("POINT_VERSION"));
+
+ String versionQualifier = getProject().getProperty("VERSION_QUALIFIER");
+ versionString.append(versionQualifier);
+
+ try
+ {
+ int buildNumber =
+ Integer.parseInt(getProject().getProperty("BUILD_NUMBER"));
+ if (buildNumber > 0)
+ {
+ versionString.append("-build");
+ versionString.append(new DecimalFormat("000").format(buildNumber));
+ }
+ } catch (NumberFormatException nfe) {}
+
+ getProject().setNewProperty(propertyName, versionString.toString());
+ }
+}
+
diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index a4bcc88..5be3c58 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -33,6 +33,7 @@
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.InetAddress;
+import java.text.DecimalFormat;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
@@ -8311,22 +8312,7 @@
*/
public static String getVersionString()
{
- StringBuilder buffer = new StringBuilder();
- buffer.append(PRODUCT_NAME);
- buffer.append(" ");
- buffer.append(MAJOR_VERSION);
- buffer.append(".");
- buffer.append(MINOR_VERSION);
- if ((VERSION_QUALIFIER == null) || (VERSION_QUALIFIER.length() == 0))
- {
- buffer.append(".");
- buffer.append(POINT_VERSION);
- }
- else
- {
- buffer.append(VERSION_QUALIFIER);
- }
- return buffer.toString();
+ return FULL_VERSION_STRING;
}
/**
@@ -8803,6 +8789,13 @@
System.out.println("Minor Version: " + MINOR_VERSION);
System.out.println("Point Version: " + POINT_VERSION);
System.out.println("Version Qualifier: " + VERSION_QUALIFIER);
+
+ if (BUILD_NUMBER > 0)
+ {
+ System.out.println("Build Number: " +
+ new DecimalFormat("000").format(BUILD_NUMBER));
+ }
+
System.out.println("Revision Number: " + REVISION_NUMBER);
System.out.println("Fix IDs: " + FIX_IDS);
System.out.println("Debug Build: " + DEBUG_BUILD);
diff --git a/opends/src/server/org/opends/server/monitors/VersionMonitorProvider.java b/opends/src/server/org/opends/server/monitors/VersionMonitorProvider.java
index b87f71e..3bca34a 100644
--- a/opends/src/server/org/opends/server/monitors/VersionMonitorProvider.java
+++ b/opends/src/server/org/opends/server/monitors/VersionMonitorProvider.java
@@ -55,6 +55,88 @@
public class VersionMonitorProvider
extends MonitorProvider
{
+ /**
+ * The name of the attribute used to provide the product name.
+ */
+ public static final String ATTR_PRODUCT_NAME = "productName";
+
+
+
+ /**
+ * The name of the attribute used to provide the short name.
+ */
+ public static final String ATTR_SHORT_NAME = "shortName";
+
+
+
+ /**
+ * The name of the attribute used to provide the major version number.
+ */
+ public static final String ATTR_MAJOR_VERSION = "majorVersion";
+
+
+
+ /**
+ * The name of the attribute used to provide the minor version number.
+ */
+ public static final String ATTR_MINOR_VERSION = "minorVersion";
+
+
+
+ /**
+ * The name of the attribute used to provide the point version number.
+ */
+ public static final String ATTR_POINT_VERSION = "pointVersion";
+
+
+
+ /**
+ * The name of the attribute used to provide the version qualifier string.
+ */
+ public static final String ATTR_VERSION_QUALIFIER = "versionQualifier";
+
+
+
+ /**
+ * The name of the attribute used to provide the weekly build number.
+ */
+ public static final String ATTR_BUILD_NUMBER = "buildNumber";
+
+
+
+ /**
+ * The name of the attribute used to provide the list of bugfix IDs.
+ */
+ public static final String ATTR_FIX_IDS = "fixIDs";
+
+
+
+ /**
+ * The name of the attribute used to provide the Subversion revision number.
+ */
+ public static final String ATTR_REVISION_NUMBER = "revisionNumber";
+
+
+
+ /**
+ * The name of the attribute used to provide the build ID (aka the build
+ * timestamp).
+ */
+ public static final String ATTR_BUILD_ID = "buildID";
+
+
+
+ /**
+ * The name of the attribute used to provide the compact version string.
+ */
+ public static final String ATTR_COMPACT_VERSION = "compactVersion";
+
+
+
+ /**
+ * The name of the attribute used to provide the full version string.
+ */
+ public static final String ATTR_FULL_VERSION = "fullVersion";
@@ -147,23 +229,44 @@
*/
public ArrayList<Attribute> getMonitorData()
{
- ArrayList<Attribute> attrs = new ArrayList<Attribute>(8);
+ ArrayList<Attribute> attrs = new ArrayList<Attribute>(12);
- attrs.add(createAttribute("productName", DynamicConstants.PRODUCT_NAME));
- attrs.add(createAttribute("buildID", DynamicConstants.BUILD_ID));
- attrs.add(createAttribute("majorVersion",
+ attrs.add(createAttribute(ATTR_PRODUCT_NAME,
+ DynamicConstants.PRODUCT_NAME));
+ attrs.add(createAttribute(ATTR_SHORT_NAME, DynamicConstants.SHORT_NAME));
+ attrs.add(createAttribute(ATTR_MAJOR_VERSION,
String.valueOf(DynamicConstants.MAJOR_VERSION)));
- attrs.add(createAttribute("minorVersion",
+ attrs.add(createAttribute(ATTR_MINOR_VERSION,
String.valueOf(DynamicConstants.MINOR_VERSION)));
- attrs.add(createAttribute("pointVersion",
+ attrs.add(createAttribute(ATTR_POINT_VERSION,
String.valueOf(DynamicConstants.POINT_VERSION)));
- attrs.add(createAttribute("versionQualifier",
- DynamicConstants.VERSION_QUALIFIER));
- attrs.add(createAttribute("revisionNumber",
+
+ String versionQualifier = DynamicConstants.VERSION_QUALIFIER;
+ if ((versionQualifier != null) && (versionQualifier.length() > 0))
+ {
+ attrs.add(createAttribute(ATTR_VERSION_QUALIFIER, versionQualifier));
+ }
+
+ int buildNumber = DynamicConstants.BUILD_NUMBER;
+ if (buildNumber > 0)
+ {
+ attrs.add(createAttribute(ATTR_BUILD_NUMBER,
+ String.valueOf(buildNumber)));
+ }
+
+ String fixIDs = DynamicConstants.FIX_IDS;
+ if ((fixIDs != null) && (fixIDs.length() > 0))
+ {
+ attrs.add(createAttribute(ATTR_FIX_IDS, fixIDs));
+ }
+
+ attrs.add(createAttribute(ATTR_REVISION_NUMBER,
String.valueOf(DynamicConstants.REVISION_NUMBER)));
- attrs.add(createAttribute("debugBuild",
- String.valueOf(DynamicConstants.DEBUG_BUILD)));
- attrs.add(createAttribute("fixIDs", DynamicConstants.FIX_IDS));
+ attrs.add(createAttribute(ATTR_BUILD_ID, DynamicConstants.BUILD_ID));
+ attrs.add(createAttribute(ATTR_COMPACT_VERSION,
+ DynamicConstants.COMPACT_VERSION_STRING));
+ attrs.add(createAttribute(ATTR_FULL_VERSION,
+ DynamicConstants.FULL_VERSION_STRING));
return attrs;
}
--
Gitblit v1.10.0