Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
45 changes: 14 additions & 31 deletions cmake/cmake_celix/BundlePackaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}
Expand All @@ -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 #####
###################################
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def package_id(self):
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:
Expand Down
12 changes: 6 additions & 6 deletions libs/utils/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}\")
Expand Down
Loading