Skip to content
Closed
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
4 changes: 1 addition & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Global options

common

build -c opt \
--incompatible_enable_cc_toolchain_resolution \
--incompatible_require_linker_input_cc_api
--incompatible_require_linker_input_cc_api

# Aliases for user-defined flags
build --flag_alias=backend_config=@config//:backend_config
Expand Down
63 changes: 34 additions & 29 deletions dev/bazel/cc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#===============================================================================

load("@onedal//dev/bazel:utils.bzl",
"utils",
"paths",
"sets",
)
Expand Down Expand Up @@ -317,31 +316,39 @@ cc_static_lib = rule(
)


def _copy_dynamic_release_file(ctx, src, out_name, is_windows = False, extra_inputs = []):
def _copy_windows_release_file(ctx, src, out_name, extra_inputs = []):
"""Copy a linker output under the file name the release layout expects.

Windows only: the Linux release names come straight out of the link action,
while a DLL and its import library have to be renamed afterwards (see
`_cc_dynamic_lib_impl`). A symlink is not enough, because creating one
requires developer mode on Windows.

Args:
ctx: rule context.
src: the file produced by the link action.
out_name: base name of the copy, declared in the current package.
extra_inputs: further link outputs to declare as inputs, so that the
copy cannot run before the whole link action completed.

Returns:
The declared copy.
"""
out = ctx.actions.declare_file(out_name)
if is_windows:
ctx.actions.run(
executable = "cmd.exe",
inputs = [src] + extra_inputs,
outputs = [out],
arguments = [
"/d",
"/c",
'copy /Y "{}" "{}"'.format(
src.path.replace("/", "\\"),
out.path.replace("/", "\\"),
),
],
use_default_shell_env = True,
)
else:
ctx.actions.run(
executable = "cp",
inputs = [src] + extra_inputs,
outputs = [out],
arguments = [src.path, out.path],
use_default_shell_env = True,
)
ctx.actions.run(
executable = "cmd.exe",
inputs = [src] + extra_inputs,
outputs = [out],
arguments = [
"/d",
"/c",
'copy /Y "{}" "{}"'.format(
src.path.replace("/", "\\"),
out.path.replace("/", "\\"),
),
],
use_default_shell_env = True,
)
return out


Expand Down Expand Up @@ -407,19 +414,17 @@ def _cc_dynamic_lib_impl(ctx):
if dynamic_outputs.dynamic_library.basename == dynamic_release_name:
default_files.append(dynamic_outputs.dynamic_library)
else:
default_files.append(_copy_dynamic_release_file(
default_files.append(_copy_windows_release_file(
ctx,
dynamic_outputs.dynamic_library,
dynamic_release_name,
is_windows = is_windows,
extra_inputs = [dynamic_outputs.interface_library] if dynamic_outputs.interface_library else [],
))
if dynamic_outputs.interface_library:
default_files.append(_copy_dynamic_release_file(
default_files.append(_copy_windows_release_file(
ctx,
dynamic_outputs.interface_library,
"{}_dll.lib".format(rt_name),
is_windows = is_windows,
))
default_info = DefaultInfo(
files = depset(default_files),
Expand Down
1 change: 0 additions & 1 deletion dev/bazel/cc/common.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")

load("@onedal//dev/bazel:utils.bzl",
"utils",
"paths",
"sets",
)

Expand Down
1 change: 0 additions & 1 deletion dev/bazel/cc/link.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ load("@rules_cc//cc:action_names.bzl", "ACTION_NAMES")
load("@onedal//dev/bazel:utils.bzl",
"utils",
"paths",
"sets",
)

load("@onedal//dev/bazel/toolchains:action_names.bzl",
Expand Down
4 changes: 0 additions & 4 deletions dev/bazel/release.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,6 @@ def _copy_data(ctx, prefix):
return dst_files

def _copy_to_release_impl(ctx):
extra_toolchain = ctx.toolchains["@onedal//dev/bazel/toolchains:extra"]
prefix = ctx.attr.name + "/daal/latest"
version_info = ctx.attr._version_info[VersionInfo] if ctx.attr._version_info else None
files = []
Expand Down Expand Up @@ -641,9 +640,6 @@ _release = rule(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
),
},
toolchains = [
"@onedal//dev/bazel/toolchains:extra"
],
)

def _headers_filter_impl(ctx):
Expand Down
Loading
Loading