Skip to content

Commit

Permalink
Update submodule and proto tag version handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Ostrzyciel committed Jul 5, 2024
1 parent 6d14c04 commit 7f12445
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/src/main/protobuf_shared
18 changes: 14 additions & 4 deletions docs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,25 @@

def define_env(env):
try:
proto_tag = subprocess.run(
['git', 'describe', '--tags', '--abbrev=0'],
proto_tag_raw = subprocess.run(
['git', 'describe', '--tags'],
cwd='../core/src/main/protobuf_shared',
check=True,
capture_output=True,
).stdout.decode().strip()
except subprocess.CalledProcessError as e:
print('Failed to call git: ', e.returncode, e.stderr)
raise e


def proto_tag():
if proto_tag_raw.count('-') > 1:
if jvm_version() == 'dev':
print(f'Warning: proto tag ({proto_tag_raw}) contains more than one hyphen, using dev instead')
return 'dev'
else:
raise ValueError(f'Proto tag ({proto_tag_raw}) contains more than one hyphen, but you are trying to build a tagged release. To fix this, you must update the protobuf_shared submodule to some stable tag.')


@env.macro
def jvm_version():
Expand Down Expand Up @@ -44,10 +53,11 @@ def git_link(file: str):
def proto_version():
if jvm_version() == 'dev':
return 'dev'
if '-' in proto_tag:
tag = proto_tag()
if '-' in tag:
print('Warning: proto tag contains a hyphen, using dev instead of ' + proto_tag)
return 'dev'
return proto_tag.replace('v', '')
return tag.replace('v', '')


@env.macro
Expand Down

0 comments on commit 7f12445

Please sign in to comment.