Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows updates #27

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion toolchains/clang/clang_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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],
)
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down
2 changes: 2 additions & 0 deletions toolchains/compilers/llvm/impl/llvm_versions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down
4 changes: 4 additions & 0 deletions toolchains/features/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
)
26 changes: 22 additions & 4 deletions toolchains/features/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
}
)
11 changes: 9 additions & 2 deletions toolchains/gcc_arm_none_eabi/gcc_arm_none_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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],
)
Expand Down Expand Up @@ -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(
Expand All @@ -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",
)
Expand Down
19 changes: 10 additions & 9 deletions tools/openocd/openocd_repository.bzl
Original file line number Diff line number Diff line change
@@ -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)
Expand Down