Skip to content

Conversation

@martinbonnin
Copy link
Contributor

@martinbonnin martinbonnin commented Mar 5, 2025

This allows to configure dependency resolution using the full Gradle APIs. See #6343.

  • schema/build.gradle.kts
apollo {
  service("service") {
    packageName.set("com.example")]
    schemaFiles.from("src/main/graphql/schema.graphqls")
    generateApolloMetatata.set(true)
    alwaysGenerateTypesMatching.set(emptyList())
  }
}

// This needs to be **after** the apollo {} block
dependencies {
  // The name of the configuration is "apollo${serviceName.capitalized()}UsedCoordinates"
  add("apolloServiceUsedCoordinates", project(":feature"))
}
  • feature/build.gradle.kts
apollo {
  service("service") {
    packageName.set("com.example")]
    generateApolloMetatata.set(true)
    alwaysGenerateTypesMatching.set(emptyList())
  }
}

dependencies {
  // The name of the configuration is "apollo${serviceName.capitalized()}"
  add("apolloService", project(":schema"))
}

One drawback is this breaks the IJ tooling model here because the dependencies are not known until the configurations are resolved.

@martinbonnin martinbonnin requested a review from BoD as a code owner March 5, 2025 18:28
@svc-apollo-docs
Copy link
Collaborator

svc-apollo-docs commented Mar 5, 2025

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 1 changed, 0 removed
* graphos/routing/v1/performance/query-batching.mdx

Build ID: 293160157b860d615173bedd

URL: https://www.apollographql.com/docs/deploy-preview/293160157b860d615173bedd

Copy link
Contributor

@BoD BoD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

For reference, applying this on the multi module sample is here.

@martinbonnin martinbonnin merged commit a00dc1b into main Mar 6, 2025
7 checks passed
@martinbonnin martinbonnin deleted the expose-configurations branch March 6, 2025 10:30
@martinbonnin martinbonnin added this to the 4.2.0 milestone Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants