Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies in prep for Bazel 7 #6536

Closed
wants to merge 15 commits into from
Closed
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
17 changes: 17 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
build_cmake
build-cmake

# Auto generated by vscode
apriltag/bin
cameraserver/bin
cameraserver/multiCameraServer/bin
cscore/bin
fieldImages/bin
hal/bin
myRobot/bin
ntcore/bin
wpilibNewCommands/bin
wpilibj/bin
wpimath/bin
wpinet/bin
wpiutil/bin
31 changes: 31 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
try-import %workspace%/user.bazelrc

build --java_language_version=11
test --test_output=errors
test --test_verbose_timeout_warnings

import shared/bazel/rc/buildbuddy.rc
import shared/bazel/compiler_flags/sanitizers.rc
import shared/bazel/compiler_flags/bullseye32_flags.rc
import shared/bazel/compiler_flags/bullseye64_flags.rc
import shared/bazel/compiler_flags/linux_flags.rc
import shared/bazel/compiler_flags/osx_flags.rc
import shared/bazel/compiler_flags/raspbian_flags.rc
import shared/bazel/compiler_flags/roborio_flags.rc
import shared/bazel/compiler_flags/windows_flags.rc
import shared/bazel/compiler_flags/windows_arm_flags.rc
import shared/bazel/compiler_flags/coverage_flags.rc

build:build_java --test_tag_filters=allwpilib-build-java --build_tag_filters=allwpilib-build-java
build:build_cpp --test_tag_filters=+allwpilib-build-cpp --build_tag_filters=+allwpilib-build-cpp
build:no_example --test_tag_filters=-wpi-example --build_tag_filters=-wpi-example
test:no_example --test_tag_filters=-wpi-example --build_tag_filters=-wpi-example


build --lockfile_mode=update
build --registry=https://raw.githubusercontent.com/pjreiniger/bazel-central-registry/bzlmodrio/

build:ci --config=remote

build --proto_toolchain_for_java=//:quickbuf_toolchain
build --proto_toolchain_for_cc=//:proto_cc_toolchain
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.4.0
291 changes: 291 additions & 0 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
name: Bazel

on: [pull_request, push]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
build-windows:
strategy:
fail-fast: false
matrix:
include:
- { name: "Windows (native)", os: windows-2022, action: "test", config: "--config=windows --noenable_bzlmod", }
- { name: "Windows (bzlmod)", os: windows-2022, action: "test", config: "--config=windows --enable_bzlmod", }

- { name: "Windows (arm)", os: windows-2022, action: "build", config: "--config=windows_arm --noenable_bzlmod", }
- { name: "Windows (arm bzlmod)", os: windows-2022, action: "build", config: "--config=windows_arm --enable_bzlmod", }

- { name: "Windows (roborio)", os: windows-2022, action: "build", config: "--config=roborio --noenable_bzlmod", }
# - { name: "Windows (roborio bzlmod)", os: windows-2022, action: "build", config: "--config=roborio --enable_bzlmod", }

- { name: "Windows (bullseye32)", os: windows-2022, action: "build", config: "--config=bullseye32 --noenable_bzlmod", }
- { name: "Windows (bullseye32 bzlmod)", os: windows-2022, action: "build", config: "--config=bullseye32 --enable_bzlmod", }

- { name: "Windows (bullseye64)", os: windows-2022, action: "build", config: "--config=bullseye64 --noenable_bzlmod", }
- { name: "Windows (bullseye64 bzlmod)", os: windows-2022, action: "build", config: "--config=bullseye64 --enable_bzlmod", }

- { name: "Windows (raspi32)", os: windows-2022, action: "build", config: "--config=raspi32 --noenable_bzlmod", }
- { name: "Windows (raspi32 bzlmod)", os: windows-2022, action: "build", config: "--config=raspi32 --enable_bzlmod", }

name: "Build ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with: { fetch-depth: 0 }
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
architecture: x64

- name: Build wpimath dependencies
run: bazel --output_user_root=C:\\bazelroot ${{ matrix.action }} -k wpiutil/... --config=ci ${{ matrix.config }} --nojava_header_compilation --verbose_failures
shell: bash

- name: Build wpimath
run: bazel --output_user_root=C:\\bazelroot build -k wpimath/... --config=ci ${{ matrix.config }} --local_cpu_resources=1 --nojava_header_compilation --verbose_failures
shell: bash

- name: Build allowing failures
run: bazel --output_user_root=C:\\bazelroot build -k ... --config=ci ${{ matrix.config }} --nojava_header_compilation --verbose_failures || true
shell: bash

- name: Build
run: bazel --output_user_root=C:\\bazelroot ${{ matrix.action }} -k ... --config=ci ${{ matrix.config }} --nojava_header_compilation --verbose_failures
shell: bash

build-mac:
strategy:
fail-fast: false
matrix:
include:
- { name: "Mac (native)", os: macos-14, action: "test", config: "--config=osx -c opt --noenable_bzlmod", }
- { name: "Mac (bzlmod)", os: macos-14, action: "test", config: "--config=osx -c opt --enable_bzlmod" }

- { name: "Mac (roborio)", os: macos-14, action: "build", config: "--config=roborio -c opt --noenable_bzlmod", }
- { name: "Mac (roborio bzlmod)", os: macos-14, action: "build", config: "--config=roborio -c opt --enable_bzlmod" }

- { name: "Mac (bullseye32)", os: macos-14, action: "build", config: "--config=bullseye32 -c opt --noenable_bzlmod", }
- { name: "Mac (bullseye32 bzlmod)", os: macos-14, action: "build", config: "--config=bullseye32 -c opt --enable_bzlmod" }

- { name: "Mac (bullseye64)", os: macos-14, action: "build", config: "--config=bullseye64 -c opt --noenable_bzlmod", }
- { name: "Mac (bullseye64 bzlmod)", os: macos-14, action: "build", config: "--config=bullseye64 -c opt --enable_bzlmod" }

- { name: "Mac (raspi32)", os: macos-14, action: "build", config: "--config=raspi32 -c opt --noenable_bzlmod", }
- { name: "Mac (raspi32 bzlmod)", os: macos-14, action: "build", config: "--config=raspi32 -c opt --enable_bzlmod" }

name: "${{ matrix.name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with: { fetch-depth: 0 }
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
architecture: aarch64

- name: Build allowing failures
run: bazel build -k ... --config=ci ${{ matrix.config }} --nojava_header_compilation --verbose_failures || true
shell: bash

- name: Build
run: bazel ${{ matrix.action }} -k ... --config=ci ${{ matrix.config }} --nojava_header_compilation --verbose_failures
shell: bash

# - name: Check Lockfile update
# run: git --no-pager diff --exit-code HEAD

build-linux:
strategy:
fail-fast: false
matrix:
include:
- { container: "wpilib/ubuntu-base:22.04", action: "test", artifact-name: "Linux (native)", config: "--config=linux --noenable_bzlmod", }
- { container: "wpilib/ubuntu-base:22.04", action: "test", artifact-name: "Linux (bzlmod)", config: "--config=linux --enable_bzlmod" }

- { container: "wpilib/ubuntu-base:22.04", action: "build", artifact-name: "Linux (roborio)", config: "--config=roborio --noenable_bzlmod", }
- { container: "wpilib/ubuntu-base:22.04", action: "build", artifact-name: "Linux (roborio bzlmod)", config: "--config=roborio --enable_bzlmod" }

- { container: "wpilib/ubuntu-base:22.04", action: "build", artifact-name: "Linux (bullseye32)", config: "--config=bullseye32 --noenable_bzlmod", }
- { container: "wpilib/ubuntu-base:22.04", action: "build", artifact-name: "Linux (bullseye32 bzlmod)", config: "--config=bullseye32 --enable_bzlmod" }

- { container: "wpilib/ubuntu-base:22.04", action: "build", artifact-name: "Linux (bullseye64)", config: "--config=bullseye64 --noenable_bzlmod", }
- { container: "wpilib/ubuntu-base:22.04", action: "build", artifact-name: "Linux (bullseye64 bzlmod)", config: "--config=bullseye64 --enable_bzlmod" }

- { container: "wpilib/ubuntu-base:22.04", action: "build", artifact-name: "Linux (raspi32)", config: "--config=raspi32 --noenable_bzlmod", }
- { container: "wpilib/ubuntu-base:22.04", action: "build", artifact-name: "Linux (raspi32 bzlmod)", config: "--config=raspi32 --enable_bzlmod" }
runs-on: ubuntu-22.04
name: "Build - ${{ matrix.artifact-name }}"
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v3
with: { fetch-depth: 0 }
- uses: bazelbuild/setup-bazelisk@v1

- name: Build and allow failures
run: bazel build ... --config=ci ${{ matrix.config }} -k --verbose_failures || true

- name: Build and Test
run: bazel ${{ matrix.action }} ... --config=ci ${{ matrix.config }} -k --verbose_failures


repin-maven:
strategy:
fail-fast: false
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run: bazel run --noenable_bzlmod @unpinned_maven//:pin
- run: git diff HEAD
- uses: actions/upload-artifact@v2
with:
name: Re-pinned maven
path: shared/bazel/deps/maven_install.json

build-sanitizers:
strategy:
fail-fast: false
matrix:
include:
- config: "tsan"
- config: "asan"
- config: "ubsan"
runs-on: ubuntu-22.04
container: wpilib/ubuntu-base:22.04
name: "Sanitizer ${{ matrix.config }}"
steps:
- uses: actions/checkout@v3
with: { fetch-depth: 0 }
- uses: bazelbuild/setup-bazelisk@v1
- name: Build and Test
run: bazel test -k --config=ci --config=linux --noenable_bzlmod --config=${{ matrix.config }} //...

build-coverage:
runs-on: ubuntu-22.04
name: "Code Coverage"
steps:
- uses: actions/checkout@v3
with: { fetch-depth: 0 }

- name: Install LCOV
run: sudo apt-get install -y lcov

- name: Build, allow buildbudy failure
run: bazel coverage --config=ci --config=linux --noenable_bzlmod -k -- //... -//simulation/halsim_gui/src/test/native/cpp:halsim_gui-test -//sysid/src/test/native:sysid-test

- name: genhtml
run: |
genhtml bazel-out/_coverage/_coverage_report.dat -o coverage_report/combined

- uses: actions/upload-artifact@v2
with:
name: "Coverage"
path: coverage_report

buildifier:
name: "buildifier"
runs-on: ubuntu-22.04
steps:
- name: Set up Go 1.15.x
uses: actions/setup-go@v2
with:
go-version: 1.15.x
id: go

- name: Install Buildifier
run: |
cd $(mktemp -d)
GO111MODULE=on go get github.com/bazelbuild/buildtools/[email protected]

- uses: actions/checkout@v3
with: { fetch-depth: 0 }

- name: Run buildifier
run: buildifier -warnings all --lint=fix -r .

- name: Check Output
run: git --no-pager diff --exit-code HEAD

- name: Generate diff
run: git diff HEAD > bazel-lint-fixes.patch
if: ${{ failure() }}

- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.platform }}-bazel-lint-fixes
path: bazel-lint-fixes.patch
if: ${{ failure() }}

unused_deps:
name: "unused_deps"
runs-on: ubuntu-22.04
steps:
- name: Set up Go 1.15.x
uses: actions/setup-go@v2
with:
go-version: 1.15.x
id: go

- uses: actions/checkout@v3

- name: Install Unused Deps
run: |
cd $(mktemp -d)
GO111MODULE=on go get github.com/bazelbuild/buildtools/[email protected]

- name: Install Buildozer
run: |
cd $(mktemp -d)
GO111MODULE=on go get github.com/bazelbuild/buildtools/[email protected]

- name: Dump Platform Flag
run: |
echo "# Flags for unused deps" > user.bazelrc
echo "build --config=linux" >> user.bazelrc
echo "build --config=ci" >> user.bazelrc
echo "build --build_tag_filters=-wpi-cpp-gui" >> user.bazelrc
echo "build --test_tag_filters=-wpi-cpp-gui" >> user.bazelrc

- name: Debug userrc
run: cat user.bazelrc

- name: Prep unused deps
run: bazel query --tool_tag=unused_deps --keep_going "kind('(kt|java|android)_*', //...)" || true

- name: Run unused deps
run: unused_deps -cquery //... > buildozer-cmds.sh

- name: Show unused deps
run: cat buildozer-cmds.sh

- uses: actions/upload-artifact@v2
with:
name: Upload Unused Deps Script
path: buildozer-cmds.sh

- name: Fix unused deps
run: chmod +x buildozer-cmds.sh && ./buildozer-cmds.sh

- name: Generate diff
run: git diff > bazel-unused-deps-fixes.patch

- name: Check Output
run: git --no-pager diff --exit-code HEAD

- uses: actions/upload-artifact@v2
with:
name: Upload Unused Deps Patch
path: bazel-unused-deps-fixes.patch
if: ${{ failure() }}
4 changes: 4 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ jobs:
with:
name: ${{ matrix.artifact-name }}
path: ${{ matrix.build-dir }}/${{ matrix.outputs }}
# - uses: actions/upload-artifact@v2
# with:
# name: ${{ matrix.artifact-name }} BUILD OPTIONS
# path: "**/build/tmp/**/options.txt"

build-documentation:
name: "Build - Documentation"
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/sync_fork.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Sync Fork

on:
schedule:
- cron: '0 13 * * *' # Once a day at 1pm
workflow_dispatch: # on button click

jobs:
sync:

runs-on: ubuntu-latest

steps:
- uses: tgymnich/[email protected]
with:
token: ${{ secrets.AUTO_UPDATE_KEY }}
owner: bazelRio
base: main
head: main
auto_merge: false
2 changes: 1 addition & 1 deletion .github/workflows/upstream-utils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ jobs:
- name: Add untracked files to index so they count as changes
run: git add -A
- name: Check output
run: git --no-pager diff --exit-code HEAD
run: git --no-pager diff --exit-code HEAD ':!*.bazel'
2 changes: 2 additions & 0 deletions .styleguide
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ generatedFileExclude {
simulation/gz_msgs/src/include/simulation/gz_msgs/msgs\.h$
fieldImages/src/main/native/resources/
apriltag/src/test/resources/
BUILD.bazel
MODULE.bazel.lock
}

repoRootNameOverride {
Expand Down
Loading
Loading