From 5f8d6ccf9915f6dc0b90655226fc518a75f7bef5 Mon Sep 17 00:00:00 2001 From: Bellier Sacha <69162022+0-Sacha@users.noreply.github.com> Date: Thu, 21 Nov 2024 22:25:23 +0100 Subject: [PATCH] feat: remote build (buildfarm) (#18) --- templates/BUILD.bazel.tpl | 11 ++--------- templates/rules.bzl.tpl | 19 +++++++++---------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/templates/BUILD.bazel.tpl b/templates/BUILD.bazel.tpl index 5648fc2..074a2c2 100644 --- a/templates/BUILD.bazel.tpl +++ b/templates/BUILD.bazel.tpl @@ -30,21 +30,14 @@ cc_toolchain_config( "%{compiler_package}:dbg": "dbg", }, - cxx_builtin_include_directories = [ - "%{compiler_package_path}%{toolchain_type}/include", - "%{compiler_package_path}lib/gcc/%{toolchain_type}/%{compiler_version}/include", - "%{compiler_package_path}lib/gcc/%{toolchain_type}/%{compiler_version}/include-fixed", - + toolchain_builtin_includedirs = [ "%{compiler_package_path}%{toolchain_type}/include/c++/%{compiler_version}", "%{compiler_package_path}%{toolchain_type}/include/c++/%{compiler_version}/%{toolchain_type}", ], copts = %{copts}, conlyopts = %{conlyopts}, - cxxopts = %{cxxopts} + [ - "-isystem%{compiler_package_path}%{toolchain_type}/include/c++/%{compiler_version}", - "-isystem%{compiler_package_path}%{toolchain_type}/include/c++/%{compiler_version}/%{toolchain_type}", - ], + cxxopts = %{cxxopts}, linkopts = %{linkopts}, defines = %{defines}, includedirs = %{includedirs}, diff --git a/templates/rules.bzl.tpl b/templates/rules.bzl.tpl index 3ab9d81..8231495 100644 --- a/templates/rules.bzl.tpl +++ b/templates/rules.bzl.tpl @@ -3,20 +3,18 @@ load("@rules_cc//cc:defs.bzl", "cc_binary") def _arm_all_files_impl(ctx): - ctx.actions.run( + ctx.actions.run_shell( inputs = [ ctx.file.dep ], outputs = [ ctx.outputs.elf ], - executable = "cp", - arguments = [ - ctx.file.dep.path, - ctx.outputs.elf.path - ], + command = "cp {dep} {elf}".format( + dep = ctx.file.dep.path, + elf = ctx.outputs.elf.path, + ), ) ctx.actions.run( inputs = [ ctx.file.dep ], outputs = [ ctx.outputs.bin ], - tools = [ ctx.file.objcopy ], - executable = ctx.file.objcopy.path, + executable = ctx.file.objcopy, arguments = [ "-O", "binary", @@ -28,8 +26,7 @@ def _arm_all_files_impl(ctx): ctx.actions.run( inputs = [ ctx.file.dep ], outputs = [ ctx.outputs.hex ], - tools = [ ctx.file.objcopy ], - executable = ctx.file.objcopy.path, + executable = ctx.file.objcopy, arguments = [ "-O", "ihex", @@ -40,6 +37,7 @@ def _arm_all_files_impl(ctx): ctx.actions.run_shell( inputs = [ ctx.file.dep ], outputs = [ ctx.outputs.dmp ], + tools = [ ctx.file.objdump ], command = "{objdump} {flags} {deps} > {out}".format( objdump = ctx.file.objdump.path, flags = "-x --syms", @@ -50,6 +48,7 @@ def _arm_all_files_impl(ctx): ctx.actions.run_shell( inputs = [ ctx.file.dep ], outputs = [ ctx.outputs.asm ], + tools = [ ctx.file.objdump ], command = "{objdump} {flags} {deps} > {out}".format( objdump = ctx.file.objdump.path, flags = "-d",