Skip to content

Commit

Permalink
Expand TILEDB_REMOVE_DEPRECATIONS to exclude all deprecated C and C…
Browse files Browse the repository at this point in the history
…++ APIs. (#4887)

[SC-23937](https://app.shortcut.com/tiledb-inc/story/23937/build-artifact-disabling-deprecated-functions)

> [!NOTE]
> Depends on #4879.

As part of preparing to remove the deprecated APIs, we need a mechanism
to exclude them from being compiled. There exists already the
`TILEDB_REMOVE_DEPRECATIONS` option, but it covers only a subset of the
deprecated APIs in the C++ `Array` class.

This PR expands `TILEDB_REMOVE_DEPRECATIONS` to cover every deprecated C
and C++ API. When this option is set, a define with the same name is
defined and the deprecated APIs are not compiled into the library. This
flag also gets publicly exported from the `TileDB::tiledb` target.

---
TYPE: BUILD
DESC: Update the `TILEDB_REMOVE_DEPRECATIONS` option to exclude all
deprecated C and C++ APIs from the library binary and the headers.
  • Loading branch information
teo-tsirpanis authored Apr 29, 2024
1 parent 2d33a5c commit fd05e14
Show file tree
Hide file tree
Showing 19 changed files with 2,386 additions and 2,255 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ endif()

list(APPEND TILEDB_C_API_FILENAME_HEADERS
"${CMAKE_SOURCE_DIR}/tiledb/sm/c_api/tiledb.h"
"${CMAKE_SOURCE_DIR}/tiledb/sm/c_api/tiledb_deprecated.h"
"${CMAKE_SOURCE_DIR}/tiledb/sm/c_api/tiledb_enum.h"
"${CMAKE_SOURCE_DIR}/tiledb/sm/c_api/tiledb_version.h"
"${CMAKE_SOURCE_DIR}/tiledb/sm/c_api/tiledb_experimental.h"
Expand Down
1 change: 1 addition & 0 deletions cmake/Modules/Doxygen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ if(DOXYGEN_FOUND)
list(APPEND TILEDB_C_API_HEADERS
"${CMAKE_CURRENT_SOURCE_DIR}/tiledb/api/c_api/api_external_common.h"
"${CMAKE_CURRENT_SOURCE_DIR}/tiledb/sm/c_api/tiledb.h"
"${CMAKE_CURRENT_SOURCE_DIR}/tiledb/sm/c_api/tiledb_deprecated.h"
)
file(GLOB TILEDB_CPP_API_HEADERS
"${CMAKE_CURRENT_SOURCE_DIR}/tiledb/sm/cpp_api/*.h"
Expand Down
4 changes: 4 additions & 0 deletions examples/c_api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ endfunction()
# Get the example sources
file(GLOB TILEDB_EXAMPLE_SOURCES_CAPI "*.c")

if(TILEDB_REMOVE_DEPRECATIONS)
list(FILTER TILEDB_EXAMPLE_SOURCES_CAPI EXCLUDE REGEX "async")
endif()

# Iterate over all example sources and call the build function
foreach(EXAMPLE_SOURCE ${TILEDB_EXAMPLE_SOURCES_CAPI})
# Get the binary name
Expand Down
4 changes: 4 additions & 0 deletions examples/cpp_api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ endfunction()
# Get the example sources
file(GLOB TILEDB_EXAMPLE_SOURCES_CPPAPI "*.cc")

if(TILEDB_REMOVE_DEPRECATIONS)
list(FILTER TILEDB_EXAMPLE_SOURCES_CPPAPI EXCLUDE REGEX "async")
endif()

# Iterate over all example sources and call the build function
foreach(EXAMPLE_SOURCE ${TILEDB_EXAMPLE_SOURCES_CPPAPI})
# Get the binary name
Expand Down
7 changes: 6 additions & 1 deletion tiledb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ if (TILEDB_CPP_API)
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array.h
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array_experimental.h
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array_schema.h
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array_schema_deprecated.h
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array_schema_evolution.h
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array_schema_experimental.h
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/as_built_experimental.h
Expand Down Expand Up @@ -113,6 +114,7 @@ if (TILEDB_CPP_API)
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/query_channel.h
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/query_condition_experimental.h
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/query_condition.h
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/query_deprecated.h
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/query_experimental.h
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/schema_base.h
${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/stats.h
Expand Down Expand Up @@ -480,7 +482,6 @@ endif()

if (TILEDB_REMOVE_DEPRECATIONS)
add_definitions(-DTILEDB_REMOVE_DEPRECATIONS)
else()
message(STATUS "The TileDB library is compiled without deprecated APIs.")
endif()

Expand Down Expand Up @@ -826,6 +827,10 @@ else()
set_target_properties(tiledb PROPERTIES EXPORT_NAME tiledb_static)
endif()

if(TILEDB_REMOVE_DEPRECATIONS)
target_compile_definitions(tiledb PUBLIC TILEDB_REMOVE_DEPRECATIONS)
endif()

file(READ "${CMAKE_CURRENT_SOURCE_DIR}/sm/c_api/tiledb_version.h" ver)

string(REGEX MATCH "TILEDB_VERSION_MAJOR ([0-9]*)" _ ${ver})
Expand Down
4 changes: 4 additions & 0 deletions tiledb/api/c_api/group/group_api_external_experimental.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ TILEDB_EXPORT capi_return_t tiledb_group_remove_member(
TILEDB_EXPORT capi_return_t tiledb_group_get_member_count(
tiledb_ctx_t* ctx, tiledb_group_t* group, uint64_t* count) TILEDB_NOEXCEPT;

#ifndef TILEDB_REMOVE_DEPRECATIONS
/**
* Get a member of a group by index and details of group.
* Deprecated, use \p tiledb_group_get_member_by_index_v2 instead.
Expand Down Expand Up @@ -441,6 +442,7 @@ TILEDB_DEPRECATED_EXPORT capi_return_t tiledb_group_get_member_by_index(
char** uri,
tiledb_object_t* type,
char** name) TILEDB_NOEXCEPT;
#endif // TILEDB_REMOVE_DEPRECATIONS

/**
* Get a member of a group by index and details of group
Expand Down Expand Up @@ -481,6 +483,7 @@ TILEDB_EXPORT capi_return_t tiledb_group_get_member_by_index_v2(
tiledb_object_t* type,
tiledb_string_t** name) TILEDB_NOEXCEPT;

#ifndef TILEDB_REMOVE_DEPRECATIONS
/**
* Get a member of a group by name and details of group.
* Deprecated, use \p tiledb_group_get_member_by_name_v2.
Expand Down Expand Up @@ -518,6 +521,7 @@ TILEDB_DEPRECATED_EXPORT capi_return_t tiledb_group_get_member_by_name(
const char* name,
char** uri,
tiledb_object_t* type) TILEDB_NOEXCEPT;
#endif // TILEDB_REMOVE_DEPRECATIONS

/**
* Get a member of a group by name and details of group.
Expand Down
43 changes: 6 additions & 37 deletions tiledb/doxygen/source/c-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ Array
:project: TileDB-C
.. doxygenfunction:: tiledb_array_get_open_timestamp_end
:project: TileDB-C
.. doxygenfunction:: tiledb_array_delete_fragments
:project: TileDB-C
.. doxygenfunction:: tiledb_array_delete_fragments_list
:project: TileDB-C
.. doxygenfunction:: tiledb_array_open
Expand All @@ -241,12 +239,8 @@ Array
:project: TileDB-C
.. doxygenfunction:: tiledb_array_create
:project: TileDB-C
.. doxygenfunction:: tiledb_array_create_with_key
:project: TileDB-C
.. doxygenfunction:: tiledb_array_consolidate
:project: TileDB-C
.. doxygenfunction:: tiledb_array_consolidate_with_key
:project: TileDB-C
.. doxygenfunction:: tiledb_array_vacuum
:project: TileDB-C
.. doxygenfunction:: tiledb_array_get_schema
Expand Down Expand Up @@ -316,8 +310,6 @@ Array Schema
:project: TileDB-C
.. doxygenfunction:: tiledb_array_schema_load
:project: TileDB-C
.. doxygenfunction:: tiledb_array_schema_load_with_key
:project: TileDB-C
.. doxygenfunction:: tiledb_array_schema_get_array_type
:project: TileDB-C
.. doxygenfunction:: tiledb_array_schema_get_capacity
Expand Down Expand Up @@ -436,8 +428,6 @@ Query
:project: TileDB-C
.. doxygenfunction:: tiledb_query_get_config
:project: TileDB-C
.. doxygenfunction:: tiledb_query_set_subarray
:project: TileDB-C
.. doxygenfunction:: tiledb_query_set_data_buffer
:project: TileDB-C
.. doxygenfunction:: tiledb_query_set_offsets_buffer
Expand All @@ -462,8 +452,6 @@ Query
:project: TileDB-C
.. doxygenfunction:: tiledb_query_submit
:project: TileDB-C
.. doxygenfunction:: tiledb_query_submit_async
:project: TileDB-C
.. doxygenfunction:: tiledb_query_get_status
:project: TileDB-C
.. doxygenfunction:: tiledb_query_get_type
Expand All @@ -474,30 +462,6 @@ Query
:project: TileDB-C
.. doxygenfunction:: tiledb_query_has_results
:project: TileDB-C
.. doxygenfunction:: tiledb_query_add_range
:project: TileDB-C
.. doxygenfunction:: tiledb_query_add_range_by_name
:project: TileDB-C
.. doxygenfunction:: tiledb_query_get_range
:project: TileDB-C
.. doxygenfunction:: tiledb_query_get_range_from_name
:project: TileDB-C
.. doxygenfunction:: tiledb_query_add_range_var
:project: TileDB-C
.. doxygenfunction:: tiledb_query_add_range_var_by_name
:project: TileDB-C
.. doxygenfunction:: tiledb_query_get_range_var
:project: TileDB-C
.. doxygenfunction:: tiledb_query_get_range_var_from_name
:project: TileDB-C
.. doxygenfunction:: tiledb_query_get_range_var_size
:project: TileDB-C
.. doxygenfunction:: tiledb_query_get_range_var_size_from_name
:project: TileDB-C
.. doxygenfunction:: tiledb_query_get_range_num
:project: TileDB-C
.. doxygenfunction:: tiledb_query_get_range_num_from_name
:project: TileDB-C
.. doxygenfunction:: tiledb_query_get_est_result_size
:project: TileDB-C
.. doxygenfunction:: tiledb_query_get_est_result_size_var
Expand Down Expand Up @@ -748,7 +712,7 @@ Fragment Info
:project: TileDB-C
.. doxygenfunction:: tiledb_fragment_info_load
:project: TileDB-C
.. doxygenfunction:: tiledb_fragment_info_get_fragment_name
.. doxygenfunction:: tiledb_fragment_info_get_fragment_name_v2
:project: TileDB-C
.. doxygenfunction:: tiledb_fragment_info_get_fragment_num
:project: TileDB-C
Expand Down Expand Up @@ -812,6 +776,11 @@ Experimental
.. autodoxygenfile:: tiledb_experimental.h
:project: TileDB-C

Deprecated
-------------
.. autodoxygenfile:: tiledb_deprecated.h
:project: TileDB-C

Serialization
-------------
.. autodoxygenfile:: tiledb_serialization.h
Expand Down
3 changes: 2 additions & 1 deletion tiledb/doxygen/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,12 @@
breathe_projects = {'TileDB-C': doxygen_xml_dir, 'TileDB-C++': doxygen_xml_dir}
breathe_default_project = 'TileDB-C'
breathe_projects_source = {
'TileDB-C': (c_api_src_path, ['tiledb.h', 'tiledb_experimental.h', 'tiledb_serialization.h']),
'TileDB-C': (c_api_src_path, ['tiledb.h', 'tiledb_deprecated.h', 'tiledb_experimental.h', 'tiledb_serialization.h']),
'TileDB-C++': (cpp_api_src_path, ['tiledb', 'tiledb_experimental'])
}
breathe_domain_by_file_pattern = {
'*/c_api/tiledb.h': 'c',
'*/c_api/tiledb_deprecated.h': 'c',
'*/c_api/tiledb_experimental.h': 'c',
'*/c_api/tiledb_serialization.h': 'c',
'*/cpp_api/tiledb': 'cpp',
Expand Down
2 changes: 2 additions & 0 deletions tiledb/sm/c_api/tiledb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7307,6 +7307,7 @@ CAPI_INTERFACE(
ctx, array, serialization_type, request, response);
}

#ifndef TILEDB_REMOVE_DEPRECATIONS
/* ****************************** */
/* C++ API */
/* ****************************** */
Expand All @@ -7318,6 +7319,7 @@ int32_t tiledb::impl::tiledb_query_submit_async_func(
return api_entry<tiledb::api::impl::tiledb_query_submit_async_func>(
ctx, query, callback_func, callback_data);
}
#endif

/* ****************************** */
/* FRAGMENT INFO */
Expand Down
Loading

0 comments on commit fd05e14

Please sign in to comment.