Skip to content

Commit 73e8bd3

Browse files
authored
Auto generation updates (#3)
* Update versions * Version update * Update gen * Update versions * Update deprecation flags * Update autogen * Update autogen * Update autogen * Gen stuff * Gen stuff * Add auto update ability * lint
1 parent 5c5bb39 commit 73e8bd3

File tree

12 files changed

+194
-28
lines changed

12 files changed

+194
-28
lines changed

.bazelrc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,45 @@
11
try-import user.bazelrc
22

3+
# build --javacopt=-Werror
4+
build --javacopt=-Xlint:all,-serial,-processing,-options
5+
36
# Windows
7+
build:windows --copt=/W3
8+
build:windows --copt=/WX
49
build:windows --copt=/std:c++20
510
build:windows --copt=/Zc:preprocessor
611
build:windows --copt=/wd5105
12+
build:windows --cxxopt=/wd4267
13+
build:windows --cxxopt=/wd4244
714

815
# Windows Arm
16+
build:windows_arm --copt=/W3
17+
build:windows_arm --copt=/WX
918
build:windows_arm --copt=/std:c++20
1019
build:windows_arm --copt=/Zc:preprocessor
1120
build:windows_arm --copt=/wd5105
21+
build:windows_arm --cxxopt=/wd4267
22+
build:windows_arm --cxxopt=/wd4244
1223
build:windows_arm --cpu=x64_arm64_windows
1324

1425
# Linux
26+
build:linux --copt=-Wall
27+
build:linux --copt=-Wextra
28+
build:linux --copt=-Werror
1529
build:linux --copt=-std=c++20
1630
build:linux --linkopt=-pthread
1731

1832
# MacOS
33+
build:macos --copt=-Wall
34+
build:macos --copt=-Wextra
35+
build:macos --copt=-Werror
1936
build:macos --copt=-std=c++20
37+
build:macos --cxxopt=-Wno-unused-parameter
38+
build:macos --cxxopt=-Wno-error=deprecated-declarations
39+
build:macos --cxxopt=-Wno-error=deprecated-enum-enum-conversion
40+
build:macos --cxxopt=-Wno-error=deprecated-anon-enum-enum-conversion
41+
build:macos --cxxopt=-Wno-error=inconsistent-missing-override
42+
build:macos --cxxopt=-Wno-error=overloaded-virtual
2043

2144
# Roborio
2245
build:roborio --incompatible_enable_cc_toolchain_resolution

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.2.1
1+
6.3.2

.github/workflows/auto_update.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Auto Update
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
# Check on Mondays and Thursdays
6+
- cron: '0 0 * * 1,4'
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
auto_update_module:
14+
name: "Auto Update Module"
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Set up Go 1.20.x
18+
uses: actions/setup-go@v4
19+
with:
20+
go-version: 1.20.x
21+
id: go
22+
23+
- uses: actions/checkout@v3
24+
25+
- name: Install Buildifier
26+
run: |
27+
cd $(mktemp -d)
28+
GO111MODULE=on go install github.com/bazelbuild/buildtools/buildifier@latest
29+
30+
# Checkout repository
31+
- uses: actions/checkout@v3
32+
with:
33+
path: libraries/rules_bzlmodrio_toolchains
34+
35+
# Checkout gentool
36+
- uses: actions/checkout@v3
37+
with:
38+
repository: 'bzlmodRio/gentool.git'
39+
fetch-depth: 0
40+
path: gentool
41+
ref: refactor_dev
42+
43+
44+
- name: Setup Cache
45+
uses: actions/cache@v3
46+
with:
47+
path: |
48+
~/bzlmod_cache/*.sha256
49+
key: ${{ runner.os }}-${{ hashFiles('**/generate/**') }}
50+
restore-keys: |
51+
${{ runner.os }}-
52+
${{ runner.os }}
53+
54+
# Run update
55+
- name: Run update
56+
run: bazel run //:auto_update
57+
working-directory: libraries/rules_bzlmodrio_toolchains/generate
58+
59+
- name: Generate if changed
60+
run: |
61+
if [[ $(git --no-pager diff --exit-code HEAD) != '' ]]; then
62+
echo "Something changed, need to re-generate"
63+
bazel run //:generate
64+
buildifier -warnings all --lint=fix -r ..
65+
else
66+
echo "No changes!"
67+
fi;
68+
working-directory: libraries/rules_bzlmodrio_toolchains/generate
69+
70+
- name: Store new version
71+
run: echo "NEW_VERSION=$(bazel run //:get_version)" >> $GITHUB_ENV
72+
working-directory: libraries/rules_bzlmodrio_toolchains/generate
73+
74+
# Create pull requests
75+
- name: Create Pull Request
76+
uses: peter-evans/create-pull-request@v4
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.AUTO_UPDATE_KEY }}
79+
with:
80+
path: libraries/rules_bzlmodrio_toolchains
81+
base: main
82+
token: ${{ secrets.AUTO_UPDATE_KEY }}
83+
reviewers: pjreiniger
84+
branch: autoupdate_${{ env.NEW_VERSION }}
85+
title: "Auto Update to '${{ env.NEW_VERSION }}'"

.github/workflows/build.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
matrix:
1313
include:
1414
# Build standard, native
15-
- { name: "windows - native", os: windows-2019, command: "test", config: "--config=windows", bazel_options: "--output_user_root=C:\\bazelroot", }
15+
- { name: "windows - native", os: windows-2022, command: "test", config: "--config=windows", bazel_options: "--output_user_root=C:\\bazelroot", }
1616
- { name: "ubuntu - native", os: ubuntu-latest, command: "test", config: "--config=linux", bazel_options: "", }
1717
- { name: "macos - native", os: macos-latest, command: "test", config: "--config=macos", bazel_options: "", }
1818

1919
# Build bzlmod, native
20-
- { name: "windows - bzlmod native", os: windows-2019, command: "test", config: "--enable_bzlmod --config=windows", bazel_options: "--output_user_root=C:\\bazelroot", }
20+
- { name: "windows - bzlmod native", os: windows-2022, command: "test", config: "--enable_bzlmod --config=windows", bazel_options: "--output_user_root=C:\\bazelroot", }
2121
- { name: "ubuntu - bzlmod native", os: ubuntu-latest, command: "test", config: "--enable_bzlmod --config=linux", bazel_options: "", }
2222
- { name: "macos - bzlmod native", os: macos-latest, command: "test", config: "--enable_bzlmod --config=macos", bazel_options: "", }
2323

@@ -26,6 +26,7 @@ jobs:
2626
steps:
2727
- uses: actions/checkout@v3
2828
- uses: actions/setup-python@v4
29+
with: { python-version: '3.10.8' }
2930
- run: bazel ${{ matrix.bazel_options }} build -k ${{ matrix.config }} --config=remote @rules_bzlmodrio_toolchains//...
3031
working-directory: tests
3132
- run: bazel ${{ matrix.bazel_options }} build -k ${{ matrix.config }} --verbose_failures --config=remote //... || true
@@ -40,19 +41,20 @@ jobs:
4041
matrix:
4142
include:
4243
# Build standard, roborio
43-
- { name: "windows - roborio", os: windows-2019, command: "build", config: "--config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
44+
- { name: "windows - roborio", os: windows-2022, command: "build", config: "--config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
4445
- { name: "ubuntu - roborio", os: ubuntu-latest, command: "build", config: "--config=roborio", bazel_options: "", }
4546
- { name: "macos - roborio", os: macos-latest, command: "build", config: "--config=roborio", bazel_options: "", }
4647

4748
# Build bzlmod, roborio
48-
# - { name: "windows - bzlmod roborio", os: windows-2019, command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
49+
# - { name: "windows - bzlmod roborio", os: windows-2022, command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
4950
- { name: "ubuntu - bzlmod roborio", os: ubuntu-latest, command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "", }
5051
- { name: "macos - bzlmod roborio", os: macos-latest, command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "", }
5152
name: "Build - ${{ matrix.name }}"
5253
runs-on: ${{ matrix.os }}
5354
steps:
5455
- uses: actions/checkout@v3
5556
- uses: actions/setup-python@v4
57+
with: { python-version: '3.10.8' }
5658
- name: Build and allow failure # TODO Sometimes symlinks don't get created correctly the first time around
5759
run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote || true
5860
working-directory: tests
@@ -65,19 +67,20 @@ jobs:
6567
matrix:
6668
include:
6769
# Build standard, bullseye32
68-
- { name: "windows - bullseye32", os: windows-2019, command: "build", config: "--config=bullseye32", bazel_options: "--output_user_root=C:\\bazelroot", }
70+
- { name: "windows - bullseye32", os: windows-2022, command: "build", config: "--config=bullseye32", bazel_options: "--output_user_root=C:\\bazelroot", }
6971
- { name: "ubuntu - bullseye32", os: ubuntu-latest, command: "build", config: "--config=bullseye32", bazel_options: "", }
7072
- { name: "macos - bullseye32", os: macos-latest, command: "build", config: "--config=bullseye32", bazel_options: "", }
7173

7274
# Build bzlmod, bullseye32
73-
- { name: "windows - bzlmod bullseye32", os: windows-2019, command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "--output_user_root=C:\\bazelroot", }
75+
- { name: "windows - bzlmod bullseye32", os: windows-2022, command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "--output_user_root=C:\\bazelroot", }
7476
- { name: "ubuntu - bzlmod bullseye32", os: ubuntu-latest, command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "", }
7577
- { name: "macos - bzlmod bullseye32", os: macos-latest, command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "", }
7678
name: "Build - ${{ matrix.name }}"
7779
runs-on: ${{ matrix.os }}
7880
steps:
7981
- uses: actions/checkout@v3
8082
- uses: actions/setup-python@v4
83+
with: { python-version: '3.10.8' }
8184
- name: Build and allow failure # TODO Sometimes symlinks don't get created correctly the first time around
8285
run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote || true
8386
working-directory: tests
@@ -91,19 +94,20 @@ jobs:
9194
matrix:
9295
include:
9396
# Build standard, bullseye32:
94-
- { name: "windows - bullseye64", os: windows-2019, command: "build", config: "--config=bullseye64", bazel_options: "--output_user_root=C:\\bazelroot", }
97+
- { name: "windows - bullseye64", os: windows-2022, command: "build", config: "--config=bullseye64", bazel_options: "--output_user_root=C:\\bazelroot", }
9598
- { name: "ubuntu - bullseye64", os: ubuntu-latest, command: "build", config: "--config=bullseye64", bazel_options: "", }
9699
- { name: "macos - bullseye64", os: macos-latest, command: "build", config: "--config=bullseye32", bazel_options: "", }
97100

98101
# Build bzlmod, bullseye32:
99-
- { name: "windows - bzlmod bullseye64", os: windows-2019, command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "--output_user_root=C:\\bazelroot", }
102+
- { name: "windows - bzlmod bullseye64", os: windows-2022, command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "--output_user_root=C:\\bazelroot", }
100103
- { name: "ubuntu - bzlmod bullseye64", os: ubuntu-latest, command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "", }
101104
- { name: "macos - bzlmod bullseye64", os: macos-latest, command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "", }
102105
name: "Build - ${{ matrix.name }}"
103106
runs-on: ${{ matrix.os }}
104107
steps:
105108
- uses: actions/checkout@v3
106109
- uses: actions/setup-python@v4
110+
with: { python-version: '3.10.8' }
107111
- name: Build and allow failure # TODO Sometimes symlinks don't get created correctly the first time around
108112
run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote || true
109113
working-directory: tests
@@ -118,12 +122,12 @@ jobs:
118122
matrix:
119123
include:
120124
# Build standard, bullseye32:
121-
- { name: "windows - raspi32", os: windows-2019, command: "build", config: "--config=raspi32", bazel_options: "--output_user_root=C:\\bazelroot", }
125+
- { name: "windows - raspi32", os: windows-2022, command: "build", config: "--config=raspi32", bazel_options: "--output_user_root=C:\\bazelroot", }
122126
- { name: "ubuntu - raspi32", os: ubuntu-latest, command: "build", config: "--config=raspi32", bazel_options: "", }
123127
- { name: "macos - raspi32", os: macos-latest, command: "build", config: "--config=raspi32", bazel_options: "", }
124128

125129
# Build bzlmod, bullseye32:
126-
- { name: "windows - bzlmod raspi32", os: windows-2019, command: "build", config: "--enable_bzlmod --config=raspi32", bazel_options: "--output_user_root=C:\\bazelroot", }
130+
- { name: "windows - bzlmod raspi32", os: windows-2022, command: "build", config: "--enable_bzlmod --config=raspi32", bazel_options: "--output_user_root=C:\\bazelroot", }
127131
- { name: "ubuntu - bzlmod raspi32", os: ubuntu-latest, command: "build", config: "--enable_bzlmod --config=raspi32", bazel_options: "", }
128132
- { name: "macos - bzlmod raspi32", os: macos-latest, command: "build", config: "--enable_bzlmod --config=raspi32", bazel_options: "", }
129133
name: "Build - ${{ matrix.name }}"

.github/workflows/lint.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
lint_python:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v3
1010
- uses: psf/black@stable
1111
wpiformat:
1212
name: "wpiformat"
@@ -18,9 +18,8 @@ jobs:
1818
git fetch origin main
1919
git branch -f main origin/main
2020
if: github.ref != 'refs/heads/main'
21-
- uses: actions/setup-python@v2
22-
with:
23-
python-version: '3.10.8'
21+
- uses: actions/setup-python@v4
22+
with: { python-version: '3.10.8' }
2423
- name: Install clang-format
2524
run: |
2625
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
base: refactor_dev
6969
token: ${{ secrets.AUTO_UPDATE_KEY }}
7070
reviewers: pjreiniger
71-
branch: autoupdate/rules_bzlmodrio_toolchains_update
71+
branch: autoupdate/rules_bzlmodrio_toolchains_update_${{ env.NEW_VERSION }}
7272
title: "Auto Update rules_bzlmodrio_toolchains module to '${{ env.NEW_VERSION }}'"
7373

7474
- name: Create BCR Pull Request
@@ -80,5 +80,5 @@ jobs:
8080
base: bzlmodrio
8181
token: ${{ secrets.AUTO_UPDATE_KEY }}
8282
reviewers: pjreiniger
83-
branch: autoupdate/rules_bzlmodrio_toolchains_update
83+
branch: autoupdate/rules_bzlmodrio_toolchains_update_${{ env.NEW_VERSION }}
8484
title: "Auto Update latest rules_bzlmodrio_toolchains to '${{ env.NEW_VERSION }}'"

MODULE.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ module(
44
compatibility_level = 2023,
55
)
66

7-
bazel_dep(name = "platforms", version = "0.0.6")
8-
bazel_dep(name = "rules_cc", version = "0.0.6")
7+
bazel_dep(name = "platforms", version = "0.0.7")
8+
bazel_dep(name = "rules_cc", version = "0.0.8")
99
bazel_dep(name = "bazel_skylib", version = "1.4.2")
1010

1111
deps = use_extension("//:maven_deps.bzl", "deps")

generate/auto_update.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import os
2+
import re
3+
from bazelrio_gentool.auto_update_utils import get_latest_tag, split_tag
4+
5+
6+
def main():
7+
latest_tag = get_latest_tag("wpilibsuite", "opensdk")
8+
9+
overall_year, overall_version = latest_tag[1:].split("-")
10+
11+
SCRIPT_DIR = os.environ["BUILD_WORKSPACE_DIRECTORY"]
12+
13+
file_to_replace = os.path.join(SCRIPT_DIR, "get_toolchain_dependencies.py")
14+
15+
with open(file_to_replace, "r") as f:
16+
contents = f.read()
17+
18+
contents = re.sub(
19+
'( +)overall_year = "(.*)"', f'\\1overall_year = "{overall_year}"', contents
20+
)
21+
contents = re.sub(
22+
'( +)overall_version = f?"(.*)"',
23+
f'\\1overall_version = "{overall_version}"',
24+
contents,
25+
)
26+
27+
with open(file_to_replace, "w") as f:
28+
f.write(contents)
29+
30+
31+
if __name__ == "__main__":
32+
main()

tests/.bazelrc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,45 @@
11
try-import user.bazelrc
22

3+
# build --javacopt=-Werror
4+
build --javacopt=-Xlint:all,-serial,-processing,-options
5+
36
# Windows
7+
build:windows --copt=/W3
8+
build:windows --copt=/WX
49
build:windows --copt=/std:c++20
510
build:windows --copt=/Zc:preprocessor
611
build:windows --copt=/wd5105
12+
build:windows --cxxopt=/wd4267
13+
build:windows --cxxopt=/wd4244
714

815
# Windows Arm
16+
build:windows_arm --copt=/W3
17+
build:windows_arm --copt=/WX
918
build:windows_arm --copt=/std:c++20
1019
build:windows_arm --copt=/Zc:preprocessor
1120
build:windows_arm --copt=/wd5105
21+
build:windows_arm --cxxopt=/wd4267
22+
build:windows_arm --cxxopt=/wd4244
1223
build:windows_arm --cpu=x64_arm64_windows
1324

1425
# Linux
26+
build:linux --copt=-Wall
27+
build:linux --copt=-Wextra
28+
build:linux --copt=-Werror
1529
build:linux --copt=-std=c++20
1630
build:linux --linkopt=-pthread
1731

1832
# MacOS
33+
build:macos --copt=-Wall
34+
build:macos --copt=-Wextra
35+
build:macos --copt=-Werror
1936
build:macos --copt=-std=c++20
37+
build:macos --cxxopt=-Wno-unused-parameter
38+
build:macos --cxxopt=-Wno-error=deprecated-declarations
39+
build:macos --cxxopt=-Wno-error=deprecated-enum-enum-conversion
40+
build:macos --cxxopt=-Wno-error=deprecated-anon-enum-enum-conversion
41+
build:macos --cxxopt=-Wno-error=inconsistent-missing-override
42+
build:macos --cxxopt=-Wno-error=overloaded-virtual
2043

2144
# Roborio
2245
build:roborio --incompatible_enable_cc_toolchain_resolution

tests/.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.2.1
1+
6.3.2

0 commit comments

Comments
 (0)