Skip to content

Commit 09958e1

Browse files
Update Thrift to version 0.16 (#657)
1 parent fb1ceda commit 09958e1

File tree

32 files changed

+1803
-84
lines changed

32 files changed

+1803
-84
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Compile dependencies that cannot be acquired via the official repositories
2+
3+
mkdir -p ${INSTALL_PATH}
4+
5+
## Compile Thrift
6+
tar -xvf ${DOWNLOAD_PATH}/thrift-0.16.0.tar.gz
7+
cd thrift-0.16.0
8+
./configure --prefix=${INSTALL_PATH}/thrift --silent --without-python \
9+
--enable-libtool-lock --enable-tutorial=no --enable-tests=no \
10+
--with-libevent --with-zlib --without-nodejs --without-lua \
11+
--without-ruby --without-csharp --without-erlang --without-perl \
12+
--without-php --without-php_extension --without-dart \
13+
--without-haskell --without-go --without-rs --without-haxe \
14+
--without-dotnetcore --without-d --without-qt4 --without-qt5 \
15+
--without-java --without-swift
16+
17+
make install -j $(nproc)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Download installers for compiled dependencies
2+
3+
mkdir -p ${DOWNLOAD_PATH}
4+
5+
## Thrift 0.16
6+
7+
wget -O ${DOWNLOAD_PATH}/thrift-0.16.0.tar.gz "http://archive.apache.org/dist/thrift/0.16.0/thrift-0.16.0.tar.gz"
8+
9+
# Calculate hash of dependencies for Github Cache Action
10+
11+
dependencies_to_hash=("thrift-0.16.0.tar.gz")
12+
13+
concatenated_hashes=""
14+
for file in "${dependencies_to_hash[@]}"; do
15+
file_hash=$(md5sum "${DOWNLOAD_PATH}/${file}" | awk '{print $1}')
16+
concatenated_hashes="${concatenated_hashes}${file_hash}"
17+
done
18+
19+
hash_value=$(echo -n "$concatenated_hashes" | md5sum | awk '{print $1}')
20+
21+
## Save said hash
22+
23+
echo "compile-hash-key=${hash_value}" >> $GITHUB_OUTPUT
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Post compilation configuration for building (environmental variables, library location settings etc..)
2+
3+
echo "${INSTALL_PATH}/thrift/bin" >> $GITHUB_PATH
4+
echo "CMAKE_PREFIX_PATH=${INSTALL_PATH}/thrift:$CMAKE_PREFIX_PATH" >> $GITHUB_ENV

.github/scripts/setup_build_ubuntu-20.04.sh renamed to .github/scripts/ubuntu-20.04/setup_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
# Install required packages for CodeCompass build
44
sudo apt-get install -y git cmake make g++ libboost-all-dev llvm-11-dev clang-11 \
5-
libclang-11-dev odb libodb-dev thrift-compiler libthrift-dev default-jdk libssl-dev \
5+
libclang-11-dev odb libodb-dev default-jdk libssl-dev \
66
libgraphviz-dev libmagic-dev libgit2-dev ctags doxygen libgtest-dev npm libldap2-dev

.github/scripts/setup_runtime_ubuntu-20.04.sh renamed to .github/scripts/ubuntu-20.04/setup_runtime.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# Install required packages for CodeCompass runtime
44
sudo apt-get install -y git cmake make g++ graphviz \
55
libboost-filesystem1.71.0 libboost-log1.71.0 libboost-program-options1.71.0 \
6-
libllvm11 clang-11 libclang1-11 libthrift-0.13.0 default-jre libssl1.1 libmagic1 \
6+
libllvm11 clang-11 libclang1-11 default-jre libssl1.1 libmagic1 \
77
libgit2-28 ctags googletest libldap-2.4-2

.github/workflows/ci.yml

Lines changed: 74 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on: [push, pull_request, workflow_dispatch]
44

55
env:
66
BUILD_TYPE: Debug
7+
## For locally compiled dependencies
8+
INSTALL_PATH: ${{github.workspace}}/dependencies/install
9+
## Temp directory for installers of the downloaded dependencies
10+
DOWNLOAD_PATH: ${{github.workspace}}/dependencies/download
711

812
permissions: read-all
913

@@ -20,6 +24,9 @@ jobs:
2024
fail-fast: false
2125

2226
runs-on: ${{ matrix.os }}
27+
outputs:
28+
has-compiled-dependencies: ${{ steps.compilation-flag.outputs.has-compiled-dependencies }}
29+
compile-hash-key: ${{ steps.download-compile-dependencies.outputs.compile-hash-key }}
2330

2431
services:
2532
# Label used to access the service container
@@ -45,10 +52,56 @@ jobs:
4552
run: sudo apt-get update
4653

4754
- name: Install required packages for build
48-
run: ./.github/scripts/setup_build_${{matrix.os}}.sh
55+
run: ./.github/scripts/${{ matrix.os }}/setup_build.sh
56+
57+
- name: Set has-compiled-dependencies flag
58+
id: compilation-flag
59+
run: |
60+
if [ -f ./.github/scripts/${{ matrix.os }}/compile_build.sh ]; then
61+
echo "has-compiled-dependencies=true" >> "$GITHUB_OUTPUT"
62+
else
63+
echo "has-compiled-dependencies=false" >> "$GITHUB_OUTPUT"
64+
fi
65+
66+
- name: Download installers for compiled dependencies
67+
if: steps.compilation-flag.outputs.has-compiled-dependencies == 'true'
68+
id: download-compile-dependencies
69+
run: |
70+
chmod +x ./.github/scripts/${{ matrix.os }}/download_build.sh
71+
./.github/scripts/${{ matrix.os }}/download_build.sh
72+
73+
- name: Restore compiled dependencies
74+
if: steps.compilation-flag.outputs.has-compiled-dependencies == 'true'
75+
id: restore-compiled-dependencies
76+
uses: actions/cache/restore@v3
77+
with:
78+
path: ${{ env.INSTALL_PATH }}
79+
key: ${{ matrix.os }}-compile-install-${{steps.download-compile-dependencies.outputs.compile-hash-key}}
80+
81+
- name: Compile dependencies
82+
if: steps.restore-compiled-dependencies.outputs.cache-hit != 'true' && steps.compilation-flag.outputs.has-compiled-dependencies == 'true'
83+
run: |
84+
chmod +x ./.github/scripts/${{ matrix.os }}/compile_build.sh
85+
./.github/scripts/${{ matrix.os }}/compile_build.sh
86+
87+
- name: Post compilation configuration (build)
88+
if: steps.compilation-flag.outputs.has-compiled-dependencies == 'true'
89+
run: |
90+
if [ -f ./.github/scripts/${{ matrix.os }}/postcompile_build.sh ]; then
91+
chmod +x ./.github/scripts/${{ matrix.os }}/postcompile_build.sh
92+
./.github/scripts/${{ matrix.os }}/postcompile_build.sh
93+
fi
94+
95+
- name: Save dependencies
96+
if: steps.restore-compiled-dependencies.outputs.cache-hit != 'true' && steps.compilation-flag.outputs.has-compiled-dependencies == 'true'
97+
id: save-compiled-dependencies
98+
uses: actions/cache/save@v3
99+
with:
100+
path: ${{ env.INSTALL_PATH }}
101+
key: ${{ matrix.os }}-compile-install-${{steps.download-compile-dependencies.outputs.compile-hash-key}}
49102

50103
- name: Install database packages
51-
run: ./.github/scripts/setup_${{matrix.db}}_${{matrix.os}}.sh
104+
run: ./.github/scripts/${{ matrix.os }}/setup_${{matrix.db}}.sh
52105

53106
- name: Install GoogleTest
54107
run: |
@@ -79,8 +132,7 @@ jobs:
79132
80133
- name: Configure CMake
81134
working-directory: ${{github.workspace}}
82-
run:
83-
cmake -E make_directory $HOME/cc-build
135+
run: cmake -E make_directory $HOME/cc-build
84136

85137
- name: Run CMake
86138
run: >
@@ -128,7 +180,6 @@ jobs:
128180
name: codecompass-${{ matrix.os }}-${{ matrix.db }}-compiletime
129181
path: ${{github.workspace}}/artifacts/codecompass-${{ matrix.os }}-${{ matrix.db }}-compiletime.zip
130182

131-
132183
## PARSING JOBS
133184
parse:
134185
needs: build
@@ -166,10 +217,26 @@ jobs:
166217

167218
# We need build dependencies for CodeCompass, as it will parsed as well
168219
- name: Install required packages for build
169-
run: ./.github/scripts/setup_build_${{matrix.os}}.sh
220+
run: ./.github/scripts/${{ matrix.os }}/setup_build.sh
170221

171222
- name: Install database packages
172-
run: ./.github/scripts/setup_${{matrix.db}}_${{matrix.os}}.sh
223+
run: ./.github/scripts/${{ matrix.os }}/setup_${{matrix.db}}.sh
224+
225+
- name: Restore compiled dependencies
226+
if: needs.build.outputs.has-compiled-dependencies == 'true'
227+
id: restore-compiled-dependencies
228+
uses: actions/cache/restore@v3
229+
with:
230+
path: ${{ env.INSTALL_PATH }}
231+
key: ${{ matrix.os }}-compile-install-${{needs.build.outputs.compile-hash-key}}
232+
233+
- name: Post compilation configuration (runtime)
234+
if: needs.build.outputs.has-compiled-dependencies == 'true'
235+
run: |
236+
if [ -f ./.github/scripts/${{ matrix.os }}/postcompile_runtime.sh ]; then
237+
chmod +x ./.github/scripts/${{ matrix.os }}/postcompile_runtime.sh
238+
./.github/scripts/${{ matrix.os }}/postcompile_runtime.sh
239+
fi
173240
174241
- name: Download CodeCompass binaries
175242
uses: actions/download-artifact@v2
@@ -241,7 +308,6 @@ jobs:
241308
cd $HOME/cc-install/bin
242309
./CodeCompass_parser -d $PROJ_XERCES_CONNSTRING -w $HOME/$DIR_WS/ -n "Xerces-C" -i $HOME/xerces-c -i $HOME/build_xerces-c/compile_commands.json -j $(nproc)
243310
244-
245311
## DOCKER IMAGE JOB
246312
docker:
247313
needs: parse
@@ -253,7 +319,6 @@ jobs:
253319
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
254320
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
255321

256-
257322
## TARBALL JOB
258323
tarball:
259324
needs: parse

.gitlab/build-deps.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,9 @@ fi
324324
##########
325325

326326
cd $PACKAGES_DIR
327-
wget --no-verbose --no-clobber http://archive.apache.org/dist/thrift/0.13.0/thrift-0.13.0.tar.gz
328-
tar -xf thrift-0.13.0.tar.gz
329-
cd thrift-0.13.0
327+
wget --no-verbose --no-clobber http://archive.apache.org/dist/thrift/0.16.0/thrift-0.16.0.tar.gz
328+
tar -xf thrift-0.16.0.tar.gz
329+
cd thrift-0.16.0
330330

331331
CXXFLAGS="$CXXFLAGS -I$DEPS_INSTALL_RUNTIME_DIR/boost-install/include" \
332332
LDFLAGS="$LDFLAGS -Wl,-rpath-link,$DEPS_INSTALL_RUNTIME_DIR/openssl-install/lib" \
@@ -338,7 +338,7 @@ LDFLAGS="$LDFLAGS -Wl,-rpath-link,$DEPS_INSTALL_RUNTIME_DIR/openssl-install/lib"
338338
--without-python
339339

340340
make install --quiet --jobs $(nproc)
341-
rm -f $PACKAGES_DIR/thrift-0.13.0.tar.gz
341+
rm -f $PACKAGES_DIR/thrift-0.16.0.tar.gz
342342

343343
########
344344
# Java #

Functions.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,4 @@ function(join _values _glue _output)
129129
string (REGEX REPLACE "([^\\]|^);" "\\1${_glue}" _tmpStr "${_values}")
130130
string (REGEX REPLACE "[\\](.)" "\\1" _tmpStr "${_tmpStr}") #fixes escaping
131131
set (${_output} "${_tmpStr}" PARENT_SCOPE)
132-
endfunction(join)
132+
endfunction(join)

doc/deps.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ known issues.
5555
```bash
5656
sudo apt install git cmake make g++ libboost-all-dev \
5757
llvm-11-dev clang-11 libclang-11-dev \
58-
odb libodb-dev thrift-compiler libthrift-dev \
58+
odb libodb-dev \
5959
default-jdk libssl-dev libgraphviz-dev libmagic-dev libgit2-dev ctags doxygen \
6060
libldap2-dev libgtest-dev
6161
```
@@ -65,7 +65,7 @@ sudo apt install git cmake make g++ libboost-all-dev \
6565
```bash
6666
sudo apt install git cmake make g++ libboost-all-dev \
6767
llvm-11-dev clang-11 libclang-11-dev \
68-
gcc-11-plugin-dev \
68+
gcc-11-plugin-dev thrift-compiler libthrift-dev \
6969
default-jdk libssl-dev libgraphviz-dev libmagic-dev libgit2-dev exuberant-ctags doxygen \
7070
libldap2-dev libgtest-dev
7171
```
@@ -157,11 +157,11 @@ time (depending on the machine one is using).
157157
> **Note:** now you may delete the *Build2* toolchain installed in the
158158
> `<build2_install_dir>` folder, if you do not need any longer.
159159
160-
### Thrift (for Ubuntu 22.04)
160+
### Thrift (for Ubuntu 20.04)
161161
CodeCompass needs [Thrift](https://thrift.apache.org/) which provides Remote
162162
Procedure Call (RPC) between the server and the client. A suitable version of
163163
Thrift is, unfortunately, not part of the official Ubuntu repositories for
164-
this version (only a newer version is available), so you should download and
164+
this version (only an older version is available), so you should download and
165165
build from source.
166166

167167
Thrift can generate stubs for many programming languages. The configure
@@ -180,10 +180,10 @@ avoid using them if it's not necessary.
180180

181181
```bash
182182
# Download and uncompress Thrift:
183-
wget "http://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=thrift/0.13.0/thrift-0.13.0.tar.gz" \
184-
-O thrift-0.13.0.tar.gz
185-
tar -xvf ./thrift-0.13.0.tar.gz
186-
cd thrift-0.13.0
183+
wget "http://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=thrift/0.16.0/thrift-0.16.0.tar.gz" \
184+
-O thrift-0.16.0.tar.gz
185+
tar -xvf ./thrift-0.16.0.tar.gz
186+
cd thrift-0.16.0
187187

188188
./configure --prefix=<thrift_install_dir> --silent --without-python \
189189
--enable-libtool-lock --enable-tutorial=no --enable-tests=no \

lib/java/libthrift-0.13.0.jar

-240 KB
Binary file not shown.

lib/java/libthrift-0.16.0.jar

337 KB
Binary file not shown.

plugins/cpp_metrics/service/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ include_directories(SYSTEM
99

1010
add_custom_command(
1111
OUTPUT
12-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/cppmetrics_constants.cpp
13-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/cppmetrics_constants.h
14-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/cppmetrics_types.cpp
15-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/cppmetrics_types.h
1612
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/CppMetricsService.cpp
1713
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/CppMetricsService.h
1814
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp
@@ -26,8 +22,6 @@ add_custom_command(
2622
"Generating Thrift for cppmetrics.thrift")
2723

2824
add_library(cppmetricsthrift STATIC
29-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/cppmetrics_constants.cpp
30-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/cppmetrics_types.cpp
3125
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/CppMetricsService.cpp)
3226

3327
target_compile_options(cppmetricsthrift PUBLIC -fPIC)

plugins/cpp_reparse/service/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ add_definitions(${LLVM_DEFINITIONS})
2323

2424
add_custom_command(
2525
OUTPUT
26-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/cppreparse_constants.cpp
27-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/cppreparse_constants.h
2826
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/cppreparse_types.cpp
2927
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/cppreparse_types.h
3028
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/CppReparseService.cpp
@@ -42,7 +40,6 @@ add_custom_command(
4240
"Generating Thrift for cppreparse.thrift")
4341

4442
add_library(cppreparsethrift STATIC
45-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/cppreparse_constants.cpp
4643
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/cppreparse_types.cpp
4744
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/CppReparseService.cpp)
4845

plugins/dummy/service/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ include_directories(SYSTEM
99

1010
add_custom_command(
1111
OUTPUT
12-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/dummy_constants.cpp
13-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/dummy_constants.h
14-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/dummy_types.cpp
15-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/dummy_types.h
1612
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/DummyService.cpp
1713
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/DummyService.h
1814
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp
@@ -26,8 +22,6 @@ add_custom_command(
2622
"Generating Thrift for dummy.thrift")
2723

2824
add_library(dummythrift STATIC
29-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/dummy_constants.cpp
30-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/dummy_types.cpp
3125
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/DummyService.cpp)
3226

3327
target_compile_options(dummythrift PUBLIC -fPIC)

plugins/git/service/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ include_directories(SYSTEM
1313

1414
add_custom_command(
1515
OUTPUT
16-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/git_constants.cpp
17-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/git_constants.h
1816
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/git_types.cpp
1917
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/git_types.h
2018
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/GitService.cpp
@@ -31,7 +29,6 @@ add_custom_command(
3129
"Generating Thrift for git.thrift")
3230

3331
add_library(gitthrift STATIC
34-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/git_constants.cpp
3532
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/git_types.cpp
3633
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/GitService.cpp)
3734

plugins/metrics/service/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ include_directories(SYSTEM
1212

1313
add_custom_command(
1414
OUTPUT
15-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/metrics_constants.cpp
16-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/metrics_constants.h
1715
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/metrics_types.cpp
1816
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/metrics_types.h
1917
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/MetricsService.cpp
@@ -30,7 +28,6 @@ add_custom_command(
3028
"Generating Thrift for metrics.thrift")
3129

3230
add_library(metricsthrift STATIC
33-
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/metrics_constants.cpp
3431
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/metrics_types.cpp
3532
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/MetricsService.cpp)
3633

0 commit comments

Comments
 (0)