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: implement run_binary rule #149

Closed
laszlocsomor opened this issue May 8, 2019 · 1 comment · Fixed by #153
Closed

Windows: implement run_binary rule #149

laszlocsomor opened this issue May 8, 2019 · 1 comment · Fixed by #153
Assignees

Comments

@laszlocsomor
Copy link
Contributor

Implement @laurentlb 's idea (from bazelbuild/bazel#7503 (comment)):

We can provide a simple rule in skylib:

exec_cmd(
  name = "x",
  tool = "//pkg:binary_to_run",
  args = ["-a", "-o", "$(location output_file)"],
  outputs = ["output_file", "logs"],
  stdout = "file_that_will_contain_stdout",
  stderr = "file_that_will_contain_stderr",
]

It executes a command, we can specify arguments, and we can save stdout and/or stderr to an output file. This should be able to replace many basic uses of genrule, right? And we can support this on all platforms.

@laszlocsomor
Copy link
Contributor Author

Crucially this rule should use ctx.actions.run and NOT ctx.actions.run_shell, to avoid depending on Bash.

@laszlocsomor laszlocsomor self-assigned this May 8, 2019
laszlocsomor added a commit to laszlocsomor/bazel-skylib that referenced this issue May 9, 2019
This rule is an alternative for genrule(): it can
run a binary with the desired arguments,
environment, inputs, and outputs, as a single
build action, without shelling out to Bash.

Fixes bazelbuild#149
laszlocsomor added a commit to laszlocsomor/bazel-skylib that referenced this issue May 9, 2019
This rule is an alternative for genrule(): it can
run a binary with the desired arguments,
environment, inputs, and outputs, as a single
build action, without shelling out to Bash.

Fixes bazelbuild#149
laszlocsomor added a commit to laszlocsomor/bazel-skylib that referenced this issue May 9, 2019
This rule is an alternative for genrule(): it can
run a binary with the desired arguments,
environment, inputs, and outputs, as a single
build action, without shelling out to Bash.

Fixes bazelbuild#149
laszlocsomor added a commit to laszlocsomor/bazel-skylib that referenced this issue May 14, 2019
This rule is an alternative for genrule(): it can
run a binary with the desired arguments,
environment, inputs, and outputs, as a single
build action, without shelling out to Bash.

Fixes bazelbuild#149
laszlocsomor added a commit to laszlocsomor/bazel-skylib that referenced this issue May 14, 2019
This rule is an alternative for genrule(): it can
run a binary with the desired arguments,
environment, inputs, and outputs, as a single
build action, without shelling out to Bash.

Fixes bazelbuild#149
laszlocsomor added a commit to laszlocsomor/bazel-skylib that referenced this issue May 14, 2019
This rule is an alternative for genrule(): it can
run a binary with the desired arguments,
environment, inputs, and outputs, as a single
build action, without shelling out to Bash.

Fixes bazelbuild#149
laszlocsomor added a commit to laszlocsomor/bazel-skylib that referenced this issue May 14, 2019
This rule is an alternative for genrule(): it can
run a binary with the desired arguments,
environment, inputs, and outputs, as a single
build action, without shelling out to Bash.

Fixes bazelbuild#149
laszlocsomor added a commit to laszlocsomor/bazel-skylib that referenced this issue May 14, 2019
This rule is an alternative for genrule(): it can
run a binary with the desired arguments,
environment, inputs, and outputs, as a single
build action, without shelling out to Bash.

Fixes bazelbuild#149
laszlocsomor added a commit to laszlocsomor/bazel-skylib that referenced this issue May 14, 2019
This rule is an alternative for genrule(): it can
run a binary with the desired arguments,
environment, inputs, and outputs, as a single
build action, without shelling out to Bash.

Fixes bazelbuild#149
laszlocsomor added a commit to laszlocsomor/bazel-skylib that referenced this issue May 14, 2019
This rule is an alternative for genrule(): it can
run a binary with the desired arguments,
environment, inputs, and outputs, as a single
build action, without shelling out to Bash.

Fixes bazelbuild#149
laszlocsomor added a commit that referenced this issue May 21, 2019
This rule is an alternative for genrule(): it can
run a binary with the desired arguments,
environment, inputs, and outputs, as a single
build action, without shelling out to Bash.

Fixes #149
ngiloq6 added a commit to ngiloq6/bazel-skylib that referenced this issue Aug 17, 2024
This rule is an alternative for genrule(): it can
run a binary with the desired arguments,
environment, inputs, and outputs, as a single
build action, without shelling out to Bash.

Fixes bazelbuild/bazel-skylib#149
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant