Skip to content

Commit

Permalink
Add spdlog to improve server messages (opentibiabr#2512)
Browse files Browse the repository at this point in the history
* Add spdlog (and luascript interface methods)

- Add spdlog log library
- Define log format
- Update builds
- Create Lua interface  to call spdlog methods
"Spdlog.info(text)"
"Spdlog.warn(text)"
"Spdlog.error(text)"
"Spdlog.debug(text)"

Co-authored-by: Eduardo Dantas <[email protected]>
Co-authored-by: Gabriel Pedro <[email protected]>
  • Loading branch information
3 people authored Apr 11, 2021
1 parent 72bbb94 commit 47f8734
Show file tree
Hide file tree
Showing 148 changed files with 2,562 additions and 2,632 deletions.
31 changes: 17 additions & 14 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
image: Visual Studio 2019

shallow_clone: true
Expand All @@ -23,26 +24,28 @@ only_commits:
- CMakeLists.txt

install:
- cmd : vcpkg install boost-asio:x64-windows
- cmd : vcpkg install boost-filesystem:x64-windows
- cmd : vcpkg install boost-iostreams:x64-windows
- cmd : vcpkg install boost-lockfree:x64-windows
- cmd : vcpkg install boost-system:x64-windows
- cmd : vcpkg install boost-variant:x64-windows
- cmd : vcpkg install cryptopp:x64-windows
- cmd : vcpkg install curl:x64-windows
- cmd : vcpkg install jsoncpp:x64-windows
- cmd : vcpkg install libmariadb:x64-windows
- cmd : vcpkg install luajit:x64-windows
- cmd : vcpkg install mpir:x64-windows
- cmd : vcpkg install pugixml:x64-windows
- cmd: vcpkg install boost-asio:x64-windows
- cmd: vcpkg install boost-filesystem:x64-windows
- cmd: vcpkg install boost-iostreams:x64-windows
- cmd: vcpkg install boost-lockfree:x64-windows
- cmd: vcpkg install boost-system:x64-windows
- cmd: vcpkg install boost-variant:x64-windows
- cmd: vcpkg install cryptopp:x64-windows
- cmd: vcpkg install curl:x64-windows
- cmd: vcpkg install jsoncpp:x64-windows
- cmd: vcpkg install libmariadb:x64-windows
- cmd: vcpkg install luajit:x64-windows
- cmd: vcpkg install mpir:x64-windows
- cmd: vcpkg install pugixml:x64-windows
- cmd: vcpkg install spdlog:x64-windows

build:
parallel: true
# MSBuild verbosity level
# verbosity: detailed

# scripts to run after build (working directory and environment changes are persisted from the previous steps)
# scripts to run after build
# (working directory and environment changes are persisted from the previous steps)
after_build:
- 7z a -tzip otservbr-global.zip -r .\vc14\*.exe -ir!.\vc14\*.dll

Expand Down
7 changes: 4 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

# Lua, XML
[*.{lua,xml}]
indent_style = tab
indent_size = 4
indent_size = 2

# SQL
[**.{sql}]
Expand All @@ -19,12 +20,12 @@ indent_size = 2

#cmake
[CMakeLists.txt]
indent_style = space
indent_style = tab
indent_size = 2

# Google Style
[*.{cpp,hpp,h}]
indent_style = space
indent_style = tab
indent_size = 2
indent_brace_style = K&R
spaces_around_brackets = none
Expand Down
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Please describe the tests that you ran to verify your changes. Provide instructi

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I checked the PR checks reports
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
Expand Down
12 changes: 12 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
source:
- any: ['src/**/*']

data:
- any: ['data/**/*', '!data/world/*']

map:
- any: ['data/world/*']

docker:
- any: ['docker/**/*']
90 changes: 0 additions & 90 deletions .github/workflows/build-mac.yml

This file was deleted.

102 changes: 57 additions & 45 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,57 +25,69 @@ jobs:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
buildtype: [Debug, Release]
include:
- os: ubuntu-18.04
triplet: x64-linux
- os: ubuntu-20.04
triplet: x64-linux

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- uses: lukka/get-cmake@latest

- name: Install Dependencies
run: >
sudo apt-get update && sudo apt-get install ccache cmake build-essential
libcurl4-openssl-dev libjsoncpp-dev libmysqlclient-dev libboost-system-dev
libboost-iostreams-dev libboost-filesystem-dev libpugixml-dev
libcrypto++-dev libspdlog-dev libluajit-5.1-dev libboost-date-time-dev
unrar zip ca-certificates
- name: Install Dependencies
run: >
sudo apt-get update && sudo apt-get install ccache build-essential
libluajit-5.1-dev zip
- name: CCache
id: ccache
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{ matrix.os }}-${{ matrix.buildtype }}-${{ hashFiles('**/src') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.buildtype }}-${{ hashFiles('**/src') }}
${{ matrix.os }}-${{ matrix.buildtype }}-
- name: CCache
id: ccache
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{ matrix.os }}-${{ matrix.buildtype }}-${{ hashFiles('**/src') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.buildtype }}-${{ hashFiles('**/src') }}
${{ matrix.os }}-${{ matrix.buildtype }}-
- name: Prepare build Environment
run: |
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} ..
- name: Restore artifacts, or setup vcpkg (do not install any package)
uses: lukka/run-vcpkg@v7
with:
setupOnly: true
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
appendedCacheKey: ${{ hashFiles( '**/vcpkg.json' ) }}
vcpkgTriplet: ${{ matrix.triplet }}
additionalCachedPaths: ${{ github.workspace }}/build/vcpkg_installed
vcpkgGitCommitId: 030cfaa24de9ea1bbf0a4d9c615ce7312ba77af1

- name: Build
run: |
cd build
make -j `nproc`
mv otbr ../
- name: 'Run CMake with Ninja, install dependencies with vcpkg, build with CMake'
uses: lukka/run-cmake@v3
with:
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
useVcpkgToolchainFile: true
buildDirectory: ${{ github.workspace }}/build/
cmakeBuildType: ${{ matrix.buildtype }}

- name: Clean workspace
if: ${{ matrix.buildtype == 'Release' }}
shell: bash
run: find . -maxdepth 1 ! -name otbr ! -name data ! -name config.lua.dist ! -name key.pem ! -name LICENSE ! -name README.md ! -name schema.sql -exec rm -r {} \;
- name: Clean workspace
if: ${{ matrix.buildtype == 'Release' }}
shell: bash
run: |
mv ${{ github.workspace }}/build/bin/otbr ${{ github.workspace }}/otbr
find . -maxdepth 1 ! -name otbr ! -name data ! -name config.lua.dist ! -name key.pem ! -name LICENSE ! -name README.md ! -name schema.sql -exec rm -r {} \;
- name: Prepare datapack contents
if: ${{ matrix.buildtype == 'Release' }}
shell: bash
run: |
mv config.lua.dist config.lua
unzip -o data/world/world.zip -d data/world/
rm data/world/world.zip
cd ..
zip -r otservbr.zip otservbr-global
- name: Prepare datapack contents
if: ${{ matrix.buildtype == 'Release' }}
shell: bash
run: |
mv config.lua.dist config.lua
unzip -o data/world/world.zip -d data/world/
rm data/world/world.zip
cd ..
zip -r otservbr.zip otservbr-global
- name: Upload binary
if: ${{ matrix.buildtype == 'Release' }}
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-otbr-amd64-${{ matrix.buildtype }}-${{ github.sha }}
path: ${{ runner.workspace }}/otservbr.zip
- name: Upload binary
if: ${{ matrix.buildtype == 'Release' }}
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-otbr-amd64-${{ matrix.buildtype }}-${{ github.sha }}
path: ${{ runner.workspace }}/otservbr.zip
51 changes: 22 additions & 29 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,38 @@ on:
jobs:
job:
name: ${{ matrix.os }}-${{ matrix.buildtype }}
runs-on: ${{ matrix.os }}-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
name: [windows]
os: [windows-latest]
buildtype: [Debug, Release]
include:
- os: windows
- os: windows-latest
triplet: x64-windows
packages: >
boost-asio boost-iostreams boost-system boost-filesystem
boost-variant boost-lockfree cryptopp curl jsoncpp
luajit libmariadb pugixml
luajit libmariadb pugixml spdlog
steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Unshallow
run: git fetch --prune --unshallow

- name: Get latest CMake
# Using 'latest' branch, the latest CMake is installed.
uses: lukka/get-cmake@latest
- uses: lukka/get-cmake@latest

- name: Windows - remove C:/mysql*
run: rm -r -fo C:/mysql-5.7.21-winx64
if: contains( matrix.os, 'windows')

# - name: Restore artifacts, or setup vcpkg (do not install any package)
# uses: lukka/run-vcpkg@v7
# id: runvcpkg
# with:
# setupOnly: true
# vcpkgDirectory: '${{ github.workspace }}/vcpkg'
# appendedCacheKey: ${{ hashFiles( '**/vcpkg.json' ) }}
# vcpkgTriplet: ${{ matrix.triplet }}
# additionalCachedPaths: ${{ github.workspace }}/build/vcpkg_installed
# vcpkgGitCommitId: 030cfaa24de9ea1bbf0a4d9c615ce7312ba77af1

- name: Run vcpkg
uses: lukka/run-vcpkg@v5
with:
Expand All @@ -58,17 +60,13 @@ jobs:
vcpkgTriplet: ${{ matrix.triplet }}
vcpkgGitCommitId: 7db401cb1ef1fc559ec9f9ce814d064c328fd767

- name: Build with CMake
uses: lukka/run-cmake@v3.2
- name: Run CMake to install the dependencies specified in the vcpkg.json manifest, generate project file and build the project
uses: lukka/run-cmake@v3
with:
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
buildDirectory: ${{ github.workspace }}/build
useVcpkgToolchainFile: true
buildDirectory: ${{ runner.workspace }}/build
cmakeBuildType: ${{ matrix.buildtype }}

- name: dir
if: ${{ matrix.buildtype == 'Release' }}
run: find $RUNNER_WORKSPACE
shell: bash
buildWithCMake: true

- name: Create datapack
if: ${{ matrix.buildtype == 'Release' }}
Expand All @@ -79,17 +77,12 @@ jobs:
Copy-Item ${{ runner.workspace }}\otservbr-global\key.pem ${{ runner.workspace }}\otservbr-global\otservbr-global
Copy-Item ${{ runner.workspace }}\otservbr-global\LICENSE ${{ runner.workspace }}\otservbr-global\otservbr-global
Copy-Item ${{ runner.workspace }}\otservbr-global\README.md ${{ runner.workspace }}\otservbr-global\otservbr-global
Copy-Item ${{ runner.workspace }}\build\otbr.exe ${{ runner.workspace }}\otservbr-global\otservbr-global\otservbr-global.exe
Copy-Item ${{ github.workspace }}\build\bin\otbr.exe ${{ runner.workspace }}\otservbr-global\otservbr-global\otbr.exe
get-childitem -path ${{ runner.workspace }}\build -filter *.dll -recurse | copy-item -destination ${{ runner.workspace }}\otservbr-global\otservbr-global
Copy-Item ${{ runner.workspace }}\otservbr-global\data -Destination ${{ runner.workspace }}\otservbr-global\otservbr-global\data
Copy-Item -Path ${{ runner.workspace }}\otservbr-global\data\* -Destination ${{ runner.workspace }}\otservbr-global\otservbr-global\data -Recurse
Compress-Archive -Path ${{ runner.workspace }}\otservbr-global\otservbr-global -DestinationPath ${{ runner.workspace }}\otservbr.zip
- name: dir
if: ${{ matrix.buildtype == 'Release' }}
run: find $RUNNER_WORKSPACE
shell: bash

- name: Upload datapack
if: ${{ matrix.buildtype == 'Release' }}
uses: actions/upload-artifact@v2
Expand Down
Loading

0 comments on commit 47f8734

Please sign in to comment.