Skip to content

Commit 74f4257

Browse files
committed
apachegh-685: Refactor config prop cmake gen and test config props
1 parent 2c28348 commit 74f4257

File tree

16 files changed

+188
-265
lines changed

16 files changed

+188
-265
lines changed

CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ limitations under the License.
3333
- pubsub_serializer.h is removed and no longer supported. Use pubsub_message_serialization_service.h instead.
3434
- C++11 support for dm is removed. C++14 is now the minimum required version.
3535
- C++17 string_view support is removed from the utils and framework lib.
36-
- Apache Celix CMake bundle functions without a celix_ prefix or infix are removed.
36+
- Apache Celix CMake container & bundle functions without a celix_ prefix or infix are removed.
3737
- Apache Celix CMake support for creating docker images and creating runtimes dirs is removed.
3838
- Support and usage of "service.lang" service property is removed.
3939
- Rename of `CELIX_FRAMEWORK_FRAMEWORK_CACHE_DIR` config property to `CELIX_FRAMEWORK_CACHE_DIR`.
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
CELIX_AUTO_START_1=@rsa_bundle_file@ @discovery_bundle_file@ @topology_manager_bundle_file@ @tst_bundle_file@
2-
LOGHELPER_ENABLE_STDOUT_FALLBACK=true
3-
CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE=true
4-
CELIX_FRAMEWORK_CACHE_DIR=.cacheClient
5-
6-
DISCOVERY_CFG_POLL_INTERVAL=1
7-
DISCOVERY_CFG_POLL_TIMEOUT=5
8-
RSA_PORT=50881
9-
DISCOVERY_CFG_SERVER_PORT=50991
10-
DISCOVERY_CFG_POLL_ENDPOINTS=http://localhost:50992/org.apache.celix.discovery.configured
1+
{
2+
"CELIX_AUTO_START_1":"@rsa_bundle_file@ @discovery_bundle_file@ @topology_manager_bundle_file@ @tst_bundle_file@",
3+
"LOGHELPER_ENABLE_STDOUT_FALLBACK":true,
4+
"CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true,
5+
"CELIX_FRAMEWORK_CACHE_DIR":".cacheClient",
6+
"DISCOVERY_CFG_POLL_INTERVAL":1,
7+
"DISCOVERY_CFG_POLL_TIMEOUT":5,
8+
"RSA_PORT":50881,
9+
"DISCOVERY_CFG_SERVER_PORT":50991,
10+
"DISCOVERY_CFG_POLL_ENDPOINTS":"http://localhost:50992/org.apache.celix.discovery.configured"
11+
}
Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
1-
# Licensed to the Apache Software Foundation (ASF) under one
2-
# or more contributor license agreements. See the NOTICE file
3-
# distributed with this work for additional information
4-
# regarding copyright ownership. The ASF licenses this file
5-
# to you under the Apache License, Version 2.0 (the
6-
# "License"); you may not use this file except in compliance
7-
# with the License. You may obtain a copy of the License at
8-
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
11-
# Unless required by applicable law or agreed to in writing,
12-
# software distributed under the License is distributed on an
13-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
# KIND, either express or implied. See the License for the
15-
# specific language governing permissions and limitations
16-
# under the License.
17-
18-
CELIX_AUTO_START_1=@rsa_bundle_file@ @calc_bundle_file@
19-
LOGHELPER_ENABLE_STDOUT_FALLBACK=true
20-
CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE=true
1+
{
2+
"CELIX_AUTO_START_1":"@rsa_bundle_file@ @calc_bundle_file@",
3+
"LOGHELPER_ENABLE_STDOUT_FALLBACK":true,
4+
"CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true
5+
}
Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
1-
# Licensed to the Apache Software Foundation (ASF) under one
2-
# or more contributor license agreements. See the NOTICE file
3-
# distributed with this work for additional information
4-
# regarding copyright ownership. The ASF licenses this file
5-
# to you under the Apache License, Version 2.0 (the
6-
# "License"); you may not use this file except in compliance
7-
# with the License. You may obtain a copy of the License at
8-
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
11-
# Unless required by applicable law or agreed to in writing,
12-
# software distributed under the License is distributed on an
13-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
# KIND, either express or implied. See the License for the
15-
# specific language governing permissions and limitations
16-
# under the License.
17-
CELIX_AUTO_START_1=@rsa_bundle_file@ @calc_bundle_file@ @remote_example_bundle_file@ @discovery_bundle_file@ @topology_manager_bundle_file@
18-
LOGHELPER_ENABLE_STDOUT_FALLBACK=true
19-
CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE=true
20-
CELIX_FRAMEWORK_CACHE_DIR=.cacheServer
21-
22-
DISCOVERY_CFG_POLL_INTERVAL=1
23-
DISCOVERY_CFG_POLL_TIMEOUT=5
24-
RSA_PORT=50882
25-
DISCOVERY_CFG_SERVER_PORT=50992
26-
DISCOVERY_CFG_POLL_ENDPOINTS=http://localhost:50991/org.apache.celix.discovery.configured
1+
{
2+
"CELIX_AUTO_START_1":"@rsa_bundle_file@ @calc_bundle_file@ @remote_example_bundle_file@ @discovery_bundle_file@ @topology_manager_bundle_file@",
3+
"LOGHELPER_ENABLE_STDOUT_FALLBACK":true,
4+
"CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true,
5+
"CELIX_FRAMEWORK_CACHE_DIR":".cacheServer",
6+
"DISCOVERY_CFG_POLL_INTERVAL":1,
7+
"DISCOVERY_CFG_POLL_TIMEOUT":5,
8+
"RSA_PORT":50882,
9+
"DISCOVERY_CFG_SERVER_PORT":50992,
10+
"DISCOVERY_CFG_POLL_ENDPOINTS":"http://localhost:50991/org.apache.celix.discovery.configured"
11+
}

bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ add_celix_bundle_dependencies(test_tm_scoped Celix::rsa_dfi Celix::rsa_topology_
5454

5555
file(GENERATE
5656
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/config.properties"
57-
CONTENT "
58-
CELIX_AUTO_START_1=$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE> $<TARGET_PROPERTY:calculator,BUNDLE_FILE> $<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager_disc_mock_bundle,BUNDLE_FILE>
59-
LOGHELPER_ENABLE_STDOUT_FALLBACK=true
60-
CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE=true
61-
")
57+
CONTENT "{
58+
\"CELIX_AUTO_START_1\":\"$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE> $<TARGET_PROPERTY:calculator,BUNDLE_FILE> $<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager_disc_mock_bundle,BUNDLE_FILE>\",
59+
\"LOGHELPER_ENABLE_STDOUT_FALLBACK\":true,
60+
\"CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE\":true
61+
}")
6262

6363
file(GENERATE
6464
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/config_import.properties"
65-
CONTENT "
66-
CELIX_AUTO_START_1=$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE> $<TARGET_PROPERTY:calculator,BUNDLE_FILE> $<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager_test_bundle,BUNDLE_FILE>
67-
LOGHELPER_ENABLE_STDOUT_FALLBACK=true
68-
CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE=true
69-
")
65+
CONTENT "{
66+
\"CELIX_AUTO_START_1\":\"$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE> $<TARGET_PROPERTY:calculator,BUNDLE_FILE> $<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager_test_bundle,BUNDLE_FILE>\",
67+
\"LOGHELPER_ENABLE_STDOUT_FALLBACK\":true,
68+
\"CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE\":true
69+
}")
7070

7171
configure_file("scope.json" "scope.json")
7272
configure_file("scope2.json" "scope2.json")

cmake/cmake_celix/BundlePackaging.cmake

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ endif ()
3131
find_program(JAR_COMMAND jar NO_CMAKE_FIND_ROOT_PATH)
3232

3333
if (JAR_COMMAND AND NOT CELIX_USE_ZIP_INSTEAD_OF_JAR)
34-
message(STATUS "Using jar to create bundles")
34+
message(DEBUG "Using jar to create bundles")
3535
else ()
3636
find_program(ZIP_COMMAND zip NO_CMAKE_FIND_ROOT_PATH)
3737
if (ZIP_COMMAND)
38-
message(STATUS "Using zip to create bundles")
38+
message(DEBUG "Using zip to create bundles")
3939
else ()
40-
message(FATAL_ERROR "A jar or zip command is needed to jar/zip bundles")
40+
message(FATAL_ERROR "A jar or zip command is needed to created bundles")
4141
endif ()
4242
endif ()
4343

@@ -48,7 +48,7 @@ if (NOT TARGET celix-bundles)
4848
endif ()
4949
#####
5050

51-
macro(extract_version_parts VERSION MAJOR MINOR PATCH)
51+
macro(_extract_version_parts VERSION MAJOR MINOR PATCH)
5252
set(MAJOR "0")
5353
set(MINOR "0")
5454
set(PATCH "0")
@@ -67,20 +67,20 @@ macro(extract_version_parts VERSION MAJOR MINOR PATCH)
6767
endif ()
6868
endmacro()
6969

70-
function(set_library_version TARGET VERSION)
70+
function(celix_set_library_version TARGET VERSION)
7171
if (VERSION AND TARGET)
72-
extract_version_parts("${VERSION}" MAJOR MINOR PATCH)
72+
_extract_version_parts("${VERSION}" MAJOR MINOR PATCH)
7373

7474
#NOTE setting aligning ABI version with major part of the interface version.
7575
#This is simpeler than using the <current>:<revision>:<age> approach of libtool
7676
set_property(TARGET ${TARGET} PROPERTY VERSION "${VERSION}")
7777
set_property(TARGET ${TARGET} PROPERTY SOVERSION ${MAJOR})
7878
else ()
79-
message(WARNING "set_library_version: Cannot set version info TARGET and/or VERSION not provided")
79+
message(WARNING "celix_set_library_version: Cannot set version info TARGET and/or VERSION not provided")
8080
endif ()
8181
endfunction()
8282

83-
function(check_lib LIB)
83+
function(_check_lib LIB)
8484
if (TARGET ${LIB})
8585
#ok
8686
elseif (IS_ABSOLUTE ${LIB} AND EXISTS ${LIB})
@@ -90,7 +90,7 @@ function(check_lib LIB)
9090
endif ()
9191
endfunction()
9292

93-
function(check_bundle BUNDLE)
93+
function(_check_bundle BUNDLE)
9494
if (TARGET ${BUNDLE})
9595
get_target_property(BUNDLE_FILE ${BUNDLE} "BUNDLE_FILE")
9696
if (NOT BUNDLE_FILE)
@@ -191,7 +191,7 @@ function(add_celix_bundle)
191191
message(FATAL_ERROR "add_bundle function requires a value for SOURCES or ACTIVATOR not both")
192192
endif ()
193193
if (BUNDLE_ACTIVATOR)
194-
check_lib(${BUNDLE_ACTIVATOR})
194+
_check_lib(${BUNDLE_ACTIVATOR})
195195
endif ()
196196
if (NOT DEFINED BUNDLE_GROUP)
197197
set(BUNDLE_GROUP "")
@@ -246,7 +246,7 @@ function(add_celix_bundle)
246246
if (BUNDLE_SOURCES)
247247
#create lib from sources
248248
add_library(${BUNDLE_TARGET_NAME} SHARED ${BUNDLE_SOURCES})
249-
set_library_version(${BUNDLE_TARGET_NAME} ${BUNDLE_VERSION})
249+
celix_set_library_version(${BUNDLE_TARGET_NAME} ${BUNDLE_VERSION})
250250
set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES
251251
"BUNDLE_TARGET_IS_LIB" TRUE
252252
"BUNDLE_TARGET" "${BUNDLE_TARGET_NAME}_bundle"
@@ -451,7 +451,7 @@ function(celix_bundle_libs)
451451
list(REMOVE_AT ARGN 0)
452452

453453
#check if arg 0 is corrent
454-
check_bundle(${BUNDLE})
454+
_check_bundle(${BUNDLE})
455455
get_target_property(BUNDLE_DIR ${BUNDLE} "BUNDLE_CONTENT_DIR")
456456
get_target_property(BUNDLE_GEN_DIR ${BUNDLE} "BUNDLE_GEN_DIR")
457457

@@ -536,7 +536,7 @@ function(celix_bundle_import_libs)
536536
list(REMOVE_AT ARGN 0)
537537

538538
#check if arg 0 is correct
539-
check_bundle(${BUNDLE})
539+
_check_bundle(${BUNDLE})
540540

541541
get_target_property(LIBS ${BUNDLE} "BUNDLE_IMPORT_LIBS")
542542

0 commit comments

Comments
 (0)