Skip to content

Commit

Permalink
[7636] Change naming scheme used by feature test macros.
Browse files Browse the repository at this point in the history
  • Loading branch information
korydraughn committed Apr 11, 2024
1 parent 05a9c1a commit 1098f08
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 7 deletions.
49 changes: 46 additions & 3 deletions lib/core/include/irods/library_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,85 @@

/// Defined if the development library supports the C++ ticket administration library.
///
/// \sa Prefer IRODS_LIBRARY_FEATURE_TICKET_ADMINISTRATION
///
/// \since 4.3.1
#define IRODS_HAS_LIBRARY_TICKET_ADMINISTRATION 202209L

/// An alias for #IRODS_HAS_LIBRARY_TICKET_ADMINISTRATION.
///
/// \since 4.3.2
#define IRODS_LIBRARY_FEATURE_TICKET_ADMINISTRATION IRODS_HAS_LIBRARY_TICKET_ADMINISTRATION

/// Defined if the development library supports the C++ zone administration library.
///
/// \sa Prefer IRODS_LIBRARY_FEATURE_ZONE_ADMINISTRATION
///
/// \since 4.3.1
#define IRODS_HAS_LIBRARY_ZONE_ADMINISTRATION 202210L

/// An alias for #IRODS_HAS_LIBRARY_ZONE_ADMINISTRATION.
///
/// \since 4.3.2
#define IRODS_LIBRARY_FEATURE_ZONE_ADMINISTRATION IRODS_HAS_LIBRARY_ZONE_ADMINISTRATION

/// Defined if the development library supports #rc_switch_user.
///
/// \sa Prefer IRODS_LIBRARY_FEATURE_SWITCH_USER
///
/// \since 4.3.1
#define IRODS_HAS_API_ENDPOINT_SWITCH_USER 202211L

/// An alias for #IRODS_HAS_API_ENDPOINT_SWITCH_USER.
///
/// \since 4.3.2
#define IRODS_LIBRARY_FEATURE_SWITCH_USER IRODS_HAS_API_ENDPOINT_SWITCH_USER

/// Defined if the development library supports the C++ system_error library.
///
/// \sa Prefer IRODS_LIBRARY_FEATURE_SYSTEM_ERROR
///
/// \since 4.3.1
#define IRODS_HAS_LIBRARY_SYSTEM_ERROR 202301L

/// An alias for #IRODS_HAS_LIBRARY_SYSTEM_ERROR.
///
/// \since 4.3.2
#define IRODS_LIBRARY_FEATURE_SYSTEM_ERROR IRODS_HAS_LIBRARY_SYSTEM_ERROR

/// Defined if the C++ client connection libraries support proxy users.
///
/// \sa Prefer IRODS_LIBRARY_FEATURE_CLIENT_CONNECTION_LIBRARIES_SUPPORT_PROXY_USERS
///
/// \since 4.3.1
#define IRODS_HAS_FEATURE_PROXY_USER_SUPPORT_FOR_CLIENT_CONNECTION_LIBRARIES 202306L

/// An alias for #IRODS_HAS_FEATURE_PROXY_USER_SUPPORT_FOR_CLIENT_CONNECTION_LIBRARIES.
///
/// \since 4.3.2
#define IRODS_LIBRARY_FEATURE_CLIENT_CONNECTION_LIBRARIES_SUPPORT_PROXY_USERS \
IRODS_HAS_FEATURE_PROXY_USER_SUPPORT_FOR_CLIENT_CONNECTION_LIBRARIES

/// Defined if the development library supports #rc_check_auth_credentials.
///
/// \sa Prefer IRODS_LIBRARY_FEATURE_CHECK_AUTH_CREDENTIALS
///
/// \since 4.3.1
#define IRODS_HAS_API_ENDPOINT_CHECK_AUTH_CREDENTIALS 202307L
#define IRODS_HAS_API_ENDPOINT_CHECK_AUTH_CREDENTIALS 202307L

/// An alias for #IRODS_HAS_API_ENDPOINT_CHECK_AUTH_CREDENTIALS.
///
/// \since 4.3.2
#define IRODS_LIBRARY_FEATURE_CHECK_AUTH_CREDENTIALS IRODS_HAS_API_ENDPOINT_CHECK_AUTH_CREDENTIALS

/// Defined if the development library supports #rc_replica_truncate.
///
/// \since 4.3.2
#define IRODS_HAS_API_ENDPOINT_REPLICA_TRUNCATE 202403L
#define IRODS_LIBRARY_FEATURE_REPLICA_TRUNCATE 202403L

/// Defined if the development library supports #rc_genquery2.
///
/// \since 4.3.2
#define IRODS_HAS_API_ENDPOINT_GENQUERY2 202403L
#define IRODS_LIBRARY_FEATURE_GENQUERY2 202404L

#endif // IRODS_LIBRARY_FEATURES_H
16 changes: 14 additions & 2 deletions server/api/src/rs_get_library_features.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,25 @@ auto rs_get_library_features(RsComm* _comm, char** _features) -> int
// clang-format off
*_features = strdup(nlohmann::json{
IRODS_FEATURE(IRODS_HAS_LIBRARY_TICKET_ADMINISTRATION)
IRODS_FEATURE(IRODS_LIBRARY_FEATURE_TICKET_ADMINISTRATION)

IRODS_FEATURE(IRODS_HAS_LIBRARY_ZONE_ADMINISTRATION)
IRODS_FEATURE(IRODS_LIBRARY_FEATURE_ZONE_ADMINISTRATION)

IRODS_FEATURE(IRODS_HAS_API_ENDPOINT_SWITCH_USER)
IRODS_FEATURE(IRODS_LIBRARY_FEATURE_SWITCH_USER)

IRODS_FEATURE(IRODS_HAS_LIBRARY_SYSTEM_ERROR)
IRODS_FEATURE(IRODS_LIBRARY_FEATURE_SYSTEM_ERROR)

IRODS_FEATURE(IRODS_HAS_FEATURE_PROXY_USER_SUPPORT_FOR_CLIENT_CONNECTION_LIBRARIES)
IRODS_FEATURE(IRODS_LIBRARY_FEATURE_CLIENT_CONNECTION_LIBRARIES_SUPPORT_PROXY_USERS)

IRODS_FEATURE(IRODS_HAS_API_ENDPOINT_CHECK_AUTH_CREDENTIALS)
IRODS_FEATURE(IRODS_HAS_API_ENDPOINT_REPLICA_TRUNCATE)
IRODS_FEATURE(IRODS_HAS_API_ENDPOINT_GENQUERY2)
IRODS_FEATURE(IRODS_LIBRARY_FEATURE_CHECK_AUTH_CREDENTIALS)

IRODS_FEATURE(IRODS_LIBRARY_FEATURE_REPLICA_TRUNCATE)
IRODS_FEATURE(IRODS_LIBRARY_FEATURE_GENQUERY2)
}.dump().c_str());
// clang-format on

Expand Down
16 changes: 14 additions & 2 deletions unit_tests/src/test_rc_get_library_features.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,25 @@ TEST_CASE("rc_get_library_features")

// clang-format off
CHECK(202209 == features.at(IRODS_TO_STRING(IRODS_HAS_LIBRARY_TICKET_ADMINISTRATION)).get<int>());
CHECK(202209 == features.at(IRODS_TO_STRING(IRODS_LIBRARY_FEATURE_TICKET_ADMINISTRATION)).get<int>());

CHECK(202210 == features.at(IRODS_TO_STRING(IRODS_HAS_LIBRARY_ZONE_ADMINISTRATION)).get<int>());
CHECK(202210 == features.at(IRODS_TO_STRING(IRODS_LIBRARY_FEATURE_ZONE_ADMINISTRATION)).get<int>());

CHECK(202211 == features.at(IRODS_TO_STRING(IRODS_HAS_API_ENDPOINT_SWITCH_USER)).get<int>());
CHECK(202211 == features.at(IRODS_TO_STRING(IRODS_LIBRARY_FEATURE_SWITCH_USER)).get<int>());

CHECK(202301 == features.at(IRODS_TO_STRING(IRODS_HAS_LIBRARY_SYSTEM_ERROR)).get<int>());
CHECK(202301 == features.at(IRODS_TO_STRING(IRODS_LIBRARY_FEATURE_SYSTEM_ERROR)).get<int>());

CHECK(202306 == features.at(IRODS_TO_STRING(IRODS_HAS_FEATURE_PROXY_USER_SUPPORT_FOR_CLIENT_CONNECTION_LIBRARIES)).get<int>());
CHECK(202306 == features.at(IRODS_TO_STRING(IRODS_LIBRARY_FEATURE_CLIENT_CONNECTION_LIBRARIES_SUPPORT_PROXY_USERS)).get<int>());

CHECK(202307 == features.at(IRODS_TO_STRING(IRODS_HAS_API_ENDPOINT_CHECK_AUTH_CREDENTIALS)).get<int>());
CHECK(202403 == features.at(IRODS_TO_STRING(IRODS_HAS_API_ENDPOINT_REPLICA_TRUNCATE)).get<int>());
CHECK(202403 == features.at(IRODS_TO_STRING(IRODS_HAS_API_ENDPOINT_GENQUERY2)).get<int>());
CHECK(202307 == features.at(IRODS_TO_STRING(IRODS_LIBRARY_FEATURE_CHECK_AUTH_CREDENTIALS)).get<int>());

CHECK(202403 == features.at(IRODS_TO_STRING(IRODS_LIBRARY_FEATURE_REPLICA_TRUNCATE)).get<int>());
CHECK(202404 == features.at(IRODS_TO_STRING(IRODS_LIBRARY_FEATURE_GENQUERY2)).get<int>());
// clang-format on
}

Expand Down

0 comments on commit 1098f08

Please sign in to comment.