Skip to content

Commit

Permalink
Merge pull request #1 from rizesql/milestone-2
Browse files Browse the repository at this point in the history
Milestone 2
  • Loading branch information
rizesql authored May 26, 2024
2 parents 8568d6b + 717be09 commit c918c14
Show file tree
Hide file tree
Showing 59 changed files with 1,972 additions and 672 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ bugprone-string-constructor,
bugprone-string-integer-assignment,
bugprone-string-literal-with-embedded-nul,
bugprone-suspicious-enum-usage,
bugprone-suspicious-include,
bugprone-suspicious-headers,
bugprone-suspicious-memset-usage,
bugprone-suspicious-missing-comma,
bugprone-suspicious-semicolon,
Expand Down
14 changes: 7 additions & 7 deletions .github/actions/configure-cmake/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ runs:
restore-keys: ${{ matrix.os }}-${{ matrix.cxx }}-ninja-cache-

- run: |
CMAKE_GENERATOR=${{ matrix.cmake_generator }} cmake -S ${GITHUB_WORKSPACE} -B ${{ env.BUILD_DIR }} \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/artifacts \
-DGITHUB_ACTIONS=${GITHUB_ACTIONS} \
-DWARNINGS_AS_ERRORS=${{ inputs.warnings_as_errors }} \
${{ inputs.custom_flags }}
CMAKE_GENERATOR=${{ matrix.cmake_generator }} cmake -S ${GITHUB_WORKSPACE} -B ${{ env.BUILD_DIR }} \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/artifacts \
-DGITHUB_ACTIONS=${GITHUB_ACTIONS} \
-DWARNINGS_AS_ERRORS=${{ inputs.warnings_as_errors }} \
${{ inputs.custom_flags }}
shell: bash
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
# https://github.com/GuillaumeFalourd/poc-github-actions/blob/main/.github/workflows/36-local-action.yml
# https://github.com/GuillaumeFalourd/poc-github-actions/blob/main/.github/workflows/36-local-action.yml
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -398,4 +398,4 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ env.ZIP_NAME }}_${{ env.TAG_NAME }}.zip
${{ env.ZIP_NAME }}_${{ env.TAG_NAME }}.zip
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fabric.properties
.idea/caches/build_file_checksums.ser

### CLion Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# Comment Reason: https://github.com/joeblau/gitignore.io/issue/186#issuecomment-215987721

# *.iml
# modules.xml
Expand Down Expand Up @@ -414,6 +414,7 @@ StyleCopReport.xml
*.vspscc
*.vssscc
.builds
.build
*.pidb
*.svclog
*.scc
Expand Down Expand Up @@ -616,7 +617,7 @@ node_modules/
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp

# Visual Studio 6 workspace and project file (working project files containing files to include in project)
# Visual Studio 6 workspace and project file (working project files containing files to headers in project)
*.dsw
*.dsp

Expand Down
56 changes: 10 additions & 46 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
cmake_minimum_required(VERSION 3.24)

# NOTE: update executable name in .github/workflows/cmake.yml:25 when changing executable name in this file
# for now, the project name is used as the executable name
project(oop)

cmake_policy(SET CMP0135 NEW)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)

option(WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)

if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "install_dir" CACHE PATH "..." FORCE)
endif ()

# disable sanitizers when releasing executables without explicitly requested debug info
# use generator expressions to set flags correctly in both single and multi config generators
set(is_debug "$<CONFIG:Debug>")
set(is_rel_with_deb "$<CONFIG:RelWithDebInfo>")
set(debug_mode "$<OR:${is_debug},${is_rel_with_deb}>")

###############################################################################
include(cmake/dependencies.cmake)
include(cmake/googleapis.cmake)

add_subdirectory(proto)
add_subdirectory(src)

# custom functions
###############################################################################

function(set_custom_stdlib_and_sanitizers target add_apple_asan)
if (MSVC)
Expand Down Expand Up @@ -66,40 +70,6 @@ endfunction()

###############################################################################

# external dependencies with FetchContent
# include(FetchContent)
#
# NOTE: Also update env vars used for caching in
# - .github/actions/configure-cmake/action.yml
# - .github/workflows/cmake.yml
# FetchContent_Declare(
# SomeLib
# GIT_REPOSITORY https://github.com/<SomeUser>/<SomeLib>.git
# GIT_TAG <some_git_hash> # <which tag/branch @ <some_date>>
# GIT_SHALLOW 1 # works only with branches or tags, not with arbitrary commit hashes
# )
#
# FetchContent_MakeAvailable(SomeLib)

###############################################################################

# external dependencies with find_package

# find_package(Threads REQUIRED)

###############################################################################

# NOTE: update executable name in .github/workflows/cmake.yml:25 when changing name here
add_executable(${PROJECT_NAME}
src/main.cpp
src/issue.h
src/user.h
src/workspace.h
src/project.h
)

###############################################################################

# target definitions

if (GITHUB_ACTIONS)
Expand Down Expand Up @@ -128,12 +98,6 @@ set_custom_stdlib_and_sanitizers(${PROJECT_NAME} true)

###############################################################################

# use SYSTEM so cppcheck/clang-tidy does not report warnings from these directories
# target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ext/<SomeHppLib>/include)
# target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${<SomeLib>_SOURCE_DIR}/include)
# target_link_directories(${PROJECT_NAME} PRIVATE ${<SomeLib>_BINARY_DIR}/lib)
# target_link_libraries(${PROJECT_NAME} <SomeLib>)

###############################################################################

# copy binaries to "bin" folder; these are uploaded as artifacts on each release
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Reasy

Reasy is an issues management implemented in C++ for a semester
Reasy is an issue management implemented in C++ for a semester
project for my OOP class at the University of Bucharest.

## Features

### 🏢 Workspaces

Separate your issues per workspace, for easier following of them
Separate your issue per workspace, for easier following of them

### 🤝 Collaboration

Multiple users have access to a workspace and can edit it as they wish

### 🧵 Threads

Each issue can have a thread of comments, sub-issues, for better collaboration
Each issue can have a thread of comments, sub-issue, for better collaboration

### 💽 GRPC Server (planned)

Expand Down
30 changes: 15 additions & 15 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@
## Tema 2

#### Cerințe
- [ ] separarea codului din clase în `.h` (sau `.hpp`) și `.cpp`
- [ ] moșteniri:
- minim o clasă de bază și **3 clase derivate**
- ierarhia trebuie să fie cu bază proprie, nu derivată dintr-o clasă predefinită
- [ ] clasă cu atribut de tip pointer la o clasă de bază cu derivate
- [ ] funcții virtuale (pure) apelate prin pointeri de bază din clasa care conține atributul de tip pointer de bază
- [X] separarea codului din clase în `.h` (sau `.hpp`) și `.cpp`
- [x] moșteniri:
- [x] minim o clasă de bază și **3 clase derivate**
- [x] ierarhia trebuie să fie cu bază proprie, nu derivată dintr-o clasă predefinită
- [x] clasă cu atribut de tip pointer la o clasă de bază cu derivate
- [x] funcții virtuale (pure) apelate prin pointeri de bază din clasa care conține atributul de tip pointer de bază
- minim o funcție virtuală va fi **specifică temei** (e.g. nu simple citiri/afișări)
- constructori virtuali (clone): sunt necesari, dar nu se consideră funcții specifice temei
- [ ] apelarea constructorului din clasa de bază din constructori din derivate
- [ ] smart pointers (recomandat, opțional)
- [ ] `dynamic_cast`/`std::dynamic_pointer_cast` pentru downcast cu sens
- [x] apelarea constructorului din clasa de bază din constructori din derivate
- [x] smart pointers (recomandat, opțional)
- [x] `dynamic_cast`/`std::dynamic_pointer_cast` pentru downcast cu sens
- [ ] suprascris cc/op= pentru copieri/atribuiri corecte, copy and swap
- [ ] excepții
- [ ] ierarhie proprie cu baza `std::exception` sau derivată din `std::exception`; minim **3** clase pentru erori specifice
- [ ] utilizare cu sens: de exemplu, `throw` în constructor (sau funcție care întoarce un obiect), `try`/`catch` în `main`
- [ ] funcții și atribute `static`
- [ ] STL
- [ ] cât mai multe `const`
- [x] excepții
- [x] ierarhie proprie cu baza `std::exception` sau derivată din `std::exception`; minim **3** clase pentru erori specifice
- [x] utilizare cu sens: de exemplu, `throw` în constructor (sau funcție care întoarce un obiect), `try`/`catch` în `main`
- [x] funcții și atribute `static`
- [x] STL
- [x] cât mai multe `const`
- [ ] la sfârșit: commit separat cu adăugarea unei noi clase derivate fără a modifica restul codului, **pe lângă cele 3 derivate deja adăugate**
- noua derivată nu poate fi una existentă care a fost ștearsă și adăugată din nou
- [ ] tag de `git`: de exemplu `v0.2`
Expand Down
47 changes: 47 additions & 0 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
include(FetchContent)

#set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf)
#set(_REFLECTION gRPC::grpc++_reflection)
#if(CMAKE_CROSSCOMPILING)
# find_program(_PROTOBUF_PROTOC protoc)
#else()
# set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
#endif()
#
FetchContent_Declare(googleapis
URL https://github.com/googleapis/googleapis/archive/0e3b813b0d0da539eacbe86b8716feeed00943c5.tar.gz
URL_HASH SHA256=44f3b9c73a5df760c4fad3cf0c5cc54732b881f00708308f7635ff75a13dcaa5
)
FetchContent_MakeAvailable(googleapis)

FetchContent_Declare(grpcxx
# URL https://github.com/uatuko/grpcxx/archive/refs/tags/v0.1.4.tar.gz
URL https://github.com/uatuko/grpcxx/archive/refs/tags/v0.2.0.tar.gz
URL_HASH SHA256=ed0e0c6ccd44aabb9447de9030b9be092bfb97cb654d69c970cbefd7b7bb44da
)
FetchContent_MakeAvailable(grpcxx)

FetchContent_Declare(libxid
URL https://github.com/uatuko/libxid/archive/refs/tags/v0.1.0.tar.gz
URL_HASH SHA256=31589bb5274c9d25a8b6c49ee04a6c76151f10082e7feb13314be02a4b2d58c8
)
FetchContent_MakeAvailable(libxid)

#include_directories(${CMAKE_SOURCE_DIR}/dependencies/sqlite)
#find_package(SQLite3 REQUIRED)
#include_directories(${CMAKE_SOURCE_DIR}/dependencies/sqlite_modern_cpp/hdr)

#FetchContent_Declare(json
# URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz
# URL_HASH SHA256=d6c65aca6b1ed68e7a182f4757257b107ae403032760ed6ef121c9d55e81757d
#)
#FetchContent_MakeAvailable(json)


set(protobuf_MODULE_COMPATIBLE TRUE)
find_package(Protobuf REQUIRED)
message(STATUS "Using protobuf ${Protobuf_VERSION}")

find_package(spdlog REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(SQLite3 REQUIRED)
56 changes: 56 additions & 0 deletions cmake/googleapis.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#cmake_path(SET googleapis_annotations_proto ${googleapis_SOURCE_DIR}/google/api/annotations.proto)
#cmake_path(SET googleapis_annotations_header ${CMAKE_CURRENT_BINARY_DIR}/google/api/annotations.pb.h)
#cmake_path(SET googleapis_annotations_source ${CMAKE_CURRENT_BINARY_DIR}/google/api/annotations.pb.cc)
#
#cmake_path(SET googleapis_http_proto ${googleapis_SOURCE_DIR}/google/api/http.proto)
#cmake_path(SET googleapis_http_header ${CMAKE_CURRENT_BINARY_DIR}/google/api/http.pb.h)
#cmake_path(SET googleapis_http_source ${CMAKE_CURRENT_BINARY_DIR}/google/api/http.pb.cc)

cmake_path(SET googleapis_rpc_code_proto ${googleapis_SOURCE_DIR}/google/rpc/code.proto)
cmake_path(SET googleapis_rpc_code_header ${CMAKE_CURRENT_BINARY_DIR}/google/rpc/code.pb.h)
cmake_path(SET googleapis_rpc_code_source ${CMAKE_CURRENT_BINARY_DIR}/google/rpc/code.pb.cc)

cmake_path(SET googleapis_rpc_status_proto ${googleapis_SOURCE_DIR}/google/rpc/status.proto)
cmake_path(SET googleapis_rpc_status_header ${CMAKE_CURRENT_BINARY_DIR}/google/rpc/status.pb.h)
cmake_path(SET googleapis_rpc_status_source ${CMAKE_CURRENT_BINARY_DIR}/google/rpc/status.pb.cc)

set(googleapis_protos
# ${googleapis_annotations_proto}
# ${googleapis_http_proto}
${googleapis_rpc_code_proto}
${googleapis_rpc_status_proto}
)

set(googleapis_headers
# ${googleapis_annotations_header}
# ${googleapis_http_header}
${googleapis_rpc_code_header}
${googleapis_rpc_status_header}
)

set(googleapis_sources
# ${googleapis_annotations_source}
# ${googleapis_http_source}
${googleapis_rpc_code_source}
${googleapis_rpc_status_source}
)

add_custom_command(
OUTPUT ${googleapis_headers} ${googleapis_sources}
DEPENDS ${googleapis_protos}
COMMAND ${Protobuf_PROTOC_EXECUTABLE}
ARGS
--proto_path=${googleapis_SOURCE_DIR}
--proto_path=${Protobuf_INCLUDE_DIR}
--cpp_out=${CMAKE_CURRENT_BINARY_DIR}
${googleapis_protos}
)

add_library(googleapis
${googleapis_sources}
)

target_include_directories(googleapis
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
PRIVATE ${Protobuf_INCLUDE_DIR}
)
11 changes: 0 additions & 11 deletions generated/include/Helper.h

This file was deleted.

5 changes: 0 additions & 5 deletions generated/src/Helper.cpp

This file was deleted.

Loading

0 comments on commit c918c14

Please sign in to comment.