Skip to content

Commit

Permalink
Bazel7 (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjreiniger authored May 7, 2024
1 parent 10bc754 commit 97578e1
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 40 deletions.
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import .bazelrc-cc
import .bazelrc-java
import .bazelrc-buildbuddy

build --test_env=LD_LIBRARY_PATH=.
build --test_env=DYLD_LIBRARY_PATH=.

# Roborio
build:roborio --platforms=@rules_bzlmodrio_toolchains//platforms/roborio
build:roborio --build_tag_filters=-no-roborio
Expand Down
2 changes: 1 addition & 1 deletion .bazelrc-cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ build:windows_arm --copt=/wd5105
build:windows_arm --cxxopt=/wd4146
build:windows_arm --cxxopt=/wd4267
build:windows_arm --cxxopt=/wd4244
build:windows_arm --cpu=x64_arm64_windows
build:windows_arm --cpu=arm64_windows

# Linux
build:linux --copt=-Wall
Expand Down
5 changes: 4 additions & 1 deletion .bazelrc-java
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# build --javacopt=-Werror
build --javacopt=-Xlint:all,-processing

common --java_language_version=17
build --java_language_version=17
build --java_runtime_version=roboriojdk_17
build --tool_java_language_version=11
build --tool_java_runtime_version=remotejdk_11
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.5.0
7.1.1
72 changes: 46 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,28 @@ jobs:
matrix:
include:
# Build non-bzlmod, native
- { name: "windows - native", os: windows-2022, command: "test", config: "--noenable_bzlmod --config=windows", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "windows arm - native", os: windows-2022, command: "build", config: "--noenable_bzlmod --config=windows_arm", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - native", os: ubuntu-22.04, command: "test", config: "--noenable_bzlmod --config=linux", bazel_options: "", }
- { name: "macos - native", os: macos-12, command: "test", config: "--noenable_bzlmod --config=macos", bazel_options: "", }
- { name: "windows - native", os: windows-2022, java_arch: "x64", command: "test", config: "--noenable_bzlmod --config=windows", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "windows arm - native", os: windows-2022, java_arch: "x64", command: "build", config: "--noenable_bzlmod --config=windows_arm", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - native", os: ubuntu-22.04, java_arch: "x64", command: "test", config: "--noenable_bzlmod --config=linux", bazel_options: "", }
- { name: "macos - native", os: macos-14, java_arch: "aarch64", command: "test", config: "--noenable_bzlmod --config=macos", bazel_options: "", }

# Build bzlmod, native
- { name: "windows - bzlmod native", os: windows-2022, command: "test", config: "--enable_bzlmod --config=windows", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "windows arm - bzlmod native", os: windows-2022, command: "build", config: "--enable_bzlmod --config=windows_arm", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod native", os: ubuntu-22.04, command: "test", config: "--enable_bzlmod --config=linux", bazel_options: "", }
- { name: "macos - bzlmod native", os: macos-12, command: "test", config: "--enable_bzlmod --config=macos", bazel_options: "", }
- { name: "windows - bzlmod native", os: windows-2022, java_arch: "x64", command: "test", config: "--enable_bzlmod --config=windows", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "windows arm - bzlmod native", os: windows-2022, java_arch: "x64", command: "build", config: "--enable_bzlmod --config=windows_arm", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod native", os: ubuntu-22.04, java_arch: "x64", command: "test", config: "--enable_bzlmod --config=linux", bazel_options: "", }
- { name: "macos - bzlmod native", os: macos-14, java_arch: "aarch64", command: "test", config: "--enable_bzlmod --config=macos", bazel_options: "", }

name: "Build - ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with: { python-version: '3.11' }
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
architecture: ${{ matrix.java_arch }}
- run: bazel ${{ matrix.bazel_options }} build -k ${{ matrix.config }} --config=remote @bzlmodrio-opencv//...
working-directory: tests
- name: Build and allow failure # TODO Sometimes symlinks don't get created correctly the first time around
Expand All @@ -45,20 +50,25 @@ jobs:
matrix:
include:
# Build non-bzlmod, roborio
- { name: "windows - roborio", os: windows-2022, command: "build", config: "--noenable_bzlmod --config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - roborio", os: ubuntu-22.04, command: "build", config: "--noenable_bzlmod --config=roborio", bazel_options: "", }
- { name: "macos - roborio", os: macos-12, command: "build", config: "--noenable_bzlmod --config=roborio", bazel_options: "", }
- { name: "windows - roborio", os: windows-2022, java_arch: "x64", command: "build", config: "--noenable_bzlmod --config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - roborio", os: ubuntu-22.04, java_arch: "x64", command: "build", config: "--noenable_bzlmod --config=roborio", bazel_options: "", }
- { name: "macos - roborio", os: macos-14, java_arch: "aarch64", command: "build", config: "--noenable_bzlmod --config=roborio", bazel_options: "", }

# Build bzlmod, roborio
# - { name: "windows - bzlmod roborio", os: windows-2022, command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod roborio", os: ubuntu-22.04, command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "", }
- { name: "macos - bzlmod roborio", os: macos-12, command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "", }
# - { name: "windows - bzlmod roborio", os: windows-2022, java_arch: "x64", command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod roborio", os: ubuntu-22.04, java_arch: "x64", command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "", }
- { name: "macos - bzlmod roborio", os: macos-14, java_arch: "aarch64", command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "", }
name: "Build - ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with: { python-version: '3.11' }
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
architecture: ${{ matrix.java_arch }}
- name: Build and allow failure # TODO Sometimes symlinks don't get created correctly the first time around
run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote || true
working-directory: tests
Expand All @@ -72,20 +82,25 @@ jobs:
matrix:
include:
# Build non-bzlmod, bullseye32
- { name: "windows - bullseye32", os: windows-2022, command: "build", config: "--noenable_bzlmod --config=bullseye32", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bullseye32", os: ubuntu-22.04, command: "build", config: "--noenable_bzlmod --config=bullseye32", bazel_options: "", }
- { name: "macos - bullseye32", os: macos-12, command: "build", config: "--noenable_bzlmod --config=bullseye32", bazel_options: "", }
- { name: "windows - bullseye32", os: windows-2022, java_arch: "x64", command: "build", config: "--noenable_bzlmod --config=bullseye32", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bullseye32", os: ubuntu-22.04, java_arch: "x64", command: "build", config: "--noenable_bzlmod --config=bullseye32", bazel_options: "", }
- { name: "macos - bullseye32", os: macos-14, java_arch: "aarch64", command: "build", config: "--noenable_bzlmod --config=bullseye32", bazel_options: "", }

# Build bzlmod, bullseye32
- { name: "windows - bzlmod bullseye32", os: windows-2022, command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod bullseye32", os: ubuntu-22.04, command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "", }
- { name: "macos - bzlmod bullseye32", os: macos-12, command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "", }
- { name: "windows - bzlmod bullseye32", os: windows-2022, java_arch: "x64", command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod bullseye32", os: ubuntu-22.04, java_arch: "x64", command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "", }
- { name: "macos - bzlmod bullseye32", os: macos-14, java_arch: "aarch64", command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "", }
name: "Build - ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with: { python-version: '3.11' }
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
architecture: ${{ matrix.java_arch }}
- name: Build and allow failure # TODO Sometimes symlinks don't get created correctly the first time around
run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote || true
working-directory: tests
Expand All @@ -100,20 +115,25 @@ jobs:
matrix:
include:
# Build non-bzlmod, bullseye32:
- { name: "windows - bullseye64", os: windows-2022, command: "build", config: "--noenable_bzlmod --config=bullseye64", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bullseye64", os: ubuntu-22.04, command: "build", config: "--noenable_bzlmod --config=bullseye64", bazel_options: "", }
- { name: "macos - bullseye64", os: macos-12, command: "build", config: "--noenable_bzlmod --config=bullseye32", bazel_options: "", }
- { name: "windows - bullseye64", os: windows-2022, java_arch: "x64", command: "build", config: "--noenable_bzlmod --config=bullseye64", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bullseye64", os: ubuntu-22.04, java_arch: "x64", command: "build", config: "--noenable_bzlmod --config=bullseye64", bazel_options: "", }
- { name: "macos - bullseye64", os: macos-14, java_arch: "aarch64", command: "build", config: "--noenable_bzlmod --config=bullseye32", bazel_options: "", }

# Build bzlmod, bullseye32:
- { name: "windows - bzlmod bullseye64", os: windows-2022, command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod bullseye64", os: ubuntu-22.04, command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "", }
- { name: "macos - bzlmod bullseye64", os: macos-12, command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "", }
- { name: "windows - bzlmod bullseye64", os: windows-2022, java_arch: "x64", command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod bullseye64", os: ubuntu-22.04, java_arch: "x64", command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "", }
- { name: "macos - bzlmod bullseye64", os: macos-14, java_arch: "aarch64", command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "", }
name: "Build - ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with: { python-version: '3.11' }
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
architecture: ${{ matrix.java_arch }}
- name: Build and allow failure # TODO Sometimes symlinks don't get created correctly the first time around
run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote || true
working-directory: tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
sudo sh -c "echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main' >> /etc/apt/sources.list.d/proposed-repositories.list"
sudo apt-get update -q
sudo apt-get install -y clang-format-14
- run: bazel run @rules_wpiformat//wpiformat -- -f ..
- run: bazel run --noenable_bzlmod @rules_wpiformat//wpiformat -- -f ..
working-directory: tests
if: github.ref != 'refs/heads/main'

Expand Down
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ module(
compatibility_level = 2024,
)

bazel_dep(name = "platforms", version = "0.0.7")
bazel_dep(name = "platforms", version = "0.0.9")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_java", version = "6.4.0")
bazel_dep(name = "rules_java", version = "7.5.0")
bazel_dep(name = "rules_bazelrio", version = "0.0.14")
bazel_dep(name = "rules_bzlmodrio_toolchains", version = "2024-1")

Expand Down
13 changes: 10 additions & 3 deletions private/non_bzlmod_dependencies/download_dependencies.bzl
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

def download_dependencies():
# Rules Java
http_archive(
name = "rules_java",
sha256 = "4da3761f6855ad916568e2bfe86213ba6d2637f56b8360538a7fb6125abf6518",
url = "https://github.com/bazelbuild/rules_java/releases/download/7.5.0/rules_java-7.5.0.tar.gz",
)

# JVM External
http_archive(
name = "rules_jvm_external",
sha256 = "d31e369b854322ca5098ea12c69d7175ded971435e55c18dd9dd5f29cc5249ac",
strip_prefix = "rules_jvm_external-5.3",
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/5.3/rules_jvm_external-5.3.tar.gz",
sha256 = "08ea921df02ffe9924123b0686dc04fd0ff875710bfadb7ad42badb931b0fd50",
strip_prefix = "rules_jvm_external-6.1",
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/6.1/rules_jvm_external-6.1.tar.gz",
)

# Bazelrio Rules
Expand Down
3 changes: 3 additions & 0 deletions tests/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import .bazelrc-cc
import .bazelrc-java
import .bazelrc-buildbuddy

build --test_env=LD_LIBRARY_PATH=.
build --test_env=DYLD_LIBRARY_PATH=.

# Roborio
build:roborio --platforms=@rules_bzlmodrio_toolchains//platforms/roborio
build:roborio --build_tag_filters=-no-roborio
Expand Down
2 changes: 1 addition & 1 deletion tests/.bazelrc-cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ build:windows_arm --copt=/wd5105
build:windows_arm --cxxopt=/wd4146
build:windows_arm --cxxopt=/wd4267
build:windows_arm --cxxopt=/wd4244
build:windows_arm --cpu=x64_arm64_windows
build:windows_arm --cpu=arm64_windows

# Linux
build:linux --copt=-Wall
Expand Down
5 changes: 4 additions & 1 deletion tests/.bazelrc-java
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# build --javacopt=-Werror
build --javacopt=-Xlint:all,-processing

common --java_language_version=17
build --java_language_version=17
build --java_runtime_version=roboriojdk_17
build --tool_java_language_version=11
build --tool_java_runtime_version=remotejdk_11
2 changes: 1 addition & 1 deletion tests/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.5.0
7.1.1
5 changes: 3 additions & 2 deletions tests/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ local_path_override(

bazel_dep(name = "googletest", version = "1.14.0")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_java", version = "6.4.0")
bazel_dep(name = "rules_jvm_external", version = "5.3")
bazel_dep(name = "rules_java", version = "7.5.0")
bazel_dep(name = "rules_jvm_external", version = "6.1")
bazel_dep(name = "rules_bazelrio", version = "0.0.14")
bazel_dep(name = "rules_bzlmodrio_toolchains", version = "2024-1")
bazel_dep(name = "rules_pmd", version = "6.43.0")
bazel_dep(name = "rules_checkstyle", version = "10.1")
bazel_dep(name = "rules_wpiformat", version = "2024.34")
bazel_dep(name = "rules_wpi_styleguide", version = "1.0.0")
bazel_dep(name = "rules_spotless", version = "2.34.0")
bazel_dep(name = "rules_bzlmodrio_jdk", version = "17.0.8-7")

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
Expand Down
10 changes: 10 additions & 0 deletions tests/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,13 @@ load("@rules_wpi_styleguide//dependencies:load_pins.bzl", "load_styleguide_pins"

load_styleguide_pins()
#####################

http_archive(
name = "rules_bzlmodrio_jdk",
sha256 = "36cd468c867817ec460d76c28ec0ccd2d9fac4a2cf966af3935243a8a4a08108",
url = "https://github.com/bzlmodRio/rules_bzlmodRio_jdk/releases/download/17.0.8-7/rules_bzlmodRio_jdk-17.0.8-7.tar.gz",
)

load("@rules_bzlmodrio_jdk//:maven_deps.bzl", "setup_legacy_setup_jdk_dependencies")

setup_legacy_setup_jdk_dependencies()

0 comments on commit 97578e1

Please sign in to comment.