Skip to content
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

[gradle] Add apollo.deps #5460

Merged
merged 1 commit into from
Dec 13, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,21 @@ public final class com/apollographql/apollo3/gradle/api/ApolloAttributes {
public abstract interface class com/apollographql/apollo3/gradle/api/ApolloAttributes$Service : org/gradle/api/Named {
}

public final class com/apollographql/apollo3/gradle/api/ApolloDependencies {
public fun <init> (Lorg/gradle/api/artifacts/dsl/DependencyHandler;)V
public final fun getApi ()Lorg/gradle/api/artifacts/Dependency;
public final fun getAst ()Lorg/gradle/api/artifacts/Dependency;
public final fun getMockServer ()Lorg/gradle/api/artifacts/Dependency;
public final fun getNormalizedCache ()Lorg/gradle/api/artifacts/Dependency;
public final fun getNormalizedCacheSqlite ()Lorg/gradle/api/artifacts/Dependency;
public final fun getRuntime ()Lorg/gradle/api/artifacts/Dependency;
}

public abstract interface class com/apollographql/apollo3/gradle/api/ApolloExtension {
public abstract fun apolloKspProcessor (Ljava/io/File;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;
public abstract fun createAllAndroidVariantServices (Ljava/lang/String;Ljava/lang/String;Lorg/gradle/api/Action;)V
public abstract fun createAllKotlinSourceSetServices (Ljava/lang/String;Ljava/lang/String;Lorg/gradle/api/Action;)V
public abstract fun getDeps ()Lcom/apollographql/apollo3/gradle/api/ApolloDependencies;
public abstract fun getGenerateSourcesDuringGradleSync ()Lorg/gradle/api/provider/Property;
public abstract fun getLinkSqlite ()Lorg/gradle/api/provider/Property;
public abstract fun service (Ljava/lang/String;Lorg/gradle/api/Action;)V
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.apollographql.apollo3.gradle.api

import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.dsl.DependencyHandler

class ApolloDependencies(private val handler: DependencyHandler) {
val api: Dependency get() = handler.create("com.apollographql.apollo3:apollo-api")
val runtime: Dependency get() = handler.create("com.apollographql.apollo3:apollo-runtime")
val normalizedCache: Dependency get() = handler.create("com.apollographql.apollo3:apollo-normalized-cache")
val normalizedCacheSqlite: Dependency get() = handler.create("com.apollographql.apollo3:apollo-normalized-cache-sqlite")
val mockServer: Dependency get() = handler.create("com.apollographql.apollo3:apollo-mockserver")
val ast: Dependency get() = handler.create("com.apollographql.apollo3:apollo-ast")
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,9 @@ interface ApolloExtension {
* - the apollo-ksp dependency
*/
fun apolloKspProcessor(schema: File, service: String, packageName: String): Any

/**
* Common apollo dependencies using the same version as the Apollo Gradle Plugin currently in the classpath
*/
val deps: ApolloDependencies
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.apollographql.apollo3.compiler.hooks.internal.ApolloCompilerJavaHooks
import com.apollographql.apollo3.compiler.hooks.internal.ApolloCompilerKotlinHooksChain
import com.apollographql.apollo3.gradle.api.AndroidProject
import com.apollographql.apollo3.gradle.api.ApolloAttributes
import com.apollographql.apollo3.gradle.api.ApolloDependencies
import com.apollographql.apollo3.gradle.api.ApolloExtension
import com.apollographql.apollo3.gradle.api.ApolloGradleToolingModel
import com.apollographql.apollo3.gradle.api.SchemaConnection
Expand Down Expand Up @@ -996,4 +997,6 @@ abstract class DefaultApolloExtension(

return project.dependencies.project(mapOf("path" to project.path, "configuration" to producer.name))
}

override val deps: ApolloDependencies = ApolloDependencies(project.dependencies)
}