goku
12/12/2024, 11:35 PMgoku
12/12/2024, 11:36 PMRepository A
-------------
:schema-module - The schema lives here. This publishes types and metadata as "schema-module-apollo"
:common-module - dependsOn(project("schema-module")) and publishes its metadata as "common-module-apollo"
Repository B (depends on Repository A modules)
--------------
:app-module
- dependsOn("com.x.y.z.schema-module-apollo")
- dependsOn("com.x.y.z.common-module-apollo")
The error we get is:
Could not resolve com.x.y.z:schema-module:1.0.0.
Required by:
project :app-module > com.x.y.z:common-module-apollo:1.0.0:20241211.235659-1
No matching variant of com.x.y.z.schema-module:1.0.0:20241211.185912-1 was found. The consumer was configured to find a component for use during 'OtherOptions', as well as attribute 'com.apollographql.direction' with value 'Upstream', attribute 'com.apollographql.service' with value 'production' but:
In my opinion, when common-module
depends on the source code of schema-module
it’s publication doesn’t contain any information about the metadata
of schema-module
. That’s why app
module is looking for schema-module
instead of schema-module-apollo
.
Any thoughts?mbonnin
12/12/2024, 11:49 PMschema-module
in the published common-module-apollo.module
filembonnin
12/12/2024, 11:51 PMcommon-module-apollo
non-transitive. Something like:
configurations.configureEach {
if (name.lowercase().contains("apollo")) {
dependencies.forEach {
if (it is ExternalDependency && it.module.name.contains("ommon-module-apollo")) {
it.isTransitive = false
}
}
}
}
mbonnin
12/12/2024, 11:52 PMgoku
12/12/2024, 11:53 PM.module
file already, no references to -apollo
.
{
"name": "apolloProductionOtherOptionsConsumable",
"attributes": {
"com.apollographql.direction": "Upstream",
"com.apollographql.service": "production",
"org.gradle.usage": "OtherOptions"
},
"dependencies": [
{
"group": "com.x.y.z",
"module": "schema-module",
"version": {
"requires": "1.0.0"
}
}
]
},
mbonnin
12/13/2024, 3:48 PMExecution failed for task ':fragments:generatePomFileForApolloPublication'.
> Failed to query the value of property 'dependencies'.
> Publishing is not able to resolve a dependency on a project with multiple publications that have different coordinates.
Found the following publications in project ':schema':
- Maven publication 'default' with coordinates com.schema:schema:1.0.0
- Maven publication 'apollo' with coordinates com.schema:schema-apollo:1.0.0
mbonnin
12/13/2024, 5:38 PMgoku
12/13/2024, 10:13 PMgoku
12/16/2024, 2:21 AMother-options.json
is missing from common-module
publication. It exists in schema-module
publication. I cloned it into common-module
publication to see if that would cause this but no luck.goku
12/16/2024, 5:32 AMcommon-models.module
file, and changing all references of schema-module
to schema-module-apollo
.mbonnin
12/16/2024, 9:33 AMgoku
12/17/2024, 4:37 AM"Impossible to find an AdHocComponent"
error on this. I think that’s because we are using kotlin-android
plugin?mbonnin
12/17/2024, 7:49 AMgoku
12/17/2024, 12:21 PM.module
file?mbonnin
12/17/2024, 12:44 PMmbonnin
12/17/2024, 12:45 PMmbonnin
12/17/2024, 12:45 PMmbonnin
12/17/2024, 2:05 PMmbonnin
12/17/2024, 2:05 PMgoku
12/17/2024, 2:12 PMmbonnin
12/17/2024, 2:17 PMmbonnin
12/17/2024, 2:18 PMgoku
12/17/2024, 4:01 PMgoku
12/18/2024, 6:07 AMSoftware component 'org.jetbrains.kotlin.gradle.plugin.mpp.KotlinTargetSoftwareComponentImpl@624ec2c8' is not an instance of AdhocComponentWithVariants
mbonnin
12/18/2024, 8:19 AMmbonnin
12/18/2024, 8:19 AMisTransitive = false
workaroundgoku
12/18/2024, 10:08 AMmbonnin
12/18/2024, 10:11 AMoutgoingVariantsConnection
?mbonnin
12/18/2024, 10:36 AMgoku
12/19/2024, 10:32 AMmbonnin
12/19/2024, 11:34 AMmbonnin
12/19/2024, 11:35 AMgoku
01/06/2025, 4:55 AM.module
points to .aar
so it is still same issue. I will need to find a way to get this variants added to JAR publication I think. Let me know if you know any easy way to do this.mbonnin
01/06/2025, 9:00 AMour modules are Android libraries but we are manually publishing Jar from them, because one of the consumer apps has java libraries and it requires jarWould a regular jar do for this library? (no ressources, no Android specific APIs?) If yes, which seems to be the case since your consumer can consume pure jar files, I wouldn't bother with the Android plugin at all in the first place
goku
01/06/2025, 11:14 PMmbonnin
01/07/2025, 10:13 AMgoku
01/07/2025, 12:16 PMmbonnin
01/07/2025, 12:43 PMgoku
01/20/2025, 3:57 AMmbonnin
01/20/2025, 1:17 PMmbonnin
01/20/2025, 1:19 PMintermediates/aar_main_jar/release/classes.jar
doesn't use Gradle metadata and is therefore not exposing its dependencies (not generated code)mbonnin
01/20/2025, 1:22 PMmbonnin
01/20/2025, 1:23 PMgoku
01/24/2025, 12:47 AMgoku
01/24/2025, 12:54 AMmbonnin
01/24/2025, 7:59 AMmbonnin
01/24/2025, 7:59 AMmbonnin
01/24/2025, 8:00 AMmbonnin
01/24/2025, 8:00 AMgoku
01/24/2025, 8:02 AMmbonnin
01/24/2025, 8:03 AMmbonnin
01/24/2025, 8:03 AMmbonnin
01/24/2025, 8:04 AMmbonnin
01/24/2025, 8:04 AMmbonnin
01/24/2025, 8:05 AMgoku
01/24/2025, 8:05 AMgoku
01/29/2025, 10:36 PMmbonnin
01/30/2025, 7:28 PMmbonnin
01/30/2025, 7:29 PMgoku
01/30/2025, 9:15 PMgoku
02/05/2025, 1:55 AMadd("prodApi", project(":schema")) {
capabilities {
requireCapability("com.schema:prod")
}
}
add("stageApi", project(":schema")) {
capabilities {
requireCapability("com.schema:stage")
}
}
But in Apollo config dependsOn(project(":schema"))
doesn’t capture the capability.
If Java only library is Apollo’s recommendation, how is this not handled I’m surprised. I would think it is a common use case to have a service per flavour.goku
02/05/2025, 2:17 AMmbonnin
02/05/2025, 10:46 AMdependencies {
listOf("Prod", "Staging").forEach { variant ->
listOf("Ir", "OtherOptions", "CodegenMetadata", "CodegenSchema").forEach { configuration ->
add("apollo${variant}${configuration}", project(":schema")){
capabilities {
requireCapability("com.schema:schema-${variant.lowercase()}")
}
}
}
}
mbonnin
02/05/2025, 10:47 AMCould not determine the dependencies of task ':fragments:generateProdApolloSources'.
> Could not resolve all dependencies for configuration ':fragments:apolloProdCodegenMetadataResolvable'.
> Could not resolve project :schema.
Required by:
project :fragments
> No matching variant of project :schema was found. The consumer was configured to find a component for use during 'CodegenMetadata', as well as attribute 'com.apollographql.direction' with value 'Upstream', attribute 'com.apollographql.service' with value 'prod' but:
- Variant 'apiElements':
- 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 'prod')
- Variant 'apolloProdCodegenMetadataConsumable' declares a component for use during 'CodegenMetadata', as well as attribute 'com.apollographql.direction' with value 'Upstream', attribute 'com.apollographql.service' with value 'prod'
mbonnin
02/05/2025, 10:48 AMapolloProdCodegenMetadataConsumable
is beyond me. Can you use 2 different modules instead?
• :schema-prod
• :schema-stage
goku
02/05/2025, 10:50 AMmbonnin
02/05/2025, 10:51 AMmbonnin
02/05/2025, 10:51 AMgoku
02/05/2025, 10:52 AMgoku
04/07/2025, 3:25 AM