Skip to content

Commit

Permalink
Lint, fix mac build (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjreiniger authored Jun 19, 2023
1 parent 4cd34b0 commit bcbc5d2
Show file tree
Hide file tree
Showing 16 changed files with 126 additions and 68 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: "test", 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: "test", 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-opencv//... || true
- run: bazel ${{ matrix.bazel_options }} build -k ${{ matrix.config }} @bzlmodrio-opencv//...
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_opencv_dependencies",
srcs = ["get_opencv_dependencies.py"],
Expand Down
2 changes: 2 additions & 0 deletions libraries/cpp/opencv/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 = "opencv",
actual = ":shared",
Expand Down
2 changes: 2 additions & 0 deletions libraries/java/opencv/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_import")

java_import(
name = "opencv",
jars = ["@edu_wpi_first_thirdparty_frc2023_opencv_opencv_java//jar:file"],
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
Loading

0 comments on commit bcbc5d2

Please sign in to comment.