Jacob Rhoda
08/02/2024, 2:36 PM// feature/feature1/build.gradle.kts
apollo {
service("service") {
...
dependsOn(project(":core:api"))
}
}
// core/api/build.gradle.kts
apollo {
service("service") {
...
isADependencyOf(project(":feature:feature1"))
}
}
Stylianos Gakis
08/02/2024, 2:41 PMdependsOn(..., bidirectional = true)
?Jacob Rhoda
08/02/2024, 2:46 PMagrosner
08/02/2024, 2:51 PMagrosner
08/02/2024, 2:52 PMagrosner
08/02/2024, 2:53 PMmbonnin
08/02/2024, 2:59 PMJacob Rhoda
08/02/2024, 3:00 PMisADependencyOf
Could not determine the dependencies of task ':core:units:generateTraction-apiApolloSources'.
> Could not resolve all task dependencies for configuration ':core:units:apolloTraction-apiCodegenMetadataResolvable'.
> Could not resolve project :core:traction-api.
Required by:
project :core:units
> No matching variant of project :core:traction-api was found. The consumer was configured to find a component for use during 'CodegenMetadata', as well as attribute 'com.apollographql.service' with value 'traction-api', attribute 'com.apollographql.direction' with value 'Upstream' but:
mbonnin
08/02/2024, 3:02 PMmbonnin
08/02/2024, 3:08 PMmbonnin
08/02/2024, 3:10 PM:core:units
• schema: :core:traction-api
?mbonnin
08/02/2024, 3:10 PMbut:
?Jacob Rhoda
08/02/2024, 3:52 PM:core:units
, :feature:import-queue
, and then the schema, :core:traction-api
. This is a slow migration 😅Jacob Rhoda
08/02/2024, 3:52 PMCould not determine the dependencies of task ':core:units:generateTraction-apiApolloSources'.
> Could not resolve all task dependencies for configuration ':core:units:apolloTraction-apiCodegenMetadataResolvable'.
> Could not resolve project :core:traction-api.
Required by:
project :core:units
> No matching variant of project :core:traction-api was found. The consumer was configured to find a component for use during 'CodegenMetadata', as well as attribute 'com.apollographql.service' with value 'traction-api', attribute 'com.apollographql.direction' with value 'Upstream' but:
- Variant '(ios_arm64, ios_simulator_arm64)CInteropApiElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during 'kotlin-commonized-cinterop' and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'apolloTraction-apiOtherOptionsConsumable' capability TractionMobile.core:traction-api:unspecified declares a component, as well as attribute 'com.apollographql.direction' with value 'Upstream', attribute 'com.apollographql.service' with value 'traction-api':
- Incompatible because this component declares a component for use during 'OtherOptions' and the consumer needed a component for use during 'CodegenMetadata'
- Variant 'debugApiElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during compile-time and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'debugRuntimeElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during runtime and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'debugSourcesElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during runtime and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'iosArm64ApiElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during 'kotlin-api' and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'iosArm64CInteropApiElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during 'kotlin-cinterop' and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'iosArm64MetadataElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during 'kotlin-metadata' and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'iosArm64SourcesElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during 'kotlin-runtime' and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'iosSimulatorArm64ApiElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during 'kotlin-api' and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'iosSimulatorArm64CInteropApiElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during 'kotlin-cinterop' and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'iosSimulatorArm64MetadataElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during 'kotlin-metadata' and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'iosSimulatorArm64SourcesElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during 'kotlin-runtime' and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'metadataApiElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during 'kotlin-metadata' and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'metadataSourcesElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during 'kotlin-runtime' and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'releaseApiElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during compile-time and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'releaseRuntimeElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during runtime and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
- Variant 'releaseSourcesElements' capability TractionMobile.core:traction-api:unspecified:
- Incompatible because this component declares a component for use during runtime and the consumer needed a component for use during 'CodegenMetadata'
- Other compatible attributes:
- Doesn't say anything about com.apollographql.direction (required 'Upstream')
- Doesn't say anything about com.apollographql.service (required 'traction-api')
Jacob Rhoda
08/02/2024, 3:52 PM:core:units
mbonnin
08/02/2024, 4:12 PMgenerateApolloMetadata
in your :core:traction-api
?mbonnin
08/02/2024, 4:14 PMgenerateApolloMetadata
is the thing that marks a module as the schema module for Apollo. isADependencyOf()
sets it automatically but without this I’m not sure it’s completely possible to find the schema moduleJacob Rhoda
08/02/2024, 4:33 PMisADependencyOf
fixes it. I wasn't setting that property in my schema module.Jacob Rhoda
08/02/2024, 4:50 PMfield
reference. If I change it to use the specific type, e.g. `AssociationType.`field`` , that removes the error. But of course that gets overridden.mbonnin
08/02/2024, 4:56 PMmbonnin
08/02/2024, 4:57 PMtargetName
can help herembonnin
08/02/2024, 4:57 PMmbonnin
08/02/2024, 4:57 PMJacob Rhoda
08/02/2024, 4:58 PMgenerateApolloMetadata
generates a bunch of types even if you don't use/reference them. I.e. there are things from our schema but which the app doesn't use. That's causing an issue with Kotlin. But if I remove that, then they don't get generated and thus it compiles. But then I have the issue with the outgoing variant.Jacob Rhoda
08/02/2024, 5:00 PMbod
08/02/2024, 5:00 PMfield
issue you can add this on a file named extra.graphqls
next to your schema:
extend enum AssociationType {
field @targetName(name: "_field")
}
Jacob Rhoda
08/02/2024, 5:05 PMisADependencyOf
and with generateApolloMetadata.set(true)
I am still slightly concerned that it's generating far more types in the type
package than it needs to... I suppose that is unavoidable though?mbonnin
08/02/2024, 11:28 PMI am still slightly concerned that it’s generating far more types in theIndeed. There’s no silver bullet. It’s either: • Generating all types • Tracking the types manually and listing them 1 by 1 inpackage than it needs to... I suppose that is unavoidable though?type
alwaysGenerateTypesMatching.set(listOf("Type1", "Type2", ...)
• Tracking the types automatically and
◦ using isADependencyOf()
◦ or using experimental bidirectional = true
and no project isolationJacob Rhoda
08/02/2024, 11:43 PMisADependencyOf
for now then. Thanks for the help!mbonnin
08/02/2024, 11:43 PMmbonnin
08/02/2024, 11:47 PMfield
thing: https://github.com/apollographql/apollo-kotlin/pull/6093