Skip to content

Commit

Permalink
Lint, fix mac builds (#2)
Browse files Browse the repository at this point in the history
* Buildifier

* Update gen

* More gen

* More gen

* Fix bad gen

* Fix windows
  • Loading branch information
pjreiniger authored Jun 19, 2023
1 parent 3a18d45 commit 86f8bef
Show file tree
Hide file tree
Showing 16 changed files with 99 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.2.0
6.2.1
9 changes: 5 additions & 4 deletions .github/workflows/auto_update.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Auto Update
on:
push:
branches-ignore:
- 'autoupdate'
workflow_dispatch:
schedule:
# Check on Mondays and Thursdays
- cron: '0 0 * * 1,4'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
Expand Down Expand Up @@ -61,7 +62,7 @@ jobs:
if [[ $(git --no-pager diff --exit-code HEAD) != '' ]]; then
echo "Something changed, need to re-generate"
bazel run //:generate
buildifier --lint=fix -r ..
buildifier -warnings all --lint=fix -r ..
else
echo "No changes!"
fi;
Expand Down
32 changes: 17 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,23 @@ jobs:
matrix:
include:
# Build standard, native
- { name: "windows - native", os: windows-latest, command: "test", config: "--config=windows", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "windows - native", os: windows-2019, command: "test", config: "--config=windows", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - native", os: ubuntu-latest, command: "test", config: "--config=linux", bazel_options: "", }
- { name: "macos - native", os: macos-latest, command: "build", config: "--config=macos --test_tag_filters=-bazelrio-cpp-test", bazel_options: "", }
- { name: "macos - native", os: macos-latest, command: "test", config: "--config=macos", bazel_options: "", }

# Build bzlmod, native
- { name: "windows - bzlmod native", os: windows-latest, command: "test", config: "--enable_bzlmod --config=windows", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "windows - bzlmod native", os: windows-2019, command: "test", config: "--enable_bzlmod --config=windows", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod native", os: ubuntu-latest, command: "test", config: "--enable_bzlmod --config=linux", bazel_options: "", }
- { name: "macos - bzlmod native", os: macos-latest, command: "build", config: "--enable_bzlmod --config=macos --test_tag_filters=-bazelrio-cpp-test", bazel_options: "", }
- { name: "macos - bzlmod native", os: macos-latest, command: "test", config: "--enable_bzlmod --config=macos", bazel_options: "", }

name: "Build - ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- run: bazel ${{ matrix.bazel_options }} build -k ${{ matrix.config }} --verbose_failures --config=remote //... @bzlmodrio-ni//... || true
- run: bazel ${{ matrix.bazel_options }} build -k ${{ matrix.config }} @bzlmodrio-ni//...
working-directory: tests
- run: bazel ${{ matrix.bazel_options }} build -k ${{ matrix.config }} --verbose_failures --config=remote //... || true
working-directory: tests
- run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote
working-directory: tests
Expand All @@ -38,12 +40,12 @@ jobs:
matrix:
include:
# Build standard, roborio
- { name: "windows - roborio", os: windows-latest, command: "build", config: "--config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "windows - roborio", os: windows-2019, command: "build", config: "--config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - roborio", os: ubuntu-latest, command: "build", config: "--config=roborio", bazel_options: "", }
- { name: "macos - roborio", os: macos-latest, command: "build", config: "--config=roborio", bazel_options: "", }

# Build bzlmod, roborio
# - { name: "windows - bzlmod roborio", os: windows-latest, command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
# - { name: "windows - bzlmod roborio", os: windows-2019, command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod roborio", os: ubuntu-latest, command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "", }
- { name: "macos - bzlmod roborio", os: macos-latest, command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "", }
name: "Build - ${{ matrix.name }}"
Expand All @@ -63,14 +65,14 @@ jobs:
matrix:
include:
# Build standard, bullseye32
- { name: "windows - bullseye32", os: windows-latest, command: "build", config: "--config=bullseye32", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "windows - bullseye32", os: windows-2019, command: "build", config: "--config=bullseye32", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bullseye32", os: ubuntu-latest, command: "build", config: "--config=bullseye32", bazel_options: "", }
# - { name: "macos - bullseye32", os: macos-latest, command: "build", config: "--config=bullseye32", bazel_options: "", }
- { name: "macos - bullseye32", os: macos-latest, command: "build", config: "--config=bullseye32", bazel_options: "", }

# Build bzlmod, bullseye32
# - { name: "windows - bzlmod bullseye32", os: windows-latest, command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "windows - bzlmod bullseye32", os: windows-2019, command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod bullseye32", os: ubuntu-latest, command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "", }
# - { name: "macos - bzlmod bullseye32", os: macos-latest, command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "", }
- { name: "macos - bzlmod bullseye32", os: macos-latest, command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "", }
name: "Build - ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -89,14 +91,14 @@ jobs:
matrix:
include:
# Build standard, bullseye32:
- { name: "windows - bullseye64", os: windows-latest, command: "build", config: "--config=bullseye64", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "windows - bullseye64", os: windows-2019, command: "build", config: "--config=bullseye64", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bullseye64", os: ubuntu-latest, command: "build", config: "--config=bullseye64", bazel_options: "", }
# - { name: "macos - bullseye64", os: macos-latest, command: "build", config: "--config=bullseye32", bazel_options: "", }
- { name: "macos - bullseye64", os: macos-latest, command: "build", config: "--config=bullseye32", bazel_options: "", }

# Build bzlmod, bullseye32:
# - { name: "windows - bzlmod bullseye64", os: windows-latest, command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "windows - bzlmod bullseye64", os: windows-2019, command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod bullseye64", os: ubuntu-latest, command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "", }
# - { name: "macos - bzlmod bullseye64", os: macos-latest, command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "", }
- { name: "macos - bzlmod bullseye64", os: macos-latest, command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "", }
name: "Build - ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
GO111MODULE=on go get github.com/bazelbuild/buildtools/[email protected]
- name: Run buildifier
run: buildifier --lint=fix -r .
run: buildifier -warnings all --lint=fix -r .

- name: Check Output
run: git --no-pager diff --exit-code HEAD
Expand Down
3 changes: 2 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ module(
)

bazel_dep(name = "platforms", version = "0.0.6")
bazel_dep(name = "rules_java", version = "5.5.0")
bazel_dep(name = "rules_cc", version = "0.0.6")
bazel_dep(name = "rules_java", version = "6.0.0")
bazel_dep(name = "rules_bazelrio", version = "0.0.10")
bazel_dep(name = "rules_bzlmodrio_toolchains", version = "2023-7")

Expand Down
2 changes: 2 additions & 0 deletions generate/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_python//python:defs.bzl", "py_binary", "py_library")

py_library(
name = "get_ni_dependencies",
srcs = ["get_ni_dependencies.py"],
Expand Down
2 changes: 2 additions & 0 deletions libraries/cpp/ni/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_cc//cc:defs.bzl", "cc_library")

alias(
name = "ni",
actual = ":shared",
Expand Down
35 changes: 26 additions & 9 deletions maven_cpp_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,43 @@ cc_library(
"""

cc_library_shared = """
static_srcs = glob(["**/*.lib", "**/*.a"], exclude=["**/*jni.lib"])
shared_srcs = glob(["**/*.dll", "**/*.so*", "**/*.dylib"], exclude=["**/*jni.dll", "**/*jni.so", "**/*.so.debug", "**/libopencv_java*.dylib"])
shared_jni_srcs = glob(["**/*jni.dll", "**/*jni.so*", "**/*.jni.dylib", "**/libopencv_java*.dylib"], exclude=["**/*.so.debug"])
JNI_PATTERN=[
"**/*jni.dll",
"**/*jni.so*",
"**/*jni.dylib",
"**/*_java*.dll",
"**/lib*_java*.dylib",
"**/lib*_java*.so",
]
cc_library(
static_srcs = glob([
"**/*.lib",
"**/*.a"
],
exclude=["**/*jni.lib"]
)
shared_srcs = glob([
"**/*.dll",
"**/*.so*",
"**/*.dylib",
],
exclude=JNI_PATTERN + ["**/*.so.debug"]
)
shared_jni_srcs = glob(JNI_PATTERN, exclude=["**/*.so.debug"])
filegroup(
name = "static_libs",
srcs = static_srcs,
visibility = ["//visibility:public"],
)
cc_library(
filegroup(
name = "shared_libs",
srcs = shared_srcs,
visibility = ["//visibility:public"],
deps = [
":static_libs",
]
)
cc_library(
filegroup(
name = "shared_jni_libs",
srcs = shared_jni_srcs,
visibility = ["//visibility:public"],
Expand Down
17 changes: 10 additions & 7 deletions private/cpp/chipobject/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
load("@rules_cc//cc:defs.bzl", "cc_library")

cc_library(
name = "shared",
linkstatic = 1,
srcs = select({
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@bazelrio_edu_wpi_first_ni-libraries_chipobject_linuxathena//:shared_libs"],
}),
target_compatible_with = select({
"@bazel_tools//src/conditions:darwin": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:linux_x86_64": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
"@rules_bzlmodrio_toolchains//constraints/is_bullseye32:bullseye32": ["@platforms//:incompatible"],
"@rules_bzlmodrio_toolchains//constraints/is_bullseye64:bullseye64": ["@platforms//:incompatible"],
"@rules_bzlmodrio_toolchains//constraints/is_raspi32:raspi32": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:linux_x86_64": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:darwin": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
visibility = ["@bzlmodrio-ni//:__subpackages__"],
deps = ["@bazelrio_edu_wpi_first_ni-libraries_chipobject_headers//:headers"] + select({
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@bazelrio_edu_wpi_first_ni-libraries_chipobject_linuxathena//:shared_libs"],
}),
deps = ["@bazelrio_edu_wpi_first_ni-libraries_chipobject_headers//:headers"],
alwayslink = 1,
)
17 changes: 10 additions & 7 deletions private/cpp/netcomm/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
load("@rules_cc//cc:defs.bzl", "cc_library")

cc_library(
name = "shared",
linkstatic = 1,
srcs = select({
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@bazelrio_edu_wpi_first_ni-libraries_netcomm_linuxathena//:shared_libs"],
}),
target_compatible_with = select({
"@bazel_tools//src/conditions:darwin": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:linux_x86_64": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
"@rules_bzlmodrio_toolchains//constraints/is_bullseye32:bullseye32": ["@platforms//:incompatible"],
"@rules_bzlmodrio_toolchains//constraints/is_bullseye64:bullseye64": ["@platforms//:incompatible"],
"@rules_bzlmodrio_toolchains//constraints/is_raspi32:raspi32": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:linux_x86_64": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:darwin": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
visibility = ["@bzlmodrio-ni//:__subpackages__"],
deps = ["@bazelrio_edu_wpi_first_ni-libraries_netcomm_headers//:headers"] + select({
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@bazelrio_edu_wpi_first_ni-libraries_netcomm_linuxathena//:shared_libs"],
}),
deps = ["@bazelrio_edu_wpi_first_ni-libraries_netcomm_headers//:headers"],
alwayslink = 1,
)
16 changes: 9 additions & 7 deletions private/cpp/runtime/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
load("@rules_cc//cc:defs.bzl", "cc_library")

cc_library(
name = "shared",
linkstatic = 1,
srcs = select({
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@bazelrio_edu_wpi_first_ni-libraries_runtime_linuxathena//:shared_libs"],
}),
target_compatible_with = select({
"@bazel_tools//src/conditions:darwin": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:linux_x86_64": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
"@rules_bzlmodrio_toolchains//constraints/is_bullseye32:bullseye32": ["@platforms//:incompatible"],
"@rules_bzlmodrio_toolchains//constraints/is_bullseye64:bullseye64": ["@platforms//:incompatible"],
"@rules_bzlmodrio_toolchains//constraints/is_raspi32:raspi32": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:linux_x86_64": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:darwin": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
visibility = ["@bzlmodrio-ni//:__subpackages__"],
deps = select({
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@bazelrio_edu_wpi_first_ni-libraries_runtime_linuxathena//:shared_libs"],
}),
alwayslink = 1,
)
17 changes: 10 additions & 7 deletions private/cpp/visa/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
load("@rules_cc//cc:defs.bzl", "cc_library")

cc_library(
name = "shared",
linkstatic = 1,
srcs = select({
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@bazelrio_edu_wpi_first_ni-libraries_visa_linuxathena//:shared_libs"],
}),
target_compatible_with = select({
"@bazel_tools//src/conditions:darwin": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:linux_x86_64": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
"@rules_bzlmodrio_toolchains//constraints/is_bullseye32:bullseye32": ["@platforms//:incompatible"],
"@rules_bzlmodrio_toolchains//constraints/is_bullseye64:bullseye64": ["@platforms//:incompatible"],
"@rules_bzlmodrio_toolchains//constraints/is_raspi32:raspi32": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:linux_x86_64": ["@platforms//:incompatible"],
"@bazel_tools//src/conditions:darwin": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
visibility = ["@bzlmodrio-ni//:__subpackages__"],
deps = ["@bazelrio_edu_wpi_first_ni-libraries_visa_headers//:headers"] + select({
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@bazelrio_edu_wpi_first_ni-libraries_visa_linuxathena//:shared_libs"],
}),
deps = ["@bazelrio_edu_wpi_first_ni-libraries_visa_headers//:headers"],
alwayslink = 1,
)
2 changes: 1 addition & 1 deletion private/non_bzlmod_dependencies/setup_dependencies.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@bzlmodrio-ni//:maven_cpp_deps.bzl", "setup_legacy_bzlmodrio_ni_cpp_dependencies")
load("@rules_bazelrio//:nonbzlmod_setup.bzl", "setup_rules_bazelrio")
load("@rules_bzlmodrio_toolchains//:maven_deps.bzl", "setup_legacy_setup_toolchains_dependencies")
load("@rules_bzlmodrio_toolchains//toolchains:load_toolchains.bzl", "load_toolchains")
load("@rules_bazelrio//:nonbzlmod_setup.bzl", "setup_rules_bazelrio")

def _setup_toolchains():
setup_legacy_setup_toolchains_dependencies()
Expand Down
2 changes: 1 addition & 1 deletion tests/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.2.0
6.2.1
1 change: 1 addition & 0 deletions tests/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local_path_override(

bazel_dep(name = "googletest", version = "1.12.1")
bazel_dep(name = "rules_cc", version = "0.0.6")
bazel_dep(name = "rules_java", version = "6.0.0")
bazel_dep(name = "rules_jvm_external", version = "5.2")
bazel_dep(name = "rules_bazelrio", version = "0.0.10")
bazel_dep(name = "rules_bzlmodrio_toolchains", version = "2023-7")
Expand Down
1 change: 1 addition & 0 deletions tests/cpp/ni/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
load("@rules_wpi_styleguide//styleguide:cc_styleguide.bzl", "cc_styleguide")

cc_binary(
Expand Down

0 comments on commit 86f8bef

Please sign in to comment.