mirror of
				https://github.com/KartKrewDev/RingRacers.git
				synced 2025-10-30 08:01:28 +00:00 
			
		
		
		
	alias-bootstrap.sh: rewrite git build alias for new build system
- Built-in help messages - On-disk cache for last used preset
This commit is contained in:
		
							parent
							
								
									797f78abab
								
							
						
					
					
						commit
						a7b3bc5938
					
				
					 2 changed files with 44 additions and 1 deletions
				
			
		|  | @ -19,7 +19,7 @@ git config 'alias.cmake' '!cmake' | |||
| # | ||||
| #     git cmake --build | ||||
| # | ||||
| git config 'alias.build' '!p="${1##-*}"; [ "$p" ] && shift; git cmake --build --preset "${p:-default}"' | ||||
| git config 'alias.build' '!./custom-git-commands/git-build' | ||||
| 
 | ||||
| # Usage: git crossmake | ||||
| # | ||||
|  |  | |||
							
								
								
									
										43
									
								
								custom-git-commands/git-build
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										43
									
								
								custom-git-commands/git-build
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,43 @@ | |||
| #!/bin/sh | ||||
| git_dir="$(git rev-parse --git-dir)" | ||||
| preset_file="$git_dir/custom-git-build-cached-preset" | ||||
| 
 | ||||
| from_cache= | ||||
| if [ $# -ge 1 ]; then | ||||
| 	preset="$1" | ||||
| else | ||||
| 	preset="$(cat "$preset_file" 2>/dev/null)" | ||||
| 	if [ -n "$preset" ]; then | ||||
| 		from_cache=1 | ||||
| 	fi | ||||
| fi | ||||
| 
 | ||||
| case "$preset" in | ||||
| 	''|help) | ||||
| 		git cmake --list-presets | ||||
| 		>&2 cat <<-EOF | ||||
| 
 | ||||
| 		This is the first you're running 'git build'. | ||||
| 		Pick a preset from above and try again. | ||||
| 
 | ||||
| 		For example: 'git build ninja-x86_mingw_static_vcpkg-develop' | ||||
| 
 | ||||
| 		After this first run, you can run 'git build' by itself and it will re-use the preset from last time! | ||||
| 		EOF | ||||
| 		;; | ||||
| 
 | ||||
| 	*) | ||||
| 		if [ -n "$from_cache" ]; then | ||||
| 			echo "Using same build preset as last time: '$preset'" | ||||
| 		else | ||||
| 			echo "$preset" > "$preset_file" | ||||
| 		fi | ||||
| 		git cmake --build --preset "$preset" | ||||
| 		if [ $? -ne 0 ]; then | ||||
| 			>&2 cat <<-EOF | ||||
| 
 | ||||
| 			CMake ran into some sort of error. | ||||
| 			Have you already ran 'git cmake --preset $preset' at least once? | ||||
| 			EOF | ||||
| 		fi | ||||
| esac | ||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 James R
						James R