mirror of
https://github.com/gradle/actions.git
synced 2026-03-23 20:45:47 +08:00
Extract init scripts into resource files
This commit is contained in:
12
src/resources/project-root-capture.init.gradle
Normal file
12
src/resources/project-root-capture.init.gradle
Normal file
@@ -0,0 +1,12 @@
|
||||
// Capture the build root directory for each executed Gradle build.
|
||||
// Only run against root build. Do not run against included builds.
|
||||
def isTopLevelBuild = gradle.getParent() == null
|
||||
if (isTopLevelBuild) {
|
||||
settingsEvaluated { settings ->
|
||||
def projectRootEntry = settings.rootDir.absolutePath + '\n'
|
||||
def projectRootList = new File(settings.gradle.gradleUserHomeDir, "project-roots.txt")
|
||||
if (!projectRootList.exists() || !projectRootList.text.contains(projectRootEntry)) {
|
||||
projectRootList << projectRootEntry
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user