From f34af43022c8dfa19a79036c64a76727b66c057a Mon Sep 17 00:00:00 2001 From: Kirill Bobyrev <3352968+kirillbobyrev@users.noreply.github.com> Date: Fri, 16 Oct 2020 17:03:34 +0200 Subject: [PATCH 1/2] Enable gRPC support for clangd on Linux (#561) This patch introduces remote index support for binaries built on Linux. Other platforms will be added soon. --- .github/workflows/autobuild.yaml | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/.github/workflows/autobuild.yaml b/.github/workflows/autobuild.yaml index bf0fc86..05621ba 100644 --- a/.github/workflows/autobuild.yaml +++ b/.github/workflows/autobuild.yaml @@ -62,7 +62,7 @@ jobs: "-DLLVM_ENABLE_ZLIB=FORCE_ON" - name: linux os: ubuntu-latest - preinstall: sudo apt-get install ninja-build libz-dev + preinstall: sudo apt-get install ninja-build libz-dev libc-ares-dev cflags: -O3 -gline-tables-only -DNDEBUG -include $GITHUB_WORKSPACE/.github/workflows/lib_compat.h cmake: > "-DCMAKE_C_COMPILER=clang" @@ -71,6 +71,11 @@ jobs: "-DLLVM_STATIC_LINK_CXX_STDLIB=ON" "-DLLVM_ENABLE_ZLIB=FORCE_ON" "-DCMAKE_PROJECT_INCLUDE=$GITHUB_WORKSPACE/.github/workflows/linux-static-deps.cmake" + "-DCLANGD_ENABLE_REMOTE=ON" + # Using c-ares as a module prevents dynamic linking of unneeded + # libraries. All other gRPC dependencies can be built from sources. + grpc_cmake: > + "-DgRPC_CARES_PROVIDER=package" steps: - name: Clone scripts uses: actions/checkout@v2 @@ -90,6 +95,30 @@ jobs: echo "$($name)=$($value)" >> $env:GITHUB_ENV } } + # FIXME: gRPC support is currently available only on Linux. Other platforms + # will be added later. + - name: Clone gRPC + if: matrix.config.name == 'linux' + uses: actions/checkout@v2 + with: + repository: grpc/grpc + path: grpc + ref: v1.32.0 + submodules: recursive + - name: Build gRPC + if: matrix.config.name == 'linux' + run: > + mkdir grpc-installation + + mkdir grpc-build + + cmake -G Ninja -S grpc -B grpc-build + "-DgRPC_INSTALL=ON" + "-DCMAKE_INSTALL_PREFIX=grpc-installation" + "-DCMAKE_BUILD_TYPE=Release" + ${{ matrix.config.grpc_cmake }} + + ninja -C grpc-build install - name: Fetch target commit uses: actions/download-artifact@v1 with: { name: release } @@ -120,6 +149,7 @@ jobs: "-DLLVM_ENABLE_PLUGINS=OFF" "-DCMAKE_C_FLAGS_RELEASE=${{ matrix.config.cflags }}" "-DCMAKE_CXX_FLAGS_RELEASE=${{ matrix.config.cflags }}" + "-DGRPC_INSTALL_PATH=grpc-installation" ${{ matrix.config.cmake }} - name: Ninja run: ninja -C ${{ env.CLANGD_DIR }} clangd From 6ab953a85391da5a4c02c535a1654f28dc8ae2ed Mon Sep 17 00:00:00 2001 From: Kirill Bobyrev <3352968+kirillbobyrev@users.noreply.github.com> Date: Fri, 16 Oct 2020 17:04:12 +0200 Subject: [PATCH 2/2] Build clangd-indexer and upload an asset with it next to clangd.zip (#560) --- .github/workflows/autobuild.yaml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/autobuild.yaml b/.github/workflows/autobuild.yaml index 05621ba..6685022 100644 --- a/.github/workflows/autobuild.yaml +++ b/.github/workflows/autobuild.yaml @@ -51,6 +51,7 @@ jobs: "-DLLVM_ENABLE_ZLIB=OFF" "-DLLVM_USE_CRT_RELEASE=MT" "-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON" + binary_extension: ".exe" - name: mac os: macos-latest preinstall: brew install ninja zlib p7zip @@ -152,19 +153,24 @@ jobs: "-DGRPC_INSTALL_PATH=grpc-installation" ${{ matrix.config.cmake }} - name: Ninja - run: ninja -C ${{ env.CLANGD_DIR }} clangd - - name: Archive + run: ninja -C ${{ env.CLANGD_DIR }} clangd clangd-indexer + - name: Archive clangd run: > 7z a clangd.zip ${{ env.CLANGD_DIR }}/LICENSE.TXT - ${{ env.CLANGD_DIR }}/bin/clangd* + ${{ env.CLANGD_DIR }}/bin/clangd${{ matrix.config.binary_extension }} ${{ env.CLANGD_DIR }}/lib/clang + - name: Archive indexing-tools + run: > + 7z a indexing-tools.zip + ${{ env.CLANGD_DIR }}/LICENSE.TXT + ${{ env.CLANGD_DIR }}/bin/clangd-indexer${{ matrix.config.binary_extension }} - name: Upload artifact uses: actions/upload-artifact@v1 with: name: ${{ matrix.config.name }} path: clangd.zip - - name: Upload asset + - name: Upload clangd asset uses: actions/upload-release-asset@v1.0.1 env: { GITHUB_TOKEN: "${{ secrets.RELEASE_TOKEN }}" } with: @@ -172,6 +178,14 @@ jobs: asset_name: clangd-${{ matrix.config.name }}-${{ github.event.release.tag_name }}.zip asset_path: clangd.zip asset_content_type: application/zip + - name: Upload indexing-tools asset + uses: actions/upload-release-asset@v1.0.1 + env: { GITHUB_TOKEN: "${{ secrets.RELEASE_TOKEN }}" } + with: + upload_url: ${{ github.event.release.upload_url }} + asset_name: clangd-indexing-tools-${{ matrix.config.name }}-${{ github.event.release.tag_name }}.zip + asset_path: indexing-tools.zip + asset_content_type: application/zip - name: Check binary compatibility if: matrix.config.name == 'linux' run: .github/workflows/lib_compat_test.py --lib=GLIBC_2.18 "$CLANGD_DIR/bin/clangd"