Skip to content

Commit ea81560

Browse files
authored
Update gratatouille so that we can have an apolloTasks configuration that hold the classpath for the tasks (#6701)
1 parent 39bcab0 commit ea81560

File tree

5 files changed

+43
-28
lines changed

5 files changed

+43
-28
lines changed

gradle/libraries.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ atomicfu = "0.26.0"
2424
compat-patrouille = "0.0.0"
2525
compose = "1.5.1"
2626
guava = "31.1-jre"
27-
gratatouille = "0.0.10"
27+
# This is used at build time only, and it's ok to resolve SNAPSHOTS
28+
gratatouille = "0.1.3-SNAPSHOT-5760abde21dbc0bea26bb4a401ca5fc69067fa80"
29+
# This is a transitive dependency of apollo-gradle-plugin and therefore cannot use SNAPSHOTs
30+
gratatouille-runtime = "0.1.2"
2831
javaPoet = "1.13.0"
2932
jetbrains-annotations = "24.0.1"
3033
junit = "4.13.2"
@@ -99,6 +102,8 @@ dgp = "com.gradle:develocity-gradle-plugin:4.1.1" # // sync with settings.gradle
99102
google-testing-compile = { group = "com.google.testing.compile", name = "compile-testing", version = "0.19" }
100103
google-testparameterinjector = { group = "com.google.testparameterinjector", name = "test-parameter-injector", version = "1.11" }
101104
gratatouille = { group = "com.gradleup.gratatouille", name = "gratatouille-gradle-plugin", version.ref = "gratatouille" }
105+
gratatouille-wiring-runtime = { group = "com.gradleup.gratatouille", name = "gratatouille-wiring-runtime", version.ref = "gratatouille-runtime" }
106+
gratatouille-tasks-runtime = { group = "com.gradleup.gratatouille", name = "gratatouille-tasks-runtime", version.ref = "gratatouille-runtime" }
102107

103108
#
104109
# See https://github.com/gradle/gradle/issues/1835

gradle/repositories.gradle.kts

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,33 @@ listOf(pluginManagement.repositories, dependencyResolutionManagement.repositorie
3131
includeModuleByRegex("androidx\\..*", ".*")
3232
}
3333
}
34-
34+
// This is used at build time but not part of pluginManagement
3535
maven("https://storage.googleapis.com/gradleup/m2") {
3636
content {
37-
includeGroup("com.gradleup.librarian")
38-
includeGroup("com.gradleup.nmcp")
39-
includeGroup("com.gradleup.nmcp.aggregation")
37+
includeModule("com.gradleup.gratatouille", "gratatouille-processor")
4038
}
4139
}
4240

43-
exclusiveContent {
44-
forRepository(::gradlePluginPortal)
45-
filter {
46-
includeModule("org.jetbrains.kotlinx", "kotlinx-benchmark-plugin")
47-
includeModule("com.github.ben-manes", "gradle-versions-plugin")
48-
includeModule("com.gradle", "develocity-gradle-plugin")
41+
if (rootProject.name == "build-logic" || it === pluginManagement.repositories) {
42+
// repositories only used at build time
43+
exclusiveContent {
44+
forRepository(::gradlePluginPortal)
45+
filter {
46+
includeModule("org.jetbrains.kotlinx", "kotlinx-benchmark-plugin")
47+
includeModule("com.github.ben-manes", "gradle-versions-plugin")
48+
includeModule("com.gradle", "develocity-gradle-plugin")
49+
}
50+
}
51+
52+
maven("https://storage.googleapis.com/gradleup/m2") {
53+
content {
54+
includeGroup("com.gradleup.librarian")
55+
includeGroup("com.gradleup.nmcp")
56+
includeGroup("com.gradleup.nmcp.aggregat=ion")
57+
includeGroup("com.gradleup.gratatouille")
58+
includeGroup("com.gradleup.gratatouille.tasks")
59+
includeGroup("com.gradleup.gratatouille.wiring")
60+
}
4961
}
5062
}
5163
}

libraries/apollo-gradle-plugin-external/build.gradle.kts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
2-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
32

43
plugins {
54
id("org.jetbrains.kotlin.jvm")
@@ -14,13 +13,17 @@ apolloLibrary(
1413
)
1514

1615
gratatouille {
17-
codeGeneration()
16+
codeGeneration {
17+
addDependencies.set(false)
18+
}
1819
pluginMarker("com.apollographql.apollo.external")
1920
}
2021

2122
dependencies {
2223
compileOnly(libs.gradle.api.min)
23-
compileOnly(libs.kotlin.plugin.min)
24+
25+
implementation(libs.gratatouille.wiring.runtime)
26+
implementation(libs.gratatouille.tasks.runtime)
2427

2528
implementation(project(":apollo-annotations"))
2629
api(project(":apollo-gradle-plugin"))

libraries/apollo-gradle-plugin-tasks/build.gradle.kts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,17 @@ dependencies {
1616
implementation(project(":apollo-compiler"))
1717
implementation(project(":apollo-tooling"))
1818
implementation(project(":apollo-ast"))
19+
implementation(libs.gratatouille.tasks.runtime)
1920
implementation(libs.asm)
2021
implementation(libs.kotlinx.serialization.json)
2122
}
2223

2324
gratatouille {
2425
codeGeneration {
25-
/**
26-
* Workaround for https://github.com/GradleUp/gratatouille/pull/52
27-
*/
28-
configurations.configureEach {
29-
if (name == "gratatouilleApiElements") {
30-
artifacts.configureEach {
31-
this as ConfigurablePublishArtifact
32-
if (extension.isNullOrEmpty()) {
33-
extension = "zip"
34-
}
35-
}
36-
}
26+
addDependencies = false
27+
classLoaderIsolation {
28+
configurationName = "apolloTasks"
3729
}
38-
classLoaderIsolation()
3930
}
4031
}
4132

libraries/apollo-gradle-plugin/build.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ apolloLibrary(
1515
)
1616

1717
gratatouille {
18-
codeGeneration()
18+
codeGeneration {
19+
addDependencies = false
20+
}
1921
pluginMarker("com.apollographql.apollo")
2022
}
2123

@@ -28,6 +30,8 @@ dependencies {
2830

2931
compileOnly(libs.gradle.api.min)
3032
implementation(project(":apollo-annotations"))
33+
implementation(libs.gratatouille.wiring.runtime)
34+
3135
testImplementation(project(":apollo-ast"))
3236
testImplementation(libs.junit)
3337
testImplementation(libs.truth)

0 commit comments

Comments
 (0)