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() {
|
||||
/* 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 */
|
||||
if (env.QT_PATH) {
|
||||
env.PATH = "${env.QT_PATH}:${env.PATH}"
|
||||
|
|
|
@ -14,6 +14,9 @@ set(REACT_BUILD_STATIC_LIB ON)
|
|||
project(${APP_NAME} CXX)
|
||||
|
||||
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_INSTALL_PREFIX bin)
|
||||
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);
|
||||
|
||||
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"));
|
||||
#endif
|
||||
|
||||
if (redirectLogIntoFile()) {
|
||||
qInstallMessageHandler(saveMessage);
|
||||
|
@ -357,6 +369,9 @@ QString getLogFilePath() {
|
|||
|
||||
void writeLogsToFile() {
|
||||
QMutexLocker locker(&consoleOutputMutex);
|
||||
if(consoleOutputStrings.isEmpty())
|
||||
return;
|
||||
|
||||
QFile logFile(getLogFilePath());
|
||||
if (logFile.open(QIODevice::WriteOnly | QIODevice::Append)) {
|
||||
for (QString message : consoleOutputStrings) {
|
||||
|
@ -522,6 +537,7 @@ void appendConsoleString(const QString &msg) {
|
|||
|
||||
void saveMessage(QtMsgType type, const QMessageLogContext &context,
|
||||
const QString &msg) {
|
||||
|
||||
Q_UNUSED(context);
|
||||
QByteArray localMsg = msg.toLocal8Bit();
|
||||
QString message = localMsg + "\n";
|
||||
|
|
|
@ -15,6 +15,12 @@ if [ -z $TARGET_SYSTEM_NAME ]; then
|
|||
fi
|
||||
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=( \
|
||||
'node_modules/react-native-i18n/desktop' \
|
||||
'node_modules/react-native-config/desktop' \
|
||||
|
@ -200,14 +206,14 @@ function compile() {
|
|||
-DEXTERNAL_MODULES_DIR="$EXTERNAL_MODULES_DIR" \
|
||||
-DDESKTOP_FONTS="$DESKTOP_FONTS" \
|
||||
-DJS_BUNDLE_PATH="$JS_BUNDLE_PATH" \
|
||||
-DCMAKE_CXX_FLAGS:='-DBUILD_FOR_BUNDLE=1' || exit 1
|
||||
$COMPILE_FLAGS || exit 1
|
||||
else
|
||||
cmake -Wno-dev \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DEXTERNAL_MODULES_DIR="$EXTERNAL_MODULES_DIR" \
|
||||
-DDESKTOP_FONTS="$DESKTOP_FONTS" \
|
||||
-DJS_BUNDLE_PATH="$JS_BUNDLE_PATH" \
|
||||
-DCMAKE_CXX_FLAGS:='-DBUILD_FOR_BUNDLE=1' || exit 1
|
||||
$COMPILE_FLAGS || exit 1
|
||||
fi
|
||||
make -S -j5 || exit 1
|
||||
popd
|
||||
|
|
Loading…
Reference in New Issue