Skip to content

Conversation

@chrisnovakovic
Copy link
Contributor

There are circumstances under which a target might want to inherit the run-time dependencies of certain build-time dependencies, because the target's output is built in such a way that its dependencies don't have their own run-time dependencies resolved. An example of this is the shell-rules plugin's sh_binary rule: a sh_binary is a zip file of its dependencies (deps) concatenated onto a shell script preamble that extracts those dependencies into a temporary directory during initialisation. If one of those deps happens to have its own run-time dependencies, Please will not resolve them, and they will therefore not be built before the target runs (and will not be sent to the remote worker along with the target's output).

Add two parameters to build_rule - runtime_deps_from_srcs and runtime_deps_from_deps - that indicate to Please that run-time dependencies should additionally be collected from the target's srcs and deps respectively. This allows build definitions to inherit the run-time dependencies of their sources and/or build-time dependencies if they know they will be needed when running the target they generate.

There are circumstances under which a target might want to inherit the
run-time dependencies of certain build-time dependencies, because the
target's output is built in such a way that its dependencies don't have
their own run-time dependencies resolved. An example of this is the
shell-rules plugin's `sh_binary` rule: a `sh_binary` is a zip file of
its dependencies (`deps`) concatenated onto a shell script preamble that
extracts those dependencies into a temporary directory during
initialisation. If one of those `deps` happens to have its own run-time
dependencies, Please will not resolve them, and they will therefore not
be built before the target runs (and will not be sent to the remote
worker along with the target's output).

Add two parameters to `build_rule` - `runtime_deps_from_srcs` and
`runtime_deps_from_deps` - that indicate to Please that run-time
dependencies should additionally be collected from the target's `srcs`
and `deps` respectively. This allows build definitions to inherit the
run-time dependencies of their sources and/or build-time dependencies if
they know they will be needed when running the target they generate.
@chrisnovakovic
Copy link
Contributor Author

Rebased to fix the FreeBSD Cirrus CI job (#3467).

}
}
}
for _, dep := range t.dependencies {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth putting this loop inside a conditional on t.RuntimeDependenciesFromSources || t.RuntimeDependenciesFromDependencies? Or is this just not run enough for it to matter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good point - that iteration over t.dependencies is entirely unnecessary for most targets. I'll gate it.

@chrisnovakovic chrisnovakovic merged commit bc8092a into thought-machine:master Dec 9, 2025
3 of 7 checks passed
@chrisnovakovic chrisnovakovic deleted the inherit-runtime-deps branch December 9, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants