refactor: rename baselib to libqbase (#3)

* refacor: rename baselib to libqbase
* gear: rename package
* ci: rename github workflows
This commit is contained in:
Michael Chernigin 2023-09-26 11:29:34 +04:00 committed by Michael Chernigin
parent 3b7699c975
commit 615407fce0
Signed by: cherniginma
GPG Key ID: 42ED11B71604A422
27 changed files with 102 additions and 100 deletions

View File

@ -1,10 +1,10 @@
%define _unpackaged_files_terminate_build 1
Name: baselib
Name: libqbase
Version: 0.0.1
Release: alt1
Summary: Common BaseALT projects library.
Summary: Common BaseALT Qt projects library.
License: GPLv2+
Group: Other
Url: https://github.com/mchernigin/baselib
@ -15,8 +15,10 @@ BuildRequires: qt5-base-common qt5-base-devel qt5-declarative-devel qt5-tools-de
Source0: %name-%version.tar
%global target_name qbase
%description
Common BaseALT projects library
Common BaseALT Qt projects library
%prep
%setup -q
@ -29,8 +31,8 @@ Common BaseALT projects library
%cmakeinstall_std
%files
%_includedir/%name/
%_libdir/liblogger.so
%_includedir/%target_name/
%_libdir/*.so
%_libdir/cmake
%changelog

View File

@ -1,2 +1,2 @@
tar: .
spec: .gear/baselib.spec
spec: .gear/libqbase.spec

View File

@ -1,4 +1,4 @@
name: baselib-container
name: qbase-container
on:
workflow_call:
@ -13,7 +13,7 @@ on:
required: true
jobs:
baselib-build-container:
qbase-build-container:
runs-on: ubuntu-latest
steps:

View File

@ -1,4 +1,4 @@
name: baselib-build
name: qbase-build
on:
workflow_call:
@ -13,29 +13,29 @@ on:
required: true
jobs:
baselib-build:
qbase-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build baselib packages
- name: Build qbase packages
run: |
docker pull --platform linux/${{ inputs.architecture }} \
ghcr.io/${{ github.repository }}-${{ inputs.architecture }}:latest
docker run --privileged=true --name baselib-build-${{ inputs.architecture }} -i --log-driver=none \
docker run --privileged=true --name qbase-build-${{ inputs.architecture }} -i --log-driver=none \
-a stdin -a stdout -a stderr -v "$(pwd)":/app --platform linux/${{ inputs.architecture }} \
ghcr.io/${{ github.repository }}-${{ inputs.architecture }}:latest
- name: Extract fresh packages
if: github.ref == 'refs/heads/master'
run: |
docker cp baselib-build-${{ inputs.architecture }}:/home/builder2/RPM/RPMS/ "$(pwd)/packages"
docker cp qbase-build-${{ inputs.architecture }}:/home/builder2/RPM/RPMS/ "$(pwd)/packages"
- name: Upload fresh RPM packages
if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v3
with:
name: baselib-${{ inputs.artifact }}-${{ inputs.architecture }}
name: qbase-${{ inputs.artifact }}-${{ inputs.architecture }}
path: ${{ github.workspace }}/packages

View File

@ -1,4 +1,4 @@
name: baselib-ci
name: qbase-ci
on:
workflow_dispatch:
@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: true
jobs:
baselib-build-container:
qbase-build-container:
uses: ./.github/workflows/build-container.yml
secrets: inherit
strategy:
@ -24,9 +24,9 @@ jobs:
distr: ${{ matrix.os.distr }}
architecture: ${{ matrix.architecture }}
baselib-build:
qbase-build:
uses: ./.github/workflows/build.yml
needs: [ baselib-build-container ]
needs: [ qbase-build-container ]
secrets: inherit
strategy:
matrix:
@ -37,7 +37,7 @@ jobs:
artifact: ${{ matrix.os.artifact }}
architecture: ${{ matrix.architecture }}
baselib-publish-api-docs:
qbase-publish-api-docs:
uses: ./.github/workflows/publish-api-docs.yml
needs: [ baselib-build ]
needs: [ qbase-build ]
secrets: inherit

View File

@ -1,9 +1,9 @@
name: baselib-publish-api-doc
name: qbase-publish-api-doc
on: [ workflow_call, workflow_dispatch ]
jobs:
baselib-publish-api-doc:
qbase-publish-api-doc:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
@ -22,7 +22,7 @@ jobs:
- name: Add generated autodocs to Git repo in the documentation branch
run: |
git config --global user.email "baselib-github-bot@basealt.ru"
git config --global user.email "qbase-github-bot@basealt.ru"
git config --global user.name "$GITHUB_WORKFLOW GitHub action"
git add -f docs
git commit -am "docs: add auto-generated developer documentation"

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.15)
project(baselib
project(qbase
VERSION 0.0.1)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

View File

@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.
PROJECT_NAME = baselib
PROJECT_NAME = libqbase
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version

View File

@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 3.15)
project(baselib-example LANGUAGES CXX)
project(qbase-example LANGUAGES CXX)
find_package(Qt5 COMPONENTS Core REQUIRED)
find_package(baselib COMPONENTS logger REQUIRED)
find_package(qbase COMPONENTS logger REQUIRED)
add_executable(${PROJECT_NAME})
target_sources(${PROJECT_NAME} PRIVATE main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE baselib::logger Qt5::Core)
target_link_libraries(${PROJECT_NAME} PRIVATE qbase::logger Qt5::Core)

View File

@ -1,14 +1,14 @@
#include <baselib/logger/prelude.h>
#include <qbase/logger/prelude.h>
#include <QCoreApplication>
#include <QDebug>
int main(int argc, char *argv[])
int main()
{
auto loggerManager = base::logger::LoggerManager::globalInstance();
auto loggerManager = qbase::logger::LoggerManager::globalInstance();
loggerManager->addLogger<base::logger::ConsoleLogger>(QtDebugMsg);
loggerManager->addLogger<base::logger::FileLogger>(QtWarningMsg, "appname", "appname.log");
loggerManager->addLogger<base::logger::SyslogLogger>(LOG_LEVEL_DISABLED, "appname");
loggerManager->addLogger<qbase::logger::ConsoleLogger>(QtDebugMsg);
loggerManager->addLogger<qbase::logger::FileLogger>(QtWarningMsg, "appname", "appname.log");
loggerManager->addLogger<qbase::logger::SyslogLogger>(LOG_LEVEL_DISABLED, "appname");
qDebug() << "Hello?";
qInfo() << "Hello?";

View File

@ -18,15 +18,15 @@
**
***********************************************************************************************************************/
#ifndef BASELIB_BASE_H
#define BASELIB_BASE_H
#ifndef QBASE_BASE_H
#define QBASE_BASE_H
#include "common.h"
#ifdef BASELIB_CORE_LIBRARY
#define BASELIB_CORE_EXPORT BASELIB_SYMBOL_EXPORT
#ifdef QBASE_CORE_LIBRARY
#define QBASE_CORE_EXPORT QBASE_SYMBOL_EXPORT
#else
#define BASELIB_CORE_EXPORT BASELIB_SYMBOL_IMPORT
#define QBASE_CORE_EXPORT QBASE_SYMBOL_IMPORT
#endif
#endif // BASELIB_BASE_H
#endif // QBASE_BASE_H

View File

@ -18,22 +18,22 @@
**
***********************************************************************************************************************/
#ifndef BASELIB_COMMON_H
#define BASELIB_COMMON_H
#ifndef QBASE_COMMON_H
#define QBASE_COMMON_H
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__)
#define BASELIB_SYMBOL_EXPORT __attribute__((__dllexport__))
#define BASELIB_SYMBOL_IMPORT __attribute__((__dllimport__))
#define QBASE_SYMBOL_EXPORT __attribute__((__dllexport__))
#define QBASE_SYMBOL_IMPORT __attribute__((__dllimport__))
#else
#if defined (__LCC__)
#define BASELIB_SYMBOL_EXPORT
#define QBASE_SYMBOL_EXPORT
#else
#define BASELIB_SYMBOL_EXPORT __attribute__((__visibility__("default")))
#define QBASE_SYMBOL_EXPORT __attribute__((__visibility__("default")))
#endif
#define BASELIB_SYMBOL_IMPORT
#define QBASE_SYMBOL_IMPORT
#endif
#endif // BASELIB_COMMON_H
#endif // QBASE_COMMON_H

View File

@ -18,18 +18,18 @@
**
***********************************************************************************************************************/
#ifndef BASELIB_CONSOLE_LOGGER_H
#define BASELIB_CONSOLE_LOGGER_H
#ifndef QBASE_CONSOLE_LOGGER_H
#define QBASE_CONSOLE_LOGGER_H
#include "logger.h"
#include "loggermessage.h"
#include "../base.h"
namespace base
namespace qbase
{
namespace logger
{
class BASELIB_CORE_EXPORT ConsoleLogger : public Logger
class QBASE_CORE_EXPORT ConsoleLogger : public Logger
{
public:
ConsoleLogger();
@ -40,6 +40,6 @@ private:
bool hasColorSupport = false;
};
} // namespace logger
} // namespace base
} // namespace qbase
#endif // BASELIB_CONSOLE_LOGGER_H
#endif // QBASE_CONSOLE_LOGGER_H

View File

@ -18,8 +18,8 @@
**
***********************************************************************************************************************/
#ifndef BASELIB_FILE_LOGGER_H
#define BASELIB_FILE_LOGGER_H
#ifndef QBASE_FILE_LOGGER_H
#define QBASE_FILE_LOGGER_H
#include "logger.h"
#include "loggermessage.h"
@ -27,11 +27,11 @@
#include <fstream>
namespace base
namespace qbase
{
namespace logger
{
class BASELIB_CORE_EXPORT FileLogger : public Logger
class QBASE_CORE_EXPORT FileLogger : public Logger
{
public:
explicit FileLogger(const char *folderName, const char *fileName);
@ -52,6 +52,6 @@ private:
std::fstream logFileStream = {};
};
} // namespace logger
} // namespace base
} // namespace qbase
#endif // BASELIB_FILE_LOGGER_H
#endif // QBASE_FILE_LOGGER_H

View File

@ -18,8 +18,8 @@
**
***********************************************************************************************************************/
#ifndef BASELIB_ABSTRACT_LOGGER_H
#define BASELIB_ABSTRACT_LOGGER_H
#ifndef QBASE_LOGGER_H
#define QBASE_LOGGER_H
#include "../base.h"
#include "loggermessage.h"
@ -31,11 +31,11 @@
#define LOG_LEVEL_DISABLED static_cast<QtMsgType>(-1)
namespace base
namespace qbase
{
namespace logger
{
class BASELIB_CORE_EXPORT Logger
class QBASE_CORE_EXPORT Logger
{
public:
Logger() = default;
@ -67,6 +67,6 @@ protected:
};
};
} // namespace logger
} // namespace base
} // namespace qbase
#endif // BASELIB_ABSTRACT_LOGGER_H
#endif // QBASE_LOGGER_H

View File

@ -18,8 +18,8 @@
**
***********************************************************************************************************************/
#ifndef BASELIB_LOGGER_MANAGER_H
#define BASELIB_LOGGER_MANAGER_H
#ifndef QBASE_LOGGER_MANAGER_H
#define QBASE_LOGGER_MANAGER_H
#include "../base.h"
#include "logger.h"
@ -30,13 +30,13 @@
#include <QString>
namespace base
namespace qbase
{
namespace logger
{
class LoggerManagerPrivate;
class BASELIB_CORE_EXPORT LoggerManager
class QBASE_CORE_EXPORT LoggerManager
{
public:
static LoggerManager *globalInstance();
@ -77,6 +77,6 @@ private:
LoggerManagerPrivate *d;
};
} // namespace logger
} // namespace base
} // namespace qbase
#endif // BASELIB_LOGGER_MANAGER_H
#endif // QBASE_LOGGER_MANAGER_H

View File

@ -18,8 +18,8 @@
**
***********************************************************************************************************************/
#ifndef BASELIB_LOGGER_MESSAGE_H
#define BASELIB_LOGGER_MESSAGE_H
#ifndef QBASE_LOGGER_MESSAGE_H
#define QBASE_LOGGER_MESSAGE_H
#include <ctime>
#include <string>
@ -27,7 +27,7 @@
#include <QtMsgHandler>
namespace base
namespace qbase
{
namespace logger
{
@ -53,6 +53,6 @@ public:
const std::thread::id threadId;
};
} // namespace logger
} // namespace base
} // namespace qbase
#endif // BASELIB_LOGGER_MESSAGE_H
#endif // QBASE_LOGGER_MESSAGE_H

View File

@ -18,8 +18,8 @@
**
***********************************************************************************************************************/
#ifndef BASELIB_LOGGERS_H
#define BASELIB_LOGGERS_H
#ifndef QBASE_PRELUDE_H
#define QBASE_PRELUDE_H
#include "loggermanager.h"
@ -27,4 +27,4 @@
#include "filelogger.h"
#include "sysloglogger.h"
#endif // BASELIB_LOGGERS_H
#endif // QBASE_PRELUDE_H

View File

@ -18,8 +18,8 @@
**
***********************************************************************************************************************/
#ifndef BASELIB_SYSLOG_LOGGER_H
#define BASELIB_SYSLOG_LOGGER_H
#ifndef QBASE_SYSLOG_LOGGER_H
#define QBASE_SYSLOG_LOGGER_H
#include "logger.h"
#include "loggermessage.h"
@ -27,11 +27,11 @@
#include <fstream>
namespace base
namespace qbase
{
namespace logger
{
class BASELIB_CORE_EXPORT SyslogLogger : public Logger
class QBASE_CORE_EXPORT SyslogLogger : public Logger
{
public:
SyslogLogger(const char *appName);
@ -47,6 +47,6 @@ private:
void log(const LoggerMessage &message) override;
};
} // namespace logger
} // namespace base
} // namespace qbase
#endif // BASELIB_SYSLOG_LOGGER_H
#endif // QBASE_SYSLOG_LOGGER_H

View File

@ -3,8 +3,8 @@ if (CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "e2k")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undef -fvisibility=default -pedantic -Wall")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undef -fvisibility-inlines-hidden -pedantic -Wall
-Wextra -Wno-long-long -Weffc++ -Werror -Wall -Wextra -pedantic -Wcast-align -Wcast-qual -Wctor-dtor-privacy \
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undef -fvisibility-inlines-hidden -pedantic -Wall -Wextra \
-Wno-long-long -Weffc++ -Werror -Wall -Wextra -pedantic -Wcast-align -Wcast-qual -Wctor-dtor-privacy \
-Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wnoexcept -Wold-style-cast \
-Woverloaded-virtual -Wredundant-decls -Wshadow -Wstrict-null-sentinel -Wundef \
-Wno-unused -Wno-variadic-macros -Wno-parentheses -fdiagnostics-show-option")

View File

@ -51,7 +51,7 @@ static std::string colorize(const std::string &text, const char *params)
return std::string("\033[") + params + "m" + text + "\033[0m";
}
namespace base
namespace qbase
{
namespace logger
{
@ -109,4 +109,4 @@ void ConsoleLogger::log(const LoggerMessage &message)
<< message.filePath << ":" << message.line << ")" << std::endl;
}
} // namespace logger
} // namespace base
} // namespace qbase

View File

@ -26,7 +26,7 @@
#include <sys/types.h>
#include <unistd.h>
namespace base
namespace qbase
{
namespace logger
{
@ -137,4 +137,4 @@ bool FileLogger::ensureDir(const char *path)
return true;
}
} // namespace logger
} // namespace base
} // namespace qbase

View File

@ -20,7 +20,7 @@
#include "logger.h"
namespace base
namespace qbase
{
namespace logger
{
@ -63,4 +63,4 @@ void Logger::logMessage(const LoggerMessage &message)
}
}
} // namespace logger
} // namespace base
} // namespace qbase

View File

@ -36,7 +36,7 @@ static std::tm getCurrentTime()
return *std::localtime(&time);
}
namespace base
namespace qbase
{
namespace logger
{
@ -181,4 +181,4 @@ LoggerManager *LoggerManager::globalInstance()
return loggerInstance();
}
} // namespace logger
} // namespace base
} // namespace qbase

View File

@ -22,7 +22,7 @@
#include <iomanip>
namespace base
namespace qbase
{
namespace logger
{
@ -50,5 +50,5 @@ std::string LoggerMessage::getTimeFormatted(const char *format) const
return buffer.str();
}
} // namespace logger
} // namespace base
} // namespace qbase

View File

@ -23,7 +23,7 @@
#include <sstream>
#include <syslog.h>
namespace base
namespace qbase
{
namespace logger
{
@ -83,4 +83,4 @@ void SyslogLogger::log(const LoggerMessage &message)
syslog(logFlag, "%s: %s (%s:%u)", prefix, message.message.c_str(), message.filePath.c_str(), message.line);
}
} // namespace logger
} // namespace base
} // namespace qbase