Skip to content

Commit 588ffa3

Browse files
BUILD-9108 fix build-gradle for Windows
use /bin/usr/find in build-gradle for compatibility with Windows Bash use local cache action in build-gradle
1 parent ec9d402 commit 588ffa3

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

build-gradle/action.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ runs:
8080
mkdir -p ".actions"
8181
ln -sf "$host_actions_root/get-build-number" .actions/get-build-number
8282
ln -sf "$host_actions_root/shared" .actions/shared
83+
ln -sf "$host_actions_root/cache" .actions/cache
8384
ls -la .actions/*
8485
echo "::endgroup::"
8586
@@ -130,20 +131,16 @@ runs:
130131
if: ${{ inputs.disable-caching != 'true' }}
131132
shell: bash
132133
run: |
133-
# Generate cache key from all Gradle files
134-
find . \( -name '*.gradle' -o -name '*.gradle.kts' \) -type f -exec md5sum {} \; | sort > gradle-md5-sums.txt
135-
md5sum gradle/libs.versions.toml gradle/wrapper/gradle-wrapper.properties 2>/dev/null >> gradle-md5-sums.txt || true
136-
137-
GRADLE_CACHE_KEY=$(md5sum gradle-md5-sums.txt | awk '{ print $1 }')
138-
134+
gradle-md5-sums="$(mktemp)"
135+
/usr/bin/find . \( -name '*.gradle' -o -name '*.gradle.kts' \) -type f -exec md5sum {} \; > "$gradle-md5-sums"
136+
md5sum gradle/libs.versions.toml gradle/wrapper/gradle-wrapper.properties 2>/dev/null >> "$gradle-md5-sums" || true
137+
GRADLE_CACHE_KEY=$(md5sum "$gradle-md5-sums" | awk '{ print $1 }')
139138
echo "🔑 Generated cache key: ${GRADLE_CACHE_KEY}"
140139
echo "GRADLE_CACHE_KEY=${GRADLE_CACHE_KEY}" >> "$GITHUB_ENV"
141140
142-
rm -f gradle-md5-sums.txt
143-
144141
- name: Restore Gradle Cache
145142
if: ${{ inputs.disable-caching != 'true' }}
146-
uses: SonarSource/gh-action_cache@v1
143+
uses: ./.actions/cache
147144
id: gradle-cache-restore
148145
with:
149146
path: ${{ inputs.cache-paths }}

promote/promote.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ MULTI_REPO_SRC_PRIVATE=sonarsource-private-qa
4444
MULTI_REPO_SRC_PUBLIC=sonarsource-public-qa
4545

4646
set_build_env() {
47-
DEFAULT_BRANCH=${DEFAULT_BRANCH:=$(gh repo view --json defaultBranchRef --jq ".defaultBranchRef.name")}
47+
: "${DEFAULT_BRANCH:=$(gh repo view --json defaultBranchRef --jq ".defaultBranchRef.name")}"
4848
export DEFAULT_BRANCH
4949
}
5050

0 commit comments

Comments
 (0)