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

fix: add copy_file_to_bin_action and copy_files_to_bin_actions to //lib:copy_to_bin.bzl #72

Merged
merged 1 commit into from
Apr 13, 2022
Merged
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
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