|
41 | 41 | fi
|
42 | 42 |
|
43 | 43 | # Directory containing this script
|
44 |
| -readonly script_dir="." |
| 44 | +readonly script_dir=`pwd` |
45 | 45 |
|
46 | 46 | # Change this if your checkout of github.com/protocolbuffers/protobuf is in a
|
47 | 47 | # different location.
|
|
238 | 238 | # Set up a hook to cleanup revision comparison checkouts when the script
|
239 | 239 | # completes.
|
240 | 240 | declare -a CLEANUP_WHEN_DONE
|
| 241 | +declare -a GIT_WORKTREE |
241 | 242 | function cleanup_revision_checkouts() {
|
242 | 243 | if [[ "${#CLEANUP_WHEN_DONE[@]}" -ne 0 ]]; then
|
243 | 244 | rm -rf "${CLEANUP_WHEN_DONE[@]}"
|
244 | 245 | fi
|
| 246 | + if [ "$GIT_WORKTREE" != "" ]; then |
| 247 | + git worktree remove "$GIT_WORKTREE" |
| 248 | + fi |
245 | 249 | }
|
246 | 250 | trap cleanup_revision_checkouts EXIT HUP INT QUIT TERM
|
247 | 251 |
|
@@ -316,19 +320,24 @@ for comparison in "${comparisons[@]}"; do
|
316 | 320 |
|
317 | 321 | # Check out the commit to a temporary directory and create its _generated
|
318 | 322 | # directory. (Results will still go in the working tree.)
|
319 |
| - tmp_checkout="$(mktemp -d -t swiftprotoperf)" |
320 |
| - CLEANUP_WHEN_DONE+=("$tmp_checkout") |
321 |
| - git --work-tree="$tmp_checkout" checkout "$comparison" -- . |
322 |
| - mkdir "$tmp_checkout/Performance/_generated" |
323 |
| - |
324 |
| - build_swift_packages "$tmp_checkout" "ForRev" |
325 |
| - ${PROTOC} --plugin="$tmp_checkout/.build/release/protoc-gen-swiftForRev" \ |
326 |
| - --swiftForRev_out=FileNaming=DropPath:"$tmp_checkout/Performance/_generated" \ |
| 323 | + GIT_WORKTREE="$(mktemp -d `pwd`/_generated/swiftprotoperf.XXXXXX)" |
| 324 | + CLEANUP_WHEN_DONE+=("$GIT_WORKTREE") |
| 325 | + git worktree add "$GIT_WORKTREE" "$comparison" |
| 326 | + mkdir "$GIT_WORKTREE/Performance/_generated" |
| 327 | + |
| 328 | + build_swift_packages "$GIT_WORKTREE" "ForRev" |
| 329 | + echo ${PROTOC} --plugin="$GIT_WORKTREE/.build/release/protoc-gen-swiftForRev" \ |
| 330 | + --swiftForRev_out=FileNaming=DropPath:"$GIT_WORKTREE/Performance/_generated" \ |
| 331 | + --proto_path=`dirname $gen_message_path` \ |
| 332 | + "$gen_message_path" |
| 333 | + ${PROTOC} --plugin="$GIT_WORKTREE/.build/release/protoc-gen-swiftForRev" \ |
| 334 | + --swiftForRev_out=FileNaming=DropPath:"$GIT_WORKTREE/Performance/_generated" \ |
| 335 | + --proto_path=`dirname $gen_message_path` \ |
327 | 336 | "$gen_message_path"
|
328 | 337 |
|
329 |
| - harness_swift="$tmp_checkout/Performance/_generated/harness_swift" |
| 338 | + harness_swift="$GIT_WORKTREE/Performance/_generated/harness_swift" |
330 | 339 | results_trace="$script_dir/_results/$report_type (swift)"
|
331 |
| - run_swift_harness "$tmp_checkout" "$comparison" "$commit_results" |
| 340 | + run_swift_harness "$GIT_WORKTREE" "$comparison" "$commit_results" |
332 | 341 | else
|
333 | 342 | echo
|
334 | 343 | echo "==== Found cached results for Swift ($comparison) ===================="
|
|
0 commit comments