Skip to content

Commit

Permalink
Make Download Schema action consider deep subprojects
Browse files Browse the repository at this point in the history
  • Loading branch information
BoD committed Feb 24, 2025
1 parent 45499d1 commit 3a0b733
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private class DownloadSchemaTask(project: Project) : Task.Backgroundable(
}
} ?: return

val allDownloadSchemaTasks: List<String> = (rootGradleProject.children + rootGradleProject)
val allDownloadSchemaTasks: List<String> = rootGradleProject.allChildrenRecursively()
.flatMap { gradleProject -> gradleProject.tasks.filter { task -> task.name.matches(DOWNLOAD_SCHEMA_TASK_REGEX) } }
.map { it.name }
.distinct()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,6 @@ class GradleToolingModelService(
}
}

private fun GradleProject.allChildrenRecursively(): List<GradleProject> {
return listOf(this) + children.flatMap { it.allChildrenRecursively() }
}

private val ApolloGradleToolingModel.projectPathCompat: String
get() = if (versionMinor >= 3) {
projectPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
import com.intellij.openapi.module.Module
import com.intellij.openapi.module.ModuleManager
import com.intellij.openapi.project.Project
import org.gradle.tooling.model.GradleProject

const val CODEGEN_GRADLE_TASK_NAME = "generateApolloSources"

Expand All @@ -23,3 +24,7 @@ fun Project.getGradleRootPath(): String? {
if (rootProjectPath == null) logw("Could not get Gradle root project path")
return rootProjectPath
}

fun GradleProject.allChildrenRecursively(): List<GradleProject> {
return listOf(this) + children.flatMap { it.allChildrenRecursively() }
}

0 comments on commit 3a0b733

Please sign in to comment.