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

How should private targets be handled? #71

Open
jfrohnhofen opened this issue Jun 11, 2021 · 1 comment
Open

How should private targets be handled? #71

jfrohnhofen opened this issue Jun 11, 2021 · 1 comment
Labels
build Related to build system discussion Things to discuss / decide. generator Related to dbt-rules

Comments

@jfrohnhofen
Copy link
Contributor

Currently private targets (i.e., targets that are private variables in BUILD.go files) cannot be used from other BUILD.go files but behave as regular targets in all other ways. Maybe it makes sense to also

  • not list them as targets in dbt build
  • not create an alias rule for them in the Ninja file
  • not build them when running dbt build //...
@jfrohnhofen jfrohnhofen added build Related to build system generator Related to dbt-rules discussion Things to discuss / decide. labels Jun 11, 2021
@jfrohnhofen jfrohnhofen added this to the v1.1 milestone Jun 11, 2021
@jfrohnhofen jfrohnhofen changed the title How should private target be handled? How should private targets be handled? Jun 11, 2021
@ptia
Copy link
Contributor

ptia commented Jun 14, 2021

I agree with the proposed solution. I think private targets should not be built or listed by dbt build; they should be only built if
a public target is being built and explicitly requests them as dependencies. I can think of these advantages:

  • It makes more sense in Go: if I define a private variable, I don't expect it to interact with the outside unless I access it somewhere public
  • It allows definition of compilation intermediates to a public target that shouldn't be accessed by other targets
  • (This might be too specific, but it's the situation I came across that made me want to use private targets) Say I have a target ConditionalTarget implementing a custom rule that only builds if a certain condition is met (say a flag is set); then, currently, ConditionalTarget's dependencies need to be custom, conditional builds, even if they are as simple as cc.Library, or they'd be built even if the condition is not met, which could fail. With private targets I can leave them as private cc.Library's, include them in ConditionalTarget, and they'd only be built if ConditionalTarget is.

@jfrohnhofen jfrohnhofen removed this from the v2.0 milestone Sep 21, 2021
sobkulir pushed a commit to sobkulir/dbt that referenced this issue Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to build system discussion Things to discuss / decide. generator Related to dbt-rules
Projects
None yet
Development

No branches or pull requests

2 participants