Use logger in dependency graph init script (#191)

Dependency graph init script now uses Gradle logger to emit warning/info messages.
This allows these messages to be suppressed using `--quiet`.
This commit is contained in:
Alex Serbin 2024-04-19 15:03:17 +02:00 committed by GitHub
parent 750cdda3ed
commit 6ccde15122
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,7 +12,7 @@ if (gradleVersion < GradleVersion.version("5.2") ||
if (getVariable('GITHUB_DEPENDENCY_GRAPH_CONTINUE_ON_FAILURE') != "true") {
throw new GradleException("Dependency Graph is not supported for ${gradleVersion}. No dependency snapshot will be generated.")
}
println "::warning::Dependency Graph is not supported for ${gradleVersion}. No dependency snapshot will be generated."
logger.warn("::warning::Dependency Graph is not supported for ${gradleVersion}. No dependency snapshot will be generated.")
return
}
@ -23,11 +23,11 @@ if (isTopLevelBuild) {
def reportFile = getUniqueReportFile(getVariable('GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR'))
if (reportFile == null) {
println "::warning::No dependency snapshot generated for step. Could not determine unique job correlator - specify GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR var for this step."
logger.warn("::warning::No dependency snapshot generated for step. Could not determine unique job correlator - specify GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR var for this step.")
return
}
println "Generating dependency graph into '${reportFile}'"
logger.lifecycle("Generating dependency graph into '${reportFile}'")
}
apply from: 'gradle-actions.github-dependency-graph-gradle-plugin-apply.groovy'