-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This only compiles `damlc-bootstrap` as a Haskell binary and `damlc` is a simple symlink with additional runfiles. We now need to define `damlc@ghci` manually since it is no longer defined automatically. The manual definition was tested with ``` $ bazel run //:damlc@ghci --define ghci_data=True > :main ide -d ``` changelog_begin changelog_end Co-authored-by: Andreas Herrmann <[email protected]>
- Loading branch information
1 parent
6d21400
commit fa45a58
Showing
2 changed files
with
67 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
load("@os_info//:os_info.bzl", "is_windows") | ||
|
||
def _add_data_impl(ctx): | ||
executable = ctx.actions.declare_file( | ||
ctx.label.name + (".exe" if is_windows else ""), | ||
) | ||
ctx.actions.symlink( | ||
output = executable, | ||
target_file = ctx.executable.executable, | ||
is_executable = True, | ||
) | ||
|
||
runfiles = ctx.runfiles(files = [ctx.executable.executable] + ctx.files.data) | ||
runfiles = runfiles.merge(ctx.attr.executable[DefaultInfo].default_runfiles) | ||
for data_dep in ctx.attr.data: | ||
runfiles = runfiles.merge(data_dep[DefaultInfo].default_runfiles) | ||
|
||
return [DefaultInfo( | ||
executable = executable, | ||
files = depset(direct = [executable]), | ||
runfiles = runfiles, | ||
)] | ||
|
||
add_data = rule( | ||
_add_data_impl, | ||
attrs = { | ||
"executable": attr.label( | ||
executable = True, | ||
cfg = "target", | ||
doc = "Create a symlink to this executable", | ||
), | ||
"data": attr.label_list( | ||
allow_files = True, | ||
doc = "Add these data files to the executable's runfiles", | ||
), | ||
}, | ||
executable = True, | ||
doc = "Creates a new target for the given executable with additional runfiles.", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters