From 966997af127c230917504578b096ab7b4dbbc0f0 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Mon, 10 Jul 2023 16:39:44 -0500 Subject: [PATCH] Build PKI console with Maven A new Maven module has been added for PKI console. The build scripts have been modified to build PKI console with Maven. The pki-console-theme.jar will continue to be built with CMake. --- .classpath | 4 +- CMakeLists.txt | 6 +-- azure-pipelines.yml | 16 +++++++ base/CMakeLists.txt | 36 +--------------- base/console/CMakeLists.txt | 25 ++++++----- base/console/bin/pkiconsole | 7 +--- base/console/pom.xml | 42 +++++++++++++++++++ base/pom.xml | 1 + build.sh | 6 +-- pki.spec | 13 +++++- .../dogtag/dev_java_tests/run_junit_tests.sh | 4 +- themes/dogtag/console-ui/src/CMakeLists.txt | 2 +- 12 files changed, 96 insertions(+), 66 deletions(-) create mode 100644 base/console/pom.xml diff --git a/.classpath b/.classpath index 1a72bba9817..25270fa1f62 100644 --- a/.classpath +++ b/.classpath @@ -27,9 +27,7 @@ - - - + diff --git a/CMakeLists.txt b/CMakeLists.txt index fae2256247e..64348f4470c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,10 +129,10 @@ add_custom_target( COMMENT "Building Java binaries" ) -# console target +# theme target add_custom_target( - console - COMMENT "Building PKI console" + theme + COMMENT "Building PKI theme" ) # javadoc target diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6c9fd12b634..bac87d50711 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -30,6 +30,7 @@ jobs: docker exec runner dnf install -y dnf-plugins-core rpm-build maven docker exec runner dnf copr enable -y @pki/master docker exec runner dnf builddep -y --spec /root/src/pki.spec + docker exec runner dnf install -y dogtag-console-framework displayName: Install PKI dependencies - script: | @@ -124,6 +125,21 @@ jobs: -DgeneratePom=true displayName: Install LDAP JDK into local Maven repo + - script: | + # get IDM Console Framework .. version + IDM_CONSOLE_FRAMEWORK_VERSION=$(docker exec runner rpm -q --qf "%{version}" dogtag-console-framework) + + docker exec runner \ + mvn install:install-file \ + -f /root/src \ + -Dfile=/usr/share/java/idm-console-framework.jar \ + -DgroupId=org.dogtagpki.console-framework \ + -DartifactId=console-framework \ + -Dversion=$IDM_CONSOLE_FRAMEWORK_VERSION-SNAPSHOT \ + -Dpackaging=jar \ + -DgeneratePom=true + displayName: Install IDM Console Framework into local Maven repo + - script: | docker exec runner \ mvn package \ diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index ccaf4a33d6d..d1d4cb78783 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -375,41 +375,9 @@ find_file(TOMCATJSS_TOMCAT_9_0_JAR /usr/share/java/tomcatjss ) -find_file(BASE_JAR +find_file(IDM_CONSOLE_FRAMEWORK_JAR NAMES - idm-console-base.jar - PATHS - ${JAVA_LIB_INSTALL_DIR} - /usr/share/java -) - -find_file(MMC_JAR - NAMES - idm-console-mcc.jar - PATHS - ${JAVA_LIB_INSTALL_DIR} - /usr/share/java -) - -find_file(MMC_EN_JAR - NAMES - idm-console-mcc_en.jar - PATHS - ${JAVA_LIB_INSTALL_DIR} - /usr/share/java -) - -find_file(NMCLF_JAR - NAMES - idm-console-nmclf.jar - PATHS - ${JAVA_LIB_INSTALL_DIR} - /usr/share/java -) - -find_file(NMCLF_EN_JAR - NAMES - idm-console-nmclf_en.jar + idm-console-framework.jar PATHS ${JAVA_LIB_INSTALL_DIR} /usr/share/java diff --git a/base/console/CMakeLists.txt b/base/console/CMakeLists.txt index f5b2d824f17..adf9a4f3aad 100644 --- a/base/console/CMakeLists.txt +++ b/base/console/CMakeLists.txt @@ -8,17 +8,18 @@ javac(pki-console-classes ${COMMONS_CLI_JAR} ${JAXRS_API_JAR} ${SLF4J_API_JAR} - ${BASE_JAR} ${LDAPJDK_JAR} ${MMC_JAR} - ${MMC_EN_JAR} ${NMCLF_JAR} ${NMCLF_EN_JAR} + ${COMMONS_CODEC_JAR} + ${JSS_JAR} + ${LDAPJDK_JAR} + ${IDM_CONSOLE_FRAMEWORK_JAR} ${PKI_COMMON_JAR} - ${JSS_JAR} ${COMMONS_CODEC_JAR} OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/classes DEPENDS pki-common-jar ) -add_dependencies(console pki-console-classes) +add_dependencies(java pki-console-classes) set(PKI_CONSOLE_JAR ${CMAKE_BINARY_DIR}/dist/pki-console.jar CACHE INTERNAL "pki-console.jar" @@ -47,7 +48,7 @@ jar(pki-console-jar pki-console-classes ) -add_dependencies(console pki-console-jar) +add_dependencies(java pki-console-jar) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/bin/pkiconsole @@ -66,9 +67,11 @@ install( WORLD_EXECUTE WORLD_READ ) -install( - FILES - ${PKI_CONSOLE_JAR} - DESTINATION - ${JAVA_JAR_INSTALL_DIR}/pki -) +if(WITH_JAVA) + install( + FILES + ${PKI_CONSOLE_JAR} + DESTINATION + ${JAVA_JAR_INSTALL_DIR}/pki + ) +endif(WITH_JAVA) diff --git a/base/console/bin/pkiconsole b/base/console/bin/pkiconsole index 79d1563bcf8..884830e0c0a 100755 --- a/base/console/bin/pkiconsole +++ b/base/console/bin/pkiconsole @@ -110,12 +110,7 @@ fi ############################################################################### CP=${PKI_LIB}/* -CP=/usr/share/java/idm-console-nmclf.jar:${CP} -CP=/usr/share/java/idm-console-nmclf_en.jar:${CP} -CP=/usr/share/java/idm-console-mcc.jar:${CP} -CP=/usr/share/java/idm-console-mcc_en.jar:${CP} -CP=/usr/share/java/idm-console-base.jar:${CP} -CP=/usr/share/java/389-console_en.jar:${CP} +CP=/usr/share/java/idm-console-framework.jar:${CP} CP=/usr/share/java/${PRODUCT}/pki-console-theme.jar:${CP} CP=/usr/share/java/${PRODUCT}/pki-console.jar:${CP} export CP diff --git a/base/console/pom.xml b/base/console/pom.xml new file mode 100644 index 00000000000..d8d15d2df75 --- /dev/null +++ b/base/console/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + + org.dogtagpki.pki + pki-base-parent + ${revision} + + + pki-console + jar + + + + + org.dogtagpki.console-framework + console-framework + 2.1.0-SNAPSHOT + + + + ${project.groupId} + pki-common + ${project.version} + + + + + + + + src/main/resources + + + pki-console + + + diff --git a/base/pom.xml b/base/pom.xml index e88b3621c99..b34b3412338 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -28,6 +28,7 @@ tps acme est + console diff --git a/build.sh b/build.sh index 8f3404c9108..7574b30a436 100755 --- a/build.sh +++ b/build.sh @@ -710,9 +710,9 @@ if [ "$BUILD_TARGET" = "dist" ] ; then make "${OPTIONS[@]}" java fi - if [ "$WITH_CONSOLE" = true ] ; then - # build PKI console - make "${OPTIONS[@]}" console + if [ "$THEME" != "" ] ; then + # build PKI theme + make "${OPTIONS[@]}" theme fi if [[ " ${PKGS_TO_BUILD[*]} " =~ " javadoc " ]]; then diff --git a/pki.spec b/pki.spec index 15574e70305..e9c3fe4286e 100644 --- a/pki.spec +++ b/pki.spec @@ -719,12 +719,12 @@ This package provides %{product_name} API documentation. Summary: %{product_name} Console Package BuildArch: noarch -BuildRequires: idm-console-framework >= 2.0 +BuildRequires: mvn(org.dogtagpki.console-framework:console-framework) >= 2.1.0 Obsoletes: pki-console < %{version}-%{release} Provides: pki-console = %{version}-%{release} -Requires: idm-console-framework >= 2.0 +Requires: mvn(org.dogtagpki.console-framework:console-framework) >= 2.1.0 Requires: %{product_id}-java = %{version}-%{release} Requires: %{product_id}-console-theme = %{version}-%{release} @@ -820,6 +820,10 @@ export JAVA_HOME=%{java_home} # flatten-maven-plugin is not available in RPM %pom_remove_plugin org.codehaus.mojo:flatten-maven-plugin +%if ! %{with console} +%pom_disable_module console base +%endif + # build Java binaries and run unit tests with Maven %mvn_build %{!?with_test:-f} -j @@ -839,6 +843,11 @@ ln -sf ../../base/tks/target/pki-tks.jar ln -sf ../../base/tps/target/pki-tps.jar ln -sf ../../base/acme/target/pki-acme.jar ln -sf ../../base/est/target/pki-est.jar + +%if %{with console} +ln -sf ../../base/console/target/pki-console.jar +%endif + popd # Remove all symbol table and relocation information from the executable. diff --git a/tests/dogtag/dev_java_tests/run_junit_tests.sh b/tests/dogtag/dev_java_tests/run_junit_tests.sh index c6a9559bea5..63417d487a1 100644 --- a/tests/dogtag/dev_java_tests/run_junit_tests.sh +++ b/tests/dogtag/dev_java_tests/run_junit_tests.sh @@ -46,9 +46,7 @@ run_dev_junit_tests() { CLASSPATH=$CLASSPATH:/usr/share/java/apache-commons-codec.jar CLASSPATH=$CLASSPATH:/usr/share/java/apache-commons-logging.jar CLASSPATH=$CLASSPATH:/usr/share/java/commons-codec.jar - CLASSPATH=$CLASSPATH:/usr/share/java/idm-console-base-1.1.7.jar - CLASSPATH=$CLASSPATH:/usr/share/java/idm-console-mcc.jar - CLASSPATH=$CLASSPATH:/usr/share/java/idm-console-nmclf.jar + CLASSPATH=$CLASSPATH:/usr/share/java/idm-console-framework.jar CLASSPATH=$CLASSPATH:/usr/share/java/jaxb-api.jar CLASSPATH=$CLASSPATH:/usr/share/java/jakarta-activation/jakarta.activation.jar CLASSPATH=$CLASSPATH:/usr/share/java/ldapjdk.jar diff --git a/themes/dogtag/console-ui/src/CMakeLists.txt b/themes/dogtag/console-ui/src/CMakeLists.txt index d98738a7fea..96ef936d04e 100644 --- a/themes/dogtag/console-ui/src/CMakeLists.txt +++ b/themes/dogtag/console-ui/src/CMakeLists.txt @@ -17,7 +17,7 @@ jar(pki-console-theme-jar com/netscape/admin/certsrv/theme/certmgmt.gif ) -add_dependencies(console pki-console-theme-jar) +add_dependencies(theme pki-console-theme-jar) install( FILES