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

[drake_bazel_...] Cleanups for bazel version #341

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions .github/workflows/bazel_download.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
- name: setup
run: ./drake_bazel_download/.github/ubuntu_setup
shell: bash
- name: install_bazelisk
run: ./drake_bazel_download/setup/install_bazelisk
shell: bash
- name: bazel_download build and test
run: ./drake_bazel_download/.github/ci_build_test
shell: bash
4 changes: 1 addition & 3 deletions drake_bazel_download/.bazeliskrc
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# Keep this version number in sync with the Ubuntu deb installed by
# drake/setup/ubuntu/source_distribution/install_bazel.sh.
USE_BAZEL_VERSION=7.0.2
USE_BAZEL_VERSION=7.4.1
4 changes: 2 additions & 2 deletions drake_bazel_download/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
module(name = "drake_external_examples")

# Add the Bazel rulesets we need.
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_python", version = "0.31.0")
bazel_dep(name = "rules_cc", version = "0.0.16")
bazel_dep(name = "rules_python", version = "0.39.0")

# Use the host system python.
register_toolchains("@bazel_tools//tools/python:autodetecting_toolchain")
Expand Down
5 changes: 5 additions & 0 deletions drake_bazel_download/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ First, install the required Ubuntu packages:
sudo setup/install_prereqs
```

If you don't have already bazel or bazelisk already installed, install bazelisk:
```
sudo setup/install_bazelisk
```

Then, to build and test all apps:
```
bazel test //...
Expand Down
16 changes: 16 additions & 0 deletions drake_bazel_download/setup/install_bazelisk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# TODO(jwnimmer-tri) Drake's install_prereqs script should perform this
# install step for us, but it doesn't so we need this work-around in the
# meantime.

set -euxo pipefail

if [[ "${EUID:-}" -ne 0 ]]; then
echo 'This script must be run as root' >&2
exit 2
fi

wget -O bazelisk.deb \
https://github.com/bazelbuild/bazelisk/releases/download/v1.23.0/bazelisk-amd64.deb
dpkg -i bazelisk.deb
12 changes: 0 additions & 12 deletions drake_bazel_download/setup/install_prereqs
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,3 @@ tar -xf drake.tar.gz -C /opt
echo -e "\ndrake VERSION.TXT: $(cat /opt/drake/share/doc/drake/VERSION.TXT)\n"

/opt/drake/share/drake/setup/install_prereqs

apt-get install --no-install-recommends gnupg

apt-key adv --fetch-keys https://bazel.build/bazel-release.pub.gpg
echo 'deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8' \
> /etc/apt/sources.list.d/bazel.list

apt-get update
apt-get install --no-install-recommends $(cat <<EOF
bazel
EOF
)
1 change: 1 addition & 0 deletions drake_bazel_external/.bazeliskrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
USE_BAZEL_VERSION=7.4.1
4 changes: 4 additions & 0 deletions drake_bazel_external/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: MIT-0

# Don't use bzlmod yet.
common --enable_workspace=true
common --enable_bzlmod=false

# Default to an optimized build.
build --compilation_mode=opt

Expand Down
1 change: 1 addition & 0 deletions drake_bazel_external/.github/setup
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -euxo pipefail

cd $(dirname "${BASH_SOURCE}")
sudo ./ubuntu_setup
sudo ../setup/install_bazelisk

cat > "${HOME}/.bazelrc" << EOF
startup --output_user_root=${WORKSPACE}/_bazel_${USER}
Expand Down
5 changes: 5 additions & 0 deletions drake_bazel_external/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ First, install the required Ubuntu packages:
sudo setup/install_prereqs
```

If you don't have already bazel or bazelisk already installed, install bazelisk:
```
sudo setup/install_bazelisk
```

Then, to build and test all apps:
```
bazel test //...
Expand Down
16 changes: 16 additions & 0 deletions drake_bazel_external/setup/install_bazelisk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# TODO(jwnimmer-tri) Drake's install_prereqs script should perform this
# install step for us, but it doesn't so we need this work-around in the
# meantime.

set -euxo pipefail

if [[ "${EUID:-}" -ne 0 ]]; then
echo 'This script must be run as root' >&2
exit 2
fi

wget -O bazelisk.deb \
https://github.com/bazelbuild/bazelisk/releases/download/v1.23.0/bazelisk-amd64.deb
dpkg -i bazelisk.deb
7 changes: 0 additions & 7 deletions drake_bazel_external/setup/install_prereqs
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,8 @@ echo -e "\ndrake VERSION.TXT: $(cat /opt/drake/share/doc/drake/VERSION.TXT)\n"

/opt/drake/share/drake/setup/install_prereqs

apt-get install --no-install-recommends gnupg

apt-key adv --fetch-keys https://bazel.build/bazel-release.pub.gpg
echo 'deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8' \
> /etc/apt/sources.list.d/bazel.list

apt-get update
apt-get install --no-install-recommends $(cat <<EOF
bazel
cmake
default-jdk
file
Expand Down
7 changes: 0 additions & 7 deletions drake_cmake_external/setup/install_prereqs
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,8 @@ echo -e "\ndrake VERSION.TXT: $(cat /opt/drake/share/doc/drake/VERSION.TXT)\n"

/opt/drake/share/drake/setup/install_prereqs

apt-get install --no-install-recommends gnupg

apt-key adv --fetch-keys https://bazel.build/bazel-release.pub.gpg
echo 'deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8' \
> /etc/apt/sources.list.d/bazel.list

apt-get update
apt-get install --no-install-recommends $(cat <<EOF
bazel
cmake
default-jdk
file
Expand Down
12 changes: 8 additions & 4 deletions private/test/file_sync_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@
"drake_cmake_installed/LICENSE",
"drake_cmake_installed_apt/LICENSE",
),
(
"drake_bazel_external/.github/setup",
"drake_cmake_external/.github/setup",
),
(
"drake_bazel_external/setup/install_prereqs",
"drake_cmake_external/setup/install_prereqs",
),
(
"drake_bazel_download/.bazeliskrc",
"drake_bazel_external/.bazeliskrc",
),
(
"drake_bazel_download/setup/install_bazelisk",
"drake_bazel_external/setup/install_bazelisk",
),
)

found_errors = False
Expand Down
Loading