GPUOpen-Tools / gpu_performance_api

GPU Performance API for AMD GPUs
MIT License
250 stars 46 forks source link

Make pre-build.py re-runnable on Windows #66

Closed jcortell68 closed 1 year ago

jcortell68 commented 1 year ago

pre-build.py couldn't be run twice. On the second run, the git pull failed with

Directory /git/gpu_performance_api/external/Lib/AMD/ADL exists. Using 'git pull' to get latest You are not currently on a branch. Please specify which branch you want to merge with. See git-pull(1) for details.

       git pull <remote> <branch>

   'git pull' failed with returncode:

This happens because the previous run intentionally checks out a specific commit, leaving the workspace in a detached state. The subsequent run tries to do a 'git pull origin' and that can't be done while the workspace is detached. I've added a step to checkout 'master' before doing the git pull. That fixes that issue.

However, there is a lot of waste in the likely scenario that the workspace is already checked out to the commit the script wants it at. So I've added a check for that and we now no-op the git workspace update in that case. That reduces a many-seconds phase of the script to almost no time.

Finally, updated .gitignore with some additional files.