diff --git a/MODERNIZATION.md b/MODERNIZATION.md index 6130d11e..5ab75a64 100644 --- a/MODERNIZATION.md +++ b/MODERNIZATION.md @@ -982,7 +982,35 @@ exactly that. So consolidation walks the dependency chain from the top: standalone chain (utils 49/49 → proto-rpc 26/26 → dht 83/83 → trackerless-network → proxyclient 15/15), lint green in all five touched packages (utils module units now clangd-tidy-linted). -6. C-6 streamr-logger +6. **C-6 streamr-logger** ✅ — the 11 headers (4 public + 7 detail/) + became named sub-modules (`streamr.logger.X`, tree-mirroring + `modules/detail/` for the internals); façade and include/ tree + deleted; all 43 repo-wide `import streamr.logger;` consumers flipped + to narrow imports (virtually all of them just + `streamr.logger.SLogger`), plus one proxyclient test that still + included SLogger.hpp textually. streamr-json usage inside the logger + units stays a TEXTUAL global-module-fragment include until C-7 + consolidates that package. Two new mechanical findings for the + remaining steps: (i) namespace-scope `static constexpr` constants + have internal linkage and cannot be exported — they become + `inline constexpr` when a header moves into module purview (the + detail color constants); (ii) a purview declaration of a C symbol + silently gets module attachment and no longer matches the libc + symbol at link time (`extern char** environ;` in FollyLoggerImpl — + undefined symbol `environ@streamr.logger.FollyLoggerImpl`); such + declarations belong in the global module fragment. + Verified: whole-tree build, 309/309 tests (per-test timeouts), + standalone chain (logger 63/63 → utils 49/49 → proto-rpc 26/26 → + dht 83/83 → trackerless-network → proxyclient 15/15), lint green in + all six touched packages (logger module units now + clangd-tidy-linted). One more clangd-tidy exclusion added after the + linux-arm64 CI leg failed: proto-rpc's RpcCommunicatorTest.cpp trips + the known preamble/BMI std-type unification failure class on the + Linux clangd build (spurious std::string-vs-std::string mismatch on + every gtest assertion) while the macOS clangd of the same major + version accepts it — owner-approved selective disabling, compiler + coverage unaffected (fourth exclusion overall; revisit each clangd + release). 7. C-7 streamr-json 8. C-8 streamr-eventemitter (+ final bench.sh metrics and memo closure) diff --git a/packages/streamr-dht/modules/connection/Connection.cppm b/packages/streamr-dht/modules/connection/Connection.cppm index 6766eb1d..4a90292b 100644 --- a/packages/streamr-dht/modules/connection/Connection.cppm +++ b/packages/streamr-dht/modules/connection/Connection.cppm @@ -14,7 +14,7 @@ module; export module streamr.dht.Connection; import streamr.eventemitter; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.Branded; import streamr.utils.Uuid; diff --git a/packages/streamr-dht/modules/connection/ConnectionLockRpcLocal.cppm b/packages/streamr-dht/modules/connection/ConnectionLockRpcLocal.cppm index 02d38195..8d26040d 100644 --- a/packages/streamr-dht/modules/connection/ConnectionLockRpcLocal.cppm +++ b/packages/streamr-dht/modules/connection/ConnectionLockRpcLocal.cppm @@ -13,7 +13,7 @@ module; export module streamr.dht.ConnectionLockRpcLocal; import streamr.dht.DhtRpcServer; -import streamr.logger; +import streamr.logger.SLogger; import streamr.dht.ConnectionLockStates; import streamr.dht.DhtCallContext; import streamr.dht.Identifiers; diff --git a/packages/streamr-dht/modules/connection/ConnectionLockRpcRemote.cppm b/packages/streamr-dht/modules/connection/ConnectionLockRpcRemote.cppm index 2a866368..30d60cb8 100644 --- a/packages/streamr-dht/modules/connection/ConnectionLockRpcRemote.cppm +++ b/packages/streamr-dht/modules/connection/ConnectionLockRpcRemote.cppm @@ -14,7 +14,7 @@ module; export module streamr.dht.ConnectionLockRpcRemote; import streamr.dht.DhtRpcClient; -import streamr.logger; +import streamr.logger.SLogger; import streamr.dht.ConnectionLockStates; import streamr.dht.DhtCallContext; import streamr.dht.Identifiers; diff --git a/packages/streamr-dht/modules/connection/ConnectionManager.cppm b/packages/streamr-dht/modules/connection/ConnectionManager.cppm index abd71fb6..55923d26 100644 --- a/packages/streamr-dht/modules/connection/ConnectionManager.cppm +++ b/packages/streamr-dht/modules/connection/ConnectionManager.cppm @@ -21,7 +21,7 @@ export module streamr.dht.ConnectionManager; import streamr.protorpc.RpcCommunicator; import streamr.dht.ConnectionLockStates; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.waitForEvent; import streamr.dht.ConnectionLockRpcLocal; import streamr.dht.ConnectionLockRpcRemote; diff --git a/packages/streamr-dht/modules/connection/ConnectorFacade.cppm b/packages/streamr-dht/modules/connection/ConnectorFacade.cppm index dba375df..b473bc74 100644 --- a/packages/streamr-dht/modules/connection/ConnectorFacade.cppm +++ b/packages/streamr-dht/modules/connection/ConnectorFacade.cppm @@ -13,7 +13,7 @@ module; export module streamr.dht.ConnectorFacade; import streamr.dht.Identifiers; -import streamr.logger; +import streamr.logger.SLogger; import streamr.protorpc.RpcCommunicator; import streamr.dht.IPendingConnection; import streamr.dht.ListeningRpcCommunicator; diff --git a/packages/streamr-dht/modules/connection/Handshaker.cppm b/packages/streamr-dht/modules/connection/Handshaker.cppm index ee5ac19e..af13bde7 100644 --- a/packages/streamr-dht/modules/connection/Handshaker.cppm +++ b/packages/streamr-dht/modules/connection/Handshaker.cppm @@ -11,7 +11,7 @@ module; export module streamr.dht.Handshaker; import streamr.eventemitter; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.EnableSharedFromThis; import streamr.utils.Uuid; import streamr.dht.Connection; diff --git a/packages/streamr-dht/modules/connection/IncomingHandshaker.cppm b/packages/streamr-dht/modules/connection/IncomingHandshaker.cppm index 9905f04c..7de2ddeb 100644 --- a/packages/streamr-dht/modules/connection/IncomingHandshaker.cppm +++ b/packages/streamr-dht/modules/connection/IncomingHandshaker.cppm @@ -12,7 +12,7 @@ module; export module streamr.dht.IncomingHandshaker; -import streamr.logger; +import streamr.logger.SLogger; import streamr.eventemitter; import streamr.dht.Connection; import streamr.dht.Handshaker; diff --git a/packages/streamr-dht/modules/connection/OutgoingHandshaker.cppm b/packages/streamr-dht/modules/connection/OutgoingHandshaker.cppm index 4246bbbf..717919ed 100644 --- a/packages/streamr-dht/modules/connection/OutgoingHandshaker.cppm +++ b/packages/streamr-dht/modules/connection/OutgoingHandshaker.cppm @@ -13,7 +13,7 @@ module; export module streamr.dht.OutgoingHandshaker; import streamr.dht.IPendingConnection; -import streamr.logger; +import streamr.logger.SLogger; import streamr.eventemitter; import streamr.dht.Connection; import streamr.dht.Handshaker; diff --git a/packages/streamr-dht/modules/connection/PendingConnection.cppm b/packages/streamr-dht/modules/connection/PendingConnection.cppm index 5afdbc51..06637e07 100644 --- a/packages/streamr-dht/modules/connection/PendingConnection.cppm +++ b/packages/streamr-dht/modules/connection/PendingConnection.cppm @@ -16,7 +16,7 @@ export module streamr.dht.PendingConnection; import streamr.utils.AbortController; import streamr.utils.AbortableTimers; -import streamr.logger; +import streamr.logger.SLogger; import streamr.dht.Connection; import streamr.dht.IPendingConnection; import streamr.dht.Identifiers; diff --git a/packages/streamr-dht/modules/connection/endpoint/ConnectedEndpointState.cppm b/packages/streamr-dht/modules/connection/endpoint/ConnectedEndpointState.cppm index 97f69331..f0907870 100644 --- a/packages/streamr-dht/modules/connection/endpoint/ConnectedEndpointState.cppm +++ b/packages/streamr-dht/modules/connection/endpoint/ConnectedEndpointState.cppm @@ -14,7 +14,7 @@ module; export module streamr.dht.ConnectedEndpointState; import streamr.eventemitter; -import streamr.logger; +import streamr.logger.SLogger; import streamr.dht.Connection; import streamr.dht.EndpointState; import streamr.dht.EndpointStateInterface; diff --git a/packages/streamr-dht/modules/connection/endpoint/ConnectingEndpointState.cppm b/packages/streamr-dht/modules/connection/endpoint/ConnectingEndpointState.cppm index 557df4a0..faf07f5b 100644 --- a/packages/streamr-dht/modules/connection/endpoint/ConnectingEndpointState.cppm +++ b/packages/streamr-dht/modules/connection/endpoint/ConnectingEndpointState.cppm @@ -10,7 +10,7 @@ module; export module streamr.dht.ConnectingEndpointState; -import streamr.logger; +import streamr.logger.SLogger; import streamr.dht.Connection; import streamr.dht.IPendingConnection; import streamr.eventemitter; diff --git a/packages/streamr-dht/modules/connection/endpoint/DisconnectedEndpointState.cppm b/packages/streamr-dht/modules/connection/endpoint/DisconnectedEndpointState.cppm index 5f8e9b70..2b5087d7 100644 --- a/packages/streamr-dht/modules/connection/endpoint/DisconnectedEndpointState.cppm +++ b/packages/streamr-dht/modules/connection/endpoint/DisconnectedEndpointState.cppm @@ -10,7 +10,7 @@ module; export module streamr.dht.DisconnectedEndpointState; -import streamr.logger; +import streamr.logger.SLogger; import streamr.dht.Connection; import streamr.dht.EndpointState; import streamr.dht.EndpointStateInterface; diff --git a/packages/streamr-dht/modules/connection/endpoint/Endpoint.cppm b/packages/streamr-dht/modules/connection/endpoint/Endpoint.cppm index 08eb4613..f302fa27 100644 --- a/packages/streamr-dht/modules/connection/endpoint/Endpoint.cppm +++ b/packages/streamr-dht/modules/connection/endpoint/Endpoint.cppm @@ -15,7 +15,7 @@ module; export module streamr.dht.Endpoint; import streamr.eventemitter; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.EnableSharedFromThis; import streamr.dht.ConnectedEndpointState; import streamr.dht.ConnectingEndpointState; diff --git a/packages/streamr-dht/modules/connection/endpoint/EndpointState.cppm b/packages/streamr-dht/modules/connection/endpoint/EndpointState.cppm index daf7f7dd..811ed6c3 100644 --- a/packages/streamr-dht/modules/connection/endpoint/EndpointState.cppm +++ b/packages/streamr-dht/modules/connection/endpoint/EndpointState.cppm @@ -10,7 +10,7 @@ module; export module streamr.dht.EndpointState; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.EnableSharedFromThis; import streamr.dht.Connection; import streamr.dht.IPendingConnection; diff --git a/packages/streamr-dht/modules/connection/endpoint/InitialEndpointState.cppm b/packages/streamr-dht/modules/connection/endpoint/InitialEndpointState.cppm index 63845525..69d781f7 100644 --- a/packages/streamr-dht/modules/connection/endpoint/InitialEndpointState.cppm +++ b/packages/streamr-dht/modules/connection/endpoint/InitialEndpointState.cppm @@ -10,7 +10,7 @@ module; export module streamr.dht.InitialEndpointState; -import streamr.logger; +import streamr.logger.SLogger; import streamr.dht.Connection; import streamr.dht.EndpointState; import streamr.dht.EndpointStateInterface; diff --git a/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnection.cppm b/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnection.cppm index 899605dd..89b4ff95 100644 --- a/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnection.cppm +++ b/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnection.cppm @@ -12,7 +12,7 @@ module; export module streamr.dht.WebsocketClientConnection; import streamr.dht.Connection; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.waitForEvent; import streamr.dht.WebsocketConnection; diff --git a/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnector.cppm b/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnector.cppm index 58898fe9..1d545234 100644 --- a/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnector.cppm +++ b/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnector.cppm @@ -15,7 +15,7 @@ export module streamr.dht.WebsocketClientConnector; import streamr.dht.Handshaker; import streamr.dht.Connection; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.AbortController; import streamr.dht.Connectivity; import streamr.dht.IPendingConnection; diff --git a/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnectorRpcRemote.cppm b/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnectorRpcRemote.cppm index 3cf66a17..423014be 100644 --- a/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnectorRpcRemote.cppm +++ b/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnectorRpcRemote.cppm @@ -11,7 +11,7 @@ export module streamr.dht.WebsocketClientConnectorRpcRemote; import streamr.dht.DhtRpcClient; import streamr.protorpc.RpcCommunicator; -import streamr.logger; +import streamr.logger.SLogger; import streamr.dht.DhtCallContext; import streamr.dht.Identifiers; import streamr.dht.RpcRemote; diff --git a/packages/streamr-dht/modules/connection/websocket/WebsocketConnection.cppm b/packages/streamr-dht/modules/connection/websocket/WebsocketConnection.cppm index 1fad69bd..7fe34830 100644 --- a/packages/streamr-dht/modules/connection/websocket/WebsocketConnection.cppm +++ b/packages/streamr-dht/modules/connection/websocket/WebsocketConnection.cppm @@ -11,7 +11,7 @@ module; export module streamr.dht.WebsocketConnection; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.EnableSharedFromThis; import streamr.dht.Connection; diff --git a/packages/streamr-dht/modules/connection/websocket/WebsocketServer.cppm b/packages/streamr-dht/modules/connection/websocket/WebsocketServer.cppm index ec3f1fa5..3e091430 100644 --- a/packages/streamr-dht/modules/connection/websocket/WebsocketServer.cppm +++ b/packages/streamr-dht/modules/connection/websocket/WebsocketServer.cppm @@ -17,7 +17,7 @@ export module streamr.dht.WebsocketServer; import streamr.eventemitter; import streamr.dht.Connection; import streamr.dht.WebsocketConnection; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.Uuid; import streamr.dht.CertificateHelper; import streamr.dht.Errors; diff --git a/packages/streamr-dht/modules/connection/websocket/WebsocketServerConnection.cppm b/packages/streamr-dht/modules/connection/websocket/WebsocketServerConnection.cppm index d246396a..c1857e9b 100644 --- a/packages/streamr-dht/modules/connection/websocket/WebsocketServerConnection.cppm +++ b/packages/streamr-dht/modules/connection/websocket/WebsocketServerConnection.cppm @@ -11,7 +11,7 @@ export module streamr.dht.WebsocketServerConnection; import streamr.dht.Connection; import streamr.eventemitter; -import streamr.logger; +import streamr.logger.SLogger; import streamr.dht.WebsocketConnection; // Hoisted from the former header (file scope, NOT exported); diff --git a/packages/streamr-dht/modules/connection/websocket/WebsocketServerConnector.cppm b/packages/streamr-dht/modules/connection/websocket/WebsocketServerConnector.cppm index 01687c54..654317a5 100644 --- a/packages/streamr-dht/modules/connection/websocket/WebsocketServerConnector.cppm +++ b/packages/streamr-dht/modules/connection/websocket/WebsocketServerConnector.cppm @@ -15,7 +15,7 @@ module; export module streamr.dht.WebsocketServerConnector; import streamr.dht.WebsocketServerConnection; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.AbortController; import streamr.utils.Ipv4Helper; import streamr.utils.Uuid; diff --git a/packages/streamr-dht/modules/transport/RoutingRpcCommunicator.cppm b/packages/streamr-dht/modules/transport/RoutingRpcCommunicator.cppm index c39ab416..49dccc9d 100644 --- a/packages/streamr-dht/modules/transport/RoutingRpcCommunicator.cppm +++ b/packages/streamr-dht/modules/transport/RoutingRpcCommunicator.cppm @@ -11,7 +11,7 @@ module; export module streamr.dht.RoutingRpcCommunicator; -import streamr.logger; +import streamr.logger.SLogger; import streamr.protorpc.RpcCommunicator; import streamr.protorpc.protos; import streamr.utils.Uuid; diff --git a/packages/streamr-dht/test/integration/ConnectionLockingTest.cpp b/packages/streamr-dht/test/integration/ConnectionLockingTest.cpp index 1f3b28e6..0cc3738f 100644 --- a/packages/streamr-dht/test/integration/ConnectionLockingTest.cpp +++ b/packages/streamr-dht/test/integration/ConnectionLockingTest.cpp @@ -18,7 +18,7 @@ import streamr.dht.Identifiers; import streamr.dht.PortRange; import streamr.dht.Transport; import streamr.dht.protos; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.collect; import streamr.utils.waitForCondition; diff --git a/packages/streamr-dht/test/integration/WebsocketClientServerTest.cpp b/packages/streamr-dht/test/integration/WebsocketClientServerTest.cpp index 6fb01f5b..056ea042 100644 --- a/packages/streamr-dht/test/integration/WebsocketClientServerTest.cpp +++ b/packages/streamr-dht/test/integration/WebsocketClientServerTest.cpp @@ -7,7 +7,7 @@ import streamr.dht.Transport; import streamr.dht.WebsocketClientConnection; import streamr.dht.WebsocketServer; import streamr.dht.WebsocketServerConnection; -import streamr.logger; +import streamr.logger.SLogger; using streamr::dht::connection::connectionevents::Connected; using streamr::dht::connection::connectionevents::Data; diff --git a/packages/streamr-dht/test/unit/CertificateHelperTest.cpp b/packages/streamr-dht/test/unit/CertificateHelperTest.cpp index b8c1e980..6a962ba7 100644 --- a/packages/streamr-dht/test/unit/CertificateHelperTest.cpp +++ b/packages/streamr-dht/test/unit/CertificateHelperTest.cpp @@ -1,7 +1,7 @@ #include import streamr.dht.CertificateHelper; -import streamr.logger; +import streamr.logger.SLogger; using streamr::dht::helpers::CertificateHelper; using streamr::logger::SLogger; diff --git a/packages/streamr-dht/test/unit/ConnectionManagerTest.cpp b/packages/streamr-dht/test/unit/ConnectionManagerTest.cpp index ce9de61e..0ed25150 100644 --- a/packages/streamr-dht/test/unit/ConnectionManagerTest.cpp +++ b/packages/streamr-dht/test/unit/ConnectionManagerTest.cpp @@ -15,7 +15,7 @@ import streamr.dht.FakeTransport; import streamr.dht.PortRange; import streamr.dht.Transport; import streamr.dht.protos; -import streamr.logger; +import streamr.logger.SLogger; using ::dht::ConnectivityResponse; using ::dht::Message; diff --git a/packages/streamr-libstreamrproxyclient/CMakeLists.txt b/packages/streamr-libstreamrproxyclient/CMakeLists.txt index 87e3d61c..c8027309 100644 --- a/packages/streamr-libstreamrproxyclient/CMakeLists.txt +++ b/packages/streamr-libstreamrproxyclient/CMakeLists.txt @@ -90,6 +90,9 @@ if (NOT IOS) find_package(folly CONFIG REQUIRED) add_executable(streamr-streamrproxyclient-test-integration test/integration/StreamrProxyClientTest.cpp) + # The test imports streamr.logger.SLogger (the former textual include + # died with the logger consolidation, MODERNIZATION.md Phase 2.6). + streamr_enable_imports(streamr-streamrproxyclient-test-integration) target_link_directories(streamr-streamrproxyclient-test-integration PUBLIC ${SHAREDLIB_OUTPUT_DIRECTORY}) target_include_directories(streamr-streamrproxyclient-test-integration PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include) diff --git a/packages/streamr-libstreamrproxyclient/src/streamrproxyclient.cpp b/packages/streamr-libstreamrproxyclient/src/streamrproxyclient.cpp index 945e6eff..7acd5268 100644 --- a/packages/streamr-libstreamrproxyclient/src/streamrproxyclient.cpp +++ b/packages/streamr-libstreamrproxyclient/src/streamrproxyclient.cpp @@ -28,7 +28,7 @@ import streamr.dht.ConnectorFacade; import streamr.dht.FakeTransport; import streamr.dht.Identifiers; import streamr.dht.protos; -import streamr.logger; +import streamr.logger.SLogger; import streamr.trackerlessnetwork.ProxyClient; import streamr.utils.BinaryUtils; import streamr.utils.EthereumAddress; diff --git a/packages/streamr-libstreamrproxyclient/test/integration/StreamrProxyClientTest.cpp b/packages/streamr-libstreamrproxyclient/test/integration/StreamrProxyClientTest.cpp index 82528441..abfdd600 100644 --- a/packages/streamr-libstreamrproxyclient/test/integration/StreamrProxyClientTest.cpp +++ b/packages/streamr-libstreamrproxyclient/test/integration/StreamrProxyClientTest.cpp @@ -2,7 +2,7 @@ #include #include #include -#include "streamr-logger/SLogger.hpp" +import streamr.logger.SLogger; using streamr::logger::SLogger; diff --git a/packages/streamr-logger/CMakeLists.txt b/packages/streamr-logger/CMakeLists.txt index c5f267f1..5bae4fb1 100644 --- a/packages/streamr-logger/CMakeLists.txt +++ b/packages/streamr-logger/CMakeLists.txt @@ -29,14 +29,15 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # project() because it inspects the compiler id. include(${CMAKE_CURRENT_SOURCE_DIR}/StreamrModules.cmake) -# Module façade (MODERNIZATION.md Part 2): the package is now a STATIC -# library whose module interface units re-export the public headers. -# #include consumers are unaffected; import consumers get the BMIs. -# detail/ headers stay internal (no partitions). +# CONSOLIDATED (MODERNIZATION.md Phase 2.6): one named sub-module per +# former header (settled architecture: no umbrella; consumers and tests +# import the individual sub-modules — external consumers virtually always +# just streamr.logger.SLogger). The include/ tree is gone; the module +# interface units are the source of truth. +file(GLOB_RECURSE STREAMR_LOGGER_MODULE_UNITS CONFIGURE_DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/modules/*.cppm) streamr_add_module_library(streamr-logger - FILES - modules/streamr.logger.cppm - modules/streamr.logger-all.cppm) + FILES ${STREAMR_LOGGER_MODULE_UNITS}) set_property(TARGET streamr-logger PROPERTY CXX_STANDARD 26) add_library(streamr::streamr-logger ALIAS streamr-logger) @@ -73,10 +74,6 @@ if(NOT IOS AND STREAMR_MODULES_SUPPORTED) set_property(TEST env_category_wrongly_written_as_fatal_and_info_log_test PROPERTY ENVIRONMENT "LOG_LEVEL=\"\"") endif() -target_include_directories( - streamr-logger PUBLIC $ - $) - # PUBLIC (was INTERFACE): the module interface units compile against folly # and streamr-json in their global module fragments. target_link_libraries(streamr-logger PUBLIC Folly::folly PUBLIC streamr::streamr-json) diff --git a/packages/streamr-logger/include/streamr-logger/detail/StreamrLogColors.hpp b/packages/streamr-logger/include/streamr-logger/detail/StreamrLogColors.hpp deleted file mode 100644 index d20d712c..00000000 --- a/packages/streamr-logger/include/streamr-logger/detail/StreamrLogColors.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef STREAMER_LOGGER_COLORS_H -#define STREAMER_LOGGER_COLORS_H - -#include - -namespace streamr::logger::detail::colors { - -static constexpr std::string_view gray = "\033[90m"; -static constexpr std::string_view blue = "\033[34m"; -static constexpr std::string_view cyan = "\033[36m"; -static constexpr std::string_view yellow = "\033[33m"; -static constexpr std::string_view green = "\033[32m"; -static constexpr std::string_view red = "\033[31m"; -static constexpr std::string_view bgRed = "\033[1;41m"; -static constexpr std::string_view resetColor = "\033[0m"; - -}; // namespace streamr::logger::detail::colors - -#endif \ No newline at end of file diff --git a/packages/streamr-logger/lint.sh b/packages/streamr-logger/lint.sh index 547d26c0..1c7dc752 100755 --- a/packages/streamr-logger/lint.sh +++ b/packages/streamr-logger/lint.sh @@ -10,11 +10,14 @@ clangd-tidy -p ./build $FILES echo "Running clang-format --dry-run on $FILES" ../../run-clang-format.py $FILES -# Module interface units: format check only. clangd-tidy is not run on -# .cppm files (headers remain the fully linted source of truth during the -# façade migration; clangd modules support is still experimental). +# CONSOLIDATED (MODERNIZATION.md Phase 2.6): the include/ tree is gone — +# the code lives in the module interface units, which are linted with +# clangd-tidy as the source of truth. MODULE_FILES=$(find ./modules -type f -name "*.cppm" 2>/dev/null | xargs echo) if [ -n "$MODULE_FILES" ]; then + echo "Running clangd-tidy on $MODULE_FILES" + clangd-tidy -p ./build $MODULE_FILES + echo "Running clang-format --dry-run on $MODULE_FILES" ../../run-clang-format.py $MODULE_FILES fi diff --git a/packages/streamr-logger/include/streamr-logger/Logger.hpp b/packages/streamr-logger/modules/Logger.cppm similarity index 93% rename from packages/streamr-logger/include/streamr-logger/Logger.hpp rename to packages/streamr-logger/modules/Logger.cppm index 0fef3864..b31eae33 100644 --- a/packages/streamr-logger/include/streamr-logger/Logger.hpp +++ b/packages/streamr-logger/modules/Logger.cppm @@ -1,15 +1,24 @@ -#ifndef STREAMER_LOGGER_LOGGER_HPP -#define STREAMER_LOGGER_LOGGER_HPP +// Module streamr.logger.Logger +// CONSOLIDATED from the former header +// streamr-logger/Logger.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; +#include #include +#include #include +#include #include #include "streamr-json/toJson.hpp" -#include "streamr-logger/LoggerImpl.hpp" -#include "streamr-logger/StreamrLogLevel.hpp" -#include "streamr-logger/detail/FollyLoggerImpl.hpp" -namespace streamr::logger { +export module streamr.logger.Logger; + +import streamr.logger.FollyLoggerImpl; +import streamr.logger.LoggerImpl; +import streamr.logger.StreamrLogLevel; + +export namespace streamr::logger { using streamr::json::StreamrJsonInitializerList; using streamr::json::toJson; @@ -212,6 +221,4 @@ class Logger { } }; -}; // namespace streamr::logger - -#endif +}; // namespace streamr::logger \ No newline at end of file diff --git a/packages/streamr-logger/include/streamr-logger/LoggerImpl.hpp b/packages/streamr-logger/modules/LoggerImpl.cppm similarity index 54% rename from packages/streamr-logger/include/streamr-logger/LoggerImpl.hpp rename to packages/streamr-logger/modules/LoggerImpl.cppm index 248fca65..7a974f97 100644 --- a/packages/streamr-logger/include/streamr-logger/LoggerImpl.hpp +++ b/packages/streamr-logger/modules/LoggerImpl.cppm @@ -1,12 +1,18 @@ -#ifndef STREAMR_LOGGER_LOGGERIMPL_HPP -#define STREAMR_LOGGER_LOGGERIMPL_HPP +// Module streamr.logger.LoggerImpl +// CONSOLIDATED from the former header +// streamr-logger/LoggerImpl.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; #include +#include #include -#include "StreamrLogLevel.hpp" +export module streamr.logger.LoggerImpl; -namespace streamr::logger { +import streamr.logger.StreamrLogLevel; + +export namespace streamr::logger { // Interface for the logger implementations @@ -23,6 +29,4 @@ class LoggerImpl { const std::source_location& location) = 0; }; -} // namespace streamr::logger - -#endif // STREAMR_LOGGER_LOGGERIMPL_HPP \ No newline at end of file +} // namespace streamr::logger \ No newline at end of file diff --git a/packages/streamr-logger/include/streamr-logger/SLogger.hpp b/packages/streamr-logger/modules/SLogger.cppm similarity index 89% rename from packages/streamr-logger/include/streamr-logger/SLogger.hpp rename to packages/streamr-logger/modules/SLogger.cppm index 38943721..33b92e90 100644 --- a/packages/streamr-logger/include/streamr-logger/SLogger.hpp +++ b/packages/streamr-logger/modules/SLogger.cppm @@ -1,12 +1,20 @@ -#ifndef STREAMER_LOGGER_SLOGGER_HPP -#define STREAMER_LOGGER_SLOGGER_HPP +// Module streamr.logger.SLogger +// CONSOLIDATED from the former header +// streamr-logger/SLogger.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; #include +#include #include #include -#include "streamr-logger/Logger.hpp" +#include "streamr-json/toJson.hpp" -namespace streamr::logger { +export module streamr.logger.SLogger; + +import streamr.logger.Logger; + +export namespace streamr::logger { using streamr::json::StreamrJsonInitializerList; class SLogger { @@ -107,6 +115,4 @@ class SLogger { Logger::instance().fatal(msg, metadata, location); } }; -}; // namespace streamr::logger - -#endif +}; // namespace streamr::logger \ No newline at end of file diff --git a/packages/streamr-logger/include/streamr-logger/StreamrLogLevel.hpp b/packages/streamr-logger/modules/StreamrLogLevel.cppm similarity index 88% rename from packages/streamr-logger/include/streamr-logger/StreamrLogLevel.hpp rename to packages/streamr-logger/modules/StreamrLogLevel.cppm index 5282ca16..9ad8ece6 100644 --- a/packages/streamr-logger/include/streamr-logger/StreamrLogLevel.hpp +++ b/packages/streamr-logger/modules/StreamrLogLevel.cppm @@ -1,12 +1,19 @@ -#ifndef STREAMR_LOGGER_STREAMR_LOG_LEVEL_HPP -#define STREAMR_LOGGER_STREAMR_LOG_LEVEL_HPP +// Module streamr.logger.StreamrLogLevel +// CONSOLIDATED from the former header +// streamr-logger/StreamrLogLevel.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; +#include #include +#include #include -#include "detail/StreamrLogColors.hpp" +export module streamr.logger.StreamrLogLevel; -namespace streamr::logger { +import streamr.logger.StreamrLogColors; + +export namespace streamr::logger { namespace streamrloglevel { @@ -89,6 +96,4 @@ template return std::visit([](const auto& level) { return level.value; }, level); } -} // namespace streamr::logger - -#endif // STREAMR_LOGGER_STREAMR_LOG_LEVEL_HPP \ No newline at end of file +} // namespace streamr::logger \ No newline at end of file diff --git a/packages/streamr-logger/include/streamr-logger/detail/FollyLoggerImpl.hpp b/packages/streamr-logger/modules/detail/FollyLoggerImpl.cppm similarity index 88% rename from packages/streamr-logger/include/streamr-logger/detail/FollyLoggerImpl.hpp rename to packages/streamr-logger/modules/detail/FollyLoggerImpl.cppm index 4ad2a4e7..e1f697de 100644 --- a/packages/streamr-logger/include/streamr-logger/detail/FollyLoggerImpl.hpp +++ b/packages/streamr-logger/modules/detail/FollyLoggerImpl.cppm @@ -1,10 +1,15 @@ -#ifndef STREAMR_LOGGER_DETAIL_FOLLY_LOGGER_IMPL_HPP -#define STREAMR_LOGGER_DETAIL_FOLLY_LOGGER_IMPL_HPP +// Module streamr.logger.FollyLoggerImpl +// CONSOLIDATED from the former header +// streamr-logger/detail/FollyLoggerImpl.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; #include #include #include +#include #include +#include #include #include #include @@ -13,13 +18,20 @@ #include #include -#include "LogLevelMap.hpp" -#include "StreamrHandlerFactory.hpp" -#include "StreamrWriterFactory.hpp" -#include "streamr-logger/LoggerImpl.hpp" +// The C symbol for the process environment: must be declared in the +// global module fragment — declared in module purview it would get +// module attachment and no longer match the libc symbol at link time. +extern "C" char** environ; // NOLINT -extern char** environ; // NOLINT (readability-redundant-declaration) -namespace streamr::logger::detail { +export module streamr.logger.FollyLoggerImpl; + +import streamr.logger.LogLevelMap; +import streamr.logger.StreamrLogLevel; +import streamr.logger.LoggerImpl; +import streamr.logger.StreamrHandlerFactory; +import streamr.logger.StreamrWriterFactory; + +export namespace streamr::logger::detail { using LoggerImpl = streamr::logger::LoggerImpl; @@ -180,6 +192,4 @@ class FollyLoggerImpl : public LoggerImpl { } }; -} // namespace streamr::logger::detail - -#endif +} // namespace streamr::logger::detail \ No newline at end of file diff --git a/packages/streamr-logger/include/streamr-logger/detail/LogLevelMap.hpp b/packages/streamr-logger/modules/detail/LogLevelMap.cppm similarity index 87% rename from packages/streamr-logger/include/streamr-logger/detail/LogLevelMap.hpp rename to packages/streamr-logger/modules/detail/LogLevelMap.cppm index b00a7dad..3a808652 100644 --- a/packages/streamr-logger/include/streamr-logger/detail/LogLevelMap.hpp +++ b/packages/streamr-logger/modules/detail/LogLevelMap.cppm @@ -1,15 +1,21 @@ -#ifndef STREAMR_LOGGER_LOG_LEVEL_MAP_HPP -#define STREAMR_LOGGER_LOG_LEVEL_MAP_HPP +// Module streamr.logger.LogLevelMap +// CONSOLIDATED from the former header +// streamr-logger/detail/LogLevelMap.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; #include #include +#include #include #include #include -#include "streamr-logger/StreamrLogLevel.hpp" +export module streamr.logger.LogLevelMap; -namespace streamr::logger::detail { +import streamr.logger.StreamrLogLevel; + +export namespace streamr::logger::detail { constexpr folly::LogLevel defaultFollyLogLevel = folly::LogLevel::INFO; constexpr StreamrLogLevel defaultStreamrLogLevel = @@ -81,6 +87,4 @@ struct LogLevelMap { } }; -} // namespace streamr::logger::detail - -#endif // STREAMR_LOGGER_LOG_LEVEL_MAP_HPP \ No newline at end of file +} // namespace streamr::logger::detail \ No newline at end of file diff --git a/packages/streamr-logger/include/streamr-logger/detail/StreamrHandlerFactory.hpp b/packages/streamr-logger/modules/detail/StreamrHandlerFactory.cppm similarity index 62% rename from packages/streamr-logger/include/streamr-logger/detail/StreamrHandlerFactory.hpp rename to packages/streamr-logger/modules/detail/StreamrHandlerFactory.cppm index 3c568ae0..d14b51e0 100644 --- a/packages/streamr-logger/include/streamr-logger/detail/StreamrHandlerFactory.hpp +++ b/packages/streamr-logger/modules/detail/StreamrHandlerFactory.cppm @@ -1,13 +1,20 @@ -#ifndef STREAMER_LOGGER_STREAMHANDLERFACTORY_HPP -#define STREAMER_LOGGER_STREAMHANDLERFACTORY_HPP +// Module streamr.logger.StreamrHandlerFactory +// CONSOLIDATED from the former header +// streamr-logger/detail/StreamrHandlerFactory.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; +#include #include #include #include -#include "StreamrLogFormatterFactory.hpp" -#include "StreamrWriterFactory.hpp" -namespace streamr::logger::detail { +export module streamr.logger.StreamrHandlerFactory; + +import streamr.logger.StreamrLogFormatterFactory; +import streamr.logger.StreamrWriterFactory; + +export namespace streamr::logger::detail { class StreamrHandlerFactory : public folly::StreamHandlerFactory { private: @@ -27,6 +34,4 @@ class StreamrHandlerFactory : public folly::StreamHandlerFactory { } }; -} // namespace streamr::logger::detail - -#endif \ No newline at end of file +} // namespace streamr::logger::detail \ No newline at end of file diff --git a/packages/streamr-logger/modules/detail/StreamrLogColors.cppm b/packages/streamr-logger/modules/detail/StreamrLogColors.cppm new file mode 100644 index 00000000..5e82532f --- /dev/null +++ b/packages/streamr-logger/modules/detail/StreamrLogColors.cppm @@ -0,0 +1,23 @@ +// Module streamr.logger.StreamrLogColors +// CONSOLIDATED from the former header +// streamr-logger/detail/StreamrLogColors.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; + +#include +#include + +export module streamr.logger.StreamrLogColors; + +export namespace streamr::logger::detail::colors { + +inline constexpr std::string_view gray = "\033[90m"; +inline constexpr std::string_view blue = "\033[34m"; +inline constexpr std::string_view cyan = "\033[36m"; +inline constexpr std::string_view yellow = "\033[33m"; +inline constexpr std::string_view green = "\033[32m"; +inline constexpr std::string_view red = "\033[31m"; +inline constexpr std::string_view bgRed = "\033[1;41m"; +inline constexpr std::string_view resetColor = "\033[0m"; + +}; // namespace streamr::logger::detail::colors \ No newline at end of file diff --git a/packages/streamr-logger/include/streamr-logger/detail/StreamrLogFormatter.hpp b/packages/streamr-logger/modules/detail/StreamrLogFormatter.cppm similarity index 93% rename from packages/streamr-logger/include/streamr-logger/detail/StreamrLogFormatter.hpp rename to packages/streamr-logger/modules/detail/StreamrLogFormatter.cppm index 84b98afc..d4efb513 100644 --- a/packages/streamr-logger/include/streamr-logger/detail/StreamrLogFormatter.hpp +++ b/packages/streamr-logger/modules/detail/StreamrLogFormatter.cppm @@ -1,18 +1,28 @@ -#ifndef STREAMER_LOGGER_STREAMRLOGFORMATTER_HPP -#define STREAMER_LOGGER_STREAMRLOGFORMATTER_HPP +// Module streamr.logger.StreamrLogFormatter +// CONSOLIDATED from the former header +// streamr-logger/detail/StreamrLogFormatter.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; +#include #include #include +#include +#include #include +#include #include #include #include #include #include -#include "LogLevelMap.hpp" -#include "StreamrLogColors.hpp" -namespace streamr::logger::detail { +export module streamr.logger.StreamrLogFormatter; + +import streamr.logger.LogLevelMap; +import streamr.logger.StreamrLogColors; + +export namespace streamr::logger::detail { namespace constants { @@ -176,6 +186,4 @@ class StreamrLogFormatter : public folly::LogFormatter { } }; -} // namespace streamr::logger::detail - -#endif +} // namespace streamr::logger::detail \ No newline at end of file diff --git a/packages/streamr-logger/include/streamr-logger/detail/StreamrLogFormatterFactory.hpp b/packages/streamr-logger/modules/detail/StreamrLogFormatterFactory.cppm similarity index 54% rename from packages/streamr-logger/include/streamr-logger/detail/StreamrLogFormatterFactory.hpp rename to packages/streamr-logger/modules/detail/StreamrLogFormatterFactory.cppm index 0dbf9118..33739ee5 100644 --- a/packages/streamr-logger/include/streamr-logger/detail/StreamrLogFormatterFactory.hpp +++ b/packages/streamr-logger/modules/detail/StreamrLogFormatterFactory.cppm @@ -1,10 +1,17 @@ -#ifndef STREAMER_LOGGER_STANDARDLOGHANDLERFACTORY_HPP -#define STREAMER_LOGGER_STANDARDLOGHANDLERFACTORY_HPP +// Module streamr.logger.StreamrLogFormatterFactory +// CONSOLIDATED from the former header +// streamr-logger/detail/StreamrLogFormatterFactory.hpp (MODERNIZATION.md +// Phase 2.6): this file is now the source of truth. +module; +#include #include -#include "StreamrLogFormatter.hpp" -namespace streamr::logger::detail { +export module streamr.logger.StreamrLogFormatterFactory; + +import streamr.logger.StreamrLogFormatter; + +export namespace streamr::logger::detail { class StreamrLogFormatterFactory : public folly::StandardLogHandlerFactory::FormatterFactory { @@ -21,6 +28,4 @@ class StreamrLogFormatterFactory } }; -} // namespace streamr::logger::detail - -#endif \ No newline at end of file +} // namespace streamr::logger::detail \ No newline at end of file diff --git a/packages/streamr-logger/include/streamr-logger/detail/StreamrWriterFactory.hpp b/packages/streamr-logger/modules/detail/StreamrWriterFactory.cppm similarity index 61% rename from packages/streamr-logger/include/streamr-logger/detail/StreamrWriterFactory.hpp rename to packages/streamr-logger/modules/detail/StreamrWriterFactory.cppm index 0c1e1d0c..211428d2 100644 --- a/packages/streamr-logger/include/streamr-logger/detail/StreamrWriterFactory.hpp +++ b/packages/streamr-logger/modules/detail/StreamrWriterFactory.cppm @@ -1,9 +1,16 @@ -#ifndef STREAMER_LOGGER_STREAMRWRITERFACTORY_HPP -#define STREAMER_LOGGER_STREAMRWRITERFACTORY_HPP - +// Module streamr.logger.StreamrWriterFactory +// CONSOLIDATED from the former header +// streamr-logger/detail/StreamrWriterFactory.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; + +#include +#include #include -namespace streamr::logger::detail { +export module streamr.logger.StreamrWriterFactory; + +export namespace streamr::logger::detail { class StreamrWriterFactory : public folly::StreamHandlerFactory::WriterFactory { private: @@ -23,6 +30,4 @@ class StreamrWriterFactory : public folly::StreamHandlerFactory::WriterFactory { } }; -} // namespace streamr::logger::detail - -#endif \ No newline at end of file +} // namespace streamr::logger::detail \ No newline at end of file diff --git a/packages/streamr-logger/modules/streamr.logger-all.cppm b/packages/streamr-logger/modules/streamr.logger-all.cppm deleted file mode 100644 index ab09e920..00000000 --- a/packages/streamr-logger/modules/streamr.logger-all.cppm +++ /dev/null @@ -1,55 +0,0 @@ -// Coarse façade partition over ALL public headers of streamr-logger. -// One partition (instead of one per header) keeps the number of -// module units — and thus repeated global-module-fragment parses -// of the expensive header stacks — minimal during the façade -// stage (measured at the Phase 2.4 bench checkpoint). Per-header -// granularity returns at consolidation if needed. -module; - -#include "streamr-logger/Logger.hpp" -#include "streamr-logger/LoggerImpl.hpp" -#include "streamr-logger/SLogger.hpp" -#include "streamr-logger/StreamrLogLevel.hpp" - -export module streamr.logger:all; - -export namespace streamr::logger { - -using streamr::logger::envLogLevelName; -using streamr::logger::Logger; - -} // namespace streamr::logger - -export namespace streamr::logger { - -using streamr::logger::LoggerImpl; - -} // namespace streamr::logger - -export namespace streamr::logger { - -using streamr::logger::SLogger; - -} // namespace streamr::logger - -export namespace streamr::logger::streamrloglevel { - -using streamr::logger::streamrloglevel::Debug; -using streamr::logger::streamrloglevel::Error; -using streamr::logger::streamrloglevel::Fatal; -using streamr::logger::streamrloglevel::Info; -using streamr::logger::streamrloglevel::Trace; -using streamr::logger::streamrloglevel::Warn; - -} // namespace streamr::logger::streamrloglevel - -export namespace streamr::logger { - -using streamr::logger::getStreamrLogLevelByName; -using streamr::logger::getStreamrLogLevelValue; -using streamr::logger::LevelGetter; -using streamr::logger::StreamrLogLevel; -using streamr::logger::StreamrLogLevelConcept; -using streamr::logger::systemDefaultLogLevel; - -} // namespace streamr::logger diff --git a/packages/streamr-logger/modules/streamr.logger.cppm b/packages/streamr-logger/modules/streamr.logger.cppm deleted file mode 100644 index 12fa620e..00000000 --- a/packages/streamr-logger/modules/streamr.logger.cppm +++ /dev/null @@ -1,4 +0,0 @@ -// Primary module interface unit of streamr.logger. -export module streamr.logger; - -export import :all; diff --git a/packages/streamr-logger/src/examples/LoggerExample.cpp b/packages/streamr-logger/src/examples/LoggerExample.cpp index 8856c8bd..183c6d0f 100644 --- a/packages/streamr-logger/src/examples/LoggerExample.cpp +++ b/packages/streamr-logger/src/examples/LoggerExample.cpp @@ -2,7 +2,9 @@ #include #include -import streamr.logger; +import streamr.logger.StreamrLogLevel; +import streamr.logger.Logger; +import streamr.logger.SLogger; using Logger = streamr::logger::Logger; using SLogger = streamr::logger::SLogger; diff --git a/packages/streamr-logger/test/unit/LoggerEnvTest.cpp b/packages/streamr-logger/test/unit/LoggerEnvTest.cpp index 2ed34b6d..dd029951 100644 --- a/packages/streamr-logger/test/unit/LoggerEnvTest.cpp +++ b/packages/streamr-logger/test/unit/LoggerEnvTest.cpp @@ -1,8 +1,13 @@ -// Tests detail-level machinery, so the detail header stays #included (no -// module partition exists for detail/ headers); mixing with import is safe. -#include "streamr-logger/detail/FollyLoggerImpl.hpp" -import streamr.logger; +#include +#include +#include +#include +#include + +import streamr.logger.FollyLoggerImpl; +import streamr.logger.Logger; +import streamr.logger.StreamrLogLevel; using Logger = streamr::logger::Logger; namespace streamrloglevel = streamr::logger::streamrloglevel; diff --git a/packages/streamr-logger/test/unit/LoggerTest.cpp b/packages/streamr-logger/test/unit/LoggerTest.cpp index b4b76119..ade89c18 100644 --- a/packages/streamr-logger/test/unit/LoggerTest.cpp +++ b/packages/streamr-logger/test/unit/LoggerTest.cpp @@ -1,9 +1,14 @@ +#include +#include #include #include #include -#include "streamr-logger/detail/FollyLoggerImpl.hpp" +#include +#include -import streamr.logger; +import streamr.logger.FollyLoggerImpl; +import streamr.logger.Logger; +import streamr.logger.StreamrLogLevel; using streamr::logger::Logger; using streamr::logger::StreamrLogLevel; diff --git a/packages/streamr-logger/test/unit/StreamrLogFormatterTest.cpp b/packages/streamr-logger/test/unit/StreamrLogFormatterTest.cpp index eee908aa..2d87ab52 100644 --- a/packages/streamr-logger/test/unit/StreamrLogFormatterTest.cpp +++ b/packages/streamr-logger/test/unit/StreamrLogFormatterTest.cpp @@ -1,6 +1,10 @@ +#include #include #include -#include +#include +#include + +import streamr.logger.StreamrLogFormatter; using StreamrLogFormatter = streamr::logger::detail::StreamrLogFormatter; using namespace std::chrono_literals; // NOLINT short chrono literals y, d etc. diff --git a/packages/streamr-proto-rpc/lint.sh b/packages/streamr-proto-rpc/lint.sh index 6822e60c..a915500b 100755 --- a/packages/streamr-proto-rpc/lint.sh +++ b/packages/streamr-proto-rpc/lint.sh @@ -5,7 +5,18 @@ set -e FILES=$(find . -type d \( -name src -o -name include -o -name test \) ! -path '*/build/*' ! -path '*/proto/*' -print0 | xargs -0 -I{} find {} -type f \( -name "*.hpp" -o -name "*.cpp" \) ! -name "PluginCodeGenerator.hpp" -print0 | xargs -0 echo) echo "Running clangd-tidy on $FILES" -clangd-tidy -p ./build $FILES +# test/unit/RpcCommunicatorTest.cpp is excluded from clangd-tidy +# (owner-approved selective disabling, Phase 2.6 consolidation): on the +# Linux CI runners clangd fails to unify std::string between the file's +# preamble and the module BMIs it imports (the known "preamble/BMI +# std-type unification" failure class from the consolidation decision +# memo — spurious "cannot initialize object parameter of type 'const +# std::basic_string' with an expression of type 'std::string'" on +# every gtest assertion). The macOS clangd of the same major version +# accepts the file, and the COMPILER accepts it on every platform; +# clang-format still checks it. Revisit on each clangd release. +TIDY_FILES=$(echo "$FILES" | tr ' ' '\n' | grep -v 'test/unit/RpcCommunicatorTest.cpp' | tr '\n' ' ') +clangd-tidy -p ./build $TIDY_FILES echo "Running clang-format --dry-run on $FILES" ../../run-clang-format.py $FILES diff --git a/packages/streamr-proto-rpc/modules/RpcCommunicator.cppm b/packages/streamr-proto-rpc/modules/RpcCommunicator.cppm index f6449e97..1f593e5f 100644 --- a/packages/streamr-proto-rpc/modules/RpcCommunicator.cppm +++ b/packages/streamr-proto-rpc/modules/RpcCommunicator.cppm @@ -12,7 +12,7 @@ module; export module streamr.protorpc.RpcCommunicator; -import streamr.logger; +import streamr.logger.SLogger; import streamr.protorpc.Errors; import streamr.protorpc.RpcCommunicatorClientApi; import streamr.protorpc.RpcCommunicatorServerApi; diff --git a/packages/streamr-proto-rpc/modules/RpcCommunicatorClientApi.cppm b/packages/streamr-proto-rpc/modules/RpcCommunicatorClientApi.cppm index 9684b8c5..d70a0540 100644 --- a/packages/streamr-proto-rpc/modules/RpcCommunicatorClientApi.cppm +++ b/packages/streamr-proto-rpc/modules/RpcCommunicatorClientApi.cppm @@ -15,7 +15,7 @@ module; export module streamr.protorpc.RpcCommunicatorClientApi; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.Branded; import streamr.utils.Uuid; import streamr.protorpc.Errors; diff --git a/packages/streamr-proto-rpc/modules/ServerRegistry.cppm b/packages/streamr-proto-rpc/modules/ServerRegistry.cppm index 8072ba55..3e27e10a 100644 --- a/packages/streamr-proto-rpc/modules/ServerRegistry.cppm +++ b/packages/streamr-proto-rpc/modules/ServerRegistry.cppm @@ -9,7 +9,7 @@ module; export module streamr.protorpc.ServerRegistry; -import streamr.logger; +import streamr.logger.SLogger; import streamr.protorpc.Errors; export namespace streamr::protorpc { diff --git a/packages/streamr-proto-rpc/test/integration/ProtoRpcTest.cpp b/packages/streamr-proto-rpc/test/integration/ProtoRpcTest.cpp index bbeee76c..433dc4f8 100644 --- a/packages/streamr-proto-rpc/test/integration/ProtoRpcTest.cpp +++ b/packages/streamr-proto-rpc/test/integration/ProtoRpcTest.cpp @@ -14,7 +14,7 @@ import streamr.protorpc.test.HelloRpcClient; import streamr.protorpc.test.TestProtosClient; import streamr.protorpc.test.WakeUpRpcClient; import streamr.protorpc.test.WakeUpRpcServer; -import streamr.logger; +import streamr.logger.SLogger; import streamr.eventemitter; namespace streamr::protorpc { diff --git a/packages/streamr-proto-rpc/test/unit/RpcCommunicatorTest.cpp b/packages/streamr-proto-rpc/test/unit/RpcCommunicatorTest.cpp index e791a6d4..d1ec3793 100644 --- a/packages/streamr-proto-rpc/test/unit/RpcCommunicatorTest.cpp +++ b/packages/streamr-proto-rpc/test/unit/RpcCommunicatorTest.cpp @@ -15,7 +15,7 @@ import streamr.protorpc.ProtoCallContext; import streamr.protorpc.RpcCommunicator; import streamr.protorpc.RpcCommunicatorClientApi; import streamr.protorpc.protos; -import streamr.logger; +import streamr.logger.SLogger; namespace streamr::protorpc { diff --git a/packages/streamr-trackerless-network/modules/logic/ContentDeliveryRpcRemote.cppm b/packages/streamr-trackerless-network/modules/logic/ContentDeliveryRpcRemote.cppm index ad390ba7..634f40e8 100644 --- a/packages/streamr-trackerless-network/modules/logic/ContentDeliveryRpcRemote.cppm +++ b/packages/streamr-trackerless-network/modules/logic/ContentDeliveryRpcRemote.cppm @@ -14,7 +14,7 @@ import streamr.trackerlessnetwork.NetworkRpcClient; import streamr.dht.DhtCallContext; import streamr.dht.RpcRemote; import streamr.dht.protos; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.StreamPartID; // Hoisted from the former header (file scope, NOT exported); diff --git a/packages/streamr-trackerless-network/modules/logic/DuplicateMessageDetector.cppm b/packages/streamr-trackerless-network/modules/logic/DuplicateMessageDetector.cppm index 248ea443..8f6edaea 100644 --- a/packages/streamr-trackerless-network/modules/logic/DuplicateMessageDetector.cppm +++ b/packages/streamr-trackerless-network/modules/logic/DuplicateMessageDetector.cppm @@ -11,7 +11,7 @@ module; export module streamr.trackerlessnetwork.DuplicateMessageDetector; -import streamr.logger; +import streamr.logger.SLogger; // Hoisted from the former header (file scope, NOT exported); // fully qualified because relative namespace names resolve diff --git a/packages/streamr-trackerless-network/modules/logic/proxy/ProxyClient.cppm b/packages/streamr-trackerless-network/modules/logic/proxy/ProxyClient.cppm index dd7bc60d..d949c348 100644 --- a/packages/streamr-trackerless-network/modules/logic/proxy/ProxyClient.cppm +++ b/packages/streamr-trackerless-network/modules/logic/proxy/ProxyClient.cppm @@ -26,7 +26,7 @@ import streamr.dht.Identifiers; import streamr.dht.Transport; import streamr.dht.protos; import streamr.eventemitter; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.AbortController; import streamr.utils.EthereumAddress; import streamr.utils.RetryUtils; diff --git a/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcLocal.cppm b/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcLocal.cppm index b4cc8c77..13d1f2cc 100644 --- a/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcLocal.cppm +++ b/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcLocal.cppm @@ -10,7 +10,7 @@ module; export module streamr.trackerlessnetwork.ProxyConnectionRpcLocal; import streamr.trackerlessnetwork.NetworkRpcServer; -import streamr.logger; +import streamr.logger.SLogger; import streamr.dht.DhtCallContext; import streamr.dht.Identifiers; import streamr.dht.ListeningRpcCommunicator; diff --git a/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcRemote.cppm b/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcRemote.cppm index 7c07f193..ebc5f6f5 100644 --- a/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcRemote.cppm +++ b/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcRemote.cppm @@ -13,7 +13,7 @@ import streamr.trackerlessnetwork.NetworkRpcClient; import streamr.dht.DhtCallContext; import streamr.dht.RpcRemote; import streamr.dht.protos; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.BinaryUtils; import streamr.utils.EthereumAddress; diff --git a/packages/streamr-trackerless-network/test/integration/ProxyClientTsIntegrationTest.cpp b/packages/streamr-trackerless-network/test/integration/ProxyClientTsIntegrationTest.cpp index 8047fc4f..5be234b7 100644 --- a/packages/streamr-trackerless-network/test/integration/ProxyClientTsIntegrationTest.cpp +++ b/packages/streamr-trackerless-network/test/integration/ProxyClientTsIntegrationTest.cpp @@ -6,7 +6,7 @@ import streamr.dht.ConnectionManager; import streamr.dht.ConnectorFacade; import streamr.dht.FakeTransport; import streamr.dht.protos; -import streamr.logger; +import streamr.logger.SLogger; import streamr.trackerlessnetwork.ProxyClient; import streamr.trackerlessnetwork.protos; import streamr.utils.BinaryUtils; diff --git a/packages/streamr-utils/modules/RetryUtils.cppm b/packages/streamr-utils/modules/RetryUtils.cppm index 1f36179c..52ac0ec0 100644 --- a/packages/streamr-utils/modules/RetryUtils.cppm +++ b/packages/streamr-utils/modules/RetryUtils.cppm @@ -17,7 +17,7 @@ module; export module streamr.utils.RetryUtils; -import streamr.logger; +import streamr.logger.SLogger; import streamr.utils.AbortController; export namespace streamr::utils {