This commit is contained in:
Eric Froemling 2020-07-03 02:51:12 -07:00
parent 3ffeff8ce4
commit 7c508dcfe6
11 changed files with 181 additions and 34 deletions

View File

@ -420,7 +420,7 @@
"assets/build/ba_data/audio/zoeOw.ogg": "https://files.ballistica.net/cache/ba1/75/1d/868bb04cf691736035c917d02762",
"assets/build/ba_data/audio/zoePickup01.ogg": "https://files.ballistica.net/cache/ba1/44/2a/8535b446284235cb503947ece074",
"assets/build/ba_data/audio/zoeScream01.ogg": "https://files.ballistica.net/cache/ba1/f5/d3/8e941851c4310465646c4167afc1",
"assets/build/ba_data/data/langdata.json": "https://files.ballistica.net/cache/ba1/91/cc/22cdc1ce692de2cba974bd095d8b",
"assets/build/ba_data/data/langdata.json": "https://files.ballistica.net/cache/ba1/b5/5b/63af84997e9012c1917ea298ebbb",
"assets/build/ba_data/data/languages/arabic.json": "https://files.ballistica.net/cache/ba1/4c/ca/1e38748da251895ca11dcdc87107",
"assets/build/ba_data/data/languages/belarussian.json": "https://files.ballistica.net/cache/ba1/49/5f/b29bb65369040892fe6601801637",
"assets/build/ba_data/data/languages/chinese.json": "https://files.ballistica.net/cache/ba1/bc/59/21bb0b4ef33c733022340c60aebf",
@ -431,11 +431,11 @@
"assets/build/ba_data/data/languages/dutch.json": "https://files.ballistica.net/cache/ba1/5b/a3/a46a77f0cc498e1f1e369d772414",
"assets/build/ba_data/data/languages/english.json": "https://files.ballistica.net/cache/ba1/30/f3/4ef3bbaf1e5b7abe114c119ec106",
"assets/build/ba_data/data/languages/esperanto.json": "https://files.ballistica.net/cache/ba1/6e/fd/685a4e1da031474d47a1d9eb2731",
"assets/build/ba_data/data/languages/french.json": "https://files.ballistica.net/cache/ba1/95/9b/66e9080c82ef76387832dedee9b4",
"assets/build/ba_data/data/languages/french.json": "https://files.ballistica.net/cache/ba1/c7/63/f72f7f8b2004ff79b1606b040f8b",
"assets/build/ba_data/data/languages/german.json": "https://files.ballistica.net/cache/ba1/ef/92/4a602f11f6dd3d0310ce98cd5538",
"assets/build/ba_data/data/languages/gibberish.json": "https://files.ballistica.net/cache/ba1/8e/24/f070599beb7b09e1268569fa55b1",
"assets/build/ba_data/data/languages/greek.json": "https://files.ballistica.net/cache/ba1/17/78/3fd0dca40e632ce53d03a944e7fa",
"assets/build/ba_data/data/languages/hindi.json": "https://files.ballistica.net/cache/ba1/ae/22/c1976a822db658e5aa732b21228e",
"assets/build/ba_data/data/languages/hindi.json": "https://files.ballistica.net/cache/ba1/30/e7/d36b1b1eeb2ec10633281855a34c",
"assets/build/ba_data/data/languages/hungarian.json": "https://files.ballistica.net/cache/ba1/4d/4b/0790110201c9adb1b521e9a55e63",
"assets/build/ba_data/data/languages/indonesian.json": "https://files.ballistica.net/cache/ba1/e3/6f/df2600b658a163f80077bd6c8d78",
"assets/build/ba_data/data/languages/italian.json": "https://files.ballistica.net/cache/ba1/70/d0/36b0d655839c60c2a763bbe52332",
@ -450,7 +450,7 @@
"assets/build/ba_data/data/languages/spanish.json": "https://files.ballistica.net/cache/ba1/a9/77/722faae6a695f19501bac76098db",
"assets/build/ba_data/data/languages/swedish.json": "https://files.ballistica.net/cache/ba1/50/9f/be006ba19be6a69a57837eb6dca0",
"assets/build/ba_data/data/languages/turkish.json": "https://files.ballistica.net/cache/ba1/ef/61/7dcdc48c7039bbad6cd01d3f9a1f",
"assets/build/ba_data/data/languages/ukrainian.json": "https://files.ballistica.net/cache/ba1/71/ea/8dfd2a392713ead3f60a833b3a4e",
"assets/build/ba_data/data/languages/ukrainian.json": "https://files.ballistica.net/cache/ba1/9d/fb/6c2feb78bdabbec049a71ba40d78",
"assets/build/ba_data/data/languages/vietnamese.json": "https://files.ballistica.net/cache/ba1/f1/00/c4ccd5969084505359e07f927b3a",
"assets/build/ba_data/data/maps/big_g.json": "https://files.ballistica.net/cache/ba1/47/0a/a617cc85d927b576c4e6fc1091ed",
"assets/build/ba_data/data/maps/bridgit.json": "https://files.ballistica.net/cache/ba1/03/4b/57ee9b42854b26f23f81bd8c58ef",
@ -4135,16 +4135,16 @@
"assets/build/windows/x64/vc_redist.x64.exe": "https://files.ballistica.net/cache/ba1/ea/19/8b8787d81abcdce158ba608cd24f",
"assets/build/windows/x64/vcruntime140_1d.dll": "https://files.ballistica.net/cache/ba1/11/d8/ff6344b429b00c24d9a1930d4338",
"assets/build/windows/x64/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/20/33/0825e11e6518f87ece3009309933",
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b6/60/0ec966889ccd774e7e7c2bde2300",
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/19/69/1a53798138120730e4b50553d3a6",
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d2/b3/2c1e2e99161df7774dc15da7974d",
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/e2/3d/afc0c90ce7f78aefa0235eeafa0b",
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/fb/42/2d6119d13bd4f4c3f6f82cd23e82",
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/60/59/6c48f3172215908e6a14784e3f76",
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/a1/cc/5bc457d1a527fa8baccff1e4c5fa",
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/c2/98/471cb5f15f314c1ddae478d37a26",
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/cb/e8/d18b9d76c0223d65ff01a6641682",
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/4b/68/b21c4b91bda649f21a7ded0c6b55",
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/4f/27/029c90dc03cab7fb214c03b3c125",
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/7f/b9/a61816627b8f70c7b5741f49d7f3"
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/85/af/d70d326fe40d4ec40672c5d062ea",
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2b/3c/d5c499426cf31f0bc75e56ba3294",
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d3/f5/d97f3590bac4f4aa811d1de04222",
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/c4/35/f83dc6901dfb3d398fda301eb6b5",
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e7/39/a79bf14a5a823e81dcfaaa846df5",
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/1a/39/cf3412e69777805f53f3d65a0cf1",
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/e7/b7/02b5a461b12f6f0ecae09e6efb45",
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d5/00/77b425a357d8ea186e71611e20fa",
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/36/75/f1214d30fc1e28d342fc35071098",
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/fc/d1/37903806d79ea619531731232aef",
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/97/79/5a38fba6af60053de588c02b79c3",
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/89/ab/4301d0fda22038089dab5c804bad"
}

View File

@ -232,6 +232,7 @@
<w>buildblessingcheck</w>
<w>builddir</w>
<w>buildfile</w>
<w>buildfilename</w>
<w>buildnum</w>
<w>buildtype</w>
<w>bullseye</w>
@ -407,6 +408,7 @@
<w>ctex</w>
<w>ctuple</w>
<w>ctype</w>
<w>cupcmd</w>
<w>curdir</w>
<w>curhash</w>
<w>curhashes</w>
@ -548,11 +550,13 @@
<w>editcontroller</w>
<w>editgame</w>
<w>editorconfig</w>
<w>efgrd</w>
<w>efile</w>
<w>efro</w>
<w>efrocache</w>
<w>efrocachemap</w>
<w>efroemling</w>
<w>efrogradle</w>
<w>efrosync</w>
<w>efrotool</w>
<w>efrotools</w>
@ -1068,6 +1072,7 @@
<w>libxz</w>
<w>lindex</w>
<w>lindexorig</w>
<w>linebits</w>
<w>lineheight</w>
<w>lineno</w>
<w>linenum</w>
@ -1534,6 +1539,7 @@
<w>pushdocs</w>
<w>pushish</w>
<w>pushlist</w>
<w>pushsymbols</w>
<w>putasset</w>
<w>putassetmanifest</w>
<w>putassetpack</w>
@ -1752,6 +1758,7 @@
<w>shellapi</w>
<w>shiftdelay</w>
<w>shiftposition</w>
<w>shiplog</w>
<w>shobs</w>
<w>shortname</w>
<w>shouldn</w>

View File

@ -1,3 +1,7 @@
### 1.5.17 (20102)
- More cleanup to logging and crash reporting system.
- Various other minor bug fixes..
### 1.5.16 (20099)
- Hopefully finally fixed that pesky crash bug on score submissions.

View File

@ -2803,12 +2803,9 @@ def lock_all_input() -> None:
return None
def log(message: str,
to_console: bool = True,
newline: bool = True,
to_server: bool = True) -> None:
"""log(message: str, to_console: bool = True, newline: bool = True,
to_server: bool = True) -> None
def log(message: str, to_stdout: bool = True, to_server: bool = True) -> None:
"""log(message: str, to_stdout: bool = True,
to_server: bool = True) -> None
Category: General Utility Functions
@ -3081,6 +3078,22 @@ def print_load_info() -> None:
return None
def print_stderr(message: str) -> None:
"""print_stderr(message: str) -> None
(internal)
"""
return None
def print_stdout(message: str) -> None:
"""print_stdout(message: str) -> None
(internal)
"""
return None
def printnodes() -> None:
"""printnodes() -> None
@ -3112,8 +3125,11 @@ def purchase(item: str) -> None:
return None
def pushcall(call: Callable, from_other_thread: bool = False) -> None:
"""pushcall(call: Callable, from_other_thread: bool = False) -> None
def pushcall(call: Callable,
from_other_thread: bool = False,
suppress_other_thread_warning: bool = False) -> None:
"""pushcall(call: Callable, from_other_thread: bool = False,
suppress_other_thread_warning: bool = False ) -> None
Pushes a call onto the event loop to be run during the next cycle.

View File

@ -149,7 +149,7 @@ def read_config() -> Tuple[AppConfig, bool]:
try:
_ba.log('broken config contents:\n' +
config_contents.replace('\000', '<NULL_BYTE>'),
to_console=False)
to_stdout=False)
except Exception as exc:
print('EXC logging broken config contents:', exc)
config = AppConfig()

View File

@ -1667,8 +1667,8 @@ class GatherWindow(ba.Window):
# Ignore harmless errors.
if exc.errno in {
errno.EHOSTUNREACH,
errno.ENETUNREACH,
errno.EHOSTUNREACH, errno.ENETUNREACH,
errno.EINVAL
}:
pass
elif exc.errno == 10022:

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2020-06-30 for Ballistica version 1.5.15 build 20098</em></h4>
<h4><em>last updated on 2020-07-03 for Ballistica version 1.5.17 build 20102</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module,
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
<hr>
@ -6352,8 +6352,8 @@ is only useful for simple URLs.)</p>
<hr>
<h2><strong><a name="function_ba_log">ba.log()</a></strong></h3>
<p><span>log(message: str, to_console: bool = True, newline: bool = True,
to_server: bool = True) -&gt; None</span></p>
<p><span>log(message: str, to_stdout: bool = True,
to_server: bool = True) -&gt; None</span></p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
@ -6481,7 +6481,8 @@ It prints various info about the current object count, etc.</p>
<hr>
<h2><strong><a name="function_ba_pushcall">ba.pushcall()</a></strong></h3>
<p><span>pushcall(call: Callable, from_other_thread: bool = False) -&gt; None</span></p>
<p><span>pushcall(call: Callable, from_other_thread: bool = False,
suppress_other_thread_warning: bool = False ) -&gt; None</span></p>
<p>Pushes a call onto the event loop to be run during the next cycle.</p>

View File

@ -30,7 +30,7 @@ from typing import TYPE_CHECKING
import efrotools
if TYPE_CHECKING:
pass
from typing import List, Optional, Set
def androidaddr(archive_dir: str, arch: str, addr: str) -> None:

View File

@ -33,7 +33,7 @@ from typing import TYPE_CHECKING
from efrotools.snippets import PROJROOT
if TYPE_CHECKING:
from typing import Optional
from typing import Optional, List, Set
def stage_server_file() -> None:
@ -651,3 +651,37 @@ def android_archive_unstripped_libs() -> None:
cwd=dst,
check=True)
subprocess.run(['rm', dstpath], check=True)
def _camel_case_split(string: str) -> List[str]:
words = [[string[0]]]
for char in string[1:]:
if words[-1][-1].islower() and char.isupper():
words.append(list(char))
else:
words[-1].append(char)
return [''.join(word) for word in words]
def efro_gradle() -> None:
"""Calls ./gradlew with some extra magic."""
import subprocess
from efrotools.android import filter_gradle_file
args = ['./gradlew'] + sys.argv[2:]
enabled_tags: Set[str] = set()
target_words = [w.lower() for w in _camel_case_split(args[-1])]
if 'google' in target_words:
enabled_tags = {'google', 'crashlytics'}
filter_gradle_file('BallisticaCore/build.gradle', enabled_tags)
try:
subprocess.run(args, check=True)
errored = False
except BaseException:
errored = True
# Put things back to default state.
filter_gradle_file('BallisticaCore/build.gradle', set())
if errored:
sys.exit(1)

View File

@ -0,0 +1,84 @@
#!/usr/bin/env python3.7
# Copyright (c) 2011-2020 Eric Froemling
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# -----------------------------------------------------------------------------
"""Functionality related to android builds."""
from __future__ import annotations
from typing import TYPE_CHECKING
from dataclasses import dataclass
if TYPE_CHECKING:
from typing import List, Optional, Set
@dataclass
class GradleFilterSection:
"""Filtered section of gradle file."""
tag: str
firstline: int
lastline: int
def filter_gradle_file(buildfilename: str, enabled_tags: Set[str]) -> None:
"""Filter 'EFRO_IF' sections in a gradle file."""
sections: List[GradleFilterSection] = []
with open(buildfilename) as infile:
original = infile.read()
lines = original.splitlines()
current_section: Optional[GradleFilterSection] = None
for i, line in enumerate(lines):
if line.strip().startswith('// EFRO_IF'):
if current_section is not None:
raise RuntimeError('Malformed gradle file')
current_section = GradleFilterSection(tag=line.split()[2],
firstline=i,
lastline=i)
elif line.strip().startswith('// EFRO_ENDIF'):
if current_section is None:
raise RuntimeError('Malformed gradle file')
current_section.lastline = i
sections.append(current_section)
current_section = None
if current_section is not None:
raise RuntimeError('Malformed gradle file')
for section in sections:
for lineno in range(section.firstline + 1, section.lastline):
enable = section.tag in enabled_tags
line = lines[lineno]
leading = ''
while line.startswith(' '):
leading += ' '
line = line[1:]
if not enable and not line.startswith('// '):
line = '// ' + line
if enable and line.startswith('// '):
line = line[3:]
lines[lineno] = leading + line
# Only write if its not changed (potentially avoid triggering builds).
out = '\n'.join(lines) + '\n'
if out != original:
with open(buildfilename, 'w') as outfile:
outfile.write(out)

View File

@ -54,7 +54,8 @@ from batools.snippets import (
python_gather, capitalize, efrocache_update, efrocache_get,
get_modern_make, warm_start_asset_build, update_docs_md, list_pip_reqs,
install_pip_reqs, checkenv, ensure_prefab_platform, prefab_run_var,
make_prefab, update_makebob, lazybuild, android_archive_unstripped_libs)
make_prefab, update_makebob, lazybuild, android_archive_unstripped_libs,
efro_gradle)
# pylint: enable=unused-import
if TYPE_CHECKING: