mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-05 06:53:18 +08:00
Moving various build cache files to the .cache dir
This commit is contained in:
parent
9784e1bd20
commit
34d2182d2a
@ -16,14 +16,14 @@ if TYPE_CHECKING:
|
|||||||
from typing import Set, List, Dict, Any, Union, Optional
|
from typing import Set, List, Dict, Any, Union, Optional
|
||||||
|
|
||||||
|
|
||||||
def formatcode(projroot: Path, full: bool) -> None:
|
def format_clang_format(projroot: Path, full: bool) -> None:
|
||||||
"""Run clang-format on all of our source code (multithreaded)."""
|
"""Run clang-format on all of our source code (multithreaded)."""
|
||||||
import time
|
import time
|
||||||
import concurrent.futures
|
import concurrent.futures
|
||||||
from multiprocessing import cpu_count
|
from multiprocessing import cpu_count
|
||||||
from efrotools import get_files_hash
|
from efrotools import get_files_hash
|
||||||
os.chdir(projroot)
|
os.chdir(projroot)
|
||||||
cachepath = Path(projroot, 'config/.cache-formatcode')
|
cachepath = Path(projroot, '.cache/format_clang_format')
|
||||||
if full and cachepath.exists():
|
if full and cachepath.exists():
|
||||||
cachepath.unlink()
|
cachepath.unlink()
|
||||||
cache = FileCache(cachepath)
|
cache = FileCache(cachepath)
|
||||||
@ -62,8 +62,8 @@ def formatcode(projroot: Path, full: bool) -> None:
|
|||||||
flush=True)
|
flush=True)
|
||||||
|
|
||||||
|
|
||||||
def cpplint(projroot: Path, full: bool) -> None:
|
def check_cpplint(projroot: Path, full: bool) -> None:
|
||||||
"""Run lint-checking on all code deemed lint-able."""
|
"""Run cpplint on all our applicable code."""
|
||||||
# pylint: disable=too-many-locals, too-many-statements
|
# pylint: disable=too-many-locals, too-many-statements
|
||||||
import tempfile
|
import tempfile
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
@ -86,7 +86,7 @@ def cpplint(projroot: Path, full: bool) -> None:
|
|||||||
filenames = [f for f in filenames if f not in code_blacklist]
|
filenames = [f for f in filenames if f not in code_blacklist]
|
||||||
filenames = [f for f in filenames if not f.endswith('.mm')]
|
filenames = [f for f in filenames if not f.endswith('.mm')]
|
||||||
|
|
||||||
cachepath = Path(projroot, 'config/.cache-lintcode')
|
cachepath = Path(projroot, '.cache/check_cpplint')
|
||||||
if full and cachepath.exists():
|
if full and cachepath.exists():
|
||||||
cachepath.unlink()
|
cachepath.unlink()
|
||||||
|
|
||||||
@ -182,14 +182,14 @@ def get_code_filenames(projroot: Path) -> List[str]:
|
|||||||
return codefilenames
|
return codefilenames
|
||||||
|
|
||||||
|
|
||||||
def formatscripts(projroot: Path, full: bool) -> None:
|
def format_yapf(projroot: Path, full: bool) -> None:
|
||||||
"""Runs yapf on all our scripts (multithreaded)."""
|
"""Runs yapf on all of our Python code."""
|
||||||
import time
|
import time
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
from multiprocessing import cpu_count
|
from multiprocessing import cpu_count
|
||||||
from efrotools import get_files_hash, PYVER
|
from efrotools import get_files_hash, PYVER
|
||||||
os.chdir(projroot)
|
os.chdir(projroot)
|
||||||
cachepath = Path(projroot, 'config/.cache-formatscripts')
|
cachepath = Path(projroot, '.cache/format_yapf')
|
||||||
if full and cachepath.exists():
|
if full and cachepath.exists():
|
||||||
cachepath.unlink()
|
cachepath.unlink()
|
||||||
|
|
||||||
@ -295,8 +295,8 @@ def pylint(projroot: Path, full: bool, fast: bool) -> None:
|
|||||||
script_blacklist: List[str] = []
|
script_blacklist: List[str] = []
|
||||||
filenames = [f for f in filenames if f not in script_blacklist]
|
filenames = [f for f in filenames if f not in script_blacklist]
|
||||||
|
|
||||||
cachebasename = '.cache-lintscriptsfast' if fast else '.cache-lintscripts'
|
cachebasename = 'check_pylint_fast' if fast else 'check_pylint'
|
||||||
cachepath = Path(projroot, 'config', cachebasename)
|
cachepath = Path(projroot, '.cache', cachebasename)
|
||||||
if full and cachepath.exists():
|
if full and cachepath.exists():
|
||||||
cachepath.unlink()
|
cachepath.unlink()
|
||||||
cache = FileCache(cachepath)
|
cache = FileCache(cachepath)
|
||||||
@ -774,6 +774,7 @@ def _run_idea_inspections_cached(cachepath: Path,
|
|||||||
inspect=inspect,
|
inspect=inspect,
|
||||||
verbose=verbose,
|
verbose=verbose,
|
||||||
inspectdir=inspectdir)
|
inspectdir=inspectdir)
|
||||||
|
cachepath.parent.mkdir(parents=True, exist_ok=True)
|
||||||
with open(cachepath, 'w') as outfile:
|
with open(cachepath, 'w') as outfile:
|
||||||
outfile.write(json.dumps({'hash': current_hash}))
|
outfile.write(json.dumps({'hash': current_hash}))
|
||||||
print(
|
print(
|
||||||
@ -782,13 +783,13 @@ def _run_idea_inspections_cached(cachepath: Path,
|
|||||||
flush=True)
|
flush=True)
|
||||||
|
|
||||||
|
|
||||||
def pycharm(projroot: Path, full: bool, verbose: bool) -> None:
|
def check_pycharm(projroot: Path, full: bool, verbose: bool) -> None:
|
||||||
"""Run pycharm inspections on all our scripts."""
|
"""Run pycharm inspections on all our scripts."""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
# FIXME: Generalize this to work with at least linux, possibly windows.
|
# FIXME: Generalize this to work with at least linux, possibly windows.
|
||||||
cachepath = Path('config/.cache-pycharm')
|
cachepath = Path('.cache/check_pycharm')
|
||||||
filenames = get_script_filenames(projroot)
|
filenames = get_script_filenames(projroot)
|
||||||
pycharmroot = Path('/Applications/PyCharm CE.app')
|
pycharmroot = Path('/Applications/PyCharm CE.app')
|
||||||
pycharmbin = Path(pycharmroot, 'Contents/MacOS/pycharm')
|
pycharmbin = Path(pycharmroot, 'Contents/MacOS/pycharm')
|
||||||
@ -832,11 +833,11 @@ def pycharm(projroot: Path, full: bool, verbose: bool) -> None:
|
|||||||
verbose=verbose)
|
verbose=verbose)
|
||||||
|
|
||||||
|
|
||||||
def clioncode(projroot: Path, full: bool, verbose: bool) -> None:
|
def check_clioncode(projroot: Path, full: bool, verbose: bool) -> None:
|
||||||
"""Run clion inspections on all our code."""
|
"""Run clion inspections on all our code."""
|
||||||
import time
|
import time
|
||||||
|
|
||||||
cachepath = Path('config/.cache-clioncode')
|
cachepath = Path('.cache/check_clioncode')
|
||||||
filenames = get_code_filenames(projroot)
|
filenames = get_code_filenames(projroot)
|
||||||
clionroot = Path('/Applications/CLion.app')
|
clionroot = Path('/Applications/CLion.app')
|
||||||
clionbin = Path(clionroot, 'Contents/MacOS/clion')
|
clionbin = Path(clionroot, 'Contents/MacOS/clion')
|
||||||
@ -886,11 +887,11 @@ def clioncode(projroot: Path, full: bool, verbose: bool) -> None:
|
|||||||
verbose=verbose)
|
verbose=verbose)
|
||||||
|
|
||||||
|
|
||||||
def androidstudiocode(projroot: Path, full: bool, verbose: bool) -> None:
|
def check_android_studio(projroot: Path, full: bool, verbose: bool) -> None:
|
||||||
"""Run Android Studio inspections on all our code."""
|
"""Run Android Studio inspections on all our code."""
|
||||||
# import time
|
# import time
|
||||||
|
|
||||||
cachepath = Path('config/.cache-androidstudiocode')
|
cachepath = Path('.cache/check_android_studio')
|
||||||
filenames = get_code_filenames(projroot)
|
filenames = get_code_filenames(projroot)
|
||||||
clionroot = Path('/Applications/Android Studio.app')
|
clionroot = Path('/Applications/Android Studio.app')
|
||||||
# clionbin = Path(clionroot, 'Contents/MacOS/studio')
|
# clionbin = Path(clionroot, 'Contents/MacOS/studio')
|
||||||
|
|||||||
@ -91,5 +91,6 @@ class FileCache:
|
|||||||
f' "{fname}"; cache not updated.{Clr.RST}')
|
f' "{fname}"; cache not updated.{Clr.RST}')
|
||||||
return
|
return
|
||||||
out = json.dumps(self.entries)
|
out = json.dumps(self.entries)
|
||||||
with open(self._path, 'w') as outfile:
|
self._path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
with self._path.open('w') as outfile:
|
||||||
outfile.write(out)
|
outfile.write(out)
|
||||||
|
|||||||
@ -199,17 +199,17 @@ def check_clean_safety() -> None:
|
|||||||
|
|
||||||
|
|
||||||
def formatcode() -> None:
|
def formatcode() -> None:
|
||||||
"""Run clang-format on all of our source code (multithreaded)."""
|
"""Format all of our C/C++/etc. code."""
|
||||||
import efrotools.code
|
import efrotools.code
|
||||||
full = '-full' in sys.argv
|
full = '-full' in sys.argv
|
||||||
efrotools.code.formatcode(PROJROOT, full)
|
efrotools.code.format_clang_format(PROJROOT, full)
|
||||||
|
|
||||||
|
|
||||||
def formatscripts() -> None:
|
def formatscripts() -> None:
|
||||||
"""Run yapf on all our scripts (multithreaded)."""
|
"""Format all of our Python/etc. code."""
|
||||||
import efrotools.code
|
import efrotools.code
|
||||||
full = '-full' in sys.argv
|
full = '-full' in sys.argv
|
||||||
efrotools.code.formatscripts(PROJROOT, full)
|
efrotools.code.format_yapf(PROJROOT, full)
|
||||||
|
|
||||||
|
|
||||||
def formatmakefile() -> None:
|
def formatmakefile() -> None:
|
||||||
@ -230,7 +230,7 @@ def cpplint() -> None:
|
|||||||
"""Run lint-checking on all code deemed lint-able."""
|
"""Run lint-checking on all code deemed lint-able."""
|
||||||
import efrotools.code
|
import efrotools.code
|
||||||
full = '-full' in sys.argv
|
full = '-full' in sys.argv
|
||||||
efrotools.code.cpplint(PROJROOT, full)
|
efrotools.code.check_cpplint(PROJROOT, full)
|
||||||
|
|
||||||
|
|
||||||
def scriptfiles() -> None:
|
def scriptfiles() -> None:
|
||||||
@ -300,7 +300,7 @@ def pycharm() -> None:
|
|||||||
import efrotools.code
|
import efrotools.code
|
||||||
full = '-full' in sys.argv
|
full = '-full' in sys.argv
|
||||||
verbose = '-v' in sys.argv
|
verbose = '-v' in sys.argv
|
||||||
efrotools.code.pycharm(PROJROOT, full, verbose)
|
efrotools.code.check_pycharm(PROJROOT, full, verbose)
|
||||||
|
|
||||||
|
|
||||||
def clioncode() -> None:
|
def clioncode() -> None:
|
||||||
@ -308,7 +308,7 @@ def clioncode() -> None:
|
|||||||
import efrotools.code
|
import efrotools.code
|
||||||
full = '-full' in sys.argv
|
full = '-full' in sys.argv
|
||||||
verbose = '-v' in sys.argv
|
verbose = '-v' in sys.argv
|
||||||
efrotools.code.clioncode(PROJROOT, full, verbose)
|
efrotools.code.check_clioncode(PROJROOT, full, verbose)
|
||||||
|
|
||||||
|
|
||||||
def androidstudiocode() -> None:
|
def androidstudiocode() -> None:
|
||||||
@ -316,7 +316,7 @@ def androidstudiocode() -> None:
|
|||||||
import efrotools.code
|
import efrotools.code
|
||||||
full = '-full' in sys.argv
|
full = '-full' in sys.argv
|
||||||
verbose = '-v' in sys.argv
|
verbose = '-v' in sys.argv
|
||||||
efrotools.code.androidstudiocode(PROJROOT, full, verbose)
|
efrotools.code.check_android_studio(PROJROOT, full, verbose)
|
||||||
|
|
||||||
|
|
||||||
def tool_config_install() -> None:
|
def tool_config_install() -> None:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user