diff --git a/build-logic/katana-convention/src/main/kotlin/dev/alvr/katana/buildlogic/mp/mobile/data/KatanaMultiplatformDataRemotePlugin.kt b/build-logic/katana-convention/src/main/kotlin/dev/alvr/katana/buildlogic/mp/mobile/data/KatanaMultiplatformDataRemotePlugin.kt index 61a98e5c9..9247ba9f7 100644 --- a/build-logic/katana-convention/src/main/kotlin/dev/alvr/katana/buildlogic/mp/mobile/data/KatanaMultiplatformDataRemotePlugin.kt +++ b/build-logic/katana-convention/src/main/kotlin/dev/alvr/katana/buildlogic/mp/mobile/data/KatanaMultiplatformDataRemotePlugin.kt @@ -58,11 +58,8 @@ internal class KatanaMultiplatformDataRemotePlugin : Plugin { private fun ApolloExtension.configureApollo() { service("anilist") { generateAsInternal.set(true) - generateDataBuilders.set(true) packageName.set(fullPackageName) - if (fullPackageName.contains(BASE_PACKAGE)) { - alwaysGenerateTypesMatching.set(listOf("Query", "User")) generateApolloMetadata.set(true) generateAsInternal.set(false) @@ -70,11 +67,18 @@ internal class KatanaMultiplatformDataRemotePlugin : Plugin { endpointUrl.set("https://graphql.anilist.co") schemaFile.set(project.file("src/commonMain/graphql/schema.graphqls")) } + } else { + val baseProject = project.project(BASE_PROJECT) + + generateDataBuilders.set(true) + isADependencyOf(baseProject) + dependsOn(baseProject) } } } private companion object { + const val BASE_PROJECT = ":data:remote:base" const val BASE_PACKAGE = ".base" } } diff --git a/data/remote/account/build.gradle.kts b/data/remote/account/build.gradle.kts index 2deacb782..9967a1c02 100644 --- a/data/remote/account/build.gradle.kts +++ b/data/remote/account/build.gradle.kts @@ -2,10 +2,6 @@ plugins { id("katana.multiplatform.data.remote") } -dependencies { - apolloMetadata(projects.data.remote.base) -} - katanaMultiplatform { commonMainDependencies { implementation(projects.data.remote.base) diff --git a/data/remote/base/src/commonMain/graphql/schema.graphqls b/data/remote/base/src/commonMain/graphql/schema.graphqls index 4f0e31e88..4d497e69d 100644 --- a/data/remote/base/src/commonMain/graphql/schema.graphqls +++ b/data/remote/base/src/commonMain/graphql/schema.graphqls @@ -129,12 +129,6 @@ type Query { ExternalLinkSourceCollection("Filter by the link id" id: Int, type: ExternalLinkType, mediaType: ExternalLinkMediaType): [MediaExternalLink] } -""" -The `Int` scalar type represents non-fractional signed whole numeric -values. Int can represent values between -(2^31) and 2^31 - 1. -""" -scalar Int - """ Page of data """ @@ -208,18 +202,6 @@ type PageInfo { hasNextPage: Boolean } -""" -The `Boolean` scalar type represents `true` or `false`. -""" -scalar Boolean - -""" -The `String` scalar type represents textual data, represented as UTF-8 -character sequences. The String type is most often used by GraphQL to -represent free-form human-readable text. -""" -scalar String - """ User sort enums """ @@ -2579,13 +2561,6 @@ type MediaList { user: User } -""" -The `Float` scalar type represents signed double-precision fractional -values as specified by -[IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point). -""" -scalar Float - """ Review sort enums """ @@ -3516,6 +3491,9 @@ enum AiringSort { EPISODE_DESC } +""" +Notification union type +""" union NotificationUnion = AiringNotification|FollowingNotification|ActivityMessageNotification|ActivityMentionNotification|ActivityReplyNotification|ActivityReplySubscribedNotification|ActivityLikeNotification|ActivityReplyLikeNotification|ThreadCommentMentionNotification|ThreadCommentReplyNotification|ThreadCommentSubscribedNotification|ThreadCommentLikeNotification|ThreadLikeNotification|RelatedMediaAdditionNotification|MediaDataChangeNotification|MediaMergeNotification|MediaDeletionNotification """ @@ -3853,6 +3831,9 @@ type ActivityMentionNotification { user: User } +""" +Activity union type +""" union ActivityUnion = TextActivity|ListActivity|MessageActivity """ @@ -5252,6 +5233,9 @@ type Deleted { deleted: Boolean } +""" +Likeable union type +""" union LikeableUnion = ListActivity|TextActivity|MessageActivity|ActivityReply|Thread|ThreadComment input AniChartHighlightInput { @@ -5863,15 +5847,8 @@ type UserModData { email: String } -""" -The `ID` scalar type represents a unique identifier, often used to -refetch an object or as key for a cache. The ID type appears in a JSON -response as a String; however, it is not intended to be human-readable. -When expected as an input type, any string (such as `"4"`) or integer -(such as `4`) input value will be accepted as an ID. -""" -scalar ID - +# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665 +# noinspection GraphQLTypeRedefinition """ A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations. """ @@ -5902,6 +5879,8 @@ type __Schema { directives: [__Directive!]! } +# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665 +# noinspection GraphQLTypeRedefinition """ The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum. @@ -5927,6 +5906,8 @@ type __Type { ofType: __Type } +# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665 +# noinspection GraphQLTypeRedefinition """ An enum describing what kind of type a given `__Type` is. """ @@ -5972,6 +5953,8 @@ enum __TypeKind { NON_NULL } +# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665 +# noinspection GraphQLTypeRedefinition """ Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type. """ @@ -5989,6 +5972,8 @@ type __Field { deprecationReason: String } +# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665 +# noinspection GraphQLTypeRedefinition """ Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value. """ @@ -6005,6 +5990,8 @@ type __InputValue { defaultValue: String } +# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665 +# noinspection GraphQLTypeRedefinition """ One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string. """ @@ -6018,6 +6005,8 @@ type __EnumValue { deprecationReason: String } +# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665 +# noinspection GraphQLTypeRedefinition """ A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document. @@ -6039,6 +6028,8 @@ type __Directive { onField: Boolean! @deprecated(reason: "Use `locations`.") } +# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665 +# noinspection GraphQLTypeRedefinition """ A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies. """ @@ -6134,16 +6125,22 @@ enum __DirectiveLocation { INPUT_FIELD_DEFINITION } +# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665 +# noinspection GraphQLTypeRedefinition """ Directs the executor to include this field or fragment only when the `if` argument is true. """ directive @include ("Included when true." if: Boolean!) on FIELD|FRAGMENT_SPREAD|INLINE_FRAGMENT +# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665 +# noinspection GraphQLTypeRedefinition """ Directs the executor to skip this field or fragment when the `if` argument is true. """ directive @skip ("Skipped when true." if: Boolean!) on FIELD|FRAGMENT_SPREAD|INLINE_FRAGMENT +# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665 +# noinspection GraphQLTypeRedefinition """ Marks an element of a GraphQL schema as no longer supported. """ diff --git a/data/remote/explore/build.gradle.kts b/data/remote/explore/build.gradle.kts index f866f523a..b03352c44 100644 --- a/data/remote/explore/build.gradle.kts +++ b/data/remote/explore/build.gradle.kts @@ -2,10 +2,6 @@ plugins { id("katana.multiplatform.data.remote") } -dependencies { - apolloMetadata(projects.data.remote.base) -} - katanaMultiplatform { commonMainDependencies { implementation(projects.data.remote.base) diff --git a/data/remote/lists/build.gradle.kts b/data/remote/lists/build.gradle.kts index 2888ad7db..849967d1d 100644 --- a/data/remote/lists/build.gradle.kts +++ b/data/remote/lists/build.gradle.kts @@ -2,10 +2,6 @@ plugins { id("katana.multiplatform.data.remote") } -dependencies { - apolloMetadata(projects.data.remote.base) -} - katanaMultiplatform { commonMainDependencies { implementation(projects.common.core) diff --git a/data/remote/social/build.gradle.kts b/data/remote/social/build.gradle.kts index 5226b1937..ed9fa692a 100644 --- a/data/remote/social/build.gradle.kts +++ b/data/remote/social/build.gradle.kts @@ -2,10 +2,6 @@ plugins { id("katana.multiplatform.data.remote") } -dependencies { - apolloMetadata(projects.data.remote.base) -} - katanaMultiplatform { commonMainDependencies { implementation(projects.data.remote.base) diff --git a/data/remote/user/build.gradle.kts b/data/remote/user/build.gradle.kts index dfea374c4..7cc04224f 100644 --- a/data/remote/user/build.gradle.kts +++ b/data/remote/user/build.gradle.kts @@ -2,10 +2,6 @@ plugins { id("katana.multiplatform.data.remote") } -dependencies { - apolloMetadata(projects.data.remote.base) -} - katanaMultiplatform { commonMainDependencies { implementation(projects.common.core) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2059170c0..066352ebb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] activity = "1.8.2" android = "8.2.2" -apollo = "3.8.2" +apollo = "4.0.0-beta.4" arrow = "1.2.1" buildconfig = "5.3.5" complete-kotlin = "1.1.0"