Add Arm Mac prefab targets

This commit is contained in:
Eric Froemling 2020-11-24 18:28:24 -06:00
parent 70105ca240
commit cfed4abdc4
10 changed files with 179 additions and 128 deletions

View File

@ -3932,24 +3932,32 @@
"assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450", "assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450",
"assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e", "assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e",
"assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f", "assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f",
"build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/a2/5f/c53f5b72ac1522e05fddf1f8aa3c", "build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ba/0a/503d80285b4e98197495d912ffe2",
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/a5/2f/a977c267b82b93044d5c24535d10", "build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/87/8f/cc883d6dc9d4599694ae07640d03",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/05/92/f317843a45060600773bf145f6e8", "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e4/9f/8a227fb667886cac6ac141eda922",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/0e/9a/fc28e3b0026eb5da187ad926a660", "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4b/c2/a1c067dab547a61c8a635a2f14bc",
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/89/b1/836fe91297961e99f4338761d129", "build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/8a/91/90a45733c48687ecccb3baf52d2b",
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/41/4d/e1e1e06d36de397efa2229aea25b", "build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/05/31/483700af5f45598fd4bc535352e7",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/0e/cd/5214d15f319d62528d9365279a30", "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e9/de/16ecb8f5a43cc11725ba8fd25b92",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c4/33/6491afaec6a52ea4603c26145dac", "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/aa/07/f7c43b399342b1a7d311dce02bd9",
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/97/42/0aca4f23d3e5e08164c07bef5220", "build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/27/ba/609c8cfcf5518cb00efe1e7c4394",
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/b8/a7/42ca4700ff2f117bf367df716815", "build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/8c/5b/bf4bea08d9861932a2fc64452840",
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/7e/93/381f83c8b1c6c546157375fa999f", "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/3d/bc/91fc66b45b4109de9f9769d63163",
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/71/c2/38fa7a0b59671f02f03de96aabca", "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cc/1b/13d06eb5703326a8d45e447eee22",
"build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/54/a1/e5a2906b6bd18229f21f5a5d0876", "build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/db/80/f32753340c14607d7bcb06700920",
"build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b9/e7/ac87044e0eac75551bcacdf2e41d", "build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/2c/81/11a95002c322158e9a72fa38d209",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/18/c2/3a457694a20c7dc22eb0d5cb67fc", "build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/3f/98/3ba1d4b690f21b2c6fab4c56640d",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3a/0c/96264568710c8e6a84af77a4f0d9", "build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/d8/2c/e271424b6a361e0b202723bd9b9a",
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f4/af/a284828a6448682278b899533e3e", "build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/50/30/cd615d3ad04924ab211fda6294de",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1e/51/7ecca58ce0acc5108b146037f2db", "build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5a/8f/8ecc7e5adf66021652d4b92c7fb0",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/30/00/f840b3853c2c7f8a2e3fa760b493", "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/41/d0/d1ecacdbdd5e42d0e171c9c04cea",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a9/d7/526b7a83d480e6ba14bae73afd2d" "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2d/dd/f11c021a66e17a63a944689b236e",
"build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/94/34/1853fd4dbd82355bbd65717c433f",
"build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8c/fb/ee704284dbcd8fc1222507fd18e5",
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/91/4d/b5e5982ebbf42b38170e0c449581",
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8e/a4/52c27869b2ebcceb6f808e85dd15",
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/58/4b/c5294de3d55ce8a6425740307ac1",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e8/7c/ef89ae18c9bbcf44ffa4dee9ffb5",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2c/01/2604026ff01a32dfe9568626b655",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9c/42/ecaae792330e32d18521d5db91c1"
} }

View File

@ -30,8 +30,8 @@
<w>achname</w> <w>achname</w>
<w>achs</w> <w>achs</w>
<w>acinstance</w> <w>acinstance</w>
<w>ack</w>
<w>ack'ed</w> <w>ack'ed</w>
<w>ack</w>
<w>acked</w> <w>acked</w>
<w>acks</w> <w>acks</w>
<w>acnt</w> <w>acnt</w>
@ -153,8 +153,8 @@
<w>bacommon</w> <w>bacommon</w>
<w>badguy</w> <w>badguy</w>
<w>bafoundation</w> <w>bafoundation</w>
<w>ballistica</w>
<w>ballistica's</w> <w>ballistica's</w>
<w>ballistica</w>
<w>ballisticacore</w> <w>ballisticacore</w>
<w>ballisticacorecb</w> <w>ballisticacorecb</w>
<w>bamaster</w> <w>bamaster</w>
@ -587,6 +587,7 @@
<w>efrocachemap</w> <w>efrocachemap</w>
<w>efroemling</w> <w>efroemling</w>
<w>efrogradle</w> <w>efrogradle</w>
<w>efrohome</w>
<w>efrosync</w> <w>efrosync</w>
<w>efrotool</w> <w>efrotool</w>
<w>efrotools</w> <w>efrotools</w>
@ -617,6 +618,7 @@
<w>entrytypeselect</w> <w>entrytypeselect</w>
<w>enumtype</w> <w>enumtype</w>
<w>enumval</w> <w>enumval</w>
<w>envcfg</w>
<w>envhash</w> <w>envhash</w>
<w>envname</w> <w>envname</w>
<w>envval</w> <w>envval</w>
@ -769,6 +771,7 @@
<w>freesound</w> <w>freesound</w>
<w>froemling</w> <w>froemling</w>
<w>frombuffer</w> <w>frombuffer</w>
<w>fromini</w>
<w>fsdf</w> <w>fsdf</w>
<w>fsettings</w> <w>fsettings</w>
<w>fsplit</w> <w>fsplit</w>
@ -807,8 +810,8 @@
<w>gamedata</w> <w>gamedata</w>
<w>gameinstance</w> <w>gameinstance</w>
<w>gamemap</w> <w>gamemap</w>
<w>gamepad</w>
<w>gamepad's</w> <w>gamepad's</w>
<w>gamepad</w>
<w>gamepadadvanced</w> <w>gamepadadvanced</w>
<w>gamepads</w> <w>gamepads</w>
<w>gamepadselect</w> <w>gamepadselect</w>
@ -1197,8 +1200,8 @@
<w>lsqlite</w> <w>lsqlite</w>
<w>lssl</w> <w>lssl</w>
<w>lstart</w> <w>lstart</w>
<w>lstr</w>
<w>lstr's</w> <w>lstr's</w>
<w>lstr</w>
<w>lstrs</w> <w>lstrs</w>
<w>lsval</w> <w>lsval</w>
<w>ltex</w> <w>ltex</w>
@ -1834,8 +1837,8 @@
<w>sessionname</w> <w>sessionname</w>
<w>sessionplayer</w> <w>sessionplayer</w>
<w>sessionplayers</w> <w>sessionplayers</w>
<w>sessionteam</w>
<w>sessionteam's</w> <w>sessionteam's</w>
<w>sessionteam</w>
<w>sessionteams</w> <w>sessionteams</w>
<w>sessiontype</w> <w>sessiontype</w>
<w>setactivity</w> <w>setactivity</w>
@ -1972,6 +1975,7 @@
<w>strptime</w> <w>strptime</w>
<w>strt</w> <w>strt</w>
<w>strval</w> <w>strval</w>
<w>subargs</w>
<w>subclassof</w> <w>subclassof</w>
<w>subcontainer</w> <w>subcontainer</w>
<w>subcontainerheight</w> <w>subcontainerheight</w>
@ -2170,8 +2174,8 @@
<w>txtw</w> <w>txtw</w>
<w>typeargs</w> <w>typeargs</w>
<w>typecheck</w> <w>typecheck</w>
<w>typechecker</w>
<w>typechecker's</w> <w>typechecker's</w>
<w>typechecker</w>
<w>typedval</w> <w>typedval</w>
<w>typeshed</w> <w>typeshed</w>
<w>typestr</w> <w>typestr</w>
@ -2225,6 +2229,7 @@
<w>upkeeptimer</w> <w>upkeeptimer</w>
<w>uploadargs</w> <w>uploadargs</w>
<w>uploadcmd</w> <w>uploadcmd</w>
<w>uppercased</w>
<w>uptime</w> <w>uptime</w>
<w>ureq</w> <w>ureq</w>
<w>useragent</w> <w>useragent</w>

View File

@ -23,8 +23,9 @@ endif
# # # #
################################################################################ ################################################################################
# Override this to 'localhost' to build cloud builds on a local Mac. # Cloudshell hosts used to build various platforms/architectures.
MAC_CLOUDSHELL_HOST ?= homebook-fro CLOUDSHELL_HOST_MAC_X86_64 ?= homebook-fro
CLOUDSHELL_HOST_MAC_ARM64 ?= fromini
# List targets in this Makefile and basic descriptions for them. # List targets in this Makefile and basic descriptions for them.
help: help:
@ -109,7 +110,7 @@ clean-list:
@git clean -dnx ${ROOT_CLEAN_IGNORES} @git clean -dnx ${ROOT_CLEAN_IGNORES}
# Tell make which of these targets don't represent files. # Tell make which of these targets don't represent files.
.PHONY: list prereqs prereqs-clean assets assets-cmake assets-windows \ .PHONY: help prereqs prereqs-clean assets assets-cmake assets-windows \
assets-windows-Win32 assets-windows-x64 \ assets-windows-Win32 assets-windows-x64 \
assets-mac assets-ios assets-android assets-clean \ assets-mac assets-ios assets-android assets-clean \
resources resources-clean code code-clean \ resources resources-clean code code-clean \
@ -537,12 +538,12 @@ update-check: prereqs
# Run formatting on all files in the project considered 'dirty'. # Run formatting on all files in the project considered 'dirty'.
format: format:
@${MAKE} -j3 format-code format-scripts format-makefile @${MAKE} -j3 format-code format-scripts format-makefile
@tools/pcommand echo GRN Formatting complete! @tools/pcommand echo BLD Formatting complete!
# Same but always formats; ignores dirty state. # Same but always formats; ignores dirty state.
format-full: format-full:
@${MAKE} -j3 format-code-full format-scripts-full format-makefile @${MAKE} -j3 format-code-full format-scripts-full format-makefile
@tools/pcommand echo GRN Formatting complete! @tools/pcommand echo BLD Formatting complete!
# Run formatting for compiled code sources (.cc, .h, etc.). # Run formatting for compiled code sources (.cc, .h, etc.).
format-code: prereqs format-code: prereqs

View File

@ -13,8 +13,8 @@
<w>ack'ed</w> <w>ack'ed</w>
<w>acked</w> <w>acked</w>
<w>acks</w> <w>acks</w>
<w>aclass</w>
<w>aclass's</w> <w>aclass's</w>
<w>aclass</w>
<w>activityplayer</w> <w>activityplayer</w>
<w>addrs</w> <w>addrs</w>
<w>adjoint</w> <w>adjoint</w>
@ -149,8 +149,8 @@
<w>cmath</w> <w>cmath</w>
<w>cmds</w> <w>cmds</w>
<w>cmdvals</w> <w>cmdvals</w>
<w>codewarrior</w>
<w>codewarrior's</w> <w>codewarrior's</w>
<w>codewarrior</w>
<w>cofnodes</w> <w>cofnodes</w>
<w>collapseable</w> <w>collapseable</w>
<w>collidable</w> <w>collidable</w>
@ -241,6 +241,7 @@
<w>echidna</w> <w>echidna</w>
<w>edef</w> <w>edef</w>
<w>efro</w> <w>efro</w>
<w>efrohome</w>
<w>elems</w> <w>elems</w>
<w>elevenbase</w> <w>elevenbase</w>
<w>elevenbits</w> <w>elevenbits</w>
@ -252,6 +253,7 @@
<w>endline</w> <w>endline</w>
<w>endtime</w> <w>endtime</w>
<w>entrypoint</w> <w>entrypoint</w>
<w>envcfg</w>
<w>envval</w> <w>envval</w>
<w>ericf</w> <w>ericf</w>
<w>ericsson</w> <w>ericsson</w>
@ -315,6 +317,7 @@
<w>freeifaddrs</w> <w>freeifaddrs</w>
<w>freqs</w> <w>freqs</w>
<w>froemling</w> <w>froemling</w>
<w>fromini</w>
<w>frompos</w> <w>frompos</w>
<w>frontmost</w> <w>frontmost</w>
<w>ftos</w> <w>ftos</w>
@ -815,6 +818,7 @@
<w>stringi</w> <w>stringi</w>
<w>strlen</w> <w>strlen</w>
<w>strtof</w> <w>strtof</w>
<w>subargs</w>
<w>subclsssing</w> <w>subclsssing</w>
<w>subentities</w> <w>subentities</w>
<w>subitems</w> <w>subitems</w>
@ -894,6 +898,7 @@
<w>unsignaled</w> <w>unsignaled</w>
<w>unstuff</w> <w>unstuff</w>
<w>unsynchronized</w> <w>unsynchronized</w>
<w>uppercased</w>
<w>userspace</w> <w>userspace</w>
<w>uther</w> <w>uther</w>
<w>uuids</w> <w>uuids</w>

View File

@ -9,16 +9,24 @@ option(TEST_BUILD "include testing features" OFF)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
if (APPLE) if (APPLE)
# Seems as of Mojave we need to explicitly pull in /usr/local stuff. # Seems as of Mojave we need to explicitly pull in homebrew paths.
include_directories("/usr/local/include") # Just hard-coding recommended homebrew install paths for now.
link_directories("/usr/local/lib") # Is there a more elegant way to do this?
if (CMAKE_SYSTEM_PROCESSOR MATCHES arm64)
list(APPEND CMAKE_PREFIX_PATH /opt/homebrew)
include_directories("/opt/homebrew/include")
link_directories("/opt/homebrew/lib")
else()
list(APPEND CMAKE_PREFIX_PATH /usr/local)
include_directories("/usr/local/include")
link_directories("/usr/local/lib")
endif()
# On Mac with homebrew it seems that Requesting 3.7 when we've got # On Mac with homebrew it seems that Requesting 3.X when we've got
# 3.8 installed will point us at the 3.8 framework but will attempt # 3.(X+1) installed will point us at the 3.(X+1) framework but will attempt
# to load a 3.7 library from within it which doesn't exist. So we need # to load a 3.X library from within it which doesn't exist. So we need
# to be a bit more explicit telling it where to look. This is no longer # to be a bit more explicit telling it where to look. Note: this was last
# necessary since we're using 3.8 now but may be once 3.9 becomes available # tested with 3.7; should revisit sometime to make sure still applies.
# through homebrew.
execute_process(COMMAND "python3.8-config" "--prefix" execute_process(COMMAND "python3.8-config" "--prefix"
OUTPUT_VARIABLE Python_ROOT_DIR OUTPUT_VARIABLE Python_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)

View File

@ -366,8 +366,8 @@ def gen_fulltest_buildfile_apple() -> None:
lines = [] lines = []
# iOS stuff # iOS stuff
lines.append('nice -n 18 make ios-build') lines.append('make ios-build')
lines.append('nice -n 18 make ios-new-build') lines.append('make ios-new-build')
if DO_SPARSE_TEST_BUILDS: if DO_SPARSE_TEST_BUILDS:
extras = SPARSE_TEST_BUILDS[dayoffset % len(SPARSE_TEST_BUILDS)] extras = SPARSE_TEST_BUILDS[dayoffset % len(SPARSE_TEST_BUILDS)]
extras = [e for e in extras if e.startswith('ios.')] extras = [e for e in extras if e.startswith('ios.')]
@ -380,7 +380,7 @@ def gen_fulltest_buildfile_apple() -> None:
raise RuntimeError(f'Unknown extra: {extra}') raise RuntimeError(f'Unknown extra: {extra}')
# tvOS stuff # tvOS stuff
lines.append('nice -n 18 make tvos-build') lines.append('make tvos-build')
if DO_SPARSE_TEST_BUILDS: if DO_SPARSE_TEST_BUILDS:
extras = SPARSE_TEST_BUILDS[dayoffset % len(SPARSE_TEST_BUILDS)] extras = SPARSE_TEST_BUILDS[dayoffset % len(SPARSE_TEST_BUILDS)]
extras = [e for e in extras if e.startswith('tvos.')] extras = [e for e in extras if e.startswith('tvos.')]
@ -393,12 +393,12 @@ def gen_fulltest_buildfile_apple() -> None:
raise RuntimeError(f'Unknown extra: {extra}') raise RuntimeError(f'Unknown extra: {extra}')
# macOS stuff # macOS stuff
lines.append('nice -n 18 make mac-build') lines.append('make mac-build')
# (throw release build in the mix to hopefully catch opt-mode-only errors). # (throw release build in the mix to hopefully catch opt-mode-only errors).
lines.append('nice -n 18 make mac-appstore-release-build') lines.append('make mac-appstore-release-build')
lines.append('nice -n 18 make mac-new-build') lines.append('make mac-new-build')
lines.append('nice -n 18 make cmake-server-build') lines.append('make cmake-server-build')
lines.append('nice -n 18 make cmake-build') lines.append('make cmake-build')
if DO_SPARSE_TEST_BUILDS: if DO_SPARSE_TEST_BUILDS:
extras = SPARSE_TEST_BUILDS[dayoffset % len(SPARSE_TEST_BUILDS)] extras = SPARSE_TEST_BUILDS[dayoffset % len(SPARSE_TEST_BUILDS)]
extras = [e for e in extras if e.startswith('mac.')] extras = [e for e in extras if e.startswith('mac.')]
@ -457,6 +457,8 @@ def get_current_prefab_platform(wsl_gives_windows: bool = True) -> str:
if system == 'Darwin': if system == 'Darwin':
if machine == 'x86_64': if machine == 'x86_64':
return 'mac_x86_64' return 'mac_x86_64'
if machine == 'arm64':
return 'mac_arm64'
# TODO: add support for arm macs. # TODO: add support for arm macs.
raise RuntimeError(f'make_prefab: unsupported mac machine type:' raise RuntimeError(f'make_prefab: unsupported mac machine type:'
f' {machine}.') f' {machine}.')
@ -727,15 +729,19 @@ def update_docs_md(check: bool) -> None:
print(f'{docs_path} is up to date.') print(f'{docs_path} is up to date.')
def cmake_prep_dir(dirname: str) -> None: def cmake_prep_dir(dirname: str, verbose: bool = False) -> None:
"""Create a dir, recreating it when cmake/python/etc. version changes. """Create a dir, recreating it when cmake/python/etc. version changes.
Useful to prevent builds from breaking when cmake or other components Useful to prevent builds from breaking when cmake or other components
are updated. are updated.
""" """
# pylint: disable=too-many-locals
# pylint: disable=too-many-branches
# pylint: disable=too-many-statements
import json import json
from efrotools import PYVER from efrotools import PYVER
verfilename = os.path.join(dirname, '.ba_cmake_env') verfilename = os.path.join(dirname, '.ba_cmake_env')
title = 'cmake_prep_dir'
versions: Dict[str, str] versions: Dict[str, str]
if os.path.isfile(verfilename): if os.path.isfile(verfilename):
@ -752,14 +758,29 @@ def cmake_prep_dir(dirname: str) -> None:
cmake_ver = cmake_ver_output.splitlines()[0].split('cmake version ')[1] cmake_ver = cmake_ver_output.splitlines()[0].split('cmake version ')[1]
cmake_ver_existing = versions.get('cmake_version') cmake_ver_existing = versions.get('cmake_version')
assert isinstance(cmake_ver_existing, (str, type(None))) assert isinstance(cmake_ver_existing, (str, type(None)))
if verbose:
print(f'{Clr.BLD}{title}:{Clr.RST} {cmake_ver=} {cmake_ver_existing=}')
# ...or if the actual location of cmake on disk changes.
cmake_path = os.path.realpath(
subprocess.run(['which', 'cmake'], check=True,
capture_output=True).stdout.decode().strip())
cmake_path_existing = versions.get('cmake_path')
assert isinstance(cmake_path_existing, (str, type(None)))
if verbose:
print(f'{Clr.BLD}{title}:{Clr.RST}'
f' {cmake_path=} {cmake_path_existing=}')
# ...or if python's version changes. # ...or if python's version changes.
python_ver_output = subprocess.run([f'python{PYVER}', '--version'], python_ver_output = subprocess.run(
check=True, [f'python{PYVER}', '--version'], check=True,
capture_output=True).stdout.decode() capture_output=True).stdout.decode().strip()
python_ver = python_ver_output.splitlines()[0].split('Python ')[1] python_ver = python_ver_output.splitlines()[0].split('Python ')[1]
python_ver_existing = versions.get('python_version') python_ver_existing = versions.get('python_version')
assert isinstance(python_ver_existing, (str, type(None))) assert isinstance(python_ver_existing, (str, type(None)))
if verbose:
print(f'{Clr.BLD}{title}:{Clr.RST}'
f' {python_ver=} {python_ver_existing=}')
# ...or if the actual location of python on disk changes. # ...or if the actual location of python on disk changes.
python_path = os.path.realpath( python_path = os.path.realpath(
@ -768,15 +789,31 @@ def cmake_prep_dir(dirname: str) -> None:
capture_output=True).stdout.decode()) capture_output=True).stdout.decode())
python_path_existing = versions.get('python_path') python_path_existing = versions.get('python_path')
assert isinstance(python_path_existing, (str, type(None))) assert isinstance(python_path_existing, (str, type(None)))
if verbose:
print(f'{Clr.BLD}{title}:{Clr.RST}'
f' {python_path=} {python_path_existing=}')
# Blow away and start from scratch if any vals differ from existing. # Blow away and start from scratch if any vals differ from existing.
if (cmake_ver_existing != cmake_ver or python_ver_existing != python_ver if (cmake_ver_existing == cmake_ver and cmake_path == cmake_path_existing
or python_path != python_path_existing): and python_ver_existing == python_ver
and python_path == python_path_existing):
if verbose:
print(f'{Clr.BLD}{title}:{Clr.RST} Keeping existing build dir.')
else:
if verbose:
print(
f'{Clr.BLD}{title}:{Clr.RST} Blowing away existing build dir.')
if (cmake_ver_existing is not None if (cmake_ver_existing is not None
and cmake_ver_existing != cmake_ver): and cmake_ver_existing != cmake_ver):
print(f'{Clr.BLU}CMake version changed from {cmake_ver_existing}' print(f'{Clr.BLU}CMake version changed from {cmake_ver_existing}'
f' to {cmake_ver}; clearing existing build at' f' to {cmake_ver}; clearing existing build at'
f' "{dirname}".{Clr.RST}') f' "{dirname}".{Clr.RST}')
if (cmake_path_existing is not None
and cmake_path_existing != cmake_path):
print(f'{Clr.BLU}CMake path changed from {cmake_path_existing}'
f' to {cmake_path}; clearing existing build at'
f' "{dirname}".{Clr.RST}')
if (python_ver_existing is not None if (python_ver_existing is not None
and python_ver_existing != python_ver): and python_ver_existing != python_ver):
print(f'{Clr.BLU}Python version changed from {python_ver_existing}' print(f'{Clr.BLU}Python version changed from {python_ver_existing}'
@ -793,6 +830,7 @@ def cmake_prep_dir(dirname: str) -> None:
outfile.write( outfile.write(
json.dumps({ json.dumps({
'cmake_version': cmake_ver, 'cmake_version': cmake_ver,
'cmake_path': cmake_path,
'python_version': python_ver, 'python_version': python_ver,
'python_path': python_path 'python_path': python_path
})) }))

View File

@ -86,41 +86,6 @@ def clean_orphaned_assets() -> None:
efrotools.run('find assets/build -depth -empty -type d -delete') efrotools.run('find assets/build -depth -empty -type d -delete')
def fix_mac_ssh() -> None:
"""Turn off mac ssh password access.
(This totally doesn't belong in this project btw..)
"""
configpath = '/etc/ssh/sshd_config'
with open(configpath) as infile:
lines = infile.readlines()
index = lines.index('#PasswordAuthentication yes\n')
lines[index] = 'PasswordAuthentication no\n'
index = lines.index('#ChallengeResponseAuthentication yes\n')
lines[index] = 'ChallengeResponseAuthentication no\n'
index = lines.index('UsePAM yes\n')
lines[index] = 'UsePAM no\n'
with open(configpath, 'w') as outfile:
outfile.write(''.join(lines))
print('SSH config updated successfully!')
def check_mac_ssh() -> None:
"""Make sure ssh password access is turned off.
(This totally doesn't belong here, but I use it it to remind myself to
fix mac ssh after system updates which blow away ssh customizations).
"""
with open('/etc/ssh/sshd_config') as infile:
lines = infile.read().splitlines()
if ('UsePAM yes' in lines or '#PasswordAuthentication yes' in lines
or '#ChallengeResponseAuthentication yes' in lines):
print('ERROR: ssh config is allowing password access.\n'
'To fix: sudo tools/pcommand fix_mac_ssh')
sys.exit(255)
print('password ssh auth seems disabled; hooray!')
def resize_image() -> None: def resize_image() -> None:
"""Resize an image and save it to a new location. """Resize an image and save it to a new location.
@ -415,7 +380,12 @@ def python_winprune() -> None:
def capitalize() -> None: def capitalize() -> None:
"""Print args capitalized.""" """Print args capitalized."""
print(' '.join(w.capitalize() for w in sys.argv[2:])) print(' '.join(w.capitalize() for w in sys.argv[2:]), end='')
def upper() -> None:
"""Print args uppercased."""
print(' '.join(w.upper() for w in sys.argv[2:]), end='')
def efrocache_update() -> None: def efrocache_update() -> None:
@ -518,13 +488,7 @@ def ensure_prefab_platform() -> None:
def prefab_run_var() -> None: def prefab_run_var() -> None:
"""Print a var for running a prefab run for the current platform. """Print the current platform prefab run target var."""
We use this mechanism instead of just having a command recursively run
a make target so that ctrl-c can be handled cleanly and directly by the
command getting run instead of generating extra errors in the recursive
processes.
"""
import batools.build import batools.build
if len(sys.argv) != 3: if len(sys.argv) != 3:
raise RuntimeError('Expected 1 arg.') raise RuntimeError('Expected 1 arg.')
@ -731,12 +695,14 @@ def cmake_prep_dir() -> None:
Useful to prevent builds from breaking when cmake or other components Useful to prevent builds from breaking when cmake or other components
are updated. are updated.
""" """
import os
from efro.error import CleanError from efro.error import CleanError
import batools.build import batools.build
if len(sys.argv) != 3: if len(sys.argv) != 3:
raise CleanError('Expected 1 arg (dir name)') raise CleanError('Expected 1 arg (dir name)')
dirname = sys.argv[2] dirname = sys.argv[2]
batools.build.cmake_prep_dir(dirname) batools.build.cmake_prep_dir(dirname,
verbose=os.environ.get('VERBOSE') == '1')
def gen_binding_code() -> None: def gen_binding_code() -> None:

View File

@ -61,9 +61,8 @@ def pcommand_main(globs: Dict[str, Any]) -> None:
exc.pretty_print() exc.pretty_print()
sys.exit(1) sys.exit(1)
else: else:
print( print(f'{Clr.RED}Unknown pcommand: "{sys.argv[1]}"{Clr.RST}',
f'{Clr.RED}Unknown pcommand command: "{sys.argv[1]}"{Clr.RST}', file=sys.stderr)
file=sys.stderr)
retval = 255 retval = 255
if show_help: if show_help:
@ -422,7 +421,7 @@ def sync_all() -> None:
import concurrent.futures import concurrent.futures
from efro.error import CleanError from efro.error import CleanError
from efro.terminal import Clr from efro.terminal import Clr
print(f'{Clr.BLU}Updating formatting for all projects...{Clr.RST}') print(f'{Clr.BLD}Updating formatting for all projects...{Clr.RST}')
projects_str = os.environ.get('EFROTOOLS_SYNC_PROJECTS') projects_str = os.environ.get('EFROTOOLS_SYNC_PROJECTS')
if projects_str is None: if projects_str is None:
raise CleanError('EFROTOOL_SYNC_PROJECTS is not defined.') raise CleanError('EFROTOOL_SYNC_PROJECTS is not defined.')
@ -453,17 +452,17 @@ def sync_all() -> None:
# Real mode # Real mode
for i in range(2): for i in range(2):
if i == 0: if i == 0:
print(Clr.BLU + 'Running sync pass 1:' print(Clr.BLD + 'Running sync pass 1:'
' (ensures all changes at dsts are pushed to src)' + ' (ensures all changes at dsts are pushed to src)' +
Clr.RST) Clr.RST)
else: else:
print(Clr.BLU + 'Running sync pass 2:' print(Clr.BLD + 'Running sync pass 2:'
' (ensures latest src is pulled to all dsts)' + Clr.RST) ' (ensures latest src is pulled to all dsts)' + Clr.RST)
for project in projects_str.split(':'): for project in projects_str.split(':'):
cmd = f'cd "{project}" && make sync-full' cmd = f'cd "{project}" && make sync-full'
print(cmd) print(cmd)
subprocess.run(cmd, shell=True, check=True) subprocess.run(cmd, shell=True, check=True)
print(Clr.BLU + 'Sync-all successful!' + Clr.RST) print(Clr.BLD + 'Sync-all successful!' + Clr.RST)
def sync() -> None: def sync() -> None:

View File

@ -36,7 +36,8 @@ def _valid_filename(fname: str) -> bool:
raise ValueError(f'{fname} is not a simple filename.') raise ValueError(f'{fname} is not a simple filename.')
if fname in [ if fname in [
'requirements.txt', 'pylintrc', 'clang-format', 'pycheckers', 'requirements.txt', 'pylintrc', 'clang-format', 'pycheckers',
'style.yapf', 'test_task_bin', '.editorconfig' 'style.yapf', 'test_task_bin', '.editorconfig', 'cloudshell',
'vmshell', 'editorconfig'
]: ]:
return True return True
return (any(fname.endswith(ext) for ext in ('.py', '.pyi')) return (any(fname.endswith(ext) for ext in ('.py', '.pyi'))
@ -255,13 +256,20 @@ def add_marker(src_proj: str, srcdata: str) -> str:
lines = srcdata.splitlines() lines = srcdata.splitlines()
# Normally we add our hash as the first line in the file, but if there's
# a shebang, we put it under that.
firstline = 0
if len(lines) > 0 and lines[0].startswith('#!'):
firstline = 1
# Make sure we're not operating on an already-synced file; that's just # Make sure we're not operating on an already-synced file; that's just
# asking for trouble. # asking for trouble.
if len(lines) > 1 and 'EFRO_SYNC_HASH=' in lines[1]: if (len(lines) > (firstline + 1)
and ('EFRO_SYNC_HASH=' in lines[firstline + 1])):
raise RuntimeError('Attempting to sync a file that is itself synced.') raise RuntimeError('Attempting to sync a file that is itself synced.')
hashstr = string_hash(srcdata) hashstr = string_hash(srcdata)
lines.insert(0, lines.insert(firstline,
f'# Synced from {src_proj}.\n# EFRO_SYNC_HASH={hashstr}\n#') f'# Synced from {src_proj}.\n# EFRO_SYNC_HASH={hashstr}\n#')
return '\n'.join(lines) + '\n' return '\n'.join(lines) + '\n'
@ -284,11 +292,24 @@ def get_dst_file_info(dstfile: Path) -> Tuple[str, str, str]:
dstlines = dstdata.splitlines() dstlines = dstdata.splitlines()
if not dstlines: if not dstlines:
raise ValueError(f'no lines found in {dstfile}') raise ValueError(f'no lines found in {dstfile}')
if 'EFRO_SYNC_HASH' not in dstlines[1]: found = False
offs: Optional[int] = None
marker_hash: Optional[str] = None
for offs in range(2):
checkline = 1 + offs
if 'EFRO_SYNC_HASH' in dstlines[checkline]:
marker_hash = dstlines[checkline].split('EFRO_SYNC_HASH=')[1]
found = True
break
if not found:
raise ValueError(f'no EFRO_SYNC_HASH found in {dstfile}') raise ValueError(f'no EFRO_SYNC_HASH found in {dstfile}')
marker_hash = dstlines[1].split('EFRO_SYNC_HASH=')[1] assert offs is not None
assert marker_hash is not None
# Return data minus the hash line. # Return data minus the 3 hash lines:
dstdata = '\n'.join(dstlines[3:]) + '\n' dstlines.pop(offs)
dstlines.pop(offs)
dstlines.pop(offs)
dstdata = '\n'.join(dstlines) + '\n'
dst_hash = string_hash(dstdata) dst_hash = string_hash(dstdata)
return marker_hash, dst_hash, dstdata return marker_hash, dst_hash, dstdata

View File

@ -25,20 +25,20 @@ from efrotools.pcommand import (
makefile_target_list, spelling, spelling_all, pytest, echo, makefile_target_list, spelling, spelling_all, pytest, echo,
compile_python_files, pyver) compile_python_files, pyver)
from batools.pcommand import ( from batools.pcommand import (
stage_server_file, py_examine, fix_mac_ssh, check_mac_ssh, resize_image, stage_server_file, py_examine, resize_image, check_clean_safety,
check_clean_safety, clean_orphaned_assets, archive_old_builds, clean_orphaned_assets, archive_old_builds, lazy_increment_build,
lazy_increment_build, get_master_asset_src_dir, androidaddr, push_ipa, get_master_asset_src_dir, androidaddr, push_ipa, printcolors,
printcolors, gen_fulltest_buildfile_android, gen_fulltest_buildfile_android, gen_fulltest_buildfile_windows,
gen_fulltest_buildfile_windows, gen_fulltest_buildfile_apple, gen_fulltest_buildfile_apple, gen_fulltest_buildfile_linux,
gen_fulltest_buildfile_linux, python_build_apple, python_build_apple_debug, python_build_apple, python_build_apple_debug, python_build_android,
python_build_android, python_build_android_debug, python_android_patch, python_build_android_debug, python_android_patch, python_gather,
python_gather, python_winprune, capitalize, efrocache_update, python_winprune, capitalize, upper, efrocache_update, efrocache_get,
efrocache_get, get_modern_make, warm_start_asset_build, update_docs_md, get_modern_make, warm_start_asset_build, update_docs_md, list_pip_reqs,
list_pip_reqs, install_pip_reqs, checkenv, ensure_prefab_platform, install_pip_reqs, checkenv, ensure_prefab_platform, prefab_run_var,
prefab_run_var, make_prefab, update_makebob, lazybuild, make_prefab, update_makebob, lazybuild, android_archive_unstripped_libs,
android_archive_unstripped_libs, efro_gradle, stage_assets, efro_gradle, stage_assets, update_assets_makefile, update_project,
update_assets_makefile, update_project, update_cmake_prefab_lib, update_cmake_prefab_lib, cmake_prep_dir, gen_binding_code,
cmake_prep_dir, gen_binding_code, gen_flat_data_code) gen_flat_data_code)
# pylint: enable=unused-import # pylint: enable=unused-import
if TYPE_CHECKING: if TYPE_CHECKING: