diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 652a920e528..83d3124f89c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -87,6 +87,7 @@ jobs: with: name: tests-integration.zip path: diagnostics.zip + ios-tests: runs-on: macos-14 steps: @@ -96,101 +97,3 @@ jobs: distribution: 'temurin' java-version: 17 - run: /Applications/Xcode_16.2.0.app/Contents/Developer/usr/bin/xcodebuild -allowProvisioningUpdates -project tests/com.apollographql.iostest/com.apollographql.iostest.xcodeproj -configuration Debug -scheme com.apollographql.iostest -sdk iphoneos -destination name='iPhone 16' test -test-timeouts-enabled YES - intellij-plugin: - if: "!startsWith(github.head_ref, 'release-')" - name: Build IntelliJ Plugin - runs-on: ubuntu-latest - outputs: - version: ${{ steps.properties.outputs.version }} - steps: - # Free GitHub Actions Environment Disk Space - - name: Free Disk Space - uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be #v1.3.1 - with: - tool-cache: false - android: false - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: true - - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 - - # Setup Java environment for the next steps - - name: Setup Java - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #v4.2.1 - with: - distribution: 'temurin' - java-version: 23 - - # Set environment variables - - name: Export Properties - id: properties - shell: bash - run: | - PROPERTIES="$(./gradlew :intellij-plugin:properties --console=plain -q)" - VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" - NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')" - - echo "::set-output name=version::$VERSION" - echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier" - - ./gradlew :intellij-plugin:printProductsReleases # prepare list of IDEs for Plugin Verifier - - # Trigger code generation in test project, as the plugin's tests depend on it - - name: Test project codegen - run: ./gradlew -p tests :intellij-plugin-test-project:generateApolloSources - - # Run tests - - name: Run Tests - run: ./gradlew :intellij-plugin:check - - # Collect Tests Result of failed tests - - name: Collect Tests Result - if: ${{ failure() }} - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 - with: - name: tests-result - path: ${{ github.workspace }}/intellij-plugin/build/reports/tests - - # Cache Plugin Verifier IDEs - - name: Setup Plugin Verifier IDEs Cache - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 #v4.2.0 - with: - path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides - key: plugin-verifier-${{ hashFiles('intellij-plugin/build/listProductsReleases.txt') }} - - # Run Verify Plugin task and IntelliJ Plugin Verifier tool - - name: Run Plugin Verification tasks - env: - JAVA_TOOL_OPTIONS: -Xmx4g -Dlogback.configurationFile=${{ github.workspace }}/intellij-plugin/logback.xml - run: ./gradlew :intellij-plugin:verifyPlugin -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }} - - # Collect Plugin Verifier Result - - name: Collect Plugin Verifier Result - if: ${{ always() }} - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 - with: - name: pluginVerifier-result - path: ${{ github.workspace }}/intellij-plugin/build/reports/pluginVerifier - - # Prepare plugin archive content for creating artifact - - name: Prepare Plugin Artifact - id: artifact - shell: bash - run: | - cd ${{ github.workspace }}/intellij-plugin/build/distributions - FILENAME=`ls *.zip` - unzip "$FILENAME" -d content - - echo "::set-output name=filename::${FILENAME:0:-4}" - - # Store already-built plugin as an artifact for downloading - - name: Upload artifact - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 - with: - name: ${{ steps.artifact.outputs.filename }} - path: ./intellij-plugin/build/distributions/content/*/* diff --git a/.github/workflows/publish-ij-plugin-snapshot.yml b/.github/workflows/publish-ij-plugin-snapshot.yml deleted file mode 100644 index 7678fb1a24d..00000000000 --- a/.github/workflows/publish-ij-plugin-snapshot.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Publish IntelliJ plugin snapshot - -on: - schedule: - - cron: '0 0 * * 0' - workflow_dispatch: -env: - DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - -jobs: - publish-intellij-plugin: - name: Publish IntelliJ plugin - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 - - - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #v4.2.1 - with: - distribution: 'temurin' - java-version: 17 - - - name: Publish snapshot to Jetbrains snapshots - run: ./gradlew --no-build-cache :intellij-plugin:publishPlugin - env: - IJ_PLUGIN_SNAPSHOT: true - PUBLISH_TOKEN: ${{ secrets.IJ_PLUGIN_PUBLISH_TOKEN }} - CERTIFICATE_CHAIN: ${{ secrets.IJ_PLUGIN_CERTIFICATE_CHAIN }} - PRIVATE_KEY: ${{ secrets.IJ_PLUGIN_PRIVATE_KEY }} - PRIVATE_KEY_PASSWORD: ${{ secrets.IJ_PLUGIN_PRIVATE_KEY_PASSWORD }} diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 9674ae5a978..4c0a367f3fd 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -31,20 +31,3 @@ jobs: COM_APOLLOGRAPHQL_PROFILE_ID: ${{ secrets.COM_APOLLOGRAPHQL_PROFILE_ID }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PRIVATE_KEY_PASSWORD: ${{ secrets.GPG_PRIVATE_KEY_PASSWORD }} - - publish-intellij-plugin: - name: Publish IntelliJ plugin - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 - - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #v4.2.1 - with: - distribution: 'temurin' - java-version: 17 - - name: Publish to JetBrains marketplace - run: ./gradlew --no-build-cache :intellij-plugin:publishPlugin - env: - PUBLISH_TOKEN: ${{ secrets.IJ_PLUGIN_PUBLISH_TOKEN }} - CERTIFICATE_CHAIN: ${{ secrets.IJ_PLUGIN_CERTIFICATE_CHAIN }} - PRIVATE_KEY: ${{ secrets.IJ_PLUGIN_PRIVATE_KEY }} - PRIVATE_KEY_PASSWORD: ${{ secrets.IJ_PLUGIN_PRIVATE_KEY_PASSWORD }} diff --git a/.gitignore b/.gitignore index f0604299550..15c89f0ffad 100644 --- a/.gitignore +++ b/.gitignore @@ -45,7 +45,3 @@ docs.json # Local Netlify folder .netlify - -# IntelliJ plugin -intellij-plugin/mockJDK -.intellijPlatform diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index a62d801f437..8dee4b8d630 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -35,8 +35,6 @@ dependencies { implementation(libs.kotlinx.serialization.json) implementation(libs.poet.java) implementation(libs.poet.kotlin) - implementation(libs.intellij.platform.plugin) - implementation(libs.intellij.changelog) implementation(libs.androidx.lint.gradle.plugin) implementation(libs.kotlin.plugin.compose) diff --git a/gradle/libraries.toml b/gradle/libraries.toml index 3e6dd0c4057..c54613c88d7 100644 --- a/gradle/libraries.toml +++ b/gradle/libraries.toml @@ -113,8 +113,6 @@ guava-jre = { group = "com.google.guava", name = "guava", version.ref = "guava" http4k-bom = "org.http4k:http4k-bom:5.8.0.0" http4k-core = { module = "org.http4k:http4k-core" } http4k-server-jetty = { module = "org.http4k:http4k-server-jetty" } -intellij-platform-plugin = "org.jetbrains.intellij.platform:intellij-platform-gradle-plugin:2.6.0" -intellij-changelog = "org.jetbrains.intellij.plugins:gradle-changelog-plugin:2.0.0" jetbrains-annotations = { group = "org.jetbrains", name = "annotations", version.ref = "jetbrains-annotations" } junit = { group = "junit", name = "junit", version.ref = "junit" } kotlin-allopen = { group = "org.jetbrains.kotlin", name = "kotlin-allopen", version.ref = "kotlin-plugin" } diff --git a/gradle/repositories.gradle.kts b/gradle/repositories.gradle.kts index a4a7a03407c..c5b77c6b872 100644 --- a/gradle/repositories.gradle.kts +++ b/gradle/repositories.gradle.kts @@ -42,20 +42,6 @@ listOf(pluginManagement.repositories, dependencyResolutionManagement.repositorie includeModule("com.gradle.publish", "plugin-publish-plugin") includeModule("com.github.ben-manes", "gradle-versions-plugin") includeModule("com.gradle", "develocity-gradle-plugin") - - // For org.jetbrains.intellij.platform - includeModule("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext", "gradle-idea-ext") - - // For org.jetbrains.changelog - includeModule("org.jetbrains.changelog", "org.jetbrains.changelog.gradle.plugin") - includeModule("org.jetbrains.intellij.plugins", "gradle-changelog-plugin") - - // For org.jetbrains.intellij.platform - includeModule("org.jetbrains.intellij.platform", "intellij-platform-gradle-plugin") - - // For org.jetbrains.grammarkit - includeModule("org.jetbrains.grammarkit", "org.jetbrains.grammarkit.gradle.plugin") - includeModule("org.jetbrains.intellij.plugins", "gradle-grammarkit-plugin") } } } diff --git a/intellij-plugin/README.md b/intellij-plugin/README.md deleted file mode 100644 index 3f7878beb5e..00000000000 --- a/intellij-plugin/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# Apollo IntelliJ Plugin - -[![Version](https://img.shields.io/jetbrains/plugin/v/20645.svg)](https://plugins.jetbrains.com/plugin/20645) -[![Downloads](https://img.shields.io/jetbrains/plugin/d/20645.svg)](https://plugins.jetbrains.com/plugin/20645) - - - -This plugin for Android Studio and IntelliJ helps you work with the -[Apollo Kotlin](https://github.com/apollographql/apollo-kotlin) GraphQL library. - -## Features -- Automatic code generation: models are re-generated whenever GraphQL files change -- Integration with the [GraphQL IntelliJ Plugin](https://plugins.jetbrains.com/plugin/8097-js-graphql): the structure of the Apollo project is automatically contributed, so there is no need to create a `graphql.config.yml` / `.graphqlconfig` file -- Navigation Kotlin code ⇄ GraphQL definitions -- Unused operations and fields highlighting -- Normalized cache viewer -- Migration helpers: - - Apollo Android 2.x → Apollo Kotlin 3.x - - Apollo Kotlin 3.x → Apollo Kotlin 4.x - - `compat` codegen → `operationBased` codegen -- Integration with [Rover](https://www.apollographql.com/docs/rover) for a rich schema editing experience -- More to come! - -## Compatibility - -- Most features are intended to work with Apollo Kotlin 4.x -- Automatic code generation works with Apollo Kotlin 3.x and above - - - -The plugin is supported on: - -- IntelliJ 2024.2.1 and above -- Android Studio 2024.2.1 (Ladybug) and above - -## Installation instructions - -Marketplace > Search for "Apollo GraphQL" > Install - - - -### Weekly snapshots - -The plugin is published every Sunday in a specific **snapshots** repository. To use it, the repository URL must be -configured: - -Settings > Plugins > ️ > Manage Plugin -Repositories > + > https://go.apollo.dev/ij-plugin-snapshots - - - - - -Then search for "Apollo GraphQL" and install the plugin as usual. diff --git a/intellij-plugin/assets/instructions-1-manage-repositories.png b/intellij-plugin/assets/instructions-1-manage-repositories.png deleted file mode 100644 index 2480709e7cc..00000000000 Binary files a/intellij-plugin/assets/instructions-1-manage-repositories.png and /dev/null differ diff --git a/intellij-plugin/assets/instructions-2-add-repository.png b/intellij-plugin/assets/instructions-2-add-repository.png deleted file mode 100644 index 8b820fd4a6a..00000000000 Binary files a/intellij-plugin/assets/instructions-2-add-repository.png and /dev/null differ diff --git a/intellij-plugin/assets/instructions-3-search-and-install.png b/intellij-plugin/assets/instructions-3-search-and-install.png deleted file mode 100644 index bb8cd332c8a..00000000000 Binary files a/intellij-plugin/assets/instructions-3-search-and-install.png and /dev/null differ diff --git a/intellij-plugin/build.gradle.kts b/intellij-plugin/build.gradle.kts deleted file mode 100644 index 93c86a68a33..00000000000 --- a/intellij-plugin/build.gradle.kts +++ /dev/null @@ -1,257 +0,0 @@ - -import org.gradle.api.tasks.testing.logging.TestExceptionFormat -import org.gradle.api.tasks.testing.logging.TestLogEvent -import org.jetbrains.changelog.markdownToHTML -import org.jetbrains.intellij.platform.gradle.TestFrameworkType -import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask.FailureLevel.INTERNAL_API_USAGES -import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask.FailureLevel.INVALID_PLUGIN -import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask.FailureLevel.PLUGIN_STRUCTURE_WARNINGS -import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType -import java.net.URI -import java.text.SimpleDateFormat -import java.util.Date - -fun properties(key: String) = project.findProperty(key).toString() - -fun isSnapshotBuild() = System.getenv("IJ_PLUGIN_SNAPSHOT").toBoolean() - - -plugins { - id("org.jetbrains.kotlin.jvm") - id("org.jetbrains.intellij.platform") - alias(libs.plugins.apollo.published) - alias(libs.plugins.grammarkit) -} - -commonSetup() - -// XXX: this should use the settings repositories instead -repositories { - // Uncomment this one to use the Kotlin "dev" repository - // maven("https://redirector.kotlinlang.org/maven/dev/") - // Uncomment this one to use the Sonatype OSSRH snapshots repository - // maven("https://oss.sonatype.org/content/repositories/snapshots/") - mavenCentral() - - intellijPlatform { - defaultRepositories() - } -} - -group = properties("pluginGroup") - -// Use the global version defined in the root project + dedicated suffix if building a snapshot from the CI -version = properties("VERSION_NAME") + getSnapshotVersionSuffix() - -fun getSnapshotVersionSuffix(): String { - if (!isSnapshotBuild()) return "" - return ".${SimpleDateFormat("YYYY-MM-dd").format(Date())}." + System.getenv("GITHUB_SHA").take(7) -} - -// Set the JVM language level used to build project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+. -kotlin { - jvmToolchain { - languageVersion = JavaLanguageVersion.of(21) - } -} - -val apolloDependencies = configurations.create("apolloDependencies").apply { - attributes { - attribute(KotlinPlatformType.attribute, KotlinPlatformType.jvm) - } - listOf(":apollo-annotations", ":apollo-api", ":apollo-runtime").forEach { - dependencies.add(project.dependencies.project(it, "jvmApiElements")) - } -} - -tasks { - val runLocalIde by intellijPlatformTesting.runIde.registering { - // Use a custom IJ/AS installation. Set this property in your local ~/.gradle/gradle.properties file. - // (for AS, it should be something like '/Applications/Android Studio.app/Contents') - // See https://plugins.jetbrains.com/docs/intellij/android-studio.html#configuring-the-plugin-gradle-build-script - providers.gradleProperty("apolloIntellijPlugin.ideDir").orNull?.let { - localPath.set(file(it)) - } - - task { - // Enables debug logging for the plugin - systemProperty("idea.log.debug.categories", "Apollo") - - // Disable hiding frequent exceptions in logs (annoying for debugging). See com.intellij.idea.IdeaLogger. - systemProperty("idea.logger.exception.expiration.minutes", "0") - - // Uncomment to disable internal mode - see https://plugins.jetbrains.com/docs/intellij/enabling-internal.html - // systemProperty("idea.is.internal", "false") - - // Enable K2 mode (can't be done in the UI in sandbox mode - see https://kotlin.github.io/analysis-api/testing-in-k2-locally.html) - systemProperty("idea.kotlin.plugin.use.k2", "true") - } - } - - // Log tests - withType { - testLogging { - exceptionFormat = TestExceptionFormat.FULL - events.add(TestLogEvent.PASSED) - events.add(TestLogEvent.FAILED) - showStandardStreams = true - } - inputs.files(apolloDependencies) - } - - generateLexer { - purgeOldFiles.set(true) - sourceFile.set(file("src/main/grammars/ApolloGraphQLLexer.flex")) - targetOutputDir.set(file("src/main/java/com/apollographql/ijplugin/psi")) - } -} - -val mockJdkRoot = layout.buildDirectory.asFile.get().resolve("mockJDK") - -// Setup fake JDK for maven dependencies to work -// See https://jetbrains-platform.slack.com/archives/CPL5291JP/p1664105522154139 and https://youtrack.jetbrains.com/issue/IJSDK-321 -tasks.register("downloadMockJdk") { - val mockJdkRoot = mockJdkRoot - doLast { - val rtJar = mockJdkRoot.resolve("java/mockJDK-1.7/jre/lib/rt.jar") - if (!rtJar.exists()) { - rtJar.parentFile.mkdirs() - rtJar.writeBytes(URI("https://github.com/JetBrains/intellij-community/raw/master/java/mockJDK-1.7/jre/lib/rt.jar").toURL() - .openStream() - .readBytes() - ) - } - } -} - -tasks.test.configure { - dependsOn("downloadMockJdk") - // Setup fake JDK for maven dependencies to work - // See https://jetbrains-platform.slack.com/archives/CPL5291JP/p1664105522154139 and https://youtrack.jetbrains.com/issue/IJSDK-321 - // Use a relative path to make build caching work - systemProperty("idea.home.path", mockJdkRoot.relativeTo(project.projectDir).path) - - // Enable K2 mode - see https://kotlin.github.io/analysis-api/testing-in-k2-locally.html - systemProperty("idea.kotlin.plugin.use.k2", "true") -} - -apollo { - service("apolloDebugServer") { - packageName.set("com.apollographql.ijplugin.apollodebugserver") - schemaFiles.from(file("../libraries/apollo-debug-server/graphql/schema.graphqls")) - introspection { - endpointUrl.set("http://localhost:12200/") - schemaFile.set(file("../libraries/apollo-debug-server/graphql/schema.graphqls")) - } - } -} - -// We're using project(":apollo-gradle-plugin") and the published "apollo-runtime" which do not have the same version -tasks.configureEach { - if (name == "checkApolloVersions") { - enabled = false - } -} - -val apolloPublished = configurations.dependencyScope("apolloPublished").get() - -configurations.getByName("implementation").extendsFrom(apolloPublished) - -dependencies { - // IntelliJ Platform dependencies must be declared before the intellijPlatform block - see https://github.com/JetBrains/intellij-platform-gradle-plugin/issues/1784 - intellijPlatform { - create(type = properties("platformType"), version = properties("platformVersion")) - bundledPlugins(properties("platformBundledPlugins").split(',').map(String::trim).filter(String::isNotEmpty)) - plugins(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty)) - instrumentationTools() - // Use a specific version of the verifier - // TODO: remove when https://youtrack.jetbrains.com/issue/MP-7366 is fixed - pluginVerifier(version = "1.383") - testFramework(TestFrameworkType.Plugin.Java) - zipSigner() - } - - implementation(project(":apollo-gradle-plugin")) - implementation(project(":apollo-ast")) - implementation(project(":apollo-tooling")) { - exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core") - } - implementation(project(":apollo-normalized-cache-sqlite")) - implementation(libs.sqlite.jdbc) - implementation(libs.apollo.normalizedcache.sqlite.incubating) { - exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core") - } - add("apolloPublished", libs.apollo.runtime.published.get().toString()) { - exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core") - } - runtimeOnly(libs.slf4j.simple) - testImplementation(libs.google.testparameterinjector) - - // Temporary workaround for https://github.com/JetBrains/intellij-platform-gradle-plugin/issues/1663 - // Should be fixed in platformVersion 2024.3.x - testRuntimeOnly("org.opentest4j:opentest4j:1.3.0") -} - -// IntelliJ Platform Gradle Plugin configuration -// See https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html#intellijPlatform-pluginConfiguration -intellijPlatform { - pluginConfiguration { - id.set(properties("pluginId")) - name.set(properties("pluginName")) - version.set(project.version.toString()) - ideaVersion { - sinceBuild = properties("pluginSinceBuild") - // No untilBuild specified, the plugin wants to be compatible with all future versions - untilBuild = provider { null } - } - // Extract the section from README.md and provide it to the plugin's manifest - description.set( - projectDir.resolve("README.md").readText().lines().run { - val start = "" - val end = "" - - if (!containsAll(listOf(start, end))) { - throw GradleException("Plugin description section not found in README.md:\n$start ... $end") - } - subList(indexOf(start) + 1, indexOf(end)) - }.joinToString("\n").run { markdownToHTML(this) } - ) - changeNotes.set( - if (isSnapshotBuild()) { - "Weekly snapshot builds contain the latest changes from the main branch." - } else { - "See the release notes." - } - ) - } - - signing { - certificateChain.set(System.getenv("CERTIFICATE_CHAIN")) - privateKey.set(System.getenv("PRIVATE_KEY")) - password.set(System.getenv("PRIVATE_KEY_PASSWORD")) - } - - publishing { - token.set(System.getenv("PUBLISH_TOKEN")) - if (isSnapshotBuild()) { - // Read more: https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html#specifying-a-release-channel - channels.set(listOf("snapshots")) - } - } - - pluginVerification { - ides { - recommended() - } - failureLevel.set( - setOf( - // Temporarily disabled due to https://platform.jetbrains.com/t/plugin-verifier-fails-with-plugin-com-intellij-modules-json-not-declared-as-a-plugin-dependency/580 - // TODO: Uncomment when https://youtrack.jetbrains.com/issue/MP-7366 is fixed - // COMPATIBILITY_PROBLEMS, - INTERNAL_API_USAGES, - INVALID_PLUGIN, - PLUGIN_STRUCTURE_WARNINGS, - ) - ) - } -} diff --git a/intellij-plugin/gradle.properties b/intellij-plugin/gradle.properties deleted file mode 100644 index 3328606b46c..00000000000 --- a/intellij-plugin/gradle.properties +++ /dev/null @@ -1,27 +0,0 @@ -# IntelliJ Platform Artifacts Repositories -# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html -pluginGroup=com.apollographql -pluginName=Apollo GraphQL -pluginId=com.apollographql.ijplugin -pluginRepositoryUrl=https://github.com/apollographql/apollo-kotlin - - -# XXX Do update the supported versions in the README.md, and in docs/source/testing/android-studio-plugin.mdx file when updating these values! -# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html -# for insight into build numbers and IntelliJ Platform versions. -pluginSinceBuild=242 -# No untilBuild specified, the plugin wants to be compatible with all future versions -# pluginUntilBuild=243.* -# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension -platformType=IU -# Corresponds to AS Ladybug 2024.2.1 -> https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html -# and https://developer.android.com/studio/archive (more up to date) -# See also https://plugins.jetbrains.com/docs/intellij/android-studio.html -platformVersion=2024.2.1 - -# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html -platformBundledPlugins=com.intellij.java, org.jetbrains.kotlin, com.intellij.gradle, org.toml.lang -# To find the version of a plugin relative to the platform version, see the plugin's page on the Marketplace, -# e.g. for the GraphQL plugin: https://plugins.jetbrains.com/plugin/8097-graphql/versions/stable -# Note: to run wih AS 2024.1.1, use org.jetbrains.android:241.14494.17 -platformPlugins=com.intellij.lang.jsgraphql:242.21829.3, org.jetbrains.android:242.21829.142 diff --git a/intellij-plugin/logback.xml b/intellij-plugin/logback.xml deleted file mode 100644 index ccaa085fb5a..00000000000 --- a/intellij-plugin/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%kvp- %msg%n - - - - - - - - diff --git a/intellij-plugin/src/main/grammars/ApolloGraphQLLexer.flex b/intellij-plugin/src/main/grammars/ApolloGraphQLLexer.flex deleted file mode 100644 index bb4456640b6..00000000000 --- a/intellij-plugin/src/main/grammars/ApolloGraphQLLexer.flex +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2016-2024 Apollo Graph, Inc. (Formerly Meteor Development Group, Inc.) - * Copyright (c) 2015-present, Jim Kynde Meyer - * All rights reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -package com.apollographql.ijplugin.psi; - -import java.util.Stack; - -import com.intellij.lexer.FlexLexer; -import com.intellij.psi.tree.IElementType; - -import static com.intellij.psi.TokenType.BAD_CHARACTER; -import static com.intellij.psi.TokenType.WHITE_SPACE; -import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.*; - -%% - -%{ - - private static final class State { - final int lBraceCount; - final int state; - - public State(int state, int lBraceCount) { - this.state = state; - this.lBraceCount = lBraceCount; - } - - @Override - public String toString() { - return "yystate = " + state + (lBraceCount == 0 ? "" : "lBraceCount = " + lBraceCount); - } - } - - protected final Stack myStateStack = new Stack(); - protected int myLeftBraceCount; - - private void pushState(int state) { - myStateStack.push(new State(yystate(), myLeftBraceCount)); - myLeftBraceCount = 0; - yybegin(state); - } - - private void popState() { - State state = myStateStack.pop(); - myLeftBraceCount = state.lBraceCount; - yybegin(state.state); - } - - public ApolloGraphQLLexer() { - this((java.io.Reader)null); - } -%} - -%public -%class ApolloGraphQLLexer -%implements FlexLexer -%function advance -%type IElementType -%unicode - -UNICODE_BOM = \uFEFF -WHITESPACE_CHAR = [ \t] -LINE_TERMINATOR = \n | (\r\n?) -WHITESPACE = ({WHITESPACE_CHAR} | {LINE_TERMINATOR})+ -EOL_COMMENT = "#" .* -NAME = [_A-Za-z][_0-9A-Za-z]* -VARIABLE = \${NAME} - -QUOTED_STRING_ESCAPE= \\[^\r\n] -QUOTED_STRING_BODY = ([^\\\"\r\n] | {QUOTED_STRING_ESCAPE})+ - -THREE_QUO = (\"\"\") -ONE_TWO_QUO = (\"\"?) -BLOCK_STRING_ESCAPE = (\\({THREE_QUO} | [^\\\"\r\n\t ])) -BLOCK_STRING_CHAR = [^\\\"\r\n\t ] -BLOCK_STRING_BODY = {BLOCK_STRING_CHAR}+ - -DIGIT = [0-9] -NON_ZERO_DIGIT = [1-9] -INTEGER_PART = -? (0 | {NON_ZERO_DIGIT} {DIGIT}*) -FRACTIONAL_PART = "." {DIGIT}+ -EXPONENT_PART = [eE] [+-]? {DIGIT}+ - -NUMBER = {INTEGER_PART} -FLOAT = {INTEGER_PART} {FRACTIONAL_PART} | {INTEGER_PART} {EXPONENT_PART} | {INTEGER_PART} {FRACTIONAL_PART} {EXPONENT_PART} - -%eof{ - myLeftBraceCount = 0; - myStateStack.clear(); -%eof} - -%state QUOTED_STRING BLOCK_STRING VARIABLE_OR_TEMPLATE TEMPLATE - -%% - - { - // Ignored tokens - {UNICODE_BOM} | - {WHITESPACE} { return WHITE_SPACE; } - {EOL_COMMENT} { return EOL_COMMENT; } - "," { return WHITE_SPACE; } - - // Punctuators - "!" { return BANG; } - "$" { pushState(VARIABLE_OR_TEMPLATE); return DOLLAR; } - "(" { return PAREN_L; } - ")" { return PAREN_R; } - "..." { return SPREAD; } - ":" { return COLON; } - "=" { return EQUALS; } - "@" { return AT; } - "[" { return BRACKET_L; } - "]" { return BRACKET_R; } - "{" { return BRACE_L; } - "|" { return PIPE; } - "}" { return BRACE_R; } - "&" { return AMP; } - - // keywords - "query" { return QUERY_KEYWORD; } - "mutation" { return MUTATION_KEYWORD; } - "subscription" { return SUBSCRIPTION_KEYWORD; } - "fragment" { return FRAGMENT_KEYWORD; } - "on" { return ON_KEYWORD; } - "schema" { return SCHEMA_KEYWORD; } - "type" { return TYPE_KEYWORD; } - "scalar" { return SCALAR_KEYWORD; } - "interface" { return INTERFACE_KEYWORD; } - "implements" { return IMPLEMENTS_KEYWORD; } - "enum" { return ENUM_KEYWORD; } - "union" { return UNION_KEYWORD; } - "extend" { return EXTEND_KEYWORD; } - "input" { return INPUT_KEYWORD; } - "directive" { return DIRECTIVE_KEYWORD; } - "repeatable" { return REPEATABLE_KEYWORD; } - - // string and number literals - \" { pushState(QUOTED_STRING); return OPEN_QUOTE; } - {THREE_QUO} { pushState(BLOCK_STRING); return OPEN_TRIPLE_QUOTE; } - {NUMBER} { return NUMBER; } - {FLOAT} { return FLOAT; } - - // identifiers - {NAME} { return NAME; } - {VARIABLE} { return VARIABLE_NAME; } - - [^] { return BAD_CHARACTER; } -} - - { - "{" { pushState(TEMPLATE); return BRACE_L; } - {NAME} { popState(); return NAME; } - [^] { popState(); return BAD_CHARACTER; } -} - - { - {QUOTED_STRING_BODY} { return REGULAR_STRING_PART; } - \" { popState(); return CLOSING_QUOTE; } - [^] { popState(); return BAD_CHARACTER; } -} - - { - {WHITESPACE} { return WHITE_SPACE; } - {BLOCK_STRING_ESCAPE} { return REGULAR_STRING_PART; } - {ONE_TWO_QUO} / [^\"] { return REGULAR_STRING_PART; } - {BLOCK_STRING_BODY} { return REGULAR_STRING_PART; } - {THREE_QUO} { popState(); return CLOSING_TRIPLE_QUOTE; } - [^] { return REGULAR_STRING_PART; } -} - -