diff --git a/toolchains/clang/clang_toolchain.bzl b/toolchains/clang/clang_toolchain.bzl index c4ff56d..b6dcfb7 100644 --- a/toolchains/clang/clang_toolchain.bzl +++ b/toolchains/clang/clang_toolchain.bzl @@ -117,7 +117,7 @@ def _clang_toolchain_config_info_impl(ctx): ] os = "nix" postfix = "" - if ctx.host_configuration.host_path_separator == ";": + if ctx.attr.is_windows: os = "windows" postfix = ".bat" tool_paths = [tool_path(name = t.name, path = t.path.format(os = os) + postfix) for t in tool_paths] @@ -181,6 +181,9 @@ clang_toolchain_config = rule( doc = "Passthrough gcc wrappers used for the compiler", default = "//toolchains/clang/clang_wrappers:all", ), + "is_windows": attr.bool( + mandatory = True, + ), }, provides = [CcToolchainConfigInfo], ) @@ -230,6 +233,10 @@ def clang_toolchain(name): supports_param_files = 0, toolchain_config = ":" + toolchain_config, toolchain_identifier = "clang", + is_windows = select({ + "@bazel_tools//src/conditions:host_windows": True, + "//conditions:default": False, + }), ) native.toolchain( diff --git a/toolchains/compilers/gcc_arm_none_eabi/impl/gcc_arm_none_versions.bzl b/toolchains/compilers/gcc_arm_none_eabi/impl/gcc_arm_none_versions.bzl index 30e7ab1..13aa1e5 100644 --- a/toolchains/compilers/gcc_arm_none_eabi/impl/gcc_arm_none_versions.bzl +++ b/toolchains/compilers/gcc_arm_none_eabi/impl/gcc_arm_none_versions.bzl @@ -41,6 +41,7 @@ _PLATFORM_SPECIFIC_CONFIGS_9 = { "windows": _WINDOWS_9, "windows server 2019": _WINDOWS_9, "windows 10": _WINDOWS_9, + "windows 11": _WINDOWS_9, "mac os x": { "full_version": "9.2.1", "remote_compiler": { @@ -72,6 +73,7 @@ _PLATFORM_SPECIFIC_CONFIGS_11 = { "windows": _WINDOWS_11, "windows server 2019": _WINDOWS_11, "windows 10": _WINDOWS_11, + "windows 11": _WINDOWS_11, "mac os x": { "full_version": "11.3.rel1", "remote_compiler": { @@ -103,6 +105,7 @@ _PLATFORM_SPECIFIC_CONFIGS_12 = { "windows": _WINDOWS_12, "windows server 2019": _WINDOWS_12, "windows 10": _WINDOWS_12, + "windows 11": _WINDOWS_12, "mac os x": { "full_version": "12.2.rel1", "remote_compiler": { diff --git a/toolchains/compilers/llvm/impl/llvm_versions.bzl b/toolchains/compilers/llvm/impl/llvm_versions.bzl index e2ea369..81f2162 100644 --- a/toolchains/compilers/llvm/impl/llvm_versions.bzl +++ b/toolchains/compilers/llvm/impl/llvm_versions.bzl @@ -41,6 +41,7 @@ _PLATFORM_SPECIFIC_CONFIGS_11 = { "windows": _WINDOWS_11, "windows server 2019": _WINDOWS_11, "windows 10": _WINDOWS_11, + "windows 11": _WINDOWS_11, "mac os x": { "full_version": "11.0", "remote_compiler": { @@ -72,6 +73,7 @@ _PLATFORM_SPECIFIC_CONFIGS_14 = { "windows": _WINDOWS_14, "windows server 2019": _WINDOWS_14, "windows 10": _WINDOWS_14, + "windows 11": _WINDOWS_14, "mac os x": { "full_version": "14.0", "remote_compiler": { diff --git a/toolchains/features/BUILD b/toolchains/features/BUILD index 7775ae9..489d57a 100644 --- a/toolchains/features/BUILD +++ b/toolchains/features/BUILD @@ -2,4 +2,8 @@ load(":defs.bzl", "print_all_features") print_all_features( name = "print_all_features", + is_windows = select({ + "@bazel_tools//src/conditions:host_windows": True, + "//conditions:default": False, + }), ) diff --git a/toolchains/features/defs.bzl b/toolchains/features/defs.bzl index 98a863d..f196d5b 100644 --- a/toolchains/features/defs.bzl +++ b/toolchains/features/defs.bzl @@ -9,14 +9,32 @@ def _print_all_features_impl(ctx): embedded_features.remove("type_name") embedded_features_str = "Embedded Features:\n " + "\n ".join(embedded_features) all_feature_str = common_features_str + "\n" + embedded_features_str - print_script_str = """ -echo "{}" -""".format(all_feature_str) - script = ctx.actions.declare_file("%s.sh" % ctx.label.name) + + file_type = "" + print_script_str = "" + if ctx.attr.is_windows: + file_type = "bat" + # Windows must have 'echo' before each line + all_feature_str = all_feature_str.replace("\n", "\necho ") + print_script_str = """ + @echo off + echo {} + """.format(all_feature_str) + else: + file_type = "sh" + print_script_str = """ + echo "{}" + """.format(all_feature_str) + script = ctx.actions.declare_file("{}.{}".format(ctx.label.name, file_type)) ctx.actions.write(script, print_script_str, is_executable = True) return [DefaultInfo(executable = script)] print_all_features = rule( _print_all_features_impl, executable = True, + attrs = { + "is_windows": attr.bool( + mandatory = True, + ), + } ) diff --git a/toolchains/gcc_arm_none_eabi/gcc_arm_none_toolchain.bzl b/toolchains/gcc_arm_none_eabi/gcc_arm_none_toolchain.bzl index e33fa14..203e883 100644 --- a/toolchains/gcc_arm_none_eabi/gcc_arm_none_toolchain.bzl +++ b/toolchains/gcc_arm_none_eabi/gcc_arm_none_toolchain.bzl @@ -118,7 +118,7 @@ def _gcc_arm_none_toolchain_config_info_impl(ctx): ] os = "nix" postfix = "" - if ctx.host_configuration.host_path_separator == ";": + if ctx.attr.is_windows: os = "windows" postfix = ".bat" tool_paths = [tool_path(name = t.name, path = t.path.format(os = os) + postfix) for t in tool_paths] @@ -264,6 +264,9 @@ gcc_arm_none_toolchain_config = rule( doc = "Passthrough gcc wrappers used for the compiler", default = "//toolchains/gcc_arm_none_eabi/gcc_wrappers:all", ), + "is_windows": attr.bool( + mandatory = True, + ), }, provides = [CcToolchainConfigInfo], ) @@ -295,6 +298,10 @@ def gcc_arm_none_toolchain(name, compiler_components, architecture, float_abi, e endian = endian, fpu = fpu, toolchain_identifier = "arm-none-eabi", + is_windows = select({ + "@bazel_tools//src/conditions:host_windows": True, + "//conditions:default": False, + }), ) cc_toolchain( @@ -307,7 +314,7 @@ def gcc_arm_none_toolchain(name, compiler_components, architecture, float_abi, e strip_files = compiler_components, as_files = compiler_components, ar_files = compiler_components, - supports_param_files = 0, + supports_param_files = 1, toolchain_config = ":" + toolchain_config, toolchain_identifier = "arm-none-eabi", ) diff --git a/tools/openocd/openocd_repository.bzl b/tools/openocd/openocd_repository.bzl index 80097ef..62cdb2f 100644 --- a/tools/openocd/openocd_repository.bzl +++ b/tools/openocd/openocd_repository.bzl @@ -1,23 +1,24 @@ def _get_platform_specific_config(os_name): _WINDOWS = { - "sha256": "1fb26bbcfd65dbabe747ce3c8467a1f1cece7253bde4a95de13c2267d422ed8b", - "prefix": "xpack-openocd-0.10.0-14", - "url": "https://github.com/xpack-dev-tools/openocd-xpack/releases/download/v0.10.0-14/xpack-openocd-0.10.0-14-win32-x64.zip", + "sha256": "5cba78c08ad03aa38549e94186cbb4ec34c384565a40a6652715577e4f1a458f", + "prefix": "xpack-openocd-0.12.0-1", + "url": "https://github.com/xpack-dev-tools/openocd-xpack/releases/download/v0.12.0-1/xpack-openocd-0.12.0-1-win32-x64.zip", } _PLATFORM_SPECIFIC_CONFIGS = { "mac os x": { - "sha256": "30917a5c6f60fcd7df82b41dcec8ab7d86f0cea3caeaf98b965b901c10a60b39", - "prefix": "xpack-openocd-0.10.0-14", - "url": "https://github.com/xpack-dev-tools/openocd-xpack/releases/download/v0.10.0-14/xpack-openocd-0.10.0-14-darwin-x64.tar.gz", + "sha256": "ca569b6bfd9b3cd87a5bc88b3a33a5c4fe854be3cf95a3dcda1c194e8da9d7bb", + "prefix": "xpack-openocd-0.12.0-1", + "url": "https://github.com/xpack-dev-tools/openocd-xpack/releases/download/v0.12.0-1/xpack-openocd-0.12.0-1-darwin-x64.tar.gz", }, "linux": { - "sha256": "185c070f9729cf38dca08686c2905561c07a63c563e5bc7a70e045f2a1865c11", - "prefix": "xpack-openocd-0.10.0-14", - "url": "https://github.com/xpack-dev-tools/openocd-xpack/releases/download/v0.10.0-14/xpack-openocd-0.10.0-14-linux-x64.tar.gz", + "sha256": "940f22eccddb0946b69149d227948f77d5917a2c5f1ab68e5d84d614c2ceed20", + "prefix": "xpack-openocd-0.12.0-1", + "url": "https://github.com/xpack-dev-tools/openocd-xpack/releases/download/v0.12.0-1/xpack-openocd-0.12.0-1-linux-x64.tar.gz", }, "windows": _WINDOWS, "windows server 2019": _WINDOWS, "windows 10": _WINDOWS, + "windows 11": _WINDOWS, } if os_name not in _PLATFORM_SPECIFIC_CONFIGS.keys(): fail("OS configuration not available for:", os_name)