-
Notifications
You must be signed in to change notification settings - Fork 651
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[🐘gradle-plugin] configuration cache and lazy properties for schema f…
…iles (#5580) * add a test for #5455 * Fix configuration cache and schema file auto detection Closes #5455 Closes #5221 * add a test for #5221
- Loading branch information
1 parent
dc34c4b
commit 50f7e04
Showing
15 changed files
with
184 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...adle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/project.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.apollographql.apollo3.gradle.internal | ||
|
||
import org.gradle.api.Project | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
|
||
internal fun Project.mainSourceSet(): String { | ||
return when (project.extensions.findByName("kotlin")) { | ||
is KotlinMultiplatformExtension -> "commonMain" | ||
else -> "main" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
libraries/apollo-gradle-plugin/testProjects/configuration-cache2/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
plugins { | ||
alias(libs.plugins.kotlin.jvm) | ||
alias(libs.plugins.apollo) | ||
} | ||
|
||
apollo { | ||
service("service") { | ||
packageName.set("com.example") | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
libraries/apollo-gradle-plugin/testProjects/configuration-cache2/settings.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
apply(from = "../../../../gradle/test.settings.gradle.kts") | ||
|
||
include(":root", ":leaf") |
3 changes: 3 additions & 0 deletions
3
...apollo-gradle-plugin/testProjects/configuration-cache2/src/main/graphql/operation.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
query GetRandom { | ||
random | ||
} |
3 changes: 3 additions & 0 deletions
3
...s/apollo-gradle-plugin/testProjects/configuration-cache2/src/main/graphql/schema.graphqls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type Query { | ||
random: String | ||
} |
25 changes: 25 additions & 0 deletions
25
libraries/apollo-gradle-plugin/testProjects/lazy-schema-file/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
plugins { | ||
alias(libs.plugins.kotlin.jvm) | ||
alias(libs.plugins.apollo) | ||
} | ||
|
||
abstract class GenerateSchemaTask: DefaultTask() { | ||
@get:OutputFile | ||
abstract val outputFile: RegularFileProperty | ||
|
||
@TaskAction | ||
fun taskAction() { | ||
println("generating schema") | ||
outputFile.asFile.get().writeText("type Query { random: Int }") | ||
} | ||
} | ||
val installTask = tasks.register("generateSchema", GenerateSchemaTask::class.java) { | ||
outputFile.set(project.file("build/schema.graphqls")) | ||
} | ||
|
||
apollo { | ||
service("service") { | ||
packageName.set("com.example") | ||
schemaFile.set(installTask.flatMap { it.outputFile }) | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
libraries/apollo-gradle-plugin/testProjects/lazy-schema-file/settings.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
apply(from = "../../../../gradle/test.settings.gradle.kts") | ||
|
Oops, something went wrong.