Blob Blame History Raw
From 3c6aa16ac1e1350a9700d7a3f9e836a44c9a134e Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata@redhat.com>
Date: Wed, 5 Oct 2016 22:58:16 +0200
Subject: [PATCH] Removed duplicate classes.

The CMake scripts have been modified to store compiled Java classes
in separate folders for each JAR files to avoid duplicates.

https://fedorahosted.org/pki/ticket/2505
(cherry picked from commit 0f9212ee0fee093be5e47afc15629d281984ec09)
(cherry picked from commit 9bfe6101e82319d9f14edc0b0c1c16ca02a0f9a4)
---
 CMakeLists.txt                                     | 1 -
 base/ca/src/CMakeLists.txt                         | 4 ++--
 base/common/src/CMakeLists.txt                     | 4 ++--
 base/java-tools/src/CMakeLists.txt                 | 4 ++--
 base/kra/src/CMakeLists.txt                        | 4 ++--
 base/server/cms/src/CMakeLists.txt                 | 4 ++--
 base/server/cmscore/src/CMakeLists.txt             | 4 ++--
 base/symkey/src/CMakeLists.txt                     | 4 ++--
 base/symkey/src/com/netscape/symkey/CMakeLists.txt | 2 +-
 base/util/src/CMakeLists.txt                       | 8 ++++----
 10 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c746056..457e144 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,7 +54,6 @@ macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source buil
 include(MacroCopyFile)
 include(Java)
 
-file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/classes)
 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/dist)
 
 # required for all PKI components
diff --git a/base/ca/src/CMakeLists.txt b/base/ca/src/CMakeLists.txt
index 854ce28..e612d72 100644
--- a/base/ca/src/CMakeLists.txt
+++ b/base/ca/src/CMakeLists.txt
@@ -96,7 +96,7 @@ javac(pki-ca-classes
         ${PKI_CMSUTIL_JAR} ${PKI_NSUTIL_JAR}
         ${PKI_CERTSRV_JAR} ${PKI_CMS_JAR} ${PKI_CMSCORE_JAR}
     OUTPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     DEPENDS
         symkey-jar pki-nsutil-jar pki-cmsutil-jar pki-certsrv-jar pki-cms-jar pki-cmscore-jar
 )
@@ -114,7 +114,7 @@ jar(pki-ca-jar
     PARAMS
         ${CMAKE_CURRENT_BINARY_DIR}/pki-ca.mf
     INPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     FILES
         com/netscape/ca/*.class
         org/dogtagpki/server/ca/*.class
diff --git a/base/common/src/CMakeLists.txt b/base/common/src/CMakeLists.txt
index ee41b2f..7ce833c 100644
--- a/base/common/src/CMakeLists.txt
+++ b/base/common/src/CMakeLists.txt
@@ -131,7 +131,7 @@ javac(pki-certsrv-classes
         ${JAXRS_API_JAR} ${RESTEASY_JAXRS_JAR} ${RESTEASY_ATOM_PROVIDER_JAR} ${RESTEASY_CLIENT_JAR}
         ${HTTPCLIENT_JAR} ${HTTPCORE_JAR}
     OUTPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     DEPENDS
         pki-nsutil-jar pki-cmsutil-jar
 )
@@ -149,7 +149,7 @@ jar(pki-certsrv-jar
     PARAMS
         ${CMAKE_CURRENT_BINARY_DIR}/pki-certsrv.mf
     INPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     FILES
         com/netscape/certsrv/*.class
         org/dogtagpki/tps/*.class
diff --git a/base/java-tools/src/CMakeLists.txt b/base/java-tools/src/CMakeLists.txt
index e7ca5db..6753102 100644
--- a/base/java-tools/src/CMakeLists.txt
+++ b/base/java-tools/src/CMakeLists.txt
@@ -100,7 +100,7 @@ javac(pki-tools-classes
         ${JAXRS_API_JAR} ${RESTEASY_JAXRS_JAR} ${RESTEASY_ATOM_PROVIDER_JAR}
         ${HTTPCLIENT_JAR} ${HTTPCORE_JAR}
     OUTPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     DEPENDS
         pki-nsutil-jar pki-cmsutil-jar pki-certsrv-jar
 )
@@ -118,7 +118,7 @@ jar(pki-tools-jar
     PARAMS
         ${CMAKE_CURRENT_BINARY_DIR}/pki-tools.mf
     INPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     FILES
         com/netscape/cmstools/*.class
     DEPENDS
diff --git a/base/kra/src/CMakeLists.txt b/base/kra/src/CMakeLists.txt
index 400ec01..c04d7fe 100644
--- a/base/kra/src/CMakeLists.txt
+++ b/base/kra/src/CMakeLists.txt
@@ -118,7 +118,7 @@ javac(pki-kra-classes
         ${PKI_CMSUTIL_JAR} ${PKI_NSUTIL_JAR}
         ${PKI_CERTSRV_JAR} ${PKI_CMS_JAR} ${PKI_CMSCORE_JAR} ${TOMCAT_CATALINA_JAR}
     OUTPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     DEPENDS
         symkey-jar pki-nsutil-jar pki-cmsutil-jar pki-certsrv-jar pki-cms-jar pki-cmscore-jar
 )
@@ -136,7 +136,7 @@ jar(pki-kra-jar
     PARAMS
         ${CMAKE_CURRENT_BINARY_DIR}/pki-kra.mf
     INPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     FILES
         com/netscape/kra/*.class
         org/dogtagpki/server/kra/*.class
diff --git a/base/server/cms/src/CMakeLists.txt b/base/server/cms/src/CMakeLists.txt
index 93f4a8a..447dcb1 100644
--- a/base/server/cms/src/CMakeLists.txt
+++ b/base/server/cms/src/CMakeLists.txt
@@ -133,7 +133,7 @@ javac(pki-cms-classes
         ${JAXRS_API_JAR} ${RESTEASY_JAXRS_JAR} ${RESTEASY_ATOM_PROVIDER_JAR}
         ${PKI_NSUTIL_JAR} ${PKI_CMSUTIL_JAR} ${PKI_CERTSRV_JAR} ${PKI_TOMCAT_JAR}
     OUTPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     DEPENDS
         pki-nsutil-jar pki-cmsutil-jar pki-certsrv-jar pki-tomcat-jar
 )
@@ -151,7 +151,7 @@ jar(pki-cms-jar
     PARAMS
         ${CMAKE_CURRENT_BINARY_DIR}/pki-cms.mf
     INPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     FILES
         com/netscape/cms/*.class
         org/dogtagpki/server/*.class
diff --git a/base/server/cmscore/src/CMakeLists.txt b/base/server/cmscore/src/CMakeLists.txt
index 32e4351..fe8dba2 100644
--- a/base/server/cmscore/src/CMakeLists.txt
+++ b/base/server/cmscore/src/CMakeLists.txt
@@ -133,7 +133,7 @@ javac(pki-cmscore-classes
         ${HTTPCLIENT_JAR} ${HTTPCORE_JAR}
         ${NUXWDOG_JAR}
     OUTPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     DEPENDS
         pki-nsutil-jar pki-cmsutil-jar pki-certsrv-jar pki-cms-jar pki-tomcat-jar
 )
@@ -151,7 +151,7 @@ jar(pki-cmscore-jar
     PARAMS
         ${CMAKE_CURRENT_BINARY_DIR}/pki-cmscore.mf
     INPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     FILES
         com/netscape/cmscore/*.class
     DEPENDS
diff --git a/base/symkey/src/CMakeLists.txt b/base/symkey/src/CMakeLists.txt
index 9a4e10f..8455d59 100644
--- a/base/symkey/src/CMakeLists.txt
+++ b/base/symkey/src/CMakeLists.txt
@@ -15,14 +15,14 @@ javac(symkey-classes
     CLASSPATH
         ${JSS_JAR}
     OUTPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
 )
 
 jar(symkey-jar
     CREATE
         ${CMAKE_BINARY_DIR}/dist/symkey.jar
     INPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     FILES
         com/netscape/symkey/*.class
     DEPENDS
diff --git a/base/symkey/src/com/netscape/symkey/CMakeLists.txt b/base/symkey/src/com/netscape/symkey/CMakeLists.txt
index 590a7d8..6915ee9 100644
--- a/base/symkey/src/com/netscape/symkey/CMakeLists.txt
+++ b/base/symkey/src/com/netscape/symkey/CMakeLists.txt
@@ -42,7 +42,7 @@ add_custom_command(
         ${symkey_library_HDRS}
     COMMAND
         ${Java_JAVAH_EXECUTABLE}
-            -classpath ${CMAKE_BINARY_DIR}/classes:${JAVA_LIB_INSTALL_DIR}/jss4.jar
+            -classpath ${CMAKE_CURRENT_BINARY_DIR}/../../../classes:${JAVA_LIB_INSTALL_DIR}/jss4.jar
             -jni -d ${CMAKE_CURRENT_BINARY_DIR}
             com.netscape.symkey.SessionKey
 )
diff --git a/base/util/src/CMakeLists.txt b/base/util/src/CMakeLists.txt
index f374c01..bf531d4 100644
--- a/base/util/src/CMakeLists.txt
+++ b/base/util/src/CMakeLists.txt
@@ -76,7 +76,7 @@ javac(pki-nsutil-classes
         ${APACHE_COMMONS_LANG_JAR} ${LDAPJDK_JAR} ${XALAN_JAR} ${XERCES_JAR}
         ${JSS_JAR} ${COMMONS_CODEC_JAR}
     OUTPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
 )
 
 configure_file(
@@ -92,7 +92,7 @@ jar(pki-nsutil-jar
     PARAMS
         ${CMAKE_CURRENT_BINARY_DIR}/pki-nsutil.mf
     INPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     FILES
         netscape/*.class
     DEPENDS
@@ -118,7 +118,7 @@ javac(pki-cmsutil-classes
         ${LDAPJDK_JAR} ${XALAN_JAR} ${XERCES_JAR}
         ${JSS_JAR} ${COMMONS_CODEC_JAR} ${NUXWDOG_JAR}
     OUTPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     DEPENDS
         pki-nsutil-jar
 )
@@ -136,7 +136,7 @@ jar(pki-cmsutil-jar
     PARAMS
         ${CMAKE_CURRENT_BINARY_DIR}/pki-cmsutil.mf
     INPUT_DIR
-        ${CMAKE_BINARY_DIR}/classes
+        ${CMAKE_CURRENT_BINARY_DIR}/classes
     FILES
         com/netscape/cmsutil/*.class
     DEPENDS
-- 
1.8.3.1