From cb0912ebc0302896551136afc4d76570b643e8fe Mon Sep 17 00:00:00 2001 From: Lars Toenning Date: Sun, 17 Dec 2023 11:45:06 +0100 Subject: [PATCH] refactor: Move QJsonWebToken lib to third_party/ --- CMakeLists.txt | 1 + src/blackcore/CMakeLists.txt | 1 + .../afv/connection/apiserverconnection.cpp | 2 +- src/blackmisc/CMakeLists.txt | 2 -- third_party/CMakeLists.txt | 4 ++++ third_party/qjsonwebtoken/CMakeLists.txt | 17 +++++++++++++++++ third_party/qjsonwebtoken/README.md | 8 ++++++++ .../qjsonwebtoken}/qjsonwebtoken.cpp | 2 +- .../qjsonwebtoken}/qjsonwebtoken.cpp.license | 0 .../qjsonwebtoken}/qjsonwebtoken.h | 4 +--- .../qjsonwebtoken}/qjsonwebtoken.h.license | 0 11 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 third_party/CMakeLists.txt create mode 100644 third_party/qjsonwebtoken/CMakeLists.txt create mode 100644 third_party/qjsonwebtoken/README.md rename {src/blackmisc/network/external => third_party/qjsonwebtoken}/qjsonwebtoken.cpp (99%) rename {src/blackmisc/network/external => third_party/qjsonwebtoken}/qjsonwebtoken.cpp.license (100%) rename {src/blackmisc/network/external => third_party/qjsonwebtoken}/qjsonwebtoken.h (99%) rename {src/blackmisc/network/external => third_party/qjsonwebtoken}/qjsonwebtoken.h.license (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e080985ad..0e3636812 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,6 +144,7 @@ add_subdirectory(cmake/crashpad) add_subdirectory(cmake/tls) add_subdirectory(cmake/simconnect) add_subdirectory(cmake/dplay) +add_subdirectory(third_party) if(SWIFT_BUILD_XSWIFTBUS) diff --git a/src/blackcore/CMakeLists.txt b/src/blackcore/CMakeLists.txt index 85c8aea8b..517900e89 100644 --- a/src/blackcore/CMakeLists.txt +++ b/src/blackcore/CMakeLists.txt @@ -268,6 +268,7 @@ target_link_libraries(core PRIVATE Qt::Qml Qt::Xml + QJsonWebToken ) target_compile_definitions(core PRIVATE BUILD_BLACKCORE_LIB) diff --git a/src/blackcore/afv/connection/apiserverconnection.cpp b/src/blackcore/afv/connection/apiserverconnection.cpp index af850a19b..41b733cab 100644 --- a/src/blackcore/afv/connection/apiserverconnection.cpp +++ b/src/blackcore/afv/connection/apiserverconnection.cpp @@ -4,7 +4,7 @@ #include "blackcore/afv/connection/apiserverconnection.h" #include "blackmisc/network/networkutils.h" -#include "blackmisc/network/external/qjsonwebtoken.h" +#include "qjsonwebtoken/qjsonwebtoken.h" #include "blackmisc/logmessage.h" #include "blackmisc/stringutils.h" #include "blackconfig/buildconfig.h" diff --git a/src/blackmisc/CMakeLists.txt b/src/blackmisc/CMakeLists.txt index 9401a1eaa..b642726bc 100644 --- a/src/blackmisc/CMakeLists.txt +++ b/src/blackmisc/CMakeLists.txt @@ -370,8 +370,6 @@ add_library(misc SHARED network/settings/serversettings.h network/authenticateduser.cpp network/authenticateduser.h - network/external/qjsonwebtoken.cpp - network/external/qjsonwebtoken.h network/client.cpp network/client.h network/clientlist.cpp diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt new file mode 100644 index 000000000..d81fec3cd --- /dev/null +++ b/third_party/CMakeLists.txt @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors +# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 + +add_subdirectory(qjsonwebtoken) diff --git a/third_party/qjsonwebtoken/CMakeLists.txt b/third_party/qjsonwebtoken/CMakeLists.txt new file mode 100644 index 000000000..5b67a2955 --- /dev/null +++ b/third_party/qjsonwebtoken/CMakeLists.txt @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors +# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 + +add_library(QJsonWebToken STATIC) +target_sources(QJsonWebToken + PRIVATE + qjsonwebtoken.cpp + qjsonwebtoken.h +) +target_link_libraries(QJsonWebToken + PUBLIC + Qt::Core +) +target_include_directories(QJsonWebToken + PUBLIC + ${PROJECT_SOURCE_DIR}/third_party +) diff --git a/third_party/qjsonwebtoken/README.md b/third_party/qjsonwebtoken/README.md new file mode 100644 index 000000000..19094f66b --- /dev/null +++ b/third_party/qjsonwebtoken/README.md @@ -0,0 +1,8 @@ + + +The files ``qjsonwebtoken.cpp`` and ``qjsonwebtoken.h`` inside this folder are imported from https://github.com/juangburgos/QJsonWebToken at revision +[65eb0f789a9c19e04f0f620422d648ec9388ce2b](https://github.com/juangburgos/QJsonWebToken/commit/65eb0f789a9c19e04f0f620422d648ec9388ce2b) with additional modifications. +They are licensed under the MIT license (SPDX-License-Identifier: MIT). diff --git a/src/blackmisc/network/external/qjsonwebtoken.cpp b/third_party/qjsonwebtoken/qjsonwebtoken.cpp similarity index 99% rename from src/blackmisc/network/external/qjsonwebtoken.cpp rename to third_party/qjsonwebtoken/qjsonwebtoken.cpp index 40b549dd9..29ae0682a 100644 --- a/src/blackmisc/network/external/qjsonwebtoken.cpp +++ b/third_party/qjsonwebtoken/qjsonwebtoken.cpp @@ -4,7 +4,7 @@ // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "blackmisc/network/external/qjsonwebtoken.h" +#include "qjsonwebtoken.h" #include diff --git a/src/blackmisc/network/external/qjsonwebtoken.cpp.license b/third_party/qjsonwebtoken/qjsonwebtoken.cpp.license similarity index 100% rename from src/blackmisc/network/external/qjsonwebtoken.cpp.license rename to third_party/qjsonwebtoken/qjsonwebtoken.cpp.license diff --git a/src/blackmisc/network/external/qjsonwebtoken.h b/third_party/qjsonwebtoken/qjsonwebtoken.h similarity index 99% rename from src/blackmisc/network/external/qjsonwebtoken.h rename to third_party/qjsonwebtoken/qjsonwebtoken.h index 211b591ef..19f41b405 100644 --- a/src/blackmisc/network/external/qjsonwebtoken.h +++ b/third_party/qjsonwebtoken/qjsonwebtoken.h @@ -15,8 +15,6 @@ #ifndef QJSONWEBTOKEN_H #define QJSONWEBTOKEN_H -#include "blackmisc/blackmiscexport.h" - #include #include #include @@ -55,7 +53,7 @@ The repository of this project includes examples that demonstrate the use of thi * ./examples/jwtcreator/ : Example that shows how to create a JWT with your custom *payload*. * ./examples/jwtverifier/ : Example that shows how to validate a JWT with a given *secret*. */ -class BLACKMISC_EXPORT QJsonWebToken +class QJsonWebToken { public: diff --git a/src/blackmisc/network/external/qjsonwebtoken.h.license b/third_party/qjsonwebtoken/qjsonwebtoken.h.license similarity index 100% rename from src/blackmisc/network/external/qjsonwebtoken.h.license rename to third_party/qjsonwebtoken/qjsonwebtoken.h.license