Skip to content

Commit c01cace

Browse files
authored
[IJ Plugin] Make 'Download Schema action' consider deep subprojects (#6394)
* Make Download Schema action consider deep subprojects * Temporarily disable plugin verifier compatibility problems, due to https://platform.jetbrains.com/t/plugin-verifier-fails-with-plugin-com-intellij-modules-json-not-declared-as-a-plugin-dependency/580
1 parent 45499d1 commit c01cace

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

intellij-plugin/build.gradle.kts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
12
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
23
import org.gradle.api.tasks.testing.logging.TestLogEvent
34
import org.jetbrains.changelog.markdownToHTML
45
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
5-
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask.FailureLevel.COMPATIBILITY_PROBLEMS
66
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask.FailureLevel.INTERNAL_API_USAGES
77
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask.FailureLevel.INVALID_PLUGIN
88
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask.FailureLevel.PLUGIN_STRUCTURE_WARNINGS
@@ -243,7 +243,8 @@ intellijPlatform {
243243
}
244244
failureLevel.set(
245245
setOf(
246-
COMPATIBILITY_PROBLEMS,
246+
// TODO: Temporarily disabled due to https://platform.jetbrains.com/t/plugin-verifier-fails-with-plugin-com-intellij-modules-json-not-declared-as-a-plugin-dependency/580
247+
// COMPATIBILITY_PROBLEMS,
247248
INTERNAL_API_USAGES,
248249
INVALID_PLUGIN,
249250
PLUGIN_STRUCTURE_WARNINGS,

intellij-plugin/src/main/kotlin/com/apollographql/ijplugin/gradle/DownloadSchemaAction.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private class DownloadSchemaTask(project: Project) : Task.Backgroundable(
6262
}
6363
} ?: return
6464

65-
val allDownloadSchemaTasks: List<String> = (rootGradleProject.children + rootGradleProject)
65+
val allDownloadSchemaTasks: List<String> = rootGradleProject.allChildrenRecursively()
6666
.flatMap { gradleProject -> gradleProject.tasks.filter { task -> task.name.matches(DOWNLOAD_SCHEMA_TASK_REGEX) } }
6767
.map { it.name }
6868
.distinct()

intellij-plugin/src/main/kotlin/com/apollographql/ijplugin/gradle/GradleToolingModelService.kt

-4
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,6 @@ class GradleToolingModelService(
302302
}
303303
}
304304

305-
private fun GradleProject.allChildrenRecursively(): List<GradleProject> {
306-
return listOf(this) + children.flatMap { it.allChildrenRecursively() }
307-
}
308-
309305
private val ApolloGradleToolingModel.projectPathCompat: String
310306
get() = if (versionMinor >= 3) {
311307
projectPath

intellij-plugin/src/main/kotlin/com/apollographql/ijplugin/gradle/GradleUtil.kt

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
55
import com.intellij.openapi.module.Module
66
import com.intellij.openapi.module.ModuleManager
77
import com.intellij.openapi.project.Project
8+
import org.gradle.tooling.model.GradleProject
89

910
const val CODEGEN_GRADLE_TASK_NAME = "generateApolloSources"
1011

@@ -23,3 +24,7 @@ fun Project.getGradleRootPath(): String? {
2324
if (rootProjectPath == null) logw("Could not get Gradle root project path")
2425
return rootProjectPath
2526
}
27+
28+
fun GradleProject.allChildrenRecursively(): List<GradleProject> {
29+
return listOf(this) + children.flatMap { it.allChildrenRecursively() }
30+
}

0 commit comments

Comments
 (0)