From 7c508dcfe6546437bba61a09bc1fd8bdb6c82105 Mon Sep 17 00:00:00 2001
From: Eric Froemling
Date: Fri, 3 Jul 2020 02:51:12 -0700
Subject: [PATCH] v1.5.17
---
.efrocachemap | 32 ++++----
.idea/dictionaries/ericf.xml | 7 ++
CHANGELOG.md | 4 +
assets/src/ba_data/python/_ba.py | 32 ++++++--
assets/src/ba_data/python/ba/_appconfig.py | 2 +-
assets/src/ba_data/python/bastd/ui/gather.py | 4 +-
docs/ba_module.md | 9 ++-
tools/batools/android.py | 2 +-
tools/batools/snippets.py | 36 ++++++++-
tools/efrotools/android.py | 84 ++++++++++++++++++++
tools/snippets | 3 +-
11 files changed, 181 insertions(+), 34 deletions(-)
create mode 100644 tools/efrotools/android.py
diff --git a/.efrocachemap b/.efrocachemap
index 8c3d924c..cf123ff0 100644
--- a/.efrocachemap
+++ b/.efrocachemap
@@ -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"
}
\ No newline at end of file
diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml
index 9d6534a6..459c3a5d 100644
--- a/.idea/dictionaries/ericf.xml
+++ b/.idea/dictionaries/ericf.xml
@@ -232,6 +232,7 @@
buildblessingcheck
builddir
buildfile
+ buildfilename
buildnum
buildtype
bullseye
@@ -407,6 +408,7 @@
ctex
ctuple
ctype
+ cupcmd
curdir
curhash
curhashes
@@ -548,11 +550,13 @@
editcontroller
editgame
editorconfig
+ efgrd
efile
efro
efrocache
efrocachemap
efroemling
+ efrogradle
efrosync
efrotool
efrotools
@@ -1068,6 +1072,7 @@
libxz
lindex
lindexorig
+ linebits
lineheight
lineno
linenum
@@ -1534,6 +1539,7 @@
pushdocs
pushish
pushlist
+ pushsymbols
putasset
putassetmanifest
putassetpack
@@ -1752,6 +1758,7 @@
shellapi
shiftdelay
shiftposition
+ shiplog
shobs
shortname
shouldn
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 090d1719..9ff993e1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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.
diff --git a/assets/src/ba_data/python/_ba.py b/assets/src/ba_data/python/_ba.py
index e9948ae1..c5078118 100644
--- a/assets/src/ba_data/python/_ba.py
+++ b/assets/src/ba_data/python/_ba.py
@@ -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.
diff --git a/assets/src/ba_data/python/ba/_appconfig.py b/assets/src/ba_data/python/ba/_appconfig.py
index 55f94943..d4d5b35b 100644
--- a/assets/src/ba_data/python/ba/_appconfig.py
+++ b/assets/src/ba_data/python/ba/_appconfig.py
@@ -149,7 +149,7 @@ def read_config() -> Tuple[AppConfig, bool]:
try:
_ba.log('broken config contents:\n' +
config_contents.replace('\000', ''),
- to_console=False)
+ to_stdout=False)
except Exception as exc:
print('EXC logging broken config contents:', exc)
config = AppConfig()
diff --git a/assets/src/ba_data/python/bastd/ui/gather.py b/assets/src/ba_data/python/bastd/ui/gather.py
index a9b93207..6e45dd83 100644
--- a/assets/src/ba_data/python/bastd/ui/gather.py
+++ b/assets/src/ba_data/python/bastd/ui/gather.py
@@ -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:
diff --git a/docs/ba_module.md b/docs/ba_module.md
index 0d5ec472..5a38c794 100644
--- a/docs/ba_module.md
+++ b/docs/ba_module.md
@@ -1,5 +1,5 @@
-last updated on 2020-06-30 for Ballistica version 1.5.15 build 20098
+last updated on 2020-07-03 for Ballistica version 1.5.17 build 20102
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 let me know. Happy modding!
@@ -6352,8 +6352,8 @@ is only useful for simple URLs.)
log(message: str, to_console: bool = True, newline: bool = True,
- to_server: bool = True) -> None
+log(message: str, to_stdout: bool = True,
+ to_server: bool = True) -> None
Category: General Utility Functions
@@ -6481,7 +6481,8 @@ It prints various info about the current object count, etc.
pushcall(call: Callable, from_other_thread: 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.
diff --git a/tools/batools/android.py b/tools/batools/android.py
index 08396d90..23506a4d 100644
--- a/tools/batools/android.py
+++ b/tools/batools/android.py
@@ -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:
diff --git a/tools/batools/snippets.py b/tools/batools/snippets.py
index 57e11240..a17d84fb 100644
--- a/tools/batools/snippets.py
+++ b/tools/batools/snippets.py
@@ -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)
diff --git a/tools/efrotools/android.py b/tools/efrotools/android.py
new file mode 100644
index 00000000..b5eb9412
--- /dev/null
+++ b/tools/efrotools/android.py
@@ -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)
diff --git a/tools/snippets b/tools/snippets
index ebe46596..1b862fc3 100755
--- a/tools/snippets
+++ b/tools/snippets
@@ -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: