mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-06 15:47:06 +08:00
latest work on internal
This commit is contained in:
parent
c801256a6a
commit
41fb4ac022
9
.idea/dictionaries/ericf.xml
generated
9
.idea/dictionaries/ericf.xml
generated
@ -1,10 +1,6 @@
|
|||||||
<component name="ProjectDictionaryState">
|
<component name="ProjectDictionaryState">
|
||||||
<dictionary name="ericf">
|
<dictionary name="ericf">
|
||||||
<words>
|
<words>
|
||||||
<w>onln</w>
|
|
||||||
<w>nprocessors</w>
|
|
||||||
<w>getconf</w>
|
|
||||||
<w>cpus</w>
|
|
||||||
<w>aaaa</w>
|
<w>aaaa</w>
|
||||||
<w>aaab</w>
|
<w>aaab</w>
|
||||||
<w>aaac</w>
|
<w>aaac</w>
|
||||||
@ -294,6 +290,7 @@
|
|||||||
<w>cpplintcode</w>
|
<w>cpplintcode</w>
|
||||||
<w>cpplintcodefull</w>
|
<w>cpplintcodefull</w>
|
||||||
<w>cpuinfo</w>
|
<w>cpuinfo</w>
|
||||||
|
<w>cpus</w>
|
||||||
<w>cpython</w>
|
<w>cpython</w>
|
||||||
<w>crashlytics</w>
|
<w>crashlytics</w>
|
||||||
<w>creditslist</w>
|
<w>creditslist</w>
|
||||||
@ -602,6 +599,7 @@
|
|||||||
<w>getclass</w>
|
<w>getclass</w>
|
||||||
<w>getcollide</w>
|
<w>getcollide</w>
|
||||||
<w>getcollidemodel</w>
|
<w>getcollidemodel</w>
|
||||||
|
<w>getconf</w>
|
||||||
<w>getconfig</w>
|
<w>getconfig</w>
|
||||||
<w>getcurrency</w>
|
<w>getcurrency</w>
|
||||||
<w>getdata</w>
|
<w>getdata</w>
|
||||||
@ -1008,6 +1006,7 @@
|
|||||||
<w>nosynctools</w>
|
<w>nosynctools</w>
|
||||||
<w>notdir</w>
|
<w>notdir</w>
|
||||||
<w>npos</w>
|
<w>npos</w>
|
||||||
|
<w>nprocessors</w>
|
||||||
<w>ntpath</w>
|
<w>ntpath</w>
|
||||||
<w>ntriple</w>
|
<w>ntriple</w>
|
||||||
<w>nturl</w>
|
<w>nturl</w>
|
||||||
@ -1028,11 +1027,13 @@
|
|||||||
<w>oghashes</w>
|
<w>oghashes</w>
|
||||||
<w>ogval</w>
|
<w>ogval</w>
|
||||||
<w>oldlady</w>
|
<w>oldlady</w>
|
||||||
|
<w>onln</w>
|
||||||
<w>onscreencountdown</w>
|
<w>onscreencountdown</w>
|
||||||
<w>onscreenkeyboard</w>
|
<w>onscreenkeyboard</w>
|
||||||
<w>onscreentimer</w>
|
<w>onscreentimer</w>
|
||||||
<w>opcode</w>
|
<w>opcode</w>
|
||||||
<w>opdir</w>
|
<w>opdir</w>
|
||||||
|
<w>opendiff</w>
|
||||||
<w>operasinger</w>
|
<w>operasinger</w>
|
||||||
<w>oppnode</w>
|
<w>oppnode</w>
|
||||||
<w>opstr</w>
|
<w>opstr</w>
|
||||||
|
|||||||
@ -14,7 +14,7 @@ NOTE: This file was autogenerated by gendummymodule; do not edit by hand.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# (hash we can use to see if this file is out of date)
|
# (hash we can use to see if this file is out of date)
|
||||||
# SOURCES_HASH=263007419767527489115215049118001842367
|
# SOURCES_HASH=71385272086508687614988508550620664609
|
||||||
|
|
||||||
# I'm sorry Pylint. I know this file saddens you. Be strong.
|
# I'm sorry Pylint. I know this file saddens you. Be strong.
|
||||||
# pylint: disable=useless-suppression
|
# pylint: disable=useless-suppression
|
||||||
|
|||||||
@ -2,28 +2,8 @@
|
|||||||
"code_source_dirs": [
|
"code_source_dirs": [
|
||||||
"src/ballistica"
|
"src/ballistica"
|
||||||
],
|
],
|
||||||
"cpplint_blacklist": [
|
|
||||||
"src/ballistica/generic/json.cc",
|
|
||||||
"src/ballistica/generic/json.h",
|
|
||||||
"src/ballistica/generic/utf8.cc",
|
|
||||||
"src/ballistica/graphics/texture/dds.h",
|
|
||||||
"src/ballistica/graphics/texture/ktx.cc",
|
|
||||||
"src/ballistica/platform/android/android_gl3.h",
|
|
||||||
"src/ballistica/platform/apple/app_delegate.h",
|
|
||||||
"src/ballistica/platform/apple/scripting_bridge_itunes.h",
|
|
||||||
"src/ballistica/platform/android/utf8/checked.h",
|
|
||||||
"src/ballistica/platform/android/utf8/unchecked.h",
|
|
||||||
"src/ballistica/platform/android/utf8/core.h",
|
|
||||||
"src/ballistica/platform/apple/sdl_main_mac.h",
|
|
||||||
"src/ballistica/platform/oculus/main_rift.cc"
|
|
||||||
],
|
|
||||||
"name": "BallisticaCore",
|
"name": "BallisticaCore",
|
||||||
"push_ipa_config": {
|
"public": true,
|
||||||
"app_bundle_name": "BallisticaCore.app",
|
|
||||||
"archive_name": "bs",
|
|
||||||
"projectpath": "ballisticacore-ios.xcodeproj",
|
|
||||||
"scheme": "BallisticaCore iOS Legacy"
|
|
||||||
},
|
|
||||||
"pylint_ignored_untracked_deps": [
|
"pylint_ignored_untracked_deps": [
|
||||||
"bs_mapdefs_tip_top",
|
"bs_mapdefs_tip_top",
|
||||||
"bs_mapdefs_lake_frigid",
|
"bs_mapdefs_lake_frigid",
|
||||||
|
|||||||
@ -114,7 +114,7 @@ def cpplintcode(projroot: Path, full: bool) -> None:
|
|||||||
def get_code_filenames(projroot: Path) -> List[str]:
|
def get_code_filenames(projroot: Path) -> List[str]:
|
||||||
"""Return the list of files to lint-check or auto-formatting."""
|
"""Return the list of files to lint-check or auto-formatting."""
|
||||||
from efrotools import get_config
|
from efrotools import get_config
|
||||||
exts = ('.h', '.cc', '.m', '.mm')
|
exts = ('.h', '.c', '.cc', '.cpp', '.cxx', '.m', '.mm')
|
||||||
places = get_config(projroot).get('code_source_dirs', None)
|
places = get_config(projroot).get('code_source_dirs', None)
|
||||||
if places is None:
|
if places is None:
|
||||||
raise RuntimeError('code_source_dirs not declared in config')
|
raise RuntimeError('code_source_dirs not declared in config')
|
||||||
@ -189,7 +189,7 @@ def _should_include_script(fnamefull: str) -> bool:
|
|||||||
if '/usr/bin/env python' in line or '/usr/bin/python' in line:
|
if '/usr/bin/env python' in line or '/usr/bin/python' in line:
|
||||||
return True
|
return True
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
# actual binary files will probably kick back this error..
|
# Actual binary files will probably kick back this error.
|
||||||
pass
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,8 @@ from typing import TYPE_CHECKING
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Optional, Tuple, List, Dict, Set
|
from typing import Optional, Tuple, List, Dict, Set
|
||||||
|
|
||||||
|
LEGAL_NOTICE_PRIVATE = 'Copyright (c) 2019 Eric Froemling'
|
||||||
|
|
||||||
CLRHDR = '\033[95m' # Header.
|
CLRHDR = '\033[95m' # Header.
|
||||||
CLRGRN = '\033[92m' # Green.
|
CLRGRN = '\033[92m' # Green.
|
||||||
CLRBLU = '\033[94m' # Glue.
|
CLRBLU = '\033[94m' # Glue.
|
||||||
@ -35,10 +37,16 @@ class App:
|
|||||||
"""Context for an app run."""
|
"""Context for an app run."""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
|
from efrotools import get_config
|
||||||
|
from pathlib import Path
|
||||||
self._check = ('--check' in sys.argv)
|
self._check = ('--check' in sys.argv)
|
||||||
self._fix = ('--fix' in sys.argv)
|
self._fix = ('--fix' in sys.argv)
|
||||||
self._checkarg = ' --check' if self._check else ''
|
self._checkarg = ' --check' if self._check else ''
|
||||||
|
|
||||||
|
# We behave differently in the public repo
|
||||||
|
self._public = get_config(Path('.'))['public']
|
||||||
|
assert isinstance(self._public, bool)
|
||||||
|
|
||||||
self._files_to_write: Dict[str, str] = {}
|
self._files_to_write: Dict[str, str] = {}
|
||||||
self._src_files: List[str] = []
|
self._src_files: List[str] = []
|
||||||
self._header_files: List[str] = []
|
self._header_files: List[str] = []
|
||||||
@ -61,7 +69,7 @@ class App:
|
|||||||
self._check_sync_states()
|
self._check_sync_states()
|
||||||
|
|
||||||
self._find_sources_and_headers('src/ballistica')
|
self._find_sources_and_headers('src/ballistica')
|
||||||
self._check_files()
|
self._check_source_files()
|
||||||
self._check_headers()
|
self._check_headers()
|
||||||
|
|
||||||
self._update_cmake_files()
|
self._update_cmake_files()
|
||||||
@ -136,9 +144,8 @@ class App:
|
|||||||
else:
|
else:
|
||||||
print(f'No issues found in {len(self._header_files)} headers.')
|
print(f'No issues found in {len(self._header_files)} headers.')
|
||||||
|
|
||||||
def _check_files(self) -> None:
|
def _check_source_files(self) -> None:
|
||||||
|
|
||||||
# A bit of sanity/lint-testing while we're here.
|
|
||||||
for fsrc in self._src_files:
|
for fsrc in self._src_files:
|
||||||
if fsrc.endswith('.cpp') or fsrc.endswith('.cxx'):
|
if fsrc.endswith('.cpp') or fsrc.endswith('.cxx'):
|
||||||
raise Exception('please use .cc for c++ files; found ' + fsrc)
|
raise Exception('please use .cc for c++ files; found ' + fsrc)
|
||||||
@ -152,6 +159,21 @@ class App:
|
|||||||
f'{CLREND}')
|
f'{CLREND}')
|
||||||
sys.exit(255)
|
sys.exit(255)
|
||||||
|
|
||||||
|
fname = 'src/ballistica' + fsrc
|
||||||
|
self._check_source_file(fname)
|
||||||
|
|
||||||
|
def _check_source_file(self, fname: str) -> None:
|
||||||
|
with open(fname) as infile:
|
||||||
|
lines = infile.read().splitlines()
|
||||||
|
|
||||||
|
# Check for Copyright line/license.
|
||||||
|
expected_lines = [(0, '// ' + LEGAL_NOTICE_PRIVATE)]
|
||||||
|
for line_number, expected in expected_lines:
|
||||||
|
if lines[line_number] != expected:
|
||||||
|
print(CLRRED + "Invalid legal notice in '" + fname +
|
||||||
|
"'; please correct." + CLREND)
|
||||||
|
sys.exit(255)
|
||||||
|
|
||||||
def _check_headers(self) -> None:
|
def _check_headers(self) -> None:
|
||||||
for header_file_raw in self._header_files:
|
for header_file_raw in self._header_files:
|
||||||
assert header_file_raw[0] == '/'
|
assert header_file_raw[0] == '/'
|
||||||
@ -172,7 +194,11 @@ class App:
|
|||||||
'_')
|
'_')
|
||||||
with open(header_file) as fhdr:
|
with open(header_file) as fhdr:
|
||||||
lines = fhdr.read().splitlines()
|
lines = fhdr.read().splitlines()
|
||||||
expected_lines = [(0, '// Copyright 2019 Eric Froemling'),
|
|
||||||
|
if self._public:
|
||||||
|
raise RuntimeError('FIXME: Check for full license.')
|
||||||
|
|
||||||
|
expected_lines = [(0, '// ' + LEGAL_NOTICE_PRIVATE),
|
||||||
(2, '#ifndef ' + guard), (3, '#define ' + guard),
|
(2, '#ifndef ' + guard), (3, '#define ' + guard),
|
||||||
(-1, '#endif // ' + guard)]
|
(-1, '#endif // ' + guard)]
|
||||||
errors_found = False
|
errors_found = False
|
||||||
@ -324,6 +350,9 @@ class App:
|
|||||||
header_exts = ['.h']
|
header_exts = ['.h']
|
||||||
|
|
||||||
# Gather all sources and headers.
|
# Gather all sources and headers.
|
||||||
|
# HMMM: Ideally we should use efrotools.code.get_code_filenames() here.
|
||||||
|
# (though we return things relative to the scan-dir which could
|
||||||
|
# throw things off)
|
||||||
for root, _dirs, files in os.walk(scan_dir):
|
for root, _dirs, files in os.walk(scan_dir):
|
||||||
for ftst in files:
|
for ftst in files:
|
||||||
if any(ftst.endswith(ext) for ext in exts):
|
if any(ftst.endswith(ext) for ext in exts):
|
||||||
@ -334,16 +363,50 @@ class App:
|
|||||||
self._header_files = sorted(header_files)
|
self._header_files = sorted(header_files)
|
||||||
|
|
||||||
def _check_python_files(self) -> None:
|
def _check_python_files(self) -> None:
|
||||||
|
from pathlib import Path
|
||||||
|
from efrotools.code import get_script_filenames
|
||||||
|
|
||||||
# Make sure all module dirs in python scripts contain an __init__.py
|
scriptfiles = get_script_filenames(Path('.'))
|
||||||
scripts_dir = 'assets/src/data/scripts'
|
for fname in scriptfiles:
|
||||||
for root, _dirs, files in os.walk(scripts_dir):
|
with open(fname) as infile:
|
||||||
if (root != scripts_dir and '__pycache__' not in root
|
contents = infile.read()
|
||||||
and os.path.basename(root) != '.vscode'):
|
|
||||||
if '__init__.py' not in files:
|
# Make sure all standalone scripts are pointing to the right
|
||||||
print(CLRRED + 'Error: no __init__.py in package dir: ' +
|
# version of python (with a few exceptions where it needs to
|
||||||
root + CLREND)
|
# differ)
|
||||||
sys.exit(255)
|
if contents.startswith('#!/'):
|
||||||
|
# copyrightline = 1
|
||||||
|
if fname not in [
|
||||||
|
'tools/devtool', 'tools/version_utils', 'tools/vmshell'
|
||||||
|
]:
|
||||||
|
if not contents.startswith('#!/usr/bin/env python3.7'):
|
||||||
|
print(f"{CLRRED}Incorrect shebang (first line) for "
|
||||||
|
f"{fname}.{CLREND}")
|
||||||
|
sys.exit(255)
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
# copyrightline = 0
|
||||||
|
|
||||||
|
# Make sure the proper copyright notice is in place.
|
||||||
|
|
||||||
|
# Check our packages and make sure all subdirs contain and __init__.py
|
||||||
|
# (I tend to forget this sometimes)
|
||||||
|
packagedirs = ['tools/efrotools']
|
||||||
|
script_asset_dir = 'assets/src/data/scripts'
|
||||||
|
for name in os.listdir(script_asset_dir):
|
||||||
|
# (Assume all dirs under our script assets dir are packages)
|
||||||
|
if os.path.isdir(os.path.join(script_asset_dir)):
|
||||||
|
packagedirs.append(os.path.join(script_asset_dir, name))
|
||||||
|
|
||||||
|
for packagedir in packagedirs:
|
||||||
|
for root, _dirs, files in os.walk(packagedir):
|
||||||
|
if ('__pycache__' not in root
|
||||||
|
and os.path.basename(root) != '.vscode'):
|
||||||
|
if '__init__.py' not in files:
|
||||||
|
print(CLRRED +
|
||||||
|
'Error: no __init__.py in package dir: ' + root +
|
||||||
|
CLREND)
|
||||||
|
sys.exit(255)
|
||||||
|
|
||||||
def _check_sync_states(self) -> None:
|
def _check_sync_states(self) -> None:
|
||||||
# Make sure none of our sync targets have been mucked with since
|
# Make sure none of our sync targets have been mucked with since
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user