Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dotnet/private/sourcelink.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ load("@rules_dotnet//dotnet/private/transitions:tfm_transition.bzl", "tfm_transi
def _generate_sourcelink_json(ctx):
output = ctx.actions.declare_file(ctx.label.name + "_sourcelink.json")
ctx.actions.run_shell(
inputs = [ctx.version_file],
inputs = [ctx.info_file],
outputs = [output],
command = """
COMMIT=$(grep "^STABLE_GIT_REVISION " "{status}" | cut -d' ' -f2 | tr -d '*')
COMMIT=$(grep "^STABLE_GIT_REVISION_FULL " "{status}" | cut -d' ' -f2 | tr -d '*')
[ -z "$COMMIT" ] && COMMIT=HEAD
printf '{{"documents":{{"*":"{repo}/raw/%s/*"}}}}\\n' "$COMMIT" > "{output}"
""".format(
status = ctx.version_file.path,
status = ctx.info_file.path,
repo = ctx.attr.repo_url.rstrip("/"),
output = output.path,
),
Expand Down
2 changes: 2 additions & 0 deletions scripts/build-info.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
$revision = (git rev-parse --short HEAD)
$full_revision = (git rev-parse HEAD)
$dirtyout = (git status --porcelain --untracked-files=no)
if ($dirtyout -eq $null) {
$dirty = ""
} else {
$dirty = "*"
}
echo "STABLE_GIT_REVISION $revision$dirty"
echo "STABLE_GIT_REVISION_FULL $full_revision$dirty"
2 changes: 2 additions & 0 deletions scripts/build-info.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/bash

revision=$(git rev-parse --short HEAD)
full_revision=$(git rev-parse HEAD)
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
dirty="*"
else
dirty=""
fi

echo "STABLE_GIT_REVISION $revision$dirty"
echo "STABLE_GIT_REVISION_FULL $full_revision$dirty"
Loading