Skip to content

Commit 72488fd

Browse files
authored
Merge branch 'drogonframework:master' into remove-thread_local
2 parents f63cf49 + d6a33f9 commit 72488fd

154 files changed

Lines changed: 6689 additions & 1441 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/cmake.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,18 @@ jobs:
4444
- name: Create Build Environment & Configure Cmake
4545
shell: bash
4646
working-directory: ./build
47+
# For unknown reasons, we fail to create file in windows ci environment.
48+
# So examples, drogon_ctl and integration tests can not be built in windows ci.
49+
# We should try to enable them again in the future.
4750
run: |
4851
[[ ${{ matrix.link }} == "SHARED" ]] && shared="ON" || shared="OFF"
4952
cmake .. \
5053
-DCMAKE_BUILD_TYPE=Debug \
5154
-DBUILD_TESTING=on \
5255
-DBUILD_SHARED_LIBS=$shared \
5356
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" \
54-
-DBUILD_CTL=ON \
55-
-DBUILD_EXAMPLES=ON \
57+
-DBUILD_CTL=OFF \
58+
-DBUILD_EXAMPLES=OFF \
5659
-DUSE_SPDLOG=ON \
5760
-DCMAKE_INSTALL_PREFIX=../install \
5861
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW \
@@ -70,7 +73,7 @@ jobs:
7073
strategy:
7174
fail-fast: false
7275
matrix:
73-
osver: [12, 13]
76+
osver: [13, 14, 15]
7477
steps:
7578
- name: Checkout Drogon source code
7679
uses: actions/checkout@v4
@@ -99,7 +102,6 @@ jobs:
99102

100103
- name: Prepare for testing
101104
run: |
102-
brew tap homebrew/services
103105
brew services restart postgresql@14
104106
brew services start mariadb
105107
brew services start redis
@@ -176,6 +178,13 @@ jobs:
176178
sudo apt-get --purge remove postgresql postgresql-doc postgresql-common postgresql-client-common
177179
sudo apt-get -y install postgresql-all
178180
181+
- name: Install g++-13
182+
if: startsWith(matrix.compiler.cxx, 'g++') && matrix.compiler.ver == 13
183+
run: |
184+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
185+
sudo apt-get install g++-${{ matrix.compiler.ver }}
186+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 13
187+
179188
- name: Install Clang
180189
if: startsWith(matrix.compiler.cxx, 'clang') && matrix.compiler.ver < 13
181190
run: sudo apt-get install clang-${{ matrix.compiler.ver }}

.github/workflows/codespell.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
14-
- run: pip install --user codespell[toml]
15-
- run: codespell --ignore-words-list="coo,folx,ot,statics,xwindows" --skip="*.csp"
14+
- run: sudo apt-get install -y codespell
15+
- run: codespell --ignore-words-list="coo,folx,ot,statics,xwindows,NotIn,aNULL," --skip="*.csp"

.github/workflows/cpp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
CLANG_FORMAT: clang-format-17
3131

3232
cpplint:
33-
runs-on: ubuntu-22.04
33+
runs-on: ubuntu-latest
3434
steps:
3535
- uses: actions/checkout@v4
3636

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
release:
5+
types: [created] # 当新版本被创建时触发
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v4
14+
15+
- name: Log in to Docker Hub
16+
uses: docker/login-action@v3
17+
with:
18+
username: ${{ secrets.DOCKER_USERNAME }}
19+
password: ${{ secrets.DOCKER_PASSWORD }}
20+
21+
- name: Build Docker image
22+
run: |
23+
cd docker/ubuntu
24+
docker build -t drogonframework/drogon:latest .
25+
26+
- name: Push Docker image
27+
run: |
28+
docker push drogonframework/drogon:latest

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ build/
3535
cmake-build-debug/
3636
cmake-build-debug-visual-studio/
3737
.idea/
38-
lib/inc/drogon/version.h
3938
html/
4039
latex/
4140
.vscode

CMakeLists.txt

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.5...3.31)
22

33
project(drogon)
44

@@ -13,6 +13,7 @@ option(BUILD_DOC "Build Doxygen documentation" OFF)
1313
option(BUILD_BROTLI "Build Brotli" ON)
1414
option(BUILD_YAML_CONFIG "Build yaml config" ON)
1515
option(USE_SUBMODULE "Use trantor as a submodule" ON)
16+
option(USE_STATIC_LIBS_ONLY "Use only static libraries as dependencies" OFF)
1617

1718
include(CMakeDependentOption)
1819
CMAKE_DEPENDENT_OPTION(BUILD_POSTGRESQL "Build with postgresql support" ON "BUILD_ORM" OFF)
@@ -24,7 +25,7 @@ CMAKE_DEPENDENT_OPTION(USE_SPDLOG "Allow using the spdlog logging library" OFF "
2425

2526
set(DROGON_MAJOR_VERSION 1)
2627
set(DROGON_MINOR_VERSION 9)
27-
set(DROGON_PATCH_VERSION 3)
28+
set(DROGON_PATCH_VERSION 10)
2829
set(DROGON_VERSION
2930
${DROGON_MAJOR_VERSION}.${DROGON_MINOR_VERSION}.${DROGON_PATCH_VERSION})
3031
set(DROGON_VERSION_STRING "${DROGON_VERSION}")
@@ -41,7 +42,7 @@ set(INSTALL_DROGON_CMAKE_DIR ${DEF_INSTALL_DROGON_CMAKE_DIR}
4142
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
4243
# Force MSVC to use UTF-8 because that's what we use. Otherwise it uses
4344
# the default of whatever Windows sets and causes encoding issues.
44-
message(STATUS "You are using MSVC. Forceing to use UTF-8")
45+
message(STATUS "You are using MSVC. Forcing to use UTF-8")
4546
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
4647
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
4748
if (MSVC_VERSION GREATER_EQUAL 1914)
@@ -77,6 +78,10 @@ if (BUILD_SHARED_LIBS)
7778
endif ()
7879
endif (BUILD_SHARED_LIBS)
7980

81+
if(USE_STATIC_LIBS_ONLY)
82+
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}")
83+
endif(USE_STATIC_LIBS_ONLY)
84+
8085
if(USE_SPDLOG)
8186
find_package(spdlog CONFIG)
8287
if(spdlog_FOUND)
@@ -116,6 +121,7 @@ endif()
116121
target_include_directories(
117122
${PROJECT_NAME}
118123
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/lib/inc>
124+
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/lib/inc>
119125
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/orm_lib/inc>
120126
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/nosql_lib/redis/inc>
121127
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
@@ -253,7 +259,7 @@ set(DROGON_SOURCES
253259
lib/src/Cookie.cc
254260
lib/src/DrClassMap.cc
255261
lib/src/DrTemplateBase.cc
256-
lib/src/FiltersFunction.cc
262+
lib/src/MiddlewaresFunction.cc
257263
lib/src/FixedWindowRateLimiter.cc
258264
lib/src/GlobalFilters.cc
259265
lib/src/Histogram.cc
@@ -268,6 +274,7 @@ set(DROGON_SOURCES
268274
lib/src/HttpFileUploadRequest.cc
269275
lib/src/HttpRequestImpl.cc
270276
lib/src/HttpRequestParser.cc
277+
lib/src/RequestStream.cc
271278
lib/src/HttpResponseImpl.cc
272279
lib/src/HttpResponseParser.cc
273280
lib/src/HttpServer.cc
@@ -278,6 +285,7 @@ set(DROGON_SOURCES
278285
lib/src/ListenerManager.cc
279286
lib/src/LocalHostFilter.cc
280287
lib/src/MultiPart.cc
288+
lib/src/MultipartStreamParser.cc
281289
lib/src/NotFound.cc
282290
lib/src/PluginsManager.cc
283291
lib/src/PromExporter.cc
@@ -302,7 +310,7 @@ set(private_headers
302310
lib/src/CacheFile.h
303311
lib/src/ConfigLoader.h
304312
lib/src/ControllerBinderBase.h
305-
lib/src/FiltersFunction.h
313+
lib/src/MiddlewaresFunction.h
306314
lib/src/HttpAppFrameworkImpl.h
307315
lib/src/HttpClientImpl.h
308316
lib/src/HttpConnectionLimit.h
@@ -332,7 +340,8 @@ set(private_headers
332340
lib/src/ConfigAdapterManager.h
333341
lib/src/JsonConfigAdapter.h
334342
lib/src/YamlConfigAdapter.h
335-
lib/src/ConfigAdapter.h)
343+
lib/src/ConfigAdapter.h
344+
lib/src/MultipartStreamParser.h)
336345

337346
if (NOT WIN32)
338347
set(DROGON_SOURCES
@@ -502,7 +511,7 @@ execute_process(COMMAND "git" rev-parse HEAD
502511
OUTPUT_VARIABLE GIT_SHA1
503512
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
504513
configure_file("${PROJECT_SOURCE_DIR}/cmake/templates/version.h.in"
505-
"${PROJECT_SOURCE_DIR}/lib/inc/drogon/version.h" @ONLY)
514+
"${CMAKE_CURRENT_BINARY_DIR}/lib/inc/drogon/version.h" @ONLY)
506515

507516
if (DROGON_CXX_STANDARD EQUAL 20)
508517
option(USE_COROUTINE "Enable C++20 coroutine support" ON)
@@ -557,7 +566,9 @@ set(DROGON_HEADERS
557566
lib/inc/drogon/HttpClient.h
558567
lib/inc/drogon/HttpController.h
559568
lib/inc/drogon/HttpFilter.h
569+
lib/inc/drogon/HttpMiddleware.h
560570
lib/inc/drogon/HttpRequest.h
571+
lib/inc/drogon/RequestStream.h
561572
lib/inc/drogon/HttpResponse.h
562573
lib/inc/drogon/HttpSimpleController.h
563574
lib/inc/drogon/HttpTypes.h
@@ -573,7 +584,7 @@ set(DROGON_HEADERS
573584
lib/inc/drogon/WebSocketConnection.h
574585
lib/inc/drogon/WebSocketController.h
575586
lib/inc/drogon/drogon.h
576-
lib/inc/drogon/version.h
587+
${CMAKE_CURRENT_BINARY_DIR}/lib/inc/drogon/version.h
577588
lib/inc/drogon/drogon_callbacks.h
578589
lib/inc/drogon/PubSubService.h
579590
lib/inc/drogon/drogon_test.h
@@ -682,6 +693,7 @@ set(ORM_HEADERS
682693
orm_lib/inc/drogon/orm/BaseBuilder.h
683694
orm_lib/inc/drogon/orm/Criteria.h
684695
orm_lib/inc/drogon/orm/DbClient.h
696+
orm_lib/inc/drogon/orm/DbConfig.h
685697
orm_lib/inc/drogon/orm/DbListener.h
686698
orm_lib/inc/drogon/orm/DbTypes.h
687699
orm_lib/inc/drogon/orm/Exception.h

CPPLINT.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ filter=-runtime/references
1010
# CHECK macros are from Drogon, not Google Test.
1111
filter=-readability/check
1212

13-
# Don't warn about the use of C++11 features.
13+
# Don't warn about the use of C++11 or C++17 features.
1414
filter=-build/c++11
15+
filter=-build/c++17
1516

1617
filter=-build/include_subdir
1718

0 commit comments

Comments
 (0)