This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/remove-jar-bundle-packaging
in repository https://gitbox.apache.org/repos/asf/celix.git

commit a82ba2357d3320d310fe6dc058c9d8a6c51b8b5e
Author: Pepijn Noltes <[email protected]>
AuthorDate: Tue Feb 10 08:47:09 2026 +0100

    Remove jar bnd packaging and introduce cmake built-in zip usage
---
 .github/workflows/ubuntu.yml            |  1 +
 CHANGES.md                              |  2 ++
 CMakeLists.txt                          |  2 --
 cmake/cmake_celix/BundlePackaging.cmake | 45 ++++++++++-----------------------
 conanfile.py                            |  1 +
 libs/utils/gtest/CMakeLists.txt         | 12 ++++-----
 6 files changed, 24 insertions(+), 39 deletions(-)

diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml
index 640d34552..351681266 100644
--- a/.github/workflows/ubuntu.yml
+++ b/.github/workflows/ubuntu.yml
@@ -146,6 +146,7 @@ jobs:
           -DENABLE_CCACHE=ON
           -DCMAKE_POLICY_VERSION_MINIMUM=3.5
           -DENABLE_GCC_ANALYZER=${{matrix.type == 'RelWithDebInfo' && 'ON' || 
'OFF'}}
+          -DCELIX_USE_COMPRESSION_FOR_BUNDLE_ZIPS=OFF
           -G Ninja
       run: |
         mkdir build install
diff --git a/CHANGES.md b/CHANGES.md
index 7da716829..e660e7ed6 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -80,6 +80,8 @@ limitations under the License.
 - The manifest format has been changed to JSON, and the manifest attribute 
names have been changed.
   The old manifest format is no longer supported.
   The old manifest attribute names are also no longer defined in 
`celix_constants.h`.
+- Using jar to packaging bundles is no longer support. Jar was used to ensure 
the MANIFEST.MF was the first
+  entry in a bundle zip file, but MANIFEST.MF is no longer used (replaced by 
MANIFEST.json).
 
 ## New Features
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 09e065ae8..9a69c377e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -157,8 +157,6 @@ if (ENABLE_TESTING)
     enable_testing()
 endif()
 
-option(CELIX_USE_ZIP_INSTEAD_OF_JAR "Default Celix cmake command will use jar 
to package bundle (if found). This option enforces Celix to use zip instead." 
OFF)
-
 option(CELIX_CXX14 "Build C++14 libraries and bundles." ON)
 option(CELIX_CXX17 "Build C++17 libraries, bundles and if testing is enabled 
C++17 tests" ON)
 if (CELIX_CXX17 AND NOT CELIX_CXX14)
diff --git a/cmake/cmake_celix/BundlePackaging.cmake 
b/cmake/cmake_celix/BundlePackaging.cmake
index bb4869022..2e28c8d13 100644
--- a/cmake/cmake_celix/BundlePackaging.cmake
+++ b/cmake/cmake_celix/BundlePackaging.cmake
@@ -19,28 +19,16 @@
 set(CELIX_NO_POSTFIX_BUILD_TYPES RelWithDebInfo Release CACHE STRING "The 
build type used for creating bundle without a build type postfix.")
 option(CELIX_USE_COMPRESSION_FOR_BUNDLE_ZIPS "Enables bundle compression" TRUE)
 
-if (CELIX_USE_COMPRESSION_FOR_BUNDLE_ZIPS)
-    set(CELIX_JAR_COMMAND_ARGUMENTS -cf)
-    set(CELIX_ZIP_COMMAND_ARGUMENTS -rq)
-else ()
-    set(CELIX_JAR_COMMAND_ARGUMENTS -cf0)
-    set(CELIX_ZIP_COMMAND_ARGUMENTS -rq0)
-endif ()
-
-find_program(JAR_COMMAND jar NO_CMAKE_FIND_ROOT_PATH)
-
-if (JAR_COMMAND AND NOT CELIX_USE_ZIP_INSTEAD_OF_JAR)
-    message(DEBUG "Using jar to create bundles")
-else ()
+if (NOT CELIX_USE_COMPRESSION_FOR_BUNDLE_ZIPS)
+    #Note `cmake -E tar --format=zip` does not support not compressing the zip 
files,
+    #falling back to using a zip command.
     find_program(ZIP_COMMAND zip NO_CMAKE_FIND_ROOT_PATH)
-    if (ZIP_COMMAND)
-        message(DEBUG "Using zip to create bundles")
-    else ()
-        message(FATAL_ERROR "A jar or zip command is needed to created 
bundles")
+    if (NOT ZIP_COMMAND)
+        message(FATAL_ERROR "Cannot find zip executable, zip exe is needed for 
creating zip files without compression")
     endif ()
+    set(CELIX_ZIP_COMMAND_ARGUMENTS -rq0)
 endif ()
 
-
 ##### setup bundles/deploy target
 if (NOT TARGET celix-bundles)
     add_custom_target(celix-bundles ALL)
@@ -286,7 +274,7 @@ function(add_celix_bundle)
     )
     #########################################################
 
-    ###### Packaging the bundle using using jar or zip and a content dir. 
Configuring dependencies ######
+    ###### Packaging the bundle using using zip or Cmake built-in zip and a 
content dir. Configuring dependencies ######
     if (ZIP_COMMAND)
         file(MAKE_DIRECTORY ${BUNDLE_CONTENT_DIR}) #Note needed because 
working_directory is bundle content dir
         add_custom_command(OUTPUT ${BUNDLE_FILE}
@@ -296,21 +284,18 @@ function(add_celix_bundle)
                 DEPENDS ${BUNDLE_TARGET_NAME} 
"$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_DEPEND_TARGETS>" 
${BUNDLE_GEN_DIR}/MANIFEST.json
                 WORKING_DIRECTORY ${BUNDLE_CONTENT_DIR}
         )
-    elseif (JAR_COMMAND)
+    else ()
+        file(MAKE_DIRECTORY ${BUNDLE_CONTENT_DIR}) #Note needed because 
working_directory is bundle content dir
         add_custom_command(OUTPUT ${BUNDLE_FILE}
-                COMMAND ${CMAKE_COMMAND} -E make_directory 
${BUNDLE_CONTENT_DIR}
                 COMMAND ${CMAKE_COMMAND} -E copy_if_different 
${BUNDLE_GEN_DIR}/MANIFEST.json ${BUNDLE_CONTENT_DIR}/META-INF/MANIFEST.json
-                COMMAND ${JAR_COMMAND} ${CELIX_JAR_COMMAND_ARGUMENTS} 
${BUNDLE_FILE} -C ${BUNDLE_CONTENT_DIR} .
+                COMMAND ${CMAKE_COMMAND} -E tar cf ${BUNDLE_FILE} --format=zip 
.
                 COMMENT "Packaging ${BUNDLE_TARGET_NAME}"
                 DEPENDS ${BUNDLE_TARGET_NAME} 
"$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_DEPEND_TARGETS>" 
${BUNDLE_GEN_DIR}/MANIFEST.json
-                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+                WORKING_DIRECTORY ${BUNDLE_CONTENT_DIR}
         )
-    else ()
-        message(FATAL_ERROR "A jar or zip command is needed to jar/zip 
bundles")
     endif ()
     
###################################################################################
 
-
     ###################################
     ##### Additional Cleanup info #####
     ###################################
@@ -943,17 +928,15 @@ function(install_celix_bundle)
             )"
                 COMPONENT ${BUNDLE}
         )
-    elseif (JAR_COMMAND)
+    else ()
         install(CODE
                 "execute_process(
                 COMMAND ${CMAKE_COMMAND} -E copy_if_different 
${BUNDLE_GEN_DIR}/MANIFEST.json META-INF/MANIFEST.json
-                COMMAND ${JAR_COMMAND} ${CELIX_JAR_COMMAND_ARGUMENTS} 
${BUNDLE_FILE_INSTALL} -C ${BUNDLE_CONTENT_DIR} .
-                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+                COMMAND ${CMAKE_COMMAND} -E tar cf ${BUNDLE_FILE_INSTALL} 
--format=zip .
+                WORKING_DIRECTORY ${BUNDLE_CONTENT_DIR}
             )"
                 COMPONENT ${BUNDLE}
         )
-    else ()
-        message(FATAL_ERROR "A jar or zip command is needed to jar/zip 
bundles")
     endif ()
 
     install(FILES ${BUNDLE_FILE_INSTALL} DESTINATION 
share/${INSTALL_PROJECT_NAME}/bundles
diff --git a/conanfile.py b/conanfile.py
index 104a9e52a..a00e7f354 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -157,6 +157,7 @@ class CelixConan(ConanFile):
         del self.info.options.enable_fuzzing
         del self.info.options.enable_code_coverage
         del self.info.options.enable_gcc_analyzer
+        del self.info.options.celix_use_compression_for_bundle_zips
 
     def build_requirements(self):
         if self.options.enable_testing:
diff --git a/libs/utils/gtest/CMakeLists.txt b/libs/utils/gtest/CMakeLists.txt
index 84fe3a4c2..56e8e2987 100644
--- a/libs/utils/gtest/CMakeLists.txt
+++ b/libs/utils/gtest/CMakeLists.txt
@@ -69,14 +69,14 @@ if(ZIP_COMMAND)
         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zip_content/top.properties 
${CMAKE_CURRENT_BINARY_DIR}/zip_content/subdir/sub.properties
         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/zip_content
     )
-else()
+else ()
     add_custom_command(OUTPUT ${TEST_ZIP_FILE}
-        COMMAND ${JAR_COMMAND} -cf ${TEST_ZIP_FILE} -C 
${CMAKE_CURRENT_BINARY_DIR}/zip_content .
-        COMMENT "Creating ${TEST_ZIP_FILE} for testing"
-        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zip_content/top.properties 
${CMAKE_CURRENT_BINARY_DIR}/zip_content/subdir/sub.properties
-        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+            COMMAND ${CMAKE_COMMAND} -E tar cf ${TEST_ZIP_FILE} --format=zip .
+            COMMENT "Creating ${TEST_ZIP_FILE} for testing"
+            DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zip_content/top.properties 
${CMAKE_CURRENT_BINARY_DIR}/zip_content/subdir/sub.properties
+            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/zip_content
     )
-endif()
+endif ()
 add_custom_target(test_utils_resources DEPENDS ${TEST_ZIP_FILE})
 add_dependencies(test_utils test_utils_resources)
 target_compile_definitions(test_utils PRIVATE 
-DTEST_ZIP_LOCATION=\"${TEST_ZIP_FILE}\")

Reply via email to