Logging disabled for release build
Signed-off-by: Volodymyr Kozieiev <vkjr.sp@gmail.com>
This commit is contained in:
parent
50e0f26864
commit
d603460ff1
|
@ -53,6 +53,10 @@ def prepDeps() {
|
||||||
}
|
}
|
||||||
|
|
||||||
def compile() {
|
def compile() {
|
||||||
|
/* disable logs for desktop builds when releasing */
|
||||||
|
if (params.BUILD_TYPE == 'release') {
|
||||||
|
env.STATUS_NO_LOGGING = 1
|
||||||
|
}
|
||||||
/* since QT is in a custom path we need to add it to PATH */
|
/* since QT is in a custom path we need to add it to PATH */
|
||||||
if (env.QT_PATH) {
|
if (env.QT_PATH) {
|
||||||
env.PATH = "${env.QT_PATH}:${env.PATH}"
|
env.PATH = "${env.QT_PATH}:${env.PATH}"
|
||||||
|
|
|
@ -14,6 +14,9 @@ set(REACT_BUILD_STATIC_LIB ON)
|
||||||
project(${APP_NAME} CXX)
|
project(${APP_NAME} CXX)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNICODE -std=c++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNICODE -std=c++11")
|
||||||
|
if(STATUS_NO_LOGGING)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATUS_NO_LOGGING")
|
||||||
|
endif()
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUNICODE -std=c11")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUNICODE -std=c11")
|
||||||
set(CMAKE_INSTALL_PREFIX bin)
|
set(CMAKE_INSTALL_PREFIX bin)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_PREFIX}" CACHE PATH "Where to place compiled executables.")
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_PREFIX}" CACHE PATH "Where to place compiled executables.")
|
||||||
|
|
|
@ -258,8 +258,20 @@ int main(int argc, char **argv) {
|
||||||
Q_INIT_RESOURCE(react_resources);
|
Q_INIT_RESOURCE(react_resources);
|
||||||
|
|
||||||
loadFontsFromResources();
|
loadFontsFromResources();
|
||||||
|
#ifdef STATUS_NO_LOGGING
|
||||||
|
QLoggingCategory::setFilterRules("UIManager=false\n"
|
||||||
|
"Flexbox=false\n"
|
||||||
|
"WebSocketModule=false\n"
|
||||||
|
"Networking=false\n"
|
||||||
|
"ViewManager=false\n"
|
||||||
|
"RCTNotification=false\n"
|
||||||
|
"default=false\n"
|
||||||
|
"RCTStatus=false\n"
|
||||||
|
"jsserver=false\n"
|
||||||
|
"status=false\n");
|
||||||
|
#else
|
||||||
QLoggingCategory::setFilterRules(QStringLiteral("UIManager=false\nFlexbox=false\nViewManager=false\nNetworking=false\nWebSocketModule=false"));
|
QLoggingCategory::setFilterRules(QStringLiteral("UIManager=false\nFlexbox=false\nViewManager=false\nNetworking=false\nWebSocketModule=false"));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (redirectLogIntoFile()) {
|
if (redirectLogIntoFile()) {
|
||||||
qInstallMessageHandler(saveMessage);
|
qInstallMessageHandler(saveMessage);
|
||||||
|
@ -357,6 +369,9 @@ QString getLogFilePath() {
|
||||||
|
|
||||||
void writeLogsToFile() {
|
void writeLogsToFile() {
|
||||||
QMutexLocker locker(&consoleOutputMutex);
|
QMutexLocker locker(&consoleOutputMutex);
|
||||||
|
if(consoleOutputStrings.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
QFile logFile(getLogFilePath());
|
QFile logFile(getLogFilePath());
|
||||||
if (logFile.open(QIODevice::WriteOnly | QIODevice::Append)) {
|
if (logFile.open(QIODevice::WriteOnly | QIODevice::Append)) {
|
||||||
for (QString message : consoleOutputStrings) {
|
for (QString message : consoleOutputStrings) {
|
||||||
|
@ -522,6 +537,7 @@ void appendConsoleString(const QString &msg) {
|
||||||
|
|
||||||
void saveMessage(QtMsgType type, const QMessageLogContext &context,
|
void saveMessage(QtMsgType type, const QMessageLogContext &context,
|
||||||
const QString &msg) {
|
const QString &msg) {
|
||||||
|
|
||||||
Q_UNUSED(context);
|
Q_UNUSED(context);
|
||||||
QByteArray localMsg = msg.toLocal8Bit();
|
QByteArray localMsg = msg.toLocal8Bit();
|
||||||
QString message = localMsg + "\n";
|
QString message = localMsg + "\n";
|
||||||
|
|
|
@ -15,6 +15,12 @@ if [ -z $TARGET_SYSTEM_NAME ]; then
|
||||||
fi
|
fi
|
||||||
WINDOWS_CROSSTOOLCHAIN_PKG_NAME='mxetoolchain-x86_64-w64-mingw32'
|
WINDOWS_CROSSTOOLCHAIN_PKG_NAME='mxetoolchain-x86_64-w64-mingw32'
|
||||||
|
|
||||||
|
if [ -z $STATUS_NO_LOGGING ]; then
|
||||||
|
COMPILE_FLAGS="-DCMAKE_CXX_FLAGS:='-DBUILD_FOR_BUNDLE=1'"
|
||||||
|
else
|
||||||
|
COMPILE_FLAGS="-DCMAKE_CXX_FLAGS:=-DBUILD_FOR_BUNDLE=1 -DSTATUS_NO_LOGGING=1"
|
||||||
|
fi
|
||||||
|
|
||||||
external_modules_dir=( \
|
external_modules_dir=( \
|
||||||
'node_modules/react-native-i18n/desktop' \
|
'node_modules/react-native-i18n/desktop' \
|
||||||
'node_modules/react-native-config/desktop' \
|
'node_modules/react-native-config/desktop' \
|
||||||
|
@ -200,14 +206,14 @@ function compile() {
|
||||||
-DEXTERNAL_MODULES_DIR="$EXTERNAL_MODULES_DIR" \
|
-DEXTERNAL_MODULES_DIR="$EXTERNAL_MODULES_DIR" \
|
||||||
-DDESKTOP_FONTS="$DESKTOP_FONTS" \
|
-DDESKTOP_FONTS="$DESKTOP_FONTS" \
|
||||||
-DJS_BUNDLE_PATH="$JS_BUNDLE_PATH" \
|
-DJS_BUNDLE_PATH="$JS_BUNDLE_PATH" \
|
||||||
-DCMAKE_CXX_FLAGS:='-DBUILD_FOR_BUNDLE=1' || exit 1
|
$COMPILE_FLAGS || exit 1
|
||||||
else
|
else
|
||||||
cmake -Wno-dev \
|
cmake -Wno-dev \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DEXTERNAL_MODULES_DIR="$EXTERNAL_MODULES_DIR" \
|
-DEXTERNAL_MODULES_DIR="$EXTERNAL_MODULES_DIR" \
|
||||||
-DDESKTOP_FONTS="$DESKTOP_FONTS" \
|
-DDESKTOP_FONTS="$DESKTOP_FONTS" \
|
||||||
-DJS_BUNDLE_PATH="$JS_BUNDLE_PATH" \
|
-DJS_BUNDLE_PATH="$JS_BUNDLE_PATH" \
|
||||||
-DCMAKE_CXX_FLAGS:='-DBUILD_FOR_BUNDLE=1' || exit 1
|
$COMPILE_FLAGS || exit 1
|
||||||
fi
|
fi
|
||||||
make -S -j5 || exit 1
|
make -S -j5 || exit 1
|
||||||
popd
|
popd
|
||||||
|
|
Loading…
Reference in New Issue