vaticle / bazel-distribution

Bazel rules for assembling and deploying software distributions (see @vaticle for usage example)
https://bazel.build
Apache License 2.0
155 stars 53 forks source link

Remove leading and trailing whitespaces from VERSION files for crate and maven assembly rules #414

Closed farost closed 1 month ago

farost commented 1 month ago

What is the goal of this PR?

We resolve issue #380 by trimming input version values from VERSION files for maven and crate artifacts assembly rules. It solves the problem of VERSION files being passed as version_file to the respective rules after being formatted to have an additional empty line in the end, which is a standard convention for files and a common IDE setting, or just being formatted incorrectly while containing a valid value.

From now on, VERSION files passed into assemble_maven and assemble_crate can have any leading and trailing whitespaces.

What are the changes implemented in this PR?

We add trim() calls for all the .kt scripts reading version files. This behavior used to exist for many .py scripts (with strip() for Python string), but these places were left forgotten (and not noticed by us as we use --define version=$(cat VERSION) in most of our assembly pipelines). We also add a respective check for trimmed version values into the maven deployment script to prevent users from forgetting to format their input versions while using any pom file as it can lead to corrupted snapshots, snapshot repositories URLs, and other automation failures.

vaticle-bot commented 1 month ago

PR Review Checklist

Do not edit the content of this comment. The PR reviewer should simply update this comment by ticking each review item below, as they get completed.


Trivial Change

Code

Architecture