-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #319 from Zemnmez/version-pipelining
version pipelining
- Loading branch information
Showing
14 changed files
with
102 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
exports_files( | ||
[ | ||
"version.tmpl.txt" | ||
"bump.py" | ||
], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import argparse | ||
import os | ||
import subprocess | ||
import shutil | ||
|
||
parser = argparse.ArgumentParser(description="Performs the action of a version bump.") | ||
parser.add_argument('--to_bump_in', help="The version file to bump, as a root-relative path.", type=str) | ||
parser.add_argument('--to_bump_out', help="The version file to bump, as a root-relative path.", type=str) | ||
parser.add_argument('--lockfile_build_label', help="A label that points to the generated (new) version lockfile.", type=str) | ||
parser.add_argument('--lockfile_build_rootpath', help="The path from the repo root that the lockfile is generated into", type=str) | ||
parser.add_argument('--lockfile_out_rootpath', help="The location to place the newly minted version lockfile at.", type=str) | ||
|
||
# This happens directly on the real workspace -- also, needs to be | ||
# run from bazel to have this set. | ||
os.chdir(os.environ.get('BUILD_WORKSPACE_DIRECTORY')) | ||
|
||
args = parser.parse_args() | ||
|
||
number = 0 | ||
|
||
with open(args.to_bump_in, mode='r', encoding='utf-8') as f: | ||
number = int(f.read()) | ||
|
||
|
||
with open(args.to_bump_out, mode='w', encoding='utf-8') as f: | ||
f.write(str(number+1)) | ||
|
||
# Once the version has been bumped, generate the new version bump file. | ||
subprocess.run(["bazelisk", "build", args.lockfile_build_label]) | ||
|
||
# Copy the newly created lockfile across | ||
shutil.copyfile( | ||
os.path.join("dist", "bin", args.lockfile_build_rootpath), | ||
args.lockfile_out_rootpath | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
load("//bzl/versioning:rules.bzl", "bump_on_change_test") | ||
|
||
bump_on_change_test( | ||
name = "version", | ||
srcs = [ "contents.txt" ], | ||
version_lock = "version.lock", | ||
version = "MAJOR", | ||
run_on_main = True | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is some content of our program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
040e04c69d4995ce0f768474f63263ccc87c3670b137516fcc1213a8b0f29406 bzl/versioning/test/bump_on_change_test/contents.txt | ||
7902699be42c8a8e46fbbb4501726517e86b22c56a189f7625a6da49081b2451 bzl/versioning/test/bump_on_change_test/MAJOR |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.