kythe.io@v0.0.68-0.20240422202219-7225dbc01741/tools/buildstamp/get_workspace_status (about)

     1  #!/bin/bash -e
     2  
     3  # This script will be run bazel when building process starts to
     4  # generate key-value information that represents the status of the
     5  # workspace. The output should be like
     6  #
     7  # KEY1 VALUE1
     8  # KEY2 VALUE2
     9  
    10  echo "STABLE_BUILD_SCM_REVISION $(git rev-parse HEAD)"
    11  
    12  # Check whether there are any uncommited changes
    13  if git diff-index --quiet HEAD; then
    14    tree_status="Clean"
    15  else
    16    tree_status="Modified"
    17  fi
    18  echo "STABLE_BUILD_SCM_STATUS ${tree_status}"
    19  
    20  echo "STABLE_KYTHE_RELEASE_VERSION $(awk '/^release_version =/ { print substr($3, 2, length($3)-2) }' kythe/release/BUILD)"