From cec44518b2b313308857d52bc8741f28619786f4 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 26 Jun 2013 11:15:38 +0000
Subject: [PATCH] Backport fix for OPENDJ-1026: Support the ability to specify the license file when building OpenDJ
---
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java | 5 ++++-
opendj-sdk/opends/build.xml | 38 +++++++++++++++++++++++++++++++++++++-
opendj-sdk/opends/src/server/org/opends/server/tools/upgrade/LicenseFile.java | 3 +++
opendj-sdk/opends/build.properties | 2 +-
4 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/opendj-sdk/opends/build.properties b/opendj-sdk/opends/build.properties
index 1c30b84..f1cb495 100644
--- a/opendj-sdk/opends/build.properties
+++ b/opendj-sdk/opends/build.properties
@@ -1,2 +1,2 @@
opendmk.lib.dir=
-
+license.file=
diff --git a/opendj-sdk/opends/build.xml b/opendj-sdk/opends/build.xml
index dd11b45..1592d87 100644
--- a/opendj-sdk/opends/build.xml
+++ b/opendj-sdk/opends/build.xml
@@ -175,9 +175,23 @@
<property name="snmp.resource.dir" location="src/snmp/resource" />
<property name="snmp.gen.dir" location="src/snmp/generated" />
<property name="snmp.src.dir" location="src/snmp/src" />
-
<property name="snmp.classes.dir"
location="${classes.dir}/org/opends/server/snmp" />
+
+
+ <!-- Properties for license inclusion. -->
+ <condition property="include.license.file">
+ <available file="${license.file}" type="file" />
+ </condition>
+ <fail message="The license file '${license.file}' could not be found">
+ <condition>
+ <and>
+ <isset property="license.file"/>
+ <length string="${license.file}" trim="true" when="greater" length="0"/>
+ <isfalse value="${include.license.file}"/>
+ </and>
+ </condition>
+ </fail>
<!-- sort-of Maven like properties for opendj dependencies-->
<fileset id="opendj.runtime.jars" dir="${lib.dir}">
@@ -959,6 +973,9 @@
<!-- Regenerate example plugin. -->
<antcall target="example-plugin" />
+
+ <!-- Copy license if required. -->
+ <antcall target="copylicense" />
</target>
@@ -1003,6 +1020,24 @@
<jvmarg value="-DLdapMapping"/>
</java>
</target>
+
+ <!-- Create license file if requested.
+
+ This target should only be called from targets which have defined the
+ pdir property, such as prepackage and rebuild.
+
+ The license file will be copied to ${pdir}/Legal/license_to_accept.txt.
+ This file location is hard-coded in the following classes:
+
+ org.opends.server.tools.upgrade.LicenseFile
+ org.opends.quicksetup.LicenseFile
+
+ Care must be taken to keep these filenames synchronized.
+ -->
+ <target name="copylicense" if="include.license.file" >
+ <mkdir dir="${pdir}/Legal" />
+ <copy tofile="${pdir}/Legal/license_to_accept.txt" file="${license.file}" />
+ </target>
<!-- Populate the Directory Server package, but don't zip it up. -->
<target name="prepackage" depends="cleancompile"
@@ -1184,6 +1219,7 @@
<copy todir="${pdir}/legal-notices">
<fileset dir="${resource.dir}/legal-notices" />
</copy>
+ <antcall target="copylicense" />
<copy todir="${pdir}">
<fileset file="${resource.dir}/README" />
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java
index 9efe009..207438c 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java
@@ -43,6 +43,9 @@
/**
* Represents information about the license file.
+ *
+ * NOTE: the license file location must be kept in sync with build.xml and
+ * org.opends.server.tools.upgrade.LicenseFile.
*/
public class LicenseFile
{
@@ -158,7 +161,7 @@
/**
* Checks if the license file exists.
*
- * @return <CODE>true</CODE> a license file {@value #LICENSE_FILE_NAME} exists
+ * @return <CODE>true</CODE> if the license file exists
* in the Legal directory in the top level installation directory
* <CODE>false</CODE> otherwise.
*/
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/upgrade/LicenseFile.java b/opendj-sdk/opends/src/server/org/opends/server/tools/upgrade/LicenseFile.java
index 435da16..6a4fdf8 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/upgrade/LicenseFile.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/upgrade/LicenseFile.java
@@ -36,6 +36,9 @@
/**
* Represents information about the license file.
+ *
+ * NOTE: the license file location must be kept in sync with build.xml and
+ * org.opends.quicksetup.LicenseFile.
*/
public class LicenseFile
{
--
Gitblit v1.10.0