diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7a37122fcc..968d6795f9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: multiplatform-build: strategy: matrix: - platform: [ ubuntu-22.04, ubuntu-24.04-arm ] + platform: [ ubuntu-24.04-arm ] name: Ubuntu Alternate Builds runs-on: ${{ matrix.platform }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 5788e3bc80..c6b10a2c5f 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -14,7 +14,7 @@ concurrency: jobs: formatting-check: name: Formatting and FSM diagram generation with pre-commit-ci-lite - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 if: github.event.pull_request.draft == false steps: # checks-out the repository under $GITHUB_WORKSPACE diff --git a/environment_setup/setup_software.sh b/environment_setup/setup_software.sh index a72c1b2253..c2c65d90ec 100755 --- a/environment_setup/setup_software.sh +++ b/environment_setup/setup_software.sh @@ -23,6 +23,11 @@ source util.sh g_arch=$(uname -m) # Global variable. No function should use this name. print_status_msg "Detected architecture: ${g_arch}" +if [[ $(lsb_release -rs) == "20.04" ]] || [[ $(lsb_release -rs) == "22.04" ]]; then + print_status_msg "This version of ubuntu is not supported anymore, please upgrade your OS version" + exit 1 +fi + print_status_msg "Installing Utilities and Dependencies" sudo apt-get update @@ -55,20 +60,13 @@ host_software_packages=( g++-10 kcachegrind # This lets us view the profiles output by callgrind libeigen3-dev # A math / numerical library used for things like linear regression - libprotobuf-dev libudev-dev libusb-1.0-0-dev libxcb-cursor0 # This is used as the Linux platform abstraction by Qt - protobuf-compiler # This is required for the "NanoPb" library, which does not - # properly manage this as a bazel dependency, so we have - # to manually install it ourselves python3.12 # Python 3 python3.12-dev # Python 3 headers python3.12-venv # Virtual Environment python3-pip # Required for bazel to install python dependencies for build targets - python3-protobuf # This is required for the "NanoPb" library, which does not - # properly manage this as a bazel dependency, so we have - # to manually install it ourselves python3-yaml # Load dynamic parameter configuration files valgrind # Checks for memory leaks libsqlite3-dev # needed to build Python 3 with sqlite support @@ -80,36 +78,16 @@ host_software_packages=( xvfb # used for CI to run GUI applications ) -if [[ $(lsb_release -rs) == "20.04" ]]; then - # This is required for bazel, we've seen some issues where - # the bazel install hasn't installed it properly - host_software_packages+=(python-is-python3) - - # This is to setup the toolchain for bazel to run - host_software_packages+=(clang) - host_software_packages+=(llvm-6.0) - host_software_packages+=(libclang-6.0-dev) - host_software_packages+=(libncurses5) - - # This fixes missing headers by notifying the linker - sudo ldconfig -fi - # Clear the download cache sudo rm -rf /tmp/tbots_download_cache mkdir /tmp/tbots_download_cache -if [[ $(lsb_release -rs) == "22.04" ]] || [[ $(lsb_release -rs) == "24.04" ]]; then +if [[ $(lsb_release -rs) == "24.04" ]]; then # This is required because a Braille TTY device that Linux provides a driver for conflicts with the ESP32 wget -nc https://github.com/UBC-Thunderbots/Software-External-Dependencies/blob/main/85-brltty.rules -O /tmp/tbots_download_cache/85-brltty.rules sudo mv /tmp/tbots_download_cache/85-brltty.rules /usr/lib/udev/rules.d/85-brltty.rules fi -if [[ $(lsb_release -rs) == "22.04" ]]; then - # This is required for clang-format - host_software_packages+=(libtinfo5) -fi - virtualenv_opt_args="" if [[ $(lsb_release -rs) == "24.04" ]]; then host_software_packages+=(python3-pyqt6) @@ -135,20 +113,11 @@ if ! sudo /usr/bin/python3.12 -m venv /opt/tbotspython $virtualenv_opt_args ; th exit 1 fi -if [[ $(lsb_release -rs) == "20.04" ]] || [[ $(lsb_release -rs) == "22.04" ]]; then - # Install pip if it is not a system-managed package - sudo /usr/bin/python3.12 -m ensurepip -fi - if ! sudo /opt/tbotspython/bin/python3 -m pip install --upgrade pip ; then print_status_msg "Error: Upgrading pip version in venv failed" exit 1 fi -if [[ $(lsb_release -rs) == "22.04" ]]; then - sudo /opt/tbotspython/bin/pip3 install -r ubuntu22_requirements.txt -fi - if [[ $(lsb_release -rs) == "24.04" ]]; then sudo /opt/tbotspython/bin/pip3 install -r ubuntu24_requirements.txt fi diff --git a/src/.bazelrc b/src/.bazelrc index 5f7bc6a27c..12ec7a0860 100644 --- a/src/.bazelrc +++ b/src/.bazelrc @@ -42,7 +42,7 @@ common --features=external_include_paths build --disk_cache=~/.cache/thunderbots_bazel_disk_cache build --experimental_remote_merkle_tree_cache # partial repo caching optimization -build --incompatible_enable_proto_toolchain_resolution # protoc caching +common --incompatible_enable_proto_toolchain_resolution # protoc caching # Ensure that we don't accidentally build gRPC common --per_file_copt=external/.*grpc.*@--GRPC_WAS_NOT_SUPPOSED_TO_BE_BUILT diff --git a/src/MODULE.bazel b/src/MODULE.bazel index e8c9f70171..b016c260d4 100644 --- a/src/MODULE.bazel +++ b/src/MODULE.bazel @@ -7,7 +7,6 @@ module( ############################################################## # Import Dependencies available in the Bazel Central Registry ############################################################## - bazel_dep(name = "googletest", version = "1.15.2") bazel_dep(name = "platforms", version = "0.0.11") bazel_dep(name = "pybind11_bazel", version = "2.13.6") @@ -15,11 +14,10 @@ bazel_dep(name = "bazel_skylib", version = "1.7.1") bazel_dep(name = "rules_pkg", version = "1.1.0") bazel_dep(name = "rules_foreign_cc", version = "0.14.0") bazel_dep(name = "rules_python", version = "1.4.1") -bazel_dep(name = "protobuf", version = "31.1") bazel_dep(name = "eigen", version = "3.4.0.bcr.3") -bazel_dep(name = "zlib", version = "1.3.1.bcr.5") -bazel_dep(name = "nanopb", version = "0.4.9.1") -bazel_dep(name = "toolchains_protoc", version = "0.4.1") +bazel_dep(name = "zlib", version = "1.3.1.bcr.6") +bazel_dep(name = "nanopb", version = "0.4.9.1.bcr.2") +bazel_dep(name = "protobuf", version = "31.1") bazel_dep(name = "rules_proto", version = "7.1.0") bazel_dep(name = "yaml-cpp", version = "0.8.0") bazel_dep(name = "buildifier_prebuilt", version = "8.0.3") @@ -79,18 +77,6 @@ use_repo(pip, "nanopb_deps") pybind11_configure = use_extension("@pybind11_bazel//:internal_configure.bzl", "internal_configure_extension") use_repo(pybind11_configure, "pybind11") -# Configure proto compiler optimization -# Optional: choose a version of protoc rather than the latest. -protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc") -protoc.toolchain( - # Creates a repository to satisfy well-known-types dependencies such as - # deps=["@com_google_protobuf//:any_proto"] - google_protobuf = "com_google_protobuf", - # Pin to any version of protoc - version = "v31.1", -) -use_repo(protoc, "com_google_protobuf", "toolchains_protoc_hub") - ########################################################################### # Setup non Bazel Central Registry dependencies & Non MODULE supported deps ########################################################################### diff --git a/src/MODULE.bazel.lock b/src/MODULE.bazel.lock index 9a86c5a12c..ce4bc12db9 100644 --- a/src/MODULE.bazel.lock +++ b/src/MODULE.bazel.lock @@ -83,8 +83,8 @@ "https://bcr.bazel.build/modules/jsoncpp/1.9.6/MODULE.bazel": "2f8d20d3b7d54143213c4dfc3d98225c42de7d666011528dc8fe91591e2e17b0", "https://bcr.bazel.build/modules/jsoncpp/1.9.6/source.json": "a04756d367a2126c3541682864ecec52f92cdee80a35735a3cb249ce015ca000", "https://bcr.bazel.build/modules/libpfm/4.11.0/MODULE.bazel": "45061ff025b301940f1e30d2c16bea596c25b176c8b6b3087e92615adbd52902", - "https://bcr.bazel.build/modules/nanopb/0.4.9.1/MODULE.bazel": "334e396616b40359425806bafdfaa0b3086b54298cf177e6b6a56af784d964bd", - "https://bcr.bazel.build/modules/nanopb/0.4.9.1/source.json": "7daaff82d4e698dfc6cdd0b8a22a71d65f2f3b7c4e176d67f92fecd6a6598532", + "https://bcr.bazel.build/modules/nanopb/0.4.9.1.bcr.2/MODULE.bazel": "4469b089354af0f478011cce5c94125d5e3cf2fda77329d4c16bf2da2e909bce", + "https://bcr.bazel.build/modules/nanopb/0.4.9.1.bcr.2/source.json": "c380d80450c09ccaf0537ac755897a471a6d4fb5a79e4d6d648789387a63ca08", "https://bcr.bazel.build/modules/nlohmann_json/3.6.1/MODULE.bazel": "6f7b417dcc794d9add9e556673ad25cb3ba835224290f4f848f8e2db1e1fca74", "https://bcr.bazel.build/modules/nlohmann_json/3.6.1/source.json": "f448c6e8963fdfa7eb831457df83ad63d3d6355018f6574fb017e8169deb43a9", "https://bcr.bazel.build/modules/platforms/0.0.10/MODULE.bazel": "8cb8efaf200bdeb2150d93e162c40f388529a25852b332cec879373771e48ed5", diff --git a/src/starlark/nanopb/nanopb.bzl b/src/starlark/nanopb/nanopb.bzl index 13c9cf203f..83fc6bf648 100644 --- a/src/starlark/nanopb/nanopb.bzl +++ b/src/starlark/nanopb/nanopb.bzl @@ -3,11 +3,6 @@ load("@platformio_rules//platformio:platformio.bzl", "PlatformIOLibraryInfo") # This file is heavily referencing platformio.bzl from rules_platformio project # https://github.com/mum4k/platformio_rules -# This rule is an adapter between proto_library + nanopb for the platformio_library -# There is a similar rule: cc_nanopb_proto_library from nanopb natively which does something similar -# However, platformio_rules do not support cc_library due to the way cross compiling works in platformio for -# embedded systems (cc_library compiles srcs to .so/.a files which is not supported the same way by platformio). - load("@rules_proto//proto:defs.bzl", "ProtoInfo") # The relative filename of the header file. @@ -25,22 +20,35 @@ _COPY_COMMAND = "cp {source} {destination}" # that the zipped path starts at lib/. _ZIP_COMMAND = "cd {output_dir} && zip -qq -r -u {zip_filename} lib/" -def _nanopb_proto_library_impl(ctx): - # This is the folder we will place all our generation artifacts in - # - # Because we need to generate the `.c` and `.h` files for all the proto files required - # for this library, including all the transitive dependencies, we would like to - # generate these in the same folder as each proto file. However bazel will not - # permit us to modify/produce files outside the folder that this rule is called from. - # We get around this be reproducing the folder structure under a generation folder - # and adding the root of this directory as an include path. - # +def _generate_output_dirs(ctx): + """ + This helper creates the folder we will place all our generation artifacts in and its corresponding path. + + Because we need to generate the `.c` and `.h` files for all the proto files required + for this library, including all the transitive dependencies, we would like to + generate these in the same folder as each proto file. However bazel will not + permit us to modify/produce files outside the folder that this rule is called from. + We get around this be reproducing the folder structure under a generation folder + and adding the root of this directory as an include path. + + :param ctx: The context to refer to + :return: generation_folder_name, generated_folder_abs_path(path to generation_folder_name) + """ generation_folder_name = ctx.attr.name + "_nanopb_gen/" generated_folder_abs_path = ctx.genfiles_dir.path + "/" + \ ctx.build_file_path[:-len("BUILD")] + generation_folder_name - - # Generate import flags for the protobuf compiler so it can find proto files we - # depend on, and a list of proto files to include + return generation_folder_name, generated_folder_abs_path + +def _collect_deps(ctx): + """ + Generate import flags for the protobuf compiler so it can find proto files we + depend on, and a list of proto files to include + + :param ctx: The context to refer to + :return: + all_proto_files - depset of proto files meant for compilation + all_proto_include_dirs - depset of paths for transitive deps to be linked + """ all_proto_files = depset() all_proto_include_dirs = depset() for dep in ctx.attr.deps: @@ -50,15 +58,42 @@ def _nanopb_proto_library_impl(ctx): all_proto_include_dirs = depset( transitive = [all_proto_include_dirs, dep[ProtoInfo].transitive_proto_path], ) + return all_proto_files, all_proto_include_dirs - # See https://jpa.kapsi.fi/nanopb/docs/reference.html#proto-file-options - # Section "Defining the options in a .options file" for more information - # on nanopb option files - all_options_map = {} +def _collect_compile_options(ctx, all_options_map): + """ + Populates the given map with any nanopb/proto options types. + + See https://jpa.kapsi.fi/nanopb/docs/reference.html#proto-file-options + Section "Defining the options in a .options file" for more information + on nanopb option files + :param all_options_map: Map to populate with options + """ for opt_file in ctx.files.options: opt_basename = opt_file.basename[:-len(".options")] all_options_map[opt_basename] = opt_file +def _compile_protos_for_nanopb( + ctx, + all_proto_files, + all_proto_include_dirs, + all_options_map, + generation_folder_name, + generated_folder_abs_path): + """ + Compiles the proto files using the protoc compiler to generate the small-sized nanopb .c and .h files. + + :param ctx: The context to refer to + :param all_proto_files: Proto files to compile + :param all_proto_include_dirs: Proto includes to link for compilation + :param all_options_map: Proto options to include for configuration of compilation + :param generation_folder_name: Name of folder to place generated artifacts + :param generated_folder_abs_path: Path of folder to place generated artifacts + + :return: + all_proto_hdr_files - Nanopb generated header files + all_proto_src_files - Nanopb generated source files + """ all_proto_hdr_files = [] all_proto_src_files = [] @@ -100,14 +135,18 @@ def _nanopb_proto_library_impl(ctx): all_proto_src_files.append(c_out) all_proto_hdr_files.append(h_out) + return all_proto_hdr_files, all_proto_src_files - cc_toolchain = find_cpp_toolchain(ctx) - feature_configuration = cc_common.configure_features( - ctx = ctx, - cc_toolchain = cc_toolchain, - ) +def _collect_explicit_nanopb_contexts(ctx): + """ + Get any compilation and linking contexts from any additional explicitly provided nanopb libs. + + :param ctx: The context to refer to - # Get the compilation and linking contexts from all nanopb srcs + :return: + nanopb_linking_contexts - Linking contexts + nanopb_compilation_contexts - Compilation contexts + """ nanopb_compilation_contexts = [ label[CcInfo].compilation_context for label in ctx.attr.nanopb_libs @@ -118,8 +157,15 @@ def _nanopb_proto_library_impl(ctx): for label in ctx.attr.nanopb_libs if label[CcInfo].linking_context != None ] + return nanopb_linking_contexts, nanopb_compilation_contexts - # Get include paths from Nanopb dependencies +def _collect_implicit_nanopb_deps(ctx): + """ + Get any transitive/implicit compilation and linking contexts from any additionally provided nanopb libs. + + :param ctx: The context to refer to + :return: nanopb_includes - list of paths to contexts included for provided deps + """ nanopb_includes = [] for lib in ctx.attr.nanopb_libs: cc_info = lib[CcInfo] @@ -129,7 +175,42 @@ def _nanopb_proto_library_impl(ctx): nanopb_includes.extend(compilation_context.includes.to_list()) nanopb_includes.extend(compilation_context.quote_includes.to_list()) - # Create compiler flags + return nanopb_includes + +def _construct_cc_info( + ctx, + all_proto_include_dirs, + all_proto_hdr_files, + all_proto_src_files, + generated_folder_abs_path, + nanopb_includes, + nanopb_linking_contexts, + nanopb_compilation_contexts): + """ + Builder for CcInfo, the underlying provider for cc_library. + + Since CcInfo's in a dep tree are compiled incrementally into artifacts and linked during bazel build, + we must construct this build target explicitly so that any cc_library's in our codebase can refer to these + nanopb proto libs. Nanopb has their own similar implementation to support nanopb proto usage in C++, + but we cannot use that since platformio requires some unique additional processing. + + :param ctx: The context to refer to + :param all_proto_include_dirs: Proto includes to link for compilation + :param all_proto_hdr_files: Nanopb generated header files to compile + :param all_proto_src_files: Nanopb generated source files to compile + :param generated_folder_abs_path: Path of folder to place generated artifacts + :param nanopb_includes: Additional nanopb-specific files to link + :param nanopb_linking_contexts: Additional nanopb-specific linked contexts to merge + :param nanopb_compilation_contexts: Additional nanopb-specific compilation contexts to merge + + :return: CcInfo with the contents of provided proto files. + """ + + cc_toolchain = find_cpp_toolchain(ctx) + feature_configuration = cc_common.configure_features( + ctx = ctx, + cc_toolchain = cc_toolchain, + ) copts = ["-I{}".format(include) for include in depset(nanopb_includes).to_list()] (compilation_context, compilation_outputs) = cc_common.compile( @@ -156,14 +237,77 @@ def _nanopb_proto_library_impl(ctx): linking_contexts = nanopb_linking_contexts, ) - # platformio_* bazel rules require a provider named transitive_zip_files and an output zip file - # these contain all files needed for compilation with platformio. - name = ctx.label.name - commands = [] + extra_context = cc_common.create_compilation_context( + includes = depset(["external/nanopb+"]), + defines = depset(["PB_FIELD_32BIT"]), + ) - inputs = all_proto_hdr_files + all_proto_src_files - outputs = [] + final_compilation_context = cc_common.merge_compilation_contexts( + compilation_contexts = [compilation_context, extra_context], + ) + + return CcInfo( + compilation_context = final_compilation_context, + linking_context = linking_context, + ) + +def _construct_default_info(zip_file): + """ + Builder for the DefaultInfo provider. + This provider is necessary for every rule in Bazel and is a collection of + deps and files. Without this provider, the rule will not perform any actions or generate any artifacts. + + :param zip_file: Archived files to wrap as a DefaultInfo + + :return: DefaultInfo with contents of zip_file + """ + return DefaultInfo(files = depset([zip_file])) + +def _construct_platformio_library_info(ctx, zip_file): + """ + Builder for the PlatformIOLibraryInfo provider. + + This is the provider used by platformio_rules so that the generated lib can be used as a dep in platformio_library. + This provider allows for platformio_rules to aggregate dependencies via paths to source files and also allows for + for using other platformio_library's as a dep to this lib. Transitive deps are also collected at this stage. + :param zip_file: Files and deps to include in the library + :return: PlatformIOLibraryInfo with the contents of zip_file + """ + runfiles = ctx.runfiles(files = [zip_file]) + transitive_libdeps = [] + for dep in ctx.attr.deps: + if PlatformIOLibraryInfo in dep: + runfiles.merge_all(dep[PlatformIOLibraryInfo].runfiles) + transitive_libdeps.extend(dep[PlatformIOLibraryInfo].transitive_libdeps) + return PlatformIOLibraryInfo( + default_runfiles = runfiles, + transitive_libdeps = transitive_libdeps, + ) + +def _package_platformio_lib(ctx, all_proto_hdr_files, all_proto_src_files): + """ + Generates the commands to create the `lib` directory recognized by PlatformIO as the + default location of libraries/headers. This is necessary due to platformIO's API definition and where it expects + lib headers to be located. + + Explicit copying of sources/headers is necessary since platformio during its upload process uses a + custom internal compiler to compile .c and .h files. This is the central reason why we cannot use CcInfo to manage + these libs. Hence, the transitive deps of a lib must contain the actual locations of source and headers rather + than incremental build artifacts as in the case with CcInfo. + See https://docs.platformio.org/en/latest/projectconf/sections/platformio/options/directory/lib_dir.html + + :param ctx: The context to refer to + :param all_proto_hdr_files: Nanopb generated header files to copy + :param all_proto_src_files: Nanopb generated source files to copy + + :return: + outputs - File destinations once the copy commands are executed + commands - Copy commands to populate the new libs dir + """ + outputs = [] + commands = [] + name = ctx.label.name for hdr_file in all_proto_hdr_files: dir = _PROTO_DIR.format(path = name) file = ctx.actions.declare_file( @@ -185,42 +329,89 @@ def _nanopb_proto_library_impl(ctx): source = src_file.path, destination = file.path, )) + return outputs, commands - extra_context = cc_common.create_compilation_context( - includes = depset(["external/nanopb+"]), - defines = depset(["PB_FIELD_32BIT"]), - ) +def _package_archive(ctx, all_proto_hdr_files, all_proto_src_files): + """ + Creates an archive containing all the provided header and source nanopb files. - final_compilation_context = cc_common.merge_compilation_contexts( - compilation_contexts = [compilation_context, extra_context], - ) + Extra: platformio_* bazel rules require a provider named transitive_zip_files and an output zip file which + contains all files needed for compilation with platformio. + + :param ctx: The context to refer to + :param all_proto_hdr_files: Nanopb generated header files to package + :param all_proto_src_files: Nanopb generated source files to package - zip_file = ctx.actions.declare_file("%s.zip" % name) + :return: + zip_file - A zipped folder containing the packaged headers and source (& transitive deps) files + in platformio structure ready for compilation/upload + """ + inputs = all_proto_hdr_files + all_proto_src_files + + (outputs, commands) = _package_platformio_lib(ctx, all_proto_hdr_files, all_proto_src_files) + zip_file = ctx.actions.declare_file("%s.zip" % ctx.label.name) outputs.append(zip_file) commands.append(_ZIP_COMMAND.format( output_dir = zip_file.dirname, zip_filename = zip_file.basename, )) + ctx.actions.run_shell( inputs = inputs, outputs = outputs, command = "\n".join(commands), ) - runfiles = ctx.runfiles(files = [zip_file]) - transitive_libdeps = [] - for dep in ctx.attr.deps: - if PlatformIOLibraryInfo in dep: - runfiles.merge_all(dep[PlatformIOLibraryInfo].runfiles) - transitive_libdeps.extend(dep[PlatformIOLibraryInfo].transitive_libdeps) + return zip_file + +def _nanopb_proto_library_impl(ctx): + """ + This is the underlying implementation of our custom nanopb library. The purpose of this custom rule is to + produce the following 3 outputs from a set of ProtoInfo's: + 1) DefaultInfo - A zip archive of generated nanopb files & deps, mandatory for all rule outputs + 2) PlatformIOLibraryInfo - A library compatible with PlatformIO rules so this can be used as a dep + 3) CcInfo - A cc compilation context so that cc_library can use this as a dep + + This rule is an adapter between proto_library + nanopb for the platformio_library + There is a similar rule: cc_nanopb_proto_library from nanopb natively which does something similar + However, platformio_rules do not support cc_library due to the way cross compiling works in platformio for + embedded systems (cc_library compiles srcs to .so/.a files which is not supported the same way by platformio). + + :param ctx: The context to refer to + :return: + DefaultInfo + PlatformIOLibraryInfo + CcInfo + """ + (generation_folder_name, generated_folder_abs_path) = _generate_output_dirs(ctx) + (all_proto_files, all_proto_include_dirs) = _collect_deps(ctx) + + all_options_map = {} + _collect_compile_options(ctx, all_options_map) + (all_proto_hdr_files, all_proto_src_files) = _compile_protos_for_nanopb( + ctx, + all_proto_files, + all_proto_include_dirs, + all_options_map, + generation_folder_name, + generated_folder_abs_path, + ) + + (nanopb_linking_contexts, nanopb_compilation_contexts) = _collect_explicit_nanopb_contexts(ctx) + nanopb_includes = _collect_implicit_nanopb_deps(ctx) + + zip_file = _package_archive(ctx, all_proto_hdr_files, all_proto_src_files) return [ - DefaultInfo(files = depset([zip_file])), - PlatformIOLibraryInfo( - default_runfiles = runfiles, - transitive_libdeps = transitive_libdeps, - ), - CcInfo( - compilation_context = final_compilation_context, - linking_context = linking_context, + _construct_default_info(zip_file), + _construct_platformio_library_info(ctx, zip_file), + _construct_cc_info( + ctx, + all_proto_include_dirs, + all_proto_hdr_files, + all_proto_src_files, + generated_folder_abs_path, + nanopb_includes, + nanopb_linking_contexts, + nanopb_compilation_contexts, ), ] diff --git a/src/toolchains/proto/BUILD b/src/toolchains/proto/BUILD deleted file mode 100644 index f655cbd3b2..0000000000 --- a/src/toolchains/proto/BUILD +++ /dev/null @@ -1,11 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain") - -# Configure protoc to have the right arguments for generating Python stubs. -# NB: the protobuf team intends to remove --python_out and instead use a protoc plugin for Python stub emit. -proto_lang_toolchain( - name = "protoc_py", - command_line = "--python_out=%s", - progress_message = "Generating Python proto_library %{label}", - runtime = "@thunderscope_deps//protobuf", - toolchain_type = "@rules_python//python/proto:toolchain_type", -)