Skip to content

Commit

Permalink
Merge branch 'master' into cpp_metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
mcserep committed Oct 18, 2023
2 parents 1dfbd9d + b146272 commit ba6c6f1
Show file tree
Hide file tree
Showing 25 changed files with 2,189 additions and 7,216 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/setup_build_ubuntu-20.04.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Install required packages for CodeCompass build
sudo apt-get install -y git cmake make g++ libboost-all-dev llvm-10-dev clang-10 \
libclang-10-dev odb libodb-dev thrift-compiler libthrift-dev default-jdk libssl-dev \
sudo apt-get install -y git cmake make g++ libboost-all-dev llvm-11-dev clang-11 \
libclang-11-dev odb libodb-dev thrift-compiler libthrift-dev default-jdk libssl-dev \
libgraphviz-dev libmagic-dev libgit2-dev ctags doxygen libgtest-dev npm libldap2-dev
2 changes: 1 addition & 1 deletion .github/scripts/setup_runtime_ubuntu-20.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# Install required packages for CodeCompass runtime
sudo apt-get install -y git cmake make g++ graphviz \
libboost-filesystem1.71.0 libboost-log1.71.0 libboost-program-options1.71.0 \
libllvm10 clang-10 libclang1-10 libthrift-0.13.0 default-jre libssl1.1 libmagic1 \
libllvm11 clang-11 libclang1-11 libthrift-0.13.0 default-jre libssl1.1 libmagic1 \
libgit2-28 ctags googletest libldap-2.4-2
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ jobs:
-DCMAKE_INSTALL_PREFIX=$HOME/${{ matrix.os }}/${{ matrix.db }}/cc-install
-DDATABASE=$DB_TYPE
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DLLVM_DIR=/usr/lib/llvm-10/cmake
-DClang_DIR=/usr/lib/cmake/clang-10
-DLLVM_DIR=/usr/lib/llvm-11/cmake
-DClang_DIR=/usr/lib/cmake/clang-11
-DTEST_DB=$DB_CONNSTRING
- name: Build
Expand Down
16 changes: 13 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# IDEs and editors.

## IDEs and editors
# NetBeans
nbproject/
.idea/
# JetBrains CLion
.idea/*
!.idea/codeStyles/
# Visual Studio Code
.vscode/
# Vim
*.swp


## Build folders
build/
build_*/
install/
install_*/

8 changes: 4 additions & 4 deletions .gitlab/build-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ export PATH=$DEPS_INSTALL_RUNTIME_DIR/python-install/bin:$PATH

if [ ! -f $DEPS_INSTALL_RUNTIME_DIR/llvm-install/bin/clang ]; then
cd $PACKAGES_DIR
wget --no-verbose --no-clobber https://github.com/llvm/llvm-project/archive/llvmorg-10.0.1.tar.gz
tar -xf llvmorg-10.0.1.tar.gz
mv llvm-project-llvmorg-10.0.1 llvm-project
wget --no-verbose --no-clobber https://github.com/llvm/llvm-project/archive/llvmorg-11.1.0.tar.gz
tar -xf llvmorg-11.1.0.tar.gz
mv llvm-project-llvmorg-11.1.0 llvm-project
mkdir llvm-project/build
cd llvm-project/build

Expand All @@ -268,7 +268,7 @@ if [ ! -f $DEPS_INSTALL_RUNTIME_DIR/llvm-install/bin/clang ]; then
-DLLVM_ENABLE_RTTI=ON

make install --quiet --jobs $(nproc)
rm -f $PACKAGES_DIR/llvmorg-10.0.1.tar.gz
rm -f $PACKAGES_DIR/llvmorg-11.1.0.tar.gz
else
echo "Found LLVM/Clang in cache."
fi
Expand Down
39 changes: 39 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

100 changes: 65 additions & 35 deletions doc/deps.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build Environment
We build CodeCompass in a Linux environment. Currently, Ubuntu Long-Term
Support releases are the main targets: Ubuntu 18.04 LTS and Ubuntu 20.04 LTS.
Support releases are the main targets: Ubuntu 20.04 LTS and Ubuntu 22.04 LTS.

We also provide a Docker image that can be used as developer environment to
CodeCompass. See its usage [in a seperate document](/docker/README.md).
Expand All @@ -15,10 +15,11 @@ be installed from the official repository of the given Linux distribution.
is required. (Alternatively, you can compile with Clang.)
- **`gcc-X`, `gcc-X-plugin-dev`**: For building ODB.
- **`libboost-all-dev`**: Boost can be used during the development.
- **`llvm-10-dev`**, **`clang-10`**, **`libclang-10-dev`**: C++ parser uses
- **`llvm-11-dev`**, **`clang-11`**, **`libclang-11-dev`**: C++ parser uses
LLVM/Clang for parsing the source code.
- **`odb`**, **`libodb-dev`**: For persistence ODB can be used which is an
Object Relation Mapping (ORM) system.
Object Relation Mapping (ORM) system.
***See [Known issues](#known-issues)!***
- **`libsqlite3-dev`**, **`libodb-sqlite-dev`**: SQLite library and the
corresponding ODB development library, in case SQLite database system is
used.
Expand All @@ -27,17 +28,20 @@ be installed from the official repository of the given Linux distribution.
database system is used.
- **`default-jdk`**: For search parsing CodeCompass uses an indexer written in
Java.
- **`thrift-compiler`**, **`libthrift-dev`**: Thrift is used as the Web RPC API.
- **`thrift-compiler`**, **`libthrift-dev`**: Thrift is used as the Web RPC API.
***See [Known issues](#known-issues)!***
- **`libssl-dev`** / **`libssl1.0-dev`**: OpenSSL libs are required by Thrift,
and NodeJS.
- **`libgraphviz-dev`**: GraphViz is used for generating diagram
visualizations.
- **`libmagic-dev`**: For detecting file types.
- **`libgit2-dev`**: For compiling Git plugin in CodeCompass.
- **`npm`**: For handling JavaScript dependencies for CodeCompass web GUI.
- **`node`** and **`npm`**: For building and developing the CodeCompass web GUI
and managing dependencies.
***See [Known issues](#known-issues)!***
- **`ctags`**: For search parsing.
- **`doxygen`**: For documentation generation.
- **`libgtest-dev`**: For testing CodeCompass.
- **`libgtest-dev`**: For testing CodeCompass.
***See [Known issues](#known-issues)!***
- **`libldap2-dev`**: For LDAP authentication.

Expand All @@ -46,55 +50,55 @@ be installed from the official repository of the given Linux distribution.
The following command installs the packages except for those which have some
known issues.

#### Ubuntu 18.04 ("Bionic Beaver") LTS
#### Ubuntu 20.04 ("Focal Fossa") LTS

```bash
sudo apt install git cmake make g++ gcc-7-plugin-dev libboost-all-dev \
llvm-10-dev clang-10 libclang-10-dev \
default-jdk libssl1.0-dev libgraphviz-dev libmagic-dev libgit2-dev ctags doxygen \
libldap2-dev libgtest-dev npm
sudo apt install git cmake make g++ libboost-all-dev \
llvm-11-dev clang-11 libclang-11-dev \
odb libodb-dev thrift-compiler libthrift-dev \
default-jdk libssl-dev libgraphviz-dev libmagic-dev libgit2-dev ctags doxygen \
libldap2-dev libgtest-dev
```

#### Ubuntu 20.04 ("Focal Fossa") LTS
#### Ubuntu 22.04 ("Jammy Jellyfish") LTS

```bash
sudo apt install git cmake make g++ libboost-all-dev \
llvm-10-dev clang-10 libclang-10-dev \
odb libodb-dev thrift-compiler libthrift-dev \
default-jdk libssl-dev libgraphviz-dev libmagic-dev libgit2-dev ctags doxygen \
libldap2-dev libgtest-dev npm
llvm-11-dev clang-11 libclang-11-dev \
gcc-11-plugin-dev \
default-jdk libssl-dev libgraphviz-dev libmagic-dev libgit2-dev exuberant-ctags doxygen \
libldap2-dev libgtest-dev
```

#### Database engine support

Depending on the desired database engines to be supported, the following
packages should be installed:

##### Ubuntu 18.04 ("Bionic Beaver")

The database connector library must be compiled manually for this release,
however, the database programs themselves should be installed from the
package manager.
##### Ubuntu 20.04 ("Focal Fossa") LTS

```bash
# For SQLite database systems:
sudo apt install libsqlite3-dev
sudo apt install libodb-sqlite-dev libsqlite3-dev

# For PostgreSQL database systems:
sudo apt install postgresql-server-dev-<version>
sudo apt install libodb-pgsql-dev postgresql-server-dev-12
```

##### Ubuntu 20.04 ("Focal Fossa") LTS
##### Ubuntu 22.04 ("Jammy Jellyfish") LTS

The database connector library must be compiled manually for this release,
however, the database programs themselves should be installed from the
package manager.

```bash
# For SQLite database systems:
sudo apt install libodb-sqlite-dev libsqlite3-dev
sudo apt install libsqlite3-dev

# For PostgreSQL database systems:
sudo apt install libodb-pgsql-dev postgresql-server-dev-<version>
sudo apt install postgresql-server-dev-14
```


## Known issues
Some third-party tools are present in the distribution's package manager in a
way that they are either incompatible with each other or not available as a
Expand All @@ -106,10 +110,10 @@ by other processes which could, in extreme cases, make the system very hard or
impossible to recover. **Please do NOT add a `sudo` in front of any `make` or
other commands below, unless *explicitly* specified!**

### ODB (for Ubuntu 18.04)
### ODB (for Ubuntu 22.04)
ODB is an Object Relational Mapping tool, that is required by CodeCompass.
For Ubuntu 18.04, the official release of ODB conflicts with the official
compiler (GNU G++ 7) of the distribution. A newer version of ODB must be
For Ubuntu 22.04, the official release of ODB conflicts with the official
compiler (GNU G++ 11) of the distribution. A newer version of ODB must be
compiled manually.

The ODB installation uses the build2 build system. (Build2 is not needed for
Expand Down Expand Up @@ -153,11 +157,12 @@ time (depending on the machine one is using).
> **Note:** now you may delete the *Build2* toolchain installed in the
> `<build2_install_dir>` folder, if you do not need any longer.
### Thrift (for Ubuntu 18.04)
### Thrift (for Ubuntu 22.04)
CodeCompass needs [Thrift](https://thrift.apache.org/) which provides Remote
Procedure Call (RPC) between the server and the client. A suitable version of
Thrift is, unfortunately, not part of the official Ubuntu repositories for
these versions, so you should download and build from source.
this version (only a newer version is available), so you should download and
build from source.

Thrift can generate stubs for many programming languages. The configure
script looks at the development environment and if it finds the environment
Expand Down Expand Up @@ -192,6 +197,30 @@ cd thrift-0.13.0
make install -j $(nproc)
```

### Node.js and NPM
Make sure you are using at least version 18 of [Node.js](https://nodejs.org/en/).
Unfortunately only older versions are available in the official Ubuntu repositories
for all supported versions, therefore a separate installation might be required from
[NodeSource](https://github.com/nodesource/distributions).

```bash
# Download and import the Nodesource GPG key
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

# Create deb repository
NODE_MAJOR=18 # or 20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list

# Run Update and Install
sudo apt-get update
sudo apt-get install nodejs
```

You can also download [nvm](https://github.com/nvm-sh/nvm), and run `nvm install`
at the root of the project to use the specified Node version (18.13.0).


### GTest/Googletest
The `libgtest-dev` package contains only the source files of GTest, but the
binaries are missing. You have to compile GTest manually.
Expand All @@ -213,9 +242,10 @@ The previously self-compiled and installed dependencies are not automatically
seen by CMake. Please set this environment before executing the build.

```bash
# For all supported OS versions:
export GTEST_ROOT=<gtest_install_dir>

# If using Ubuntu 18.04:
# If using Ubuntu 22.04:
export CMAKE_PREFIX_PATH=<thrift_install_dir>:$CMAKE_PREFIX_PATH
export CMAKE_PREFIX_PATH=<odb_install_directory>:$CMAKE_PREFIX_PATH

Expand All @@ -239,8 +269,8 @@ cmake .. \
-DCMAKE_INSTALL_PREFIX=<CodeCompass_install_dir> \
-DDATABASE=<database_type> \
-DCMAKE_BUILD_TYPE=<build_type> \
-DLLVM_DIR=/usr/lib/llvm-10/cmake \
-DClang_DIR=/usr/lib/cmake/clang-10
-DLLVM_DIR=/usr/lib/llvm-11/cmake \
-DClang_DIR=/usr/lib/cmake/clang-11

# To specify linker for building CodeCompass use
# -DCODECOMPASS_LINKER=<path_to_linker>
Expand Down
3 changes: 2 additions & 1 deletion doc/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ PostgreSQL can be installed from the package manager:

```bash
sudo apt install postgresql-<version>
# (e.g. postgresql-12)
# (e.g. postgresql-12 for Ubuntu 20.04
# and postgresql-14 for Ubuntu 22.04)
```

This will set up an automatically starting local server on the default port
Expand Down
14 changes: 11 additions & 3 deletions docker/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ RUN set -x && apt-get update -qq \
cmake make \
default-jdk \
ctags \
ca-certificates \
curl \
gnupg \
doxygen \
gcc-9 gcc-9-plugin-dev g++-9 \
libboost-filesystem-dev \
Expand All @@ -25,15 +27,21 @@ RUN set -x && apt-get update -qq \
libmagic-dev \
libsqlite3-dev \
libssl-dev \
llvm-10 clang-10 llvm-10-dev libclang-10-dev \
llvm-11 clang-11 llvm-11-dev libclang-11-dev \
npm \
thrift-compiler libthrift-dev \
odb libodb-sqlite-dev libodb-pgsql-dev && \
ln -s /usr/bin/gcc-9 /usr/bin/gcc && \
ln -s /usr/bin/g++-9 /usr/bin/g++

RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs
# Install NodeJS from NodeSource.
RUN mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update -qq && \
apt-get install -y nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/

# Build GTest.
RUN cd /usr/src/googletest && \
Expand Down
2 changes: 1 addition & 1 deletion docker/runtime/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ RUN if [ "pgsql" = "${CC_DATABASE}" ]; then \

RUN set -x && apt-get update -qq && \
apt-get install -qq --yes --no-install-recommends \
llvm-10 \
llvm-11 \
libboost-filesystem-dev libboost-log-dev libboost-program-options-dev \
default-jre \
libgit2-dev \
Expand Down
Loading

0 comments on commit ba6c6f1

Please sign in to comment.