Copy dependency graph init script to Gradle Home

- Temporarily use a hard-coded plugin for convenience
This commit is contained in:
daz 2023-07-01 19:00:02 -06:00
parent d7761f188f
commit a6ad1901be
No known key found for this signature in database
3 changed files with 13 additions and 9 deletions

View File

@ -172,12 +172,21 @@ export class GradleStateCache {
} }
private initializeGradleUserHome(gradleUserHome: string, initScriptsDir: string): void { private initializeGradleUserHome(gradleUserHome: string, initScriptsDir: string): void {
const initScriptFilenames = ['build-result-capture.init.gradle', 'build-result-capture-service.plugin.groovy'] const initScriptFilenames = [
'build-result-capture.init.gradle',
'build-result-capture-service.plugin.groovy',
'github-dependency-graph.init.gradle'
]
for (const initScriptFilename of initScriptFilenames) { for (const initScriptFilename of initScriptFilenames) {
const initScriptContent = this.readInitScriptAsString(initScriptFilename) const initScriptContent = this.readInitScriptAsString(initScriptFilename)
const initScriptPath = path.resolve(initScriptsDir, initScriptFilename) const initScriptPath = path.resolve(initScriptsDir, initScriptFilename)
fs.writeFileSync(initScriptPath, initScriptContent) fs.writeFileSync(initScriptPath, initScriptContent)
} }
// TODO:DAZ Remove this when we use a real dependency again
const depGraphJar = 'github-dependency-graph-gradle-plugin-0.0.3.jar'
const jarFile = path.resolve(__dirname, '..', '..', 'src', 'resources', 'init-scripts', depGraphJar)
fs.copyFileSync(jarFile, path.resolve(initScriptsDir, depGraphJar))
} }
private readInitScriptAsString(resource: string): string { private readInitScriptAsString(resource: string): string {

View File

@ -1,12 +1,7 @@
import org.gradle.github.GitHubDependencyGraphPlugin // TODO:DAZ This should be conditionally applied, since the script may be present when not required.
initscript { initscript {
repositories {
maven {
url = uri("https://plugins.gradle.org/m2/")
}
}
dependencies { dependencies {
classpath("org.gradle:github-dependency-graph-gradle-plugin:+") classpath files("github-dependency-graph-gradle-plugin-0.0.3.jar")
} }
} }
apply plugin: GitHubDependencyGraphPlugin apply plugin: org.gradle.github.GitHubDependencyGraphPlugin