Skip to content

Commit f987638

Browse files
Merge pull request #374 from treefrogframework/v2_7
Next issues
2 parents a12d281 + 233ae6a commit f987638

21 files changed

+92
-90
lines changed

.github/workflows/actions.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,21 @@ jobs:
5050
run: |
5151
$GITHUB_WORKSPACE/tools/test/releasetest/releasetest
5252
53-
build-ubuntu-mongoc:
53+
build-ubuntu-sharedlink:
5454
runs-on: ubuntu-22.04
5555
steps:
5656
- uses: actions/checkout@main
5757
- name: apt
5858
run: |
5959
sudo apt-get update -qq
60-
sudo apt install -y --no-install-recommends pkg-config qmake6 qt6-base-dev qt6-base-dev-tools qt6-tools-dev-tools qt6-declarative-dev libqt6sql6-mysql libqt6sql6-psql libqt6sql6-odbc libqt6sql6-sqlite libqt6core6 libqt6qml6 libqt6xml6 libpq5 libodbc1 libmongoc-dev libbson-dev gcc g++ clang make cmake
60+
sudo apt install -y --no-install-recommends pkg-config qmake6 qt6-base-dev qt6-base-dev-tools qt6-tools-dev-tools qt6-declarative-dev libqt6sql6-mysql libqt6sql6-psql libqt6sql6-odbc libqt6sql6-sqlite libqt6core6 libqt6qml6 libqt6xml6 libpq5 libodbc1 libmongoc-dev libbson-dev liblz4-dev gcc g++ clang make cmake
6161
- name: qmake version
6262
run: |
6363
sudo rm -f /usr/bin/qmake
6464
sudo ln -sf /usr/bin/qmake6 /usr/bin/qmake
6565
qmake -v
6666
- name: configure
67-
run: ./configure --prefix=/usr/local --enable-shared-mongoc --spec=linux-clang
67+
run: ./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-lz4 --spec=linux-clang
6868
- name: make
6969
run: |
7070
make -j4 -C src
@@ -153,14 +153,14 @@ jobs:
153153
treefrog -v
154154
tspawn --show-drivers
155155
156-
build-macos-mongoc:
156+
build-macos-sharedlink:
157157
runs-on: macos-latest
158158
steps:
159159
- uses: actions/checkout@main
160160
- name: Homebrew
161-
run: brew install qt6 mongo-c-driver gflags glog
161+
run: brew install qt6 mongo-c-driver gflags glog lz4
162162
- name: configure
163-
run: ./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-glog
163+
run: ./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-glog --enable-shared-lz4
164164
- name: build
165165
run: |
166166
make -j4 -C src

configure

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ usage()
1010
Usage: $0 [OPTION]... [VAR=VALUE]...
1111
1212
Configuration:
13-
-h, --help display this help and exit
14-
--enable-debug compile with debugging information
15-
--enable-gui-mod compile and link with QtGui module
13+
-h, --help display this help and exit
1614
--enable-shared-mongoc link the mongoc shared library
17-
--enable-shared-glog link the glog shared library
18-
--spec=SPEC use SPEC as QMAKESPEC
15+
--enable-shared-lz4 link the lz4 shared library
16+
--enable-shared-glog link the glog shared library
17+
--enable-gui-mod compile and link with QtGui module
18+
--enable-debug compile with debugging information
19+
--spec=SPEC use SPEC as QMAKESPEC
1920
2021
Installation directories:
2122
--prefix=PREFIX install files in PREFIX [$PREFIX]
@@ -96,6 +97,9 @@ while [ -n "`echo $1 | grep '-'`" ]; do
9697
--enable-shared-mongoc | --enable-shared-mongoc=*)
9798
ENABLE_SHARED_MONGOC="enable_shared_mongoc=1"
9899
;;
100+
--enable-shared-lz4 | --enable-shared-lz4=*)
101+
ENABLE_SHARED_LZ4="enable_shared_lz4=1"
102+
;;
99103
--enable-shared-glog | --enable-shared-glog=*)
100104
ENABLE_SHARED_GLOG="enable_shared_glog=1"
101105
;;
@@ -191,7 +195,7 @@ fi
191195
cd "$BASEDIR/src"
192196
rm -f .qmake.stash
193197
[ -f Makefile ] && make -k distclean >/dev/null 2>&1
194-
$QMAKE $OPT target.path=\"$LIBDIR\" header.path=\"$INCLUDEDIR\" $ENABLE_GUI $ENABLE_SHARED_MONGOC
198+
$QMAKE $OPT target.path=\"$LIBDIR\" header.path=\"$INCLUDEDIR\" $ENABLE_GUI $ENABLE_SHARED_MONGOC $ENABLE_SHARED_LZ4
195199
RET=$?
196200
if [ $RET != 0 ]; then
197201
echo "qmake failed"
@@ -246,18 +250,20 @@ fi
246250

247251
# compile LZ4
248252
cd "$BASEDIR/3rdparty/lz4"
249-
echo
250-
echo -n "Compiling LZ4 ... "
251253
make clean >/dev/null 2>&1
252-
make -j${NPROC} lib >/dev/null 2>&1
253-
RET=$?
254-
if [ $RET != 0 ]; then
255-
make SHELL='bash -x' lib
256-
echo "failed"
257-
echo "LZ4 not available."
258-
exit $RET
254+
if [ -z "$ENABLE_SHARED_LZ4" ]; then
255+
echo
256+
echo -n "Compiling LZ4 ... "
257+
make -j${NPROC} lib >/dev/null 2>&1
258+
RET=$?
259+
if [ $RET != 0 ]; then
260+
make SHELL='bash -x' lib
261+
echo "failed"
262+
echo "LZ4 not available."
263+
exit $RET
264+
fi
265+
echo "OK"
259266
fi
260-
echo "OK"
261267

262268
echo
263269
echo "First, run \"make\" and \"sudo make install\" in src directory."

configure.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@echo OFF
22
@setlocal
33

4-
set VERSION=2.6.0
4+
set VERSION=2.6.1
55
set TFDIR=C:\TreeFrog\%VERSION%
66
set MONBOC_VERSION=1.21.2
77
set LZ4_VERSION=1.9.4

installer/create_installer.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
:: 10行目、28行目、39行目を編集
88

99

10-
set VERSION=2.6.0
10+
set VERSION=2.6.1
1111
set QTBASE=C:\Qt
1212
set TFDIR=C:\TreeFrog\%VERSION%
1313

installer/treefrog-setup/treefrog-setup/AssemblyInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ using namespace System::Security::Permissions;
3131
// すべての値を指定するか、下のように '*' を使ってリビジョンおよびビルド番号を
3232
// 既定値にすることができます:
3333

34-
[assembly:AssemblyVersionAttribute("2.6.0")];
34+
[assembly:AssemblyVersionAttribute("2.6.1")];
3535

3636
[assembly:ComVisible(false)];
3737

src/corelib.pro

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ lessThan(QT_MAJOR_VERSION, 6) {
1414
DEFINES *= QT_USE_QSTRINGBUILDER
1515
DEFINES += TF_MAKEDLL
1616
DEFINES += QT_DEPRECATED_WARNINGS
17-
INCLUDEPATH += ../include ../3rdparty/lz4/lib
17+
INCLUDEPATH += ../include
1818
DEPENDPATH += ../include
1919
MOC_DIR = .obj/
2020
OBJECTS_DIR = .obj/
@@ -38,22 +38,15 @@ isEmpty(target.path) {
3838
INSTALLS += target
3939

4040
windows {
41-
win32-msvc* {
42-
LIBS += ../3rdparty/lz4/build/cmake/build/Release/lz4_static.lib
43-
} else {
44-
LIBS += ../3rdparty/lz4/lib/release/liblz4.a
45-
}
46-
41+
INCLUDEPATH += ../3rdparty/lz4/lib
42+
LIBS += ../3rdparty/lz4/build/cmake/build/Release/lz4_static.lib
4743
header.files = $$HEADER_FILES $$HEADER_CLASSES
4844
header.files += $$MONGODB_FILES $$MONGODB_CLASSES
45+
4946
lessThan(QT_MAJOR_VERSION, 6) {
50-
win32-msvc* {
51-
QMAKE_CXXFLAGS += /source-charset:utf-8 /wd 4819 /wd 4661
52-
}
47+
QMAKE_CXXFLAGS += /source-charset:utf-8 /wd 4819 /wd 4661
5348
} else {
54-
win32-msvc* {
55-
QMAKE_CXXFLAGS += /wd 4819 /wd 4661
56-
}
49+
QMAKE_CXXFLAGS += /wd 4819 /wd 4661
5750
}
5851

5952
isEmpty(header.path) {
@@ -64,13 +57,20 @@ windows {
6457
test.files = $$TEST_FILES $$TEST_CLASSES
6558
test.path = $$header.path/TfTest
6659
INSTALLS += header script test
67-
} else:unix {
68-
LIBS += ../3rdparty/lz4/lib/liblz4.a
69-
macx:QMAKE_SONAME_PREFIX=@rpath
60+
} else {
61+
# UNIX
62+
isEmpty( enable_shared_lz4 ) {
63+
# Static link
64+
LIBS += ../3rdparty/lz4/lib/liblz4.a
65+
INCLUDEPATH += ../include ../3rdparty/lz4/lib
66+
} else {
67+
LIBS += $$system("pkg-config --libs liblz4 2>/dev/null")
68+
QMAKE_CXXFLAGS += $$system("pkg-config --cflags-only-I liblz4 2>/dev/null")
69+
}
7070

71+
macx:QMAKE_SONAME_PREFIX=@rpath
7172
header.files = $$HEADER_FILES $$HEADER_CLASSES
7273
header.files += $$MONGODB_FILES $$MONGODB_CLASSES
73-
7474
test.files = $$TEST_FILES $$TEST_CLASSES
7575
test.path = $$header.path/TfTest
7676
INSTALLS += header test
@@ -430,26 +430,21 @@ freebsd {
430430

431431
# Files for MongoDB
432432
windows {
433+
# Windows
433434
DEFINES += MONGOC_COMPILATION BSON_COMPILATION
434435
INCLUDEPATH += ../3rdparty/mongo-driver/src/libmongoc/src/mongoc ../3rdparty/mongo-driver/src/libbson/src
435-
win32-msvc* {
436-
LIBS += ../3rdparty/mongo-driver/src/libmongoc/Release/mongoc-static-1.0.lib ../3rdparty/mongo-driver/src/libbson/Release/bson-static-1.0.lib
437-
LIBS += -lws2_32 -lpsapi -lAdvapi32
438-
}
436+
LIBS += ../3rdparty/mongo-driver/src/libmongoc/Release/mongoc-static-1.0.lib ../3rdparty/mongo-driver/src/libbson/Release/bson-static-1.0.lib
437+
LIBS += -lws2_32 -lpsapi -lAdvapi32
439438
} else {
439+
# UNIX
440440
isEmpty( enable_shared_mongoc ) {
441441
# Static link
442442
INCLUDEPATH += ../3rdparty/mongo-driver/src/libmongoc/src/mongoc ../3rdparty/mongo-driver/src/libbson/src
443443
LIBS += ../3rdparty/mongo-driver/src/libmongoc/libmongoc-static-1.0.a ../3rdparty/mongo-driver/src/libbson/libbson-static-1.0.a
444444
} else {
445-
macx {
446-
# Homebrew
447-
INCLUDEPATH += /usr/local/include/libmongoc-1.0 /usr/local/include/libbson-1.0
448-
LIBS += -L/usr/local/lib -lmongoc-1.0 -lbson-1.0
449-
} else {
450-
INCLUDEPATH += /usr/include/libmongoc-1.0 /usr/include/libbson-1.0
451-
LIBS += $$system("pkg-config --libs libmongoc-1.0 2>/dev/null")
452-
}
445+
# Shared link
446+
LIBS += $$system("pkg-config --libs libmongoc-1.0 2>/dev/null")
447+
QMAKE_CXXFLAGS += $$system("pkg-config --cflags-only-I libmongoc-1.0 2>/dev/null")
453448
}
454449
}
455450

src/taccesslog.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,11 @@ TAccessLogger::TAccessLogger()
119119
}
120120

121121

122-
TAccessLogger::TAccessLogger(const TAccessLogger &other)
122+
TAccessLogger::TAccessLogger(TAccessLogger &&other)
123123
{
124-
if (other._accessLog) {
125-
open();
126-
*_accessLog = *(other._accessLog);
127-
}
124+
_accessLog = std::move(other._accessLog);
125+
_timer = std::move(other._timer);
126+
other._accessLog = nullptr;
128127
}
129128

130129

@@ -134,12 +133,11 @@ TAccessLogger::~TAccessLogger()
134133
}
135134

136135

137-
TAccessLogger &TAccessLogger::operator=(const TAccessLogger &other)
136+
TAccessLogger &TAccessLogger::operator=(TAccessLogger &&other)
138137
{
139-
if (other._accessLog) {
140-
open();
141-
*_accessLog = *(other._accessLog);
142-
}
138+
_accessLog = std::move(other._accessLog);
139+
_timer = std::move(other._timer);
140+
other._accessLog = nullptr;
143141
return *this;
144142
}
145143

@@ -157,8 +155,6 @@ void TAccessLogger::write()
157155
if (_accessLog) {
158156
_accessLog->duration = _timer.elapsed();
159157
Tf::writeAccessLog(*_accessLog);
160-
161-
close(); // write one-shot
162158
}
163159
}
164160

src/taccesslog.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ class T_CORE_EXPORT TAccessLog {
2323
class T_CORE_EXPORT TAccessLogger {
2424
public:
2525
TAccessLogger();
26-
TAccessLogger(const TAccessLogger &other);
26+
TAccessLogger(const TAccessLogger &other) = delete;
27+
TAccessLogger(TAccessLogger &&other);
2728
~TAccessLogger();
28-
TAccessLogger &operator=(const TAccessLogger &other);
29+
TAccessLogger &operator=(const TAccessLogger &other) = delete;
30+
TAccessLogger &operator=(TAccessLogger &&other);
2931

3032
void open();
3133
void write();

src/tactioncontext.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@
3333

3434
TActionContext::TActionContext() :
3535
TDatabaseContext()
36-
{
37-
accessLogger.open();
38-
}
36+
{ }
3937

4038

4139
TActionContext::~TActionContext()
@@ -68,6 +66,7 @@ void TActionContext::execute(THttpRequest &request)
6866

6967
// Access log
7068
if (Tf::isAccessLoggerAvailable()) {
69+
accessLogger.open();
7170
QByteArray firstLine;
7271
firstLine.reserve(200);
7372
firstLine += reqHeader.method();
@@ -406,6 +405,7 @@ void TActionContext::flushResponse(TActionController *controller, bool immediate
406405
if (immediate) {
407406
flushSocket();
408407
accessLogger.write(); // Writes access log
408+
accessLogger.close();
409409
closeSocket();
410410
}
411411
}

src/tactionworker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ qint64 TActionWorker::writeResponse(THttpResponseHeader &header, QIODevice *body
4242
}
4343

4444
if (!TActionContext::stopped.load()) {
45-
_socket->sendData(header.toByteArray(), body, autoRemove, accessLogger);
45+
_socket->sendData(header.toByteArray(), body, autoRemove, std::move(accessLogger));
4646
}
4747
accessLogger.close();
4848
return 0;

0 commit comments

Comments
 (0)