Skip to content

Commit

Permalink
SimpleSubscriptionResumptionStorage should be made conditionally comp…
Browse files Browse the repository at this point in the history
…iled in GN (#24653)

* SimpleSubscriptionResumptionStorage should be made conditionally compiled in GN

* Restyled fix
  • Loading branch information
jtung-apple authored and pull[bot] committed Jan 24, 2024
1 parent c51182a commit e6430c0
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 46 deletions.
11 changes: 9 additions & 2 deletions src/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import("//build_overrides/chip.gni")
import("//build_overrides/nlio.gni")
import("${chip_root}/src/platform/device.gni")

import("${chip_root}/build/chip/buildconfig_header.gni")
import("common_flags.gni")
Expand Down Expand Up @@ -50,6 +51,7 @@ buildconfig_header("app_buildconfig") {
"CHIP_CONFIG_IM_FORCE_FABRIC_QUOTA_CHECK=${chip_im_force_fabric_quota_check}",
"CHIP_CONFIG_ENABLE_SESSION_RESUMPTION=${chip_enable_session_resumption}",
"CHIP_CONFIG_ACCESS_CONTROL_POLICY_LOGGING_VERBOSITY=${chip_access_control_policy_logging_verbosity}",
"CHIP_CONFIG_PERSIST_SUBSCRIPTIONS=${chip_persist_subscriptions}",
]
}

Expand Down Expand Up @@ -173,8 +175,6 @@ static_library("app") {
"ReadHandler.cpp",
"RequiredPrivilege.cpp",
"RequiredPrivilege.h",
"SimpleSubscriptionResumptionStorage.cpp",
"SimpleSubscriptionResumptionStorage.h",
"StatusResponse.cpp",
"StatusResponse.h",
"SubscriptionResumptionStorage.h",
Expand All @@ -189,6 +189,13 @@ static_library("app") {
"reporting/reporting.h",
]

if (chip_persist_subscriptions) {
sources += [
"SimpleSubscriptionResumptionStorage.cpp",
"SimpleSubscriptionResumptionStorage.h",
]
}

public_deps = [
":app_config",
"${chip_root}/src/access",
Expand Down
5 changes: 0 additions & 5 deletions src/app/SimpleSubscriptionResumptionStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@

#include <app/SimpleSubscriptionResumptionStorage.h>

// TODO: move the conditional compilation into BUILD.gn config options
#if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS

#include <lib/support/Base64.h>
#include <lib/support/CodeUtils.h>
#include <lib/support/SafeInt.h>
Expand Down Expand Up @@ -469,5 +466,3 @@ CHIP_ERROR SimpleSubscriptionResumptionStorage::DeleteAll(FabricIndex fabricInde

} // namespace app
} // namespace chip

#endif // CHIP_CONFIG_PERSIST_SUBSCRIPTIONS
5 changes: 0 additions & 5 deletions src/app/SimpleSubscriptionResumptionStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@

#include <app/SubscriptionResumptionStorage.h>

// TODO: move the conditional compilation into BUILD.gn config options
#if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS

#include <lib/core/TLV.h>
#include <lib/support/DefaultStorageKeyAllocator.h>
#include <lib/support/Pool.h>
Expand Down Expand Up @@ -141,5 +138,3 @@ class SimpleSubscriptionResumptionStorage : public SubscriptionResumptionStorage
};
} // namespace app
} // namespace chip

#endif // CHIP_CONFIG_PERSIST_SUBSCRIPTIONS
5 changes: 4 additions & 1 deletion src/app/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ chip_test_suite("tests") {
"TestPendingNotificationMap.cpp",
"TestReadInteraction.cpp",
"TestReportingEngine.cpp",
"TestSimpleSubscriptionResumptionStorage.cpp",
"TestStatusIB.cpp",
"TestStatusResponseMessage.cpp",
"TestTimedHandler.cpp",
Expand Down Expand Up @@ -147,4 +146,8 @@ chip_test_suite("tests") {
test_sources += [ "TestCommissionManager.cpp" ]
public_deps += [ "${chip_root}/src/app/server" ]
}

if (chip_persist_subscriptions) {
test_sources += [ "TestSimpleSubscriptionResumptionStorage.cpp" ]
}
}
14 changes: 0 additions & 14 deletions src/app/tests/TestSimpleSubscriptionResumptionStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#include <lib/support/UnitTestRegistration.h>
#include <nlunit-test.h>

#if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS

#include <app/SimpleSubscriptionResumptionStorage.h>
#include <lib/support/TestPersistentStorageDelegate.h>

Expand Down Expand Up @@ -468,15 +466,3 @@ int TestSimpleSubscriptionResumptionStorage()
}

CHIP_REGISTER_TEST_SUITE(TestSimpleSubscriptionResumptionStorage)

#else // CHIP_CONFIG_PERSIST_SUBSCRIPTIONS

/**
* Main
*/
int TestSimpleSubscriptionResumptionStorage()
{
return 0;
}

#endif // CHIP_CONFIG_PERSIST_SUBSCRIPTIONS
11 changes: 0 additions & 11 deletions src/lib/core/CHIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1358,17 +1358,6 @@ extern const char CHIP_NON_PRODUCTION_MARKER[];
* @}
*/

/**
* @def CHIP_CONFIG_PERSIST_SUBSCRIPTIONS
*
* @brief
* Enable persistence and resumption of subscriptions on servers.
*
*/
#ifndef CHIP_CONFIG_PERSIST_SUBSCRIPTIONS
#define CHIP_CONFIG_PERSIST_SUBSCRIPTIONS 0
#endif // CHIP_CONFIG_PERSIST_SUBSCRIPTIONS

/**
* @def CHIP_CONFIG_MAX_SUBSCRIPTION_RESUMPTION_STORAGE_CONCURRENT_ITERATORS
*
Expand Down
3 changes: 0 additions & 3 deletions src/platform/Darwin/CHIPPlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,3 @@
#ifndef CHIP_CONFIG_KVS_PATH
#define CHIP_CONFIG_KVS_PATH "/tmp/chip_kvs"
#endif // CHIP_CONFIG_KVS_PATH

// Enable subscription persistence and resumption for CI
#define CHIP_CONFIG_PERSIST_SUBSCRIPTIONS 1
3 changes: 0 additions & 3 deletions src/platform/Linux/CHIPPlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ using CHIP_CONFIG_PERSISTED_STORAGE_KEY_TYPE = const char *;
#define CHIP_CONFIG_BDX_MAX_NUM_TRANSFERS 1
#endif // CHIP_CONFIG_BDX_MAX_NUM_TRANSFERS

// Enable subscription persistence and resumption for CI
#define CHIP_CONFIG_PERSIST_SUBSCRIPTIONS 1

// ==================== Security Configuration Overrides ====================

#ifndef CHIP_CONFIG_KVS_PATH
Expand Down
2 changes: 0 additions & 2 deletions src/platform/cc13x2_26x2/CHIPPlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,3 @@
#ifndef CHIP_CONFIG_MAX_FABRICS
#define CHIP_CONFIG_MAX_FABRICS 5
#endif

#define CHIP_CONFIG_PERSIST_SUBSCRIPTIONS 0
8 changes: 8 additions & 0 deletions src/platform/device.gni
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ declare_args() {
} else {
chip_mdns = "none"
}

# Enable Subscription persistence / resumption for CI and supported platforms
if (chip_device_platform == "darwin" || chip_device_platform == "linux" ||
chip_device_platform == "fake") {
chip_persist_subscriptions = true
} else {
chip_persist_subscriptions = false
}
}

if (chip_device_platform == "bl702" && chip_enable_openthread) {
Expand Down

0 comments on commit e6430c0

Please sign in to comment.