Skip to content

Commit

Permalink
Only call onSchema() once in multi-module scenrios (#6252)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin authored Nov 12, 2024
1 parent e5c9bf8 commit 30d83ed
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ private abstract class GenerateSourcesFromIr : WorkAction<GenerateSourcesFromIrP
hasPlugin
)

val upstreamCodegenMetadata = upstreamMetadata.files.map { it.toCodegenMetadata() }
ApolloCompiler.buildSchemaAndOperationsSourcesFromIr(
codegenSchema = codegenSchema,
irOperations = irOperations.get().asFile.toIrOperations(),
downstreamUsedCoordinates = downstreamUsedCoordinates.get().toUsedCoordinates(),
upstreamCodegenMetadata = upstreamMetadata.files.map { it.toCodegenMetadata() },
upstreamCodegenMetadata = upstreamCodegenMetadata,
codegenOptions = codegenOptions.get().asFile.toCodegenOptions(),
layout = plugin?.layout(codegenSchema),
irOperationsTransform = plugin?.irOperationsTransform(),
Expand All @@ -120,8 +121,10 @@ private abstract class GenerateSourcesFromIr : WorkAction<GenerateSourcesFromIrP
operationOutputGenerator = plugin?.toOperationOutputGenerator(),
).writeTo(outputDir.get().asFile, true, metadataOutputFile.orNull?.asFile)

plugin?.schemaListener()?.let { onSchemaDocument ->
onSchemaDocument.onSchema(codegenSchema.schema, outputDir.get().asFile)
if (upstreamCodegenMetadata.isEmpty()) {
plugin?.schemaListener()?.let { onSchemaDocument ->
onSchemaDocument.onSchema(codegenSchema.schema, outputDir.get().asFile)
}
}
}
}
Expand Down

0 comments on commit 30d83ed

Please sign in to comment.