Skip to content

Commit

Permalink
fix: add copy_file_to_bin_action and copy_files_to_bin_actions to //l…
Browse files Browse the repository at this point in the history
…ib:copy_to_bin.bzl (#72)
  • Loading branch information
gregmagolan authored Apr 13, 2022
1 parent 6828d92 commit b9bc7a4
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
62 changes: 62 additions & 0 deletions docs/copy_to_bin.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,68 @@ Originally authored in rules_nodejs
https://github.com/bazelbuild/rules_nodejs/blob/8b5d27400db51e7027fe95ae413eeabea4856f8e/internal/common/copy_to_bin.bzl


<a id="#copy_file_to_bin_action"></a>

## copy_file_to_bin_action

<pre>
copy_file_to_bin_action(<a href="#copy_file_to_bin_action-ctx">ctx</a>, <a href="#copy_file_to_bin_action-file">file</a>, <a href="#copy_file_to_bin_action-is_windows">is_windows</a>)
</pre>

Helper function that creates an action to copy a file to the output tree.

File are copied to the same workspace-relative path. The resulting files is
returned.

If the file passed in is already in the output tree is then it is returned
without a copy action.


**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="copy_file_to_bin_action-ctx"></a>ctx | The rule context. | none |
| <a id="copy_file_to_bin_action-file"></a>file | The file to copy. | none |
| <a id="copy_file_to_bin_action-is_windows"></a>is_windows | If true, an cmd.exe action is created so there is no bash dependency. | <code>False</code> |

**RETURNS**

A File in the output tree.


<a id="#copy_files_to_bin_actions"></a>

## copy_files_to_bin_actions

<pre>
copy_files_to_bin_actions(<a href="#copy_files_to_bin_actions-ctx">ctx</a>, <a href="#copy_files_to_bin_actions-files">files</a>, <a href="#copy_files_to_bin_actions-is_windows">is_windows</a>)
</pre>

Helper function that creates actions to copy files to the output tree.

Files are copied to the same workspace-relative path. The resulting list of
files is returned.

If a file passed in is already in the output tree is then it is added
directly to the result without a copy action.


**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="copy_files_to_bin_actions-ctx"></a>ctx | The rule context. | none |
| <a id="copy_files_to_bin_actions-files"></a>files | List of File objects. | none |
| <a id="copy_files_to_bin_actions-is_windows"></a>is_windows | If true, an cmd.exe action is created so there is no bash dependency. | <code>False</code> |

**RETURNS**

List of File objects in the output tree.


<a id="#copy_to_bin"></a>

## copy_to_bin
Expand Down
4 changes: 4 additions & 0 deletions lib/copy_to_bin.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ https://github.com/bazelbuild/rules_nodejs/blob/8b5d27400db51e7027fe95ae413eeabe

load(
"//lib/private:copy_to_bin.bzl",
_copy_file_to_bin_action = "copy_file_to_bin_action",
_copy_files_to_bin_actions = "copy_files_to_bin_actions",
_copy_to_bin = "copy_to_bin",
)

copy_file_to_bin_action = _copy_file_to_bin_action
copy_files_to_bin_actions = _copy_files_to_bin_actions
copy_to_bin = _copy_to_bin

0 comments on commit b9bc7a4

Please sign in to comment.