tools consolidation

This commit is contained in:
Eric Froemling 2021-06-10 13:57:26 -05:00
parent 12d704e672
commit fdb5cfa83a
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
10 changed files with 69 additions and 23 deletions

View File

@ -3941,18 +3941,18 @@
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9c/7b/ac1a200be0f37078af0991faca3b",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/33/63/382b5d03b6859de55c252e1bc53f",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/5a/90/b6ff7f753011448bd1ef10f98525",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/54/e1/e946d71c83ae5aeb60957c6afba8",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/a1/a6/59d250814162a6277d828c910fb2",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/be/2d/6f7814c61e2cdf64196badcc66ff",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2e/cb/d5bb1384fef2ef9555ce4860b223",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/3d/7f/d4a740b66e707e7ce5777e1e6d05",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/95/8c/bb66f5c95dfad4d1e065a1c6ec65",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/9a/95/ef4cce689188a298a06fd8b91f8f",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/92/f1/a5e76f90c630e2b0353ab17403e6",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/ee/12/6e765384e0bdc251c83f49d8f4be",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/84/6c/ba6569adf15bb4e8dba4f4368e3f",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ba/e0/65c4d633bcb6b2108ede1b318a10",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a1/09/37cae1308d189851acc4f4be7e1b",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/36/22/df6c0eb6ea71cd58ce0c6d104c8b",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/e9/c6/cda6cff37de9b551c0945cef06d3",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/e8/61/823ab754444032a53f7d3471a6f1",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/c1/9c/7bbcb97e759e71f8c0839324e8b9",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/6c/cb/5b24a85c69eb42f42a1855bfb45b",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/46/dc/dfbc5d0bace55610f9a5bccd48bc",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/ac/98/e1116b5b7adbed6309b21baf796d",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/3e/21/ce34c716ff3b0c286312fb84a3eb",
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/17/8a/3e4eec6be82a7d51ec68c2cd9134",
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/18/27/4063e018845b61a43d3fb975dda9",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/94/8e/b57d1b16f9a97ae6b75f6aa64d24",

View File

@ -337,6 +337,7 @@
<w>chdir</w>
<w>cheadersline</w>
<w>checkarg</w>
<w>checkarglist</w>
<w>checkboxwidget</w>
<w>checkchisel</w>
<w>checkenv</w>
@ -886,6 +887,7 @@
<w>gameutils</w>
<w>gbytecount</w>
<w>gearvr</w>
<w>genchangelog</w>
<w>gendocs</w>
<w>gendummymodule</w>
<w>genericpath</w>

View File

@ -166,6 +166,7 @@
<w>charstr</w>
<w>chatmessage</w>
<w>chdir</w>
<w>checkarglist</w>
<w>checkboxwidget</w>
<w>checkchisel</w>
<w>childanntype</w>
@ -399,6 +400,7 @@
<w>gbus</w>
<w>gcc's</w>
<w>gearvr</w>
<w>genchangelog</w>
<w>getactivity</w>
<w>getattro</w>
<w>getattrofunc</w>

View File

@ -10,9 +10,9 @@ cpp_sources: ../ballistica/generated/python_embedded/binding.inc \
clean:
@rm -rf ../ballistica/generated
../ballistica/generated/python_embedded/bootstrap.inc : bameta/python_embedded/bootstrap.py ../../tools/batools/codegen.py
../ballistica/generated/python_embedded/bootstrap.inc : bameta/python_embedded/bootstrap.py ../../tools/batools/meta.py
@../../tools/pcommand gen_flat_data_code $< $@ bootstrap_code
../ballistica/generated/python_embedded/binding.inc : bameta/python_embedded/binding.py ../../tools/batools/codegen.py
../ballistica/generated/python_embedded/binding.inc : bameta/python_embedded/binding.py ../../tools/batools/meta.py
@../../tools/pcommand gen_binding_code $< $@

View File

@ -175,7 +175,7 @@ def lazybuild(target: str, category: SourceCategory, command: str) -> None:
# Everything possibly affecting meta builds.
if category is SourceCategory.META:
paths = [
'Makefile', 'tools/generate_code', 'tools/batools/codegen.py',
'Makefile', 'tools/generate_code', 'tools/batools/meta.py',
'src/meta'
]

34
tools/batools/genchangelog.py Executable file
View File

@ -0,0 +1,34 @@
# Released under the MIT License. See LICENSE for details.
#
"""Generates a pretty html changelog from our markdown."""
import os
import subprocess
def generate(projroot: str) -> None:
"""Main script entry point."""
# Make sure we start from root dir (one above this script).
os.chdir(projroot)
out_path = 'build/changelog.html'
out_path_tmp = out_path + '.md'
# Do some filtering of our raw changelog.
with open('CHANGELOG.md') as infile:
lines = infile.read().splitlines()
# Strip out anything marked internal.
lines = [
line for line in lines if not line.strip().startswith('- (internal)')
]
with open(out_path_tmp, 'w') as outfile:
outfile.write('\n'.join(lines))
subprocess.run(f'pandoc -f markdown {out_path_tmp} > {out_path}',
shell=True,
check=True)
print(f'Generated changelog at \'{out_path}\'.')
os.unlink(out_path_tmp)

View File

@ -1,6 +1,6 @@
# Released under the MIT License. See LICENSE for details.
#
"""Functionality related to code generation."""
"""Functionality used in meta-builds (dynamically generated sources)."""
from __future__ import annotations
import os

View File

@ -804,24 +804,24 @@ def cmake_prep_dir() -> None:
def gen_binding_code() -> None:
"""Generate binding.inc file."""
from efro.error import CleanError
import batools.codegen
import batools.meta
if len(sys.argv) != 4:
raise CleanError('Expected 2 args (srcfile, dstfile)')
inpath = sys.argv[2]
outpath = sys.argv[3]
batools.codegen.gen_binding_code(str(PROJROOT), inpath, outpath)
batools.meta.gen_binding_code(str(PROJROOT), inpath, outpath)
def gen_flat_data_code() -> None:
"""Generate a C++ include file from a Python file."""
from efro.error import CleanError
import batools.codegen
import batools.meta
if len(sys.argv) != 5:
raise CleanError('Expected 3 args (srcfile, dstfile, varname)')
inpath = sys.argv[2]
outpath = sys.argv[3]
varname = sys.argv[4]
batools.codegen.gen_flat_data_code(str(PROJROOT), inpath, outpath, varname)
batools.meta.gen_flat_data_code(str(PROJROOT), inpath, outpath, varname)
def win_ci_binary_build() -> None:
@ -849,3 +849,9 @@ def win_ci_binary_build() -> None:
check=True,
)
print('so far so good 4', flush=True)
def genchangelog() -> None:
"""Gen a pretty html changelog."""
from batools.genchangelog import generate
generate(projroot=str(PROJROOT))

View File

@ -53,6 +53,7 @@ class Updater:
self._check = check
self._fix = fix
self._checkarg = ' --check' if self._check else ''
self._checkarglist: List[str] = ['--check'] if self._check else []
# We behave differently in the public repo
self._public = getconfig(Path('.'))['public']
@ -79,8 +80,8 @@ class Updater:
# NOTE: Do py-enums before updating asset deps since it *is* an asset.
self._update_python_enums_module()
self._update_resources_makefile()
self._update_meta_makefile()
self._update_resources_makefile()
self._update_assets_makefile()
self._check_makefiles()
@ -176,11 +177,12 @@ class Updater:
# been updated.
# (only do this if gendocs is available)
if os.path.exists('tools/gendocs.py'):
if os.system('tools/pcommand update_docs_md' +
self._checkarg) != 0:
print(f'{Clr.RED}Error checking/updating'
f' docs markdown.{Clr.RST}')
sys.exit(255)
try:
subprocess.run(['tools/pcommand', 'update_docs_md'] +
self._checkarglist,
check=True)
except Exception as exc:
raise CleanError('Error checking/updating docs') from exc
def _update_prereqs(self) -> None:

View File

@ -39,7 +39,7 @@ from batools.pcommand import (
efro_gradle, stage_assets, update_assets_makefile, update_project,
update_cmake_prefab_lib, cmake_prep_dir, gen_binding_code,
gen_flat_data_code, wsl_path_to_win, wsl_build_check_win_drive,
win_ci_binary_build)
win_ci_binary_build, genchangelog)
# pylint: enable=unused-import
if TYPE_CHECKING: