mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-28 01:43:22 +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">
|
||||
<dictionary name="ericf">
|
||||
<words>
|
||||
<w>onln</w>
|
||||
<w>nprocessors</w>
|
||||
<w>getconf</w>
|
||||
<w>cpus</w>
|
||||
<w>aaaa</w>
|
||||
<w>aaab</w>
|
||||
<w>aaac</w>
|
||||
@ -294,6 +290,7 @@
|
||||
<w>cpplintcode</w>
|
||||
<w>cpplintcodefull</w>
|
||||
<w>cpuinfo</w>
|
||||
<w>cpus</w>
|
||||
<w>cpython</w>
|
||||
<w>crashlytics</w>
|
||||
<w>creditslist</w>
|
||||
@ -602,6 +599,7 @@
|
||||
<w>getclass</w>
|
||||
<w>getcollide</w>
|
||||
<w>getcollidemodel</w>
|
||||
<w>getconf</w>
|
||||
<w>getconfig</w>
|
||||
<w>getcurrency</w>
|
||||
<w>getdata</w>
|
||||
@ -1008,6 +1006,7 @@
|
||||
<w>nosynctools</w>
|
||||
<w>notdir</w>
|
||||
<w>npos</w>
|
||||
<w>nprocessors</w>
|
||||
<w>ntpath</w>
|
||||
<w>ntriple</w>
|
||||
<w>nturl</w>
|
||||
@ -1028,11 +1027,13 @@
|
||||
<w>oghashes</w>
|
||||
<w>ogval</w>
|
||||
<w>oldlady</w>
|
||||
<w>onln</w>
|
||||
<w>onscreencountdown</w>
|
||||
<w>onscreenkeyboard</w>
|
||||
<w>onscreentimer</w>
|
||||
<w>opcode</w>
|
||||
<w>opdir</w>
|
||||
<w>opendiff</w>
|
||||
<w>operasinger</w>
|
||||
<w>oppnode</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)
|
||||
# SOURCES_HASH=263007419767527489115215049118001842367
|
||||
# SOURCES_HASH=71385272086508687614988508550620664609
|
||||
|
||||
# I'm sorry Pylint. I know this file saddens you. Be strong.
|
||||
# pylint: disable=useless-suppression
|
||||
|
||||
@ -2,28 +2,8 @@
|
||||
"code_source_dirs": [
|
||||
"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",
|
||||
"push_ipa_config": {
|
||||
"app_bundle_name": "BallisticaCore.app",
|
||||
"archive_name": "bs",
|
||||
"projectpath": "ballisticacore-ios.xcodeproj",
|
||||
"scheme": "BallisticaCore iOS Legacy"
|
||||
},
|
||||
"public": true,
|
||||
"pylint_ignored_untracked_deps": [
|
||||
"bs_mapdefs_tip_top",
|
||||
"bs_mapdefs_lake_frigid",
|
||||
|
||||
@ -114,7 +114,7 @@ def cpplintcode(projroot: Path, full: bool) -> None:
|
||||
def get_code_filenames(projroot: Path) -> List[str]:
|
||||
"""Return the list of files to lint-check or auto-formatting."""
|
||||
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)
|
||||
if places is None:
|
||||
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:
|
||||
return True
|
||||
except UnicodeDecodeError:
|
||||
# actual binary files will probably kick back this error..
|
||||
# Actual binary files will probably kick back this error.
|
||||
pass
|
||||
return False
|
||||
|
||||
|
||||
@ -24,6 +24,8 @@ from typing import TYPE_CHECKING
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional, Tuple, List, Dict, Set
|
||||
|
||||
LEGAL_NOTICE_PRIVATE = 'Copyright (c) 2019 Eric Froemling'
|
||||
|
||||
CLRHDR = '\033[95m' # Header.
|
||||
CLRGRN = '\033[92m' # Green.
|
||||
CLRBLU = '\033[94m' # Glue.
|
||||
@ -35,10 +37,16 @@ class App:
|
||||
"""Context for an app run."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
from efrotools import get_config
|
||||
from pathlib import Path
|
||||
self._check = ('--check' in sys.argv)
|
||||
self._fix = ('--fix' in sys.argv)
|
||||
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._src_files: List[str] = []
|
||||
self._header_files: List[str] = []
|
||||
@ -61,7 +69,7 @@ class App:
|
||||
self._check_sync_states()
|
||||
|
||||
self._find_sources_and_headers('src/ballistica')
|
||||
self._check_files()
|
||||
self._check_source_files()
|
||||
self._check_headers()
|
||||
|
||||
self._update_cmake_files()
|
||||
@ -136,9 +144,8 @@ class App:
|
||||
else:
|
||||
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:
|
||||
if fsrc.endswith('.cpp') or fsrc.endswith('.cxx'):
|
||||
raise Exception('please use .cc for c++ files; found ' + fsrc)
|
||||
@ -152,6 +159,21 @@ class App:
|
||||
f'{CLREND}')
|
||||
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:
|
||||
for header_file_raw in self._header_files:
|
||||
assert header_file_raw[0] == '/'
|
||||
@ -172,7 +194,11 @@ class App:
|
||||
'_')
|
||||
with open(header_file) as fhdr:
|
||||
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),
|
||||
(-1, '#endif // ' + guard)]
|
||||
errors_found = False
|
||||
@ -324,6 +350,9 @@ class App:
|
||||
header_exts = ['.h']
|
||||
|
||||
# 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 ftst in files:
|
||||
if any(ftst.endswith(ext) for ext in exts):
|
||||
@ -334,16 +363,50 @@ class App:
|
||||
self._header_files = sorted(header_files)
|
||||
|
||||
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
|
||||
scripts_dir = 'assets/src/data/scripts'
|
||||
for root, _dirs, files in os.walk(scripts_dir):
|
||||
if (root != scripts_dir and '__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)
|
||||
scriptfiles = get_script_filenames(Path('.'))
|
||||
for fname in scriptfiles:
|
||||
with open(fname) as infile:
|
||||
contents = infile.read()
|
||||
|
||||
# Make sure all standalone scripts are pointing to the right
|
||||
# version of python (with a few exceptions where it needs to
|
||||
# differ)
|
||||
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:
|
||||
# Make sure none of our sync targets have been mucked with since
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user