Skip to content

[4.x] Remove unused code, better grammar #6553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ import com.apollographql.apollo.compiler.codegen.SchemaAndOperationsLayout
import com.apollographql.apollo.compiler.codegen.writeTo
import com.apollographql.apollo.compiler.internal.DefaultApolloCompilerRegistry
import com.apollographql.apollo.compiler.internal.GradleCompilerPluginLogger
import com.apollographql.apollo.compiler.operationoutput.OperationDescriptor
import com.apollographql.apollo.compiler.operationoutput.OperationId
import com.apollographql.apollo.compiler.operationoutput.OperationOutput
import java.io.File
import java.util.ServiceLoader
import java.util.function.Consumer

/**
* EntryPoints contains code that is called using reflection from the Gradle plugin.
* EntryPoints contains code called using reflection from the Gradle plugin.
* This is so that the classloader can be isolated, and we can use our preferred version of
* Kotlin and other dependencies without risking conflicts.
*
Expand Down Expand Up @@ -160,22 +157,6 @@ class EntryPoints {
}
}

@Suppress("DEPRECATION")
internal fun ApolloCompilerPlugin.toOperationOutputGenerator(): OperationOutputGenerator {
return object : OperationOutputGenerator {
override fun generate(operationDescriptorList: Collection<OperationDescriptor>): OperationOutput {
var operationIds = operationIds(operationDescriptorList.toList())
if (operationIds == null) {
operationIds = operationDescriptorList.map { OperationId(OperationIdGenerator.Sha256.apply(it.source, it.name), it.name) }
}
return operationDescriptorList.associateBy { descriptor ->
val operationId = operationIds.firstOrNull { it.name == descriptor.name } ?: error("No id found for operation ${descriptor.name}")
operationId.id
}
}
}
}

internal fun Consumer<String>.toLogger(): ApolloCompiler.Logger {
return object : ApolloCompiler.Logger {
override fun warning(message: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import com.apollographql.apollo.compiler.operationoutput.OperationId
internal class LegacyOperationIdsGenerator(private val plugin: ApolloCompilerPlugin) : OperationIdsGenerator {
override fun generate(operationDescriptors: List<OperationDescriptor>): List<OperationId> {
@Suppress("DEPRECATION")
val operationIds = plugin.operationIds(operationDescriptors.toList())
val operationIds = plugin.operationIds(operationDescriptors)
if (operationIds != null) {
println("Apollo: using ApolloCompiler.operationIds() is deprecated. Please use registry.registerOperationIdsGenerator() from beforeCompilationStep() instead.")
return operationIds
Expand Down
Loading