api version utils

This commit is contained in:
Eric Froemling 2022-07-20 10:25:09 -07:00
parent f0609cfc00
commit 709d3d8a4e
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
6 changed files with 648 additions and 618 deletions

File diff suppressed because it is too large Load Diff

View File

@ -89,6 +89,7 @@
<w>aparsed</w> <w>aparsed</w>
<w>apichanges</w> <w>apichanges</w>
<w>apis</w> <w>apis</w>
<w>apiversion</w>
<w>apks</w> <w>apks</w>
<w>apost</w> <w>apost</w>
<w>appath</w> <w>appath</w>
@ -1369,6 +1370,7 @@
<w>linenum</w> <w>linenum</w>
<w>linenumber</w> <w>linenumber</w>
<w>linenums</w> <w>linenums</w>
<w>linestart</w>
<w>linetype</w> <w>linetype</w>
<w>linetypes</w> <w>linetypes</w>
<w>linflav</w> <w>linflav</w>

View File

@ -1,4 +1,4 @@
### 1.7.5 (20654, 2022-07-18) ### 1.7.5 (build 20658, api 7, 2022-07-20)
- Android build now uses the ReLinker library to load the native main.so, which will (hopefully) avoid some random load failures on older Android versions. - Android build now uses the ReLinker library to load the native main.so, which will (hopefully) avoid some random load failures on older Android versions.
- Android Google Play build now prints a message at launch if the billing library isn't available or needs to be updated (explaining why purchases won't work in that case). - Android Google Play build now prints a message at launch if the billing library isn't available or needs to be updated (explaining why purchases won't work in that case).
- Various minor bug fixes (mostly cleaning up unnecessary error logging) - Various minor bug fixes (mostly cleaning up unnecessary error logging)

View File

@ -59,6 +59,7 @@
<w>aosp</w> <w>aosp</w>
<w>aparsed</w> <w>aparsed</w>
<w>apientry</w> <w>apientry</w>
<w>apiversion</w>
<w>apost</w> <w>apost</w>
<w>appconfig</w> <w>appconfig</w>
<w>appname</w> <w>appname</w>
@ -693,6 +694,7 @@
<w>linearsize</w> <w>linearsize</w>
<w>linearstep</w> <w>linearstep</w>
<w>linemax</w> <w>linemax</w>
<w>linestart</w>
<w>linkstoryboards</w> <w>linkstoryboards</w>
<w>listobj</w> <w>listobj</w>
<w>llock</w> <w>llock</w>

View File

@ -21,7 +21,7 @@
namespace ballistica { namespace ballistica {
// These are set automatically via script; don't modify them here. // These are set automatically via script; don't modify them here.
const int kAppBuildNumber = 20654; const int kAppBuildNumber = 20658;
const char* kAppVersion = "1.7.5"; const char* kAppVersion = "1.7.5";
// Our standalone globals. // Our standalone globals.

View File

@ -5,28 +5,39 @@
from __future__ import annotations from __future__ import annotations
import os import os
import sys from enum import Enum
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from typing_extensions import assert_never
from efro.error import CleanError
if TYPE_CHECKING: if TYPE_CHECKING:
pass pass
def _handle_args(args: list[str]) -> str: class Mode(Enum):
"""Mode we can run this command in."""
INFO = 'info'
BUILD = 'build'
VERSION = 'version'
API = 'api'
def _handle_args(args: list[str]) -> Mode:
"""parse os args and return a mode""" """parse os args and return a mode"""
mode = None mode: Mode | None = None
if len(args) == 0: if len(args) == 0:
print('OPTIONS: info, build, version') print('OPTIONS: info, build, version', 'apiversion')
sys.exit(0) raise CleanError()
elif len(args) == 1:
if args[0] == 'info': try:
mode = 'info' mode = Mode(args[0])
if args[0] == 'build': except ValueError as exc:
mode = 'build' raise CleanError(f"Invalid mode '{args[0]}'") from exc
if args[0] == 'version':
mode = 'version' if len(args) != 1:
if mode is None: raise CleanError('Incorrect args.')
raise Exception('invalid args')
return mode return mode
@ -52,6 +63,18 @@ def get_current_version() -> tuple[str, int]:
return version, build_number return version, build_number
def get_current_api_version() -> int:
"""Pull current api version from the project."""
with open('assets/src/ba_data/python/ba/_meta.py',
encoding='utf-8') as infile:
lines = infile.readlines()
linestart = 'CURRENT_API_VERSION = '
for line in lines:
if line.startswith(linestart):
return int(line.strip().removeprefix(linestart).strip())
raise RuntimeError('Api version line not found.')
def run(projroot: str, args: list[str]) -> None: def run(projroot: str, args: list[str]) -> None:
"""Main entry point for this script.""" """Main entry point for this script."""
@ -62,12 +85,15 @@ def run(projroot: str, args: list[str]) -> None:
version, build_number = get_current_version() version, build_number = get_current_version()
if mode == 'info': if mode is Mode.INFO:
print('version = ' + version) print('version = ' + version)
print('build = ' + str(build_number)) print('build = ' + str(build_number))
elif mode == 'version': print('api = ' + str(get_current_api_version()))
elif mode is Mode.VERSION:
print(version) print(version)
elif mode == 'build': elif mode is Mode.BUILD:
print(build_number) print(build_number)
elif mode is Mode.API:
print(get_current_api_version())
else: else:
raise Exception('invalid mode: ' + str(mode)) assert_never(mode)