diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a77cdf4..3e29fac 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -71,7 +71,7 @@ jobs: - name: Compile production code run: | chmod +x ./gradlew - ./gradlew clean classes -PweatherProductionOnly=true --rerun-tasks --no-daemon --stacktrace + ./gradlew clean classes -PweatherProductionOnly=true --rerun-tasks --max-workers=2 --no-daemon --stacktrace - name: Analyze uses: github/codeql-action/analyze@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28 # v4 diff --git a/gradle/legacy-tools.gradle b/gradle/legacy-tools.gradle index 1f92467..e74c6aa 100644 --- a/gradle/legacy-tools.gradle +++ b/gradle/legacy-tools.gradle @@ -22,10 +22,23 @@ new RandomAccessFile(new File(tool.parentFile, 'specialsource-bootstrap.lock'), if (gradle.startParameter.offline) { throw new GradleException('The pinned legacy SpecialSource tool is missing or invalid. Run once online to restore it.') } - def connection = new URL(toolUrl).openConnection() - connection.connectTimeout = 15000 - connection.readTimeout = 30000 - byte[] downloaded = connection.inputStream.withCloseable { it.bytes } + byte[] downloaded + for (int attempt = 1; attempt <= 3; attempt++) { + def connection = new URL(toolUrl).openConnection() + connection.connectTimeout = 15000 + connection.readTimeout = 30000 + try { + downloaded = connection.inputStream.withCloseable { it.bytes } + break + } catch (IOException failure) { + int status = connection.responseCode + if (attempt == 3 || (status != 429 && status < 500)) throw failure + logger.lifecycle('Legacy build tool download returned HTTP {}; retrying ({}/3).', status, attempt + 1) + Thread.sleep(1000L * attempt) + } finally { + connection.disconnect() + } + } if (digest(downloaded) != toolSha256) { throw new GradleException('The legacy SpecialSource download did not match its pinned SHA-256.') } diff --git a/gradle/release.gradle b/gradle/release.gradle index c003806..f9b77fe 100644 --- a/gradle/release.gradle +++ b/gradle/release.gradle @@ -115,7 +115,7 @@ tasks.register('verifyReleaseArtifacts') { tasks.register('writeReleaseChecksums') { group = 'verification' - dependsOn tasks.named('verifyReleaseArtifacts') + dependsOn tasks.named('verifyReleaseArtifacts'), tasks.named('writeReleaseChecksum') def output = layout.buildDirectory.file('release/SHA256SUMS') outputs.file(output) inputs.files(releaseFiles.map { names -> names.collect { layout.buildDirectory.file("libs/${it}") } })