Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .aspect/bazelrc/ci.bazelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Disable bzlmod since this project uses WORKSPACE
# Docs: https://bazel.build/external/migration#disable-bzlmod
common --noenable_bzlmod
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be moved to the root .bazelrc. We probably don't want MODULE.bazel to be autogenerated in any case.


# We recommend enforcing a policy that keeps your CI from being slowed down
# by individual test targets that should be optimized
# or split up into multiple test targets with sharding or manually.
Expand Down
22 changes: 22 additions & 0 deletions .aspect/workflows/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
queue: aspect-devx-service
bazel:
rcfiles:
- ".aspect/bazelrc/ci.bazelrc"

tasks:
- build:
targets:
- //...
- -//tools:compdb # Exclude: com_grail_bazel_compdb is incompatible with current toolchain
bazel:
flags:
- "--config=ci"
- test:
targets:
- //test
bazel:
flags:
- "--config=ci"
- finalization:

2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ build --per_file_copt="external/llvm-project/.*@-Wno-deprecated-anon-enum-enum-c
build --per_file_copt="external/llvm-project/.*@-Wno-ambiguous-reversed-operator" # C++20 warning
build --per_file_copt="external/com_google_protobuf/.*@-Wno-deprecated-declarations" # sprintf on macOS
build --per_file_copt="external/com_google_protobuf/.*@-Wno-unused-function"
build --per_file_copt="external/com_google_protobuf/.*@-Wno-missing-field-initializers"
build --per_file_copt="external/com_google_protobuf/.*@-Wno-unnecessary-virtual-specifier"

build:asserts --copt="-DFORCE_DEBUG=1"
build:asserts --copt="-DLLVM_ENABLE_ASSERTIONS=1"
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.2
7.5.0
27 changes: 19 additions & 8 deletions .buildkite/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$schema: "http://json.schemastore.org/buildkite"
steps:
- label: ":bazel: Build and Test"
- label: ":lint-roller: Lint"
key: lint
agents:
queue: bazel
key: build
queue: aspect-small-ubuntu-lts
command: |
./tools/reformat.sh
if ! git diff --quiet; then
Expand All @@ -17,8 +17,19 @@ steps:

./tools/lint.sh

# DO NOT remove --config=ci as that turns on sanitizers.
bazel --bazelrc=.bazelrc --bazelrc=.aspect/bazelrc/ci.bazelrc build //... --config=ci

# Don't use //... as that will also try to update snapshots
bazel --bazelrc=.bazelrc --bazelrc=.aspect/bazelrc/ci.bazelrc test //test --config=ci
- key: aspect-workflows-upload
label: ":aspect: Setup Aspect Workflows"
commands: |
rosetta steps | buildkite-agent pipeline upload
agents:
queue: aspect-small-ubuntu-lts
# - label: "build and test"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove this?

# agents:
# queue: aspect-devx-service
# key: build
# command: |
# # DO NOT remove --config=ci as that turns on sanitizers.
# bazel --bazelrc=.bazelrc --bazelrc=.aspect/bazelrc/ci.bazelrc build //... --config=ci
#
# # Don't use //... as that will also try to update snapshots
# bazel --bazelrc=.bazelrc --bazelrc=.aspect/bazelrc/ci.bazelrc test //test --config=ci
48 changes: 24 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,13 @@ jobs:
strategy:
matrix:
include:
- platform: "ubuntu-22.04"
container: "gcc:9.5.0-buster"
- platform: "ubuntu-24.04"
config: "dev"
- platform: "ubuntu-22.04"
container: "gcc:9.5.0-buster"
- platform: "ubuntu-24.04"
config: "release"
# macOS 14 => arm64
- platform: "macos-14"
container: ""
config: "release"
runs-on: ${{ matrix.platform }}
container: ${{ matrix.container }}
env:
TAG: ${{ github.event.ref }}
permissions:
Expand All @@ -41,6 +36,20 @@ jobs:
run:
shell: bash
steps:
- name: "🧹 Free up disk space"
if: runner.os == 'Linux'
run: |
# Free up disk space on GitHub-hosted runners
# The LLVM 21 toolchain requires ~5GB when extracted
echo "Before cleanup:"
df -h /
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force || true
echo "After cleanup:"
df -h /
- uses: actions/checkout@v4
- name: "📝 Check version"
run: |
Expand All @@ -53,12 +62,12 @@ jobs:
NEW_VERSION="${TAG_LIKE/v/}" ./tools/version_check.sh
- name: "🐍 Install Bazelisk"
run: |
if ! command -v bazelisk; then
if ! command -v bazelisk && ! command -v bazel; then
if [ "$RUNNER_OS" == "Windows" ]; then
choco install bazelisk
elif [ "$RUNNER_OS" == "Linux" ]; then
curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-linux-amd64 > /usr/local/bin/bazel
chmod +x /usr/local/bin/bazel
sudo curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-linux-amd64 -o /usr/local/bin/bazel
sudo chmod +x /usr/local/bin/bazel
else
sudo npm install -g @bazel/bazelisk
fi
Expand All @@ -72,26 +81,22 @@ jobs:
create_credentials_file: true
- name: "🚧 Build scip-clang"
run: |
# Stop Windows from converting the // to /
# https://github.com/bazelbuild/bazel/commit/866ecc8c3d5e0b899e3f0c9c6b2265f16daae842
# https://stackoverflow.com/a/34386471
export MSYS2_ARG_CONV_EXCL="*"
if [ "$RUNNER_OS" == "macOS" ]; then
export BAZEL_MEM="13G"
else # if [ "$RUNNER_OS" == "Linux" ]; then
else
export BAZEL_MEM="6G"
fi
{
echo "startup --host_jvm_args=-Xmx$BAZEL_MEM"
} > ci.bazelrc
# Comment out the 'upload log' bit below for debugging
SUFFIX=""
if [ "$CONFIG" == "release" ]; then
if [ "$(uname -s)" == "Linux" ]; then
SUFFIX="-linux"
fi
fi
bazel build //indexer:scip-clang --config="$CONFIG$SUFFIX" # --execution_log_binary_file=log
bazel --bazelrc=.bazelrc --bazelrc=.aspect/bazelrc/ci.bazelrc build //indexer:scip-clang --config="$CONFIG$SUFFIX"
if [ "$RUNNER_OS" == "Linux" ]; then
echo "--- GLIBC VERSIONS ---"
objdump -T bazel-bin/indexer/scip-clang | grep GLIBC | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vu
Expand All @@ -101,11 +106,6 @@ jobs:
CONFIG: ${{ matrix.config }}
- name: "🔎 Identify OS"
run: echo "OS=$(uname -s | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
# - name: '🪵 Upload log'
# uses: actions/upload-artifact@v3
# with:
# name: ${{ env.OS }}-${{ matrix.config }}-build-log
# path: log
- name: ${{ format('🪄 Rename binary ({0})', matrix.config) }}
run: |
SUFFIX="-dev"
Expand All @@ -129,7 +129,9 @@ jobs:
name: "Create release"
if: github.event_name != 'workflow_dispatch' || inputs.create_release
needs: build-and-upload-artifacts
runs-on: "ubuntu-22.04"
runs-on: "ubuntu-24.04"
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: "📝 Create Release"
Expand All @@ -145,8 +147,6 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TRIGGER: ${{ github.event_name }}
INPUT_REVISION: ${{ inputs.revision }}
# Download everything to avoid spelling out the different
# platforms here.
- name: "📥 Download all artifacts"
uses: actions/download-artifact@v4
- name: "📤 Upload artifacts for release"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# scip-clang: SCIP indexer for C and C++ ![(Status: Beta)](https://img.shields.io/badge/status-beta-yellow?style=flat)

scip-clang is a precise code indexer based on Clang 16,
scip-clang is a precise code indexer based on Clang 21,
which supports cross-repository code navigation for C, C++ and CUDA
in Sourcegraph.

Expand Down Expand Up @@ -201,7 +201,7 @@ scip-clang --compdb-path=build/small_compdb.json --show-compiler-diagnostics
<summary>Known diagnostics when indexing CUDA</summary>

1. If you see an error related to the `texture` template, that is likely
because of the Clang version not being Clang 16 or newer.
because of the Clang version not being Clang 21 or newer.
See https://github.com/llvm/llvm-project/issues/61340
2. If you see any errors related to GCC headers, that's a
[known issue](https://github.com/sourcegraph/scip-clang/issues/440).
Expand Down
13 changes: 12 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,27 @@ load("//:fetch_deps.bzl", "fetch_direct_dependencies")
fetch_direct_dependencies()

# Setup the toolchain before setting up other dependencies
# Note: bazel_toolchain_dependencies() brings in rules_cc 0.2.14
load("@toolchains_llvm//toolchain:deps.bzl", "bazel_toolchain_dependencies")

bazel_toolchain_dependencies()

# bazel_features needs its deps called explicitly
load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

# Set up cc_compatibility_proxy for rules_cc 0.2.14+ in WORKSPACE mode
load("@rules_cc//cc:extensions.bzl", "compatibility_proxy_repo")

compatibility_proxy_repo()

load("//:setup_llvm.bzl", "setup_llvm_toolchain")

setup_llvm_toolchain(name = "llvm_toolchain")

load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")

llvm_register_toolchains()

Expand Down
68 changes: 42 additions & 26 deletions fetch_deps.bzl
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")

_BAZEL_SKYLIB_VERSION = "1.3.0"
_PLATFORMS_COMMIT = "3fbc687756043fb58a407c2ea8c944bc2fe1d922" # 2022 Nov 10
_BAZEL_TOOLCHAIN_VERSION = "0.10.3"
_PLATFORMS_VERSION = "1.0.0" # Updated from 2022 commit for visionos support
_BAZEL_TOOLCHAIN_VERSION = "1.6.0"
_RULES_BOOST_COMMIT = "00b9b9ecb9b43564de44ea0b10e22b29dcf84d79"
_LLVM_COMMIT = "e0f3110b854a476c16cce7b44472cd7838d344e9" # Keep in sync with Version.h
_ABSL_COMMIT = "4ffaea74c1f5408e0757547a1ca0518ad43fa9f1"
_LLVM_COMMIT = "2078da43e25a4623cab2d0d60decddf709aaea28" # Keep in sync with Version.h
_ABSL_VERSION = "20240722.0"
_CXXOPTS_VERSION = "3.0.0"
_RAPIDJSON_COMMIT = "a98e99992bd633a2736cc41f96ec85ef0c50e44d"
_WYHASH_COMMIT = "ea3b25e1aef55d90f707c3a292eeb9162e2615d8"
_SPDLOG_COMMIT = "edc51df1bdad8667b628999394a1e7c4dc6f3658"
_PROTOBUF_VERSION = "3.21.12"
_SPDLOG_COMMIT = "486b55554f11c9cccc913e11a87085b2a91f706f" # v1.16.0
_PROTOBUF_VERSION = "25.3"
_SCIP_COMMIT = "aa0e511dcfefbacc3b96dcc2fe2abd9894416b1e"
_UTFCPP_VERSION = "4.0.5"
# ^ When bumping this version, check if any new fields are introduced
Expand All @@ -22,7 +22,7 @@ _UTFCPP_VERSION = "4.0.5"
# See https://github.com/google/perfetto/issues/271#issuecomment-1527691232
_PERFETTO_VERSION = "33.1" # Keep in sync with docs/Development.md
_DOCTEST_VERSION = "2.4.9"
_DTL_VERSION = "1.20"
_DTL_VERSION = "1.21"
_RULES_PYTHON_VERSION = "0.18.1"

def fetch_direct_dependencies():
Expand All @@ -37,17 +37,19 @@ def fetch_direct_dependencies():

http_archive(
name = "platforms",
sha256 = "b4a3b45dc4202e2b3e34e3bc49d2b5b37295fc23ea58d88fb9e01f3642ad9b55",
strip_prefix = "platforms-%s" % _PLATFORMS_COMMIT,
urls = ["https://github.com/bazelbuild/platforms/archive/%s.zip" % _PLATFORMS_COMMIT],
sha256 = "3384eb1c30762704fbe38e440204e114154086c8fc8a8c2e3e28441028c019a8",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/{0}/platforms-{0}.tar.gz".format(_PLATFORMS_VERSION),
"https://github.com/bazelbuild/platforms/releases/download/{0}/platforms-{0}.tar.gz".format(_PLATFORMS_VERSION),
],
)

http_archive(
name = "toolchains_llvm",
sha256 = "b7cd301ef7b0ece28d20d3e778697a5e3b81828393150bed04838c0c52963a01",
strip_prefix = "toolchains_llvm-%s" % _BAZEL_TOOLCHAIN_VERSION,
sha256 = "2b298a1d7ea99679f5edf8af09367363e64cb9fbc46e0b7c1b1ba2b1b1b51058",
strip_prefix = "toolchains_llvm-v%s" % _BAZEL_TOOLCHAIN_VERSION,
canonical_id = _BAZEL_TOOLCHAIN_VERSION,
url = "https://github.com/grailbio/bazel-toolchain/releases/download/{0}/toolchains_llvm-{0}.tar.gz".format(_BAZEL_TOOLCHAIN_VERSION),
url = "https://github.com/bazel-contrib/toolchains_llvm/releases/download/v{0}/toolchains_llvm-v{0}.tar.gz".format(_BAZEL_TOOLCHAIN_VERSION),
)

http_archive(
Expand Down Expand Up @@ -79,14 +81,14 @@ def fetch_direct_dependencies():
# Keep the name 'zlib' so that Protobuf doesn't pull in another copy.
#
# https://sourcegraph.com/github.com/protocolbuffers/protobuf/-/blob/protobuf_deps.bzl?L48-58
# Using zlib 1.3.1 to fix macro conflicts with macOS headers in zlib 1.2.11
http_archive(
name = "zlib",
build_file = "@scip_clang//third_party:zlib.BUILD",
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
strip_prefix = "zlib-1.2.11",
sha256 = "17e88863f3600672ab49182f217281b6fc4d3c762bde361935e436a95214d05c",
strip_prefix = "zlib-1.3.1",
urls = [
"https://mirror.bazel.build/zlib.net/zlib-1.2.11.tar.gz",
"https://zlib.net/zlib-1.2.11.tar.gz",
"https://github.com/madler/zlib/archive/refs/tags/v1.3.1.tar.gz",
],
)

Expand All @@ -100,17 +102,33 @@ def fetch_direct_dependencies():
],
)

# LLVM 18+ uses zlib-ng instead of zlib
http_archive(
name = "llvm_zlib",
build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD",
sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731",
strip_prefix = "zlib-ng-2.0.7",
urls = [
"https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip",
],
)

# Cherry-pick fix for CUDA assertion failure from
# https://github.com/llvm/llvm-project/pull/173762
# Can be removed once LLVM merges the fix and we update the commit.
http_archive(
name = "llvm-raw",
sha256 = "04b76a5be88331f71a4e4fe96bccfebec302ddd0dbd9418fd5c186a7361c54fb",
sha256 = "536a4d64ab21bc85bf95ae4dc412b36e8a9c72d487a476839f3c31c3ded69e96",
strip_prefix = "llvm-project-%s" % _LLVM_COMMIT,
build_file_content = "# empty",
urls = ["https://github.com/llvm/llvm-project/archive/%s.tar.gz" % _LLVM_COMMIT],
patch_args = ["-p1"],
patches = ["//third_party:llvm-cuda-tooling.patch"],
)

http_archive(
name = "com_google_protobuf",
sha256 = "f7042d540c969b00db92e8e1066a9b8099c8379c33f40f360eb9e1d98a36ca26",
sha256 = "5156b22536feaa88cf95503153a6b2cd67cc80f20f1218f154b84a12c288a220",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v%s.zip" % _PROTOBUF_VERSION],
strip_prefix = "protobuf-%s" % _PROTOBUF_VERSION,
)
Expand All @@ -129,11 +147,9 @@ def fetch_direct_dependencies():
# https://sourcegraph.com/github.com/protocolbuffers/protobuf/-/blob/protobuf_deps.bzl?L39-46
http_archive(
name = "com_google_absl",
sha256 = "fee8ec623d8bbf0ecb9563a8e08ae319d1ca9fdf8c1c84384520a6992f571659",
strip_prefix = "abseil-cpp-%s" % _ABSL_COMMIT,
urls = ["https://github.com/abseil/abseil-cpp/archive/%s.zip" % _ABSL_COMMIT],
patch_args = ["-p1"],
patches = ["//third_party:abseil.patch"],
sha256 = "95e90be7c3643e658670e0dd3c1b27092349c34b632c6e795686355f67eca89f",
strip_prefix = "abseil-cpp-%s" % _ABSL_VERSION,
urls = ["https://github.com/abseil/abseil-cpp/archive/%s.zip" % _ABSL_VERSION],
)

# Abseil also has a flags/argument parsing library, but let's
Expand Down Expand Up @@ -165,7 +181,7 @@ def fetch_direct_dependencies():
# NOTE: fmt also comes through spdlog, we don't have an explicit dep on fmt.
http_archive(
name = "spdlog",
sha256 = "93a270dd7ec8fa672eb4feaef443dc14a4a9edc7b59aea998ae5da6cbf7b7119",
sha256 = "d2fef585c9879dd239dc498e2e8a1e22982b3ed67b2d14e78622b7ef25bdfdfa",
build_file = "@scip_clang//third_party:spdlog.BUILD",
strip_prefix = "spdlog-%s" % _SPDLOG_COMMIT,
urls = ["https://github.com/gabime/spdlog/archive/%s.tar.gz" % _SPDLOG_COMMIT],
Expand All @@ -180,7 +196,7 @@ def fetch_direct_dependencies():

http_archive(
name = "dtl",
sha256 = "579f81bca88f4b9760a59d99c5a95bd8dd5dc2f20f33f1f9b5f64cb08979f54d",
sha256 = "90ed2dbf4e6d687737fe25f118bbcb6aed778cecc3f2115d191a032bf8643dbd",
build_file = "@scip_clang//third_party:dtl.BUILD",
strip_prefix = "dtl-%s" % _DTL_VERSION,
urls = ["https://github.com/cubicdaiya/dtl/archive/v%s.tar.gz" % _DTL_VERSION],
Expand Down
Loading
Loading