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

Recursive assembly rules overwrite correct version numbers #359

Open
flyingsilverfin opened this issue Nov 11, 2022 · 0 comments
Open

Recursive assembly rules overwrite correct version numbers #359

flyingsilverfin opened this issue Nov 11, 2022 · 0 comments

Comments

@flyingsilverfin
Copy link
Member

flyingsilverfin commented Nov 11, 2022

Problem to Solve

Assembly rules often depend on other assembly rules - for example a targz assembly may depend on building JARs to package internally. Most assembly rules take a global constant called version and use it to append the version number to the distribution file names.

However, this can lead to the following situation:

output-2.0.0.tar.gz
 - lib/dependency-main-2.0.0.jar

where the dependency-main comes from a different repository that is on a different version number, let's say 1.0.0. In this case, we actually write an incorrect version number.

The general problem is that the version number is set globally in the root workspace and used for all build targets triggered.

Current Workaround

The best we can do is not to use a verison number at all.

Proposed Solution

Require extension to bazel:

  • Allow hierarchical workspaces to be loaded, each with their own constants & definitions

or

  • Allow defining a version number contextualised to each target (eg. rule instance), rather than each rule.

The latter would require a very verbose set of definitions at the root target, such as @dependency//:main.version=1.0.0, doing this for each target in the build tree requiring a version number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant