From 85df97b4b7dcf62e14bb95f25a19e63a65b3014d Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Thu, 17 Oct 2019 11:00:06 -0700 Subject: [PATCH] added linux prefab builds --- Makefile | 33 ++++++++++++++++++++---- assets/src/data/scripts/_ba.py | 4 +-- assets/src/data/scripts/ba/_meta.py | 4 +-- tools/efrotools/snippets.py | 40 +++++++++++++++++++++-------- tools/snippets | 34 +++++++++--------------- 5 files changed, 73 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index 50bf65b0..0bd4421b 100644 --- a/Makefile +++ b/Makefile @@ -121,7 +121,7 @@ cleanlist: # Prebuilt binaries for various platforms. # Download/assemble/run a debug build for this platform. -prefab: +prefab-debug: @tools/snippets make_prefab debug # Download/assemble/run a release build for this platform. @@ -129,7 +129,7 @@ prefab-release: @tools/snippets make_prefab release # Download/assemble a debug build for this platform. -prefab-build: +prefab-debug-build: @tools/snippets make_prefab debug-build # Download/assemble a release build for this platform. @@ -138,10 +138,10 @@ prefab-release-build: # Specific platform prefab targets: -prefab-mac: prefab-mac-build +prefab-mac-debug: prefab-mac-build @cd build/prefab/mac/debug && ./ballisticacore -prefab-mac-build: assets-cmake build/prefab/mac/debug/ballisticacore +prefab-mac-debug-build: assets-cmake build/prefab/mac/debug/ballisticacore @${STAGE_ASSETS} -cmake build/prefab/mac/debug build/prefab/mac/debug/ballisticacore: .efrocachemap @@ -156,8 +156,31 @@ prefab-mac-release-build: assets-cmake build/prefab/mac/release/ballisticacore build/prefab/mac/release/ballisticacore: .efrocachemap @tools/snippets efrocache_get $@ +PREFAB_LINUX_FLAVOR ?= linux64-u19s + +prefab-linux-debug: prefab-linux-build + @cd build/prefab/linux/debug && ./ballisticacore + +prefab-linux-debug-build: assets-cmake build/prefab/linux/debug/ballisticacore + @${STAGE_ASSETS} -cmake build/prefab/linux/debug + +build/prefab/linux/debug/ballisticacore: .efrocachemap + @tools/snippets efrocache_get $@ + +prefab-linux-release: prefab-linux-release-build + @cd build/prefab/linux/release && ./ballisticacore + +prefab-linux-release-build: assets-cmake \ + build/prefab/linux/release/ballisticacore + @${STAGE_ASSETS} -cmake build/prefab/linux/release + +build/prefab/linux/release/ballisticacore: .efrocachemap + @tools/snippets efrocache_get $@ + # Tell make which of these targets don't represent files. -.PHONY: prefab-mac prefab-mac-build prefab-mac-release prefab-mac-release-build +.PHONY: prefab-mac prefab-mac-build prefab-mac-release \ + prefab-mac-release-build prefab-linux prefab-linux-build prefab-linux-release \ + prefab-linux-release-build\ ################################################################################ diff --git a/assets/src/data/scripts/_ba.py b/assets/src/data/scripts/_ba.py index be00e474..5413ab2d 100644 --- a/assets/src/data/scripts/_ba.py +++ b/assets/src/data/scripts/_ba.py @@ -18,9 +18,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # ----------------------------------------------------------------------------- -"""A dummy stub module for the real _bs. +"""A dummy stub module for the real _ba. -The real _bs is a compiled extension module and only available +The real _ba is a compiled extension module and only available in the live game. This dummy module allows Pylint/Mypy/etc. to function reasonably well outside of the game. diff --git a/assets/src/data/scripts/ba/_meta.py b/assets/src/data/scripts/ba/_meta.py index 9dfb2bbb..c00064fc 100644 --- a/assets/src/data/scripts/ba/_meta.py +++ b/assets/src/data/scripts/ba/_meta.py @@ -212,7 +212,7 @@ class DirectoryScan: def _process_module_meta_tags(self, subpath: pathlib.Path, flines: List[str], - meta_lines: Dict[int, str]) -> None: + meta_lines: Dict[int, List[str]]) -> None: """Pull data from a module based on its bs_meta tags.""" for lindex, mline in meta_lines.items(): # meta_lines is just anything containing 'bs_meta'; make sure @@ -278,7 +278,7 @@ class DirectoryScan: return classname def get_api_requirement(self, subpath: pathlib.Path, - meta_lines: Dict[int, str], + meta_lines: Dict[int, List[str]], toplevel: bool) -> Optional[int]: """Return an API requirement integer or None if none present. diff --git a/tools/efrotools/snippets.py b/tools/efrotools/snippets.py index 47ba9f7a..7dfadb4a 100644 --- a/tools/efrotools/snippets.py +++ b/tools/efrotools/snippets.py @@ -124,14 +124,12 @@ def _trim_docstring(docstring: str) -> str: return '\n'.join(trimmed) -def spelling() -> None: - """Add words to the PyCharm dictionary.""" +def _spelling(words: List[str]) -> None: fname = '.idea/dictionaries/ericf.xml' with open(fname) as infile: lines = infile.read().splitlines() if lines[2] != ' ': raise RuntimeError('Unexpected dictionary format.') - words = sys.argv[2:] added_count = 0 for word in words: line = f' {word.lower()}' @@ -146,6 +144,28 @@ def spelling() -> None: print('Added', added_count, 'words to the dictionary.') +def spelling_all() -> None: + """Add all misspellings from a pycharscripts run.""" + + print('Running "make pycharmscriptsfull"...') + lines = [ + line for line in subprocess.run( + ['make', 'pycharmscriptsfull'], check=False, + capture_output=True).stdout.decode().splitlines() + if 'Typo: In word' in line + ] + words = [ + line.split('Typo: In word')[1].strip().replace("'", "") + for line in lines + ] + _spelling(words) + + +def spelling() -> None: + """Add words to the PyCharm dictionary.""" + _spelling(sys.argv[2:]) + + def check_clean_safety() -> None: """Ensure all files are are added to git or in gitignore. @@ -380,14 +400,12 @@ def compile_python_files() -> None: """ import py_compile for arg in sys.argv[2:]: - # Hmm; seems mypy doesn't know about invalidation_mode yet. - mode = py_compile.PycInvalidationMode.UNCHECKED_HASH # type: ignore - py_compile.compile( # type: ignore - arg, - dfile=os.path.basename(arg), - doraise=True, - optimize=1, - invalidation_mode=mode) + mode = py_compile.PycInvalidationMode.UNCHECKED_HASH + py_compile.compile(arg, + dfile=os.path.basename(arg), + doraise=True, + optimize=1, + invalidation_mode=mode) def makefile_target_list() -> None: diff --git a/tools/snippets b/tools/snippets index 2caa18e4..40908bc0 100755 --- a/tools/snippets +++ b/tools/snippets @@ -45,7 +45,7 @@ from efrotools.snippets import ( # pylint: disable=unused-import PROJROOT, snippets_main, formatcode, formatscripts, formatmakefile, cpplintcode, pylintscripts, mypyscripts, tool_config_install, sync, sync_all, scriptfiles, pycharmscripts, clioncode, androidstudiocode, - makefile_target_list, spelling, compile_python_files) + makefile_target_list, spelling, spelling_all, compile_python_files) if TYPE_CHECKING: from typing import Optional, List @@ -55,17 +55,17 @@ if TYPE_CHECKING: # clustering similar tests too much) SPARSE_TESTS: List[List[str]] = [ ['ios.pylibs.debug', 'android.pylibs.arm'], - ['linux.package.64', 'android.pylibs.arm64'], + ['linux.package', 'android.pylibs.arm64'], ['windows.package', 'mac.pylibs'], ['tvos.pylibs', 'android.pylibs.x86'], - ['linux.package.server.64', 'android.pylibs.arm.debug'], + ['android.pylibs.arm.debug'], ['windows.package.server'], ['ios.pylibs', 'android.pylibs.arm64.debug'], - ['linux.package.server.32'], + ['linux.package.server'], ['android.pylibs.x86.debug', 'mac.package'], ['mac.package.server', 'android.pylibs.x86_64'], ['windows.package.oculus'], - ['linux.package.32', 'android.pylibs.x86_64.debug'], + ['android.pylibs.x86_64.debug'], ['mac.pylibs.debug', 'android.package'], ] @@ -290,32 +290,22 @@ def gen_fulltest_buildfile_linux() -> None: """ import datetime - # Its a bit of a waste of time doing both 32 and 64 bit builds - # for everything, so let's do one of each and alternate the architecture. dayoffset = datetime.datetime.now().timetuple().tm_yday targets = ['build', 'server-build'] - lin32flav = 'LINUX32_FLAVOR=linux32-u16s' - lin64flav = 'LINUX64_FLAVOR=linux64-u18s' + linflav = 'LINUX_FLAVOR=linux64-u19s' lines = [] - for i, target in enumerate(targets): - if (i + dayoffset) % 2 == 0: - lines.append(f'{lin32flav} make linux32-{target}') - else: - lines.append(f'{lin64flav} make linux64-{target}') + for target in targets: + lines.append(f'{linflav} make linux-{target}') if DO_SPARSE_TESTS: extras = SPARSE_TESTS[dayoffset % len(SPARSE_TESTS)] extras = [e for e in extras if e.startswith('linux.')] for extra in extras: - if extra == 'linux.package.32': - lines.append(f'{lin32flav} make linux32-package') - elif extra == 'linux.package.server.32': - lines.append(f'{lin32flav} make linux32-server-package') - elif extra == 'linux.package.64': - lines.append(f'{lin64flav} make linux64-package') - elif extra == 'linux.package.server.64': - lines.append(f'{lin64flav} make linux64-server-package') + if extra == 'linux.package': + lines.append(f'{linflav} make linux-package') + elif extra == 'linux.package.server': + lines.append(f'{linflav} make linux-server-package') else: raise RuntimeError(f'Unknown extra: {extra}')