Update scripts to handle passing files as parameters.
This commit is contained in:
		
							parent
							
								
									f16a554154
								
							
						
					
					
						commit
						2cd2f7570c
					
				| @ -9,14 +9,13 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||||
| : ${BACKTRACE:="NO"} # or YES to print a rust backtrace when panicking | ||||
| : ${NO_COLOR:=""} # Set to anything to disable color output | ||||
| 
 | ||||
| 
 | ||||
| cd "$DIR/../" | ||||
| REALPATH=$(command -v uu-realpath || command -v realpath) | ||||
| MAKE=$(command -v gmake || command -v make) | ||||
| 
 | ||||
| function main { | ||||
|     build_container | ||||
|     launch_container | ||||
|     launch_container "${@}" | ||||
| } | ||||
| 
 | ||||
| function build_container { | ||||
| @ -51,7 +50,17 @@ function launch_container { | ||||
|         additional_flags+=(--env RUST_BACKTRACE=full) | ||||
|     fi | ||||
| 
 | ||||
|     docker run "${additional_flags[@]}" --init --rm -i --mount type=tmpfs,destination=/tmp -v "$($REALPATH ./):/source:ro" --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source --entrypoint "" organic-test "${additional_args[@]}" | ||||
|     if [ $# -gt 0 ]; then | ||||
|         # If we passed in args, we need to forward them along | ||||
|         for path in "${@}"; do | ||||
|             local full_path=$($REALPATH "$path") | ||||
|             local containing_folder=$(dirname "$full_path") | ||||
|             local file_name=$(basename "$full_path") | ||||
|             docker run "${additional_flags[@]}" --init --rm -i --mount type=tmpfs,destination=/tmp -v "${containing_folder}:/input:ro"  -v "$($REALPATH ./):/source:ro" --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source --entrypoint "" organic-test "${additional_args[@]}" -- "/input/$file_name" | ||||
|         done | ||||
|     else | ||||
|         docker run "${additional_flags[@]}" --init --rm -i --mount type=tmpfs,destination=/tmp -v "$($REALPATH ./):/source:ro" --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source --entrypoint "" organic-test "${additional_args[@]}" | ||||
|     fi | ||||
| } | ||||
| 
 | ||||
| main "${@}" | ||||
|  | ||||
| @ -17,7 +17,7 @@ function main { | ||||
|         additional_flags+=(--profile "$PROFILE") | ||||
|     fi | ||||
|     cargo build --no-default-features "${additional_flags[@]}" | ||||
|     time ./target/${PROFILE}/parse | ||||
|     time ./target/${PROFILE}/parse "${@}" | ||||
| } | ||||
| 
 | ||||
| main "${@}" | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander