intellij-platform-gradle-plugin icon indicating copy to clipboard operation
intellij-platform-gradle-plugin copied to clipboard

Can't find `performanceTesting.jar` when building against Android Studio 2024.2.1.2

Open pbreault opened this issue 1 year ago • 3 comments
trafficstars

What happened?

performanceTesting.jar is not bundled in android studio 2024.2.1.* This causes a resolution error in :compileKotlin.

Relevant log output or stack trace

Execution failed for task ':compileKotlin'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find /Users/pbreault/.gradle/caches/8.9/transforms/55d0ff1d6fc91e695986202ef9ca3343/transformed/android-studio-2024.2.1.2-mac_arm/plugins/performanceTesting/lib/performanceTesting.jar-242.20224.300.2421.12216002+167.jar (bundledModule:com.jetbrains.performancePlugin:242.20224.300.2421.12216002+167).
     Searched in the following locations:
         file:/Users/pbreault/.gradle/caches/8.9/transforms/55d0ff1d6fc91e695986202ef9ca3343/transformed/android-studio-2024.2.1.2-mac_arm/plugins/performanceTesting/lib/performanceTesting.jar

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Steps to reproduce

1. build.gradle.kts

plugins {
    id("org.jetbrains.kotlin.jvm") version "1.9.24"
    id("org.jetbrains.intellij.platform") version "2.0.1"
}

repositories {
    mavenCentral()
    intellijPlatform {
        defaultRepositories()
    }
}

intellijPlatform {
    pluginConfiguration {
        name = "example"
        group = "com.example"
    }
    buildSearchableOptions.set(false)
    instrumentCode = true
}

java {
    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17
}

tasks.runIde {
    jvmArgs = listOf("-Xmx4096m", "-XX:+UnlockDiagnosticVMOptions")
}

dependencies {
    intellijPlatform {
        bundledPlugin("org.jetbrains.android")
        instrumentationTools()
        androidStudio("2024.2.1.2")

    }

    testImplementation("junit:junit:4.13.2")
    testImplementation("org.mockito:mockito-core:4.7.0")
    testImplementation("com.google.truth:truth:1.4.4")
}

2. Need at least one Kotlin file to force :compileKotlin to run.

//  src/main/kotlin/com/example/main.kt
println("hello world")

3. Repro

gradle build

Gradle IntelliJ Plugin version

2.0.1

Gradle version

8.9

Operating System

macOS

Link to build, i.e. failing GitHub Action job

No response

pbreault avatar Aug 15 '24 01:08 pbreault

I extracted that jar from IntelliJ IDEA (2024.2) and placed it in the directory that was causing the error. Until the bug is fixed, this workaround can be used.

emertozd avatar Aug 15 '24 18:08 emertozd

This issue is blocking development for plugins built against 2024.2.x.

Was the performanceTesting.jar dependency accidentally included in the AS bundle manifest? It seems to be an Intellij based plugin.

I extracted that jar from IntelliJ IDEA (2024.2) and placed it in the directory that was causing the error. Until the bug is fixed, this workaround can be used.

I was able to use this workaround to get a new version published, but it's unstable and continually fails during development. It's not scalable across teams.

kadorisio-hood avatar Oct 10 '24 15:10 kadorisio-hood

I took this one from the repository as a workaround. I renamed it "performanceTesting.jar" and moved it in the folder mentionned in the example

dennisbordet avatar Oct 14 '24 08:10 dennisbordet

I have tried writing an awful workaround for my deployment pipeline, but it doesn't work... Could really use some help!

      - name: Missing performanceTesting jar hack fix
        run: |
          echo "see https://github.com/JetBrains/intellij-platform-gradle-plugin/issues/1738"
          FOLDER=/home/runner/.gradle/caches/transforms-3/e773a64bc76e36769f59d43df2c66fa6/transformed/android-studio-2024.2.1.10-linux/plugins                 
          mkdir -p ${FOLDER}/performanceTesting
          mkdir -p ${FOLDER}/performanceTesting/lib
          FOLDER=${FOLDER}/performanceTesting/lib
          
          FILE=performance-testing-242.23339.19.jar
          URL=https://www.jetbrains.com/intellij-repository/releases/com/jetbrains/intellij/performanceTesting/performance-testing/242.23339.19/${FILE}
          wget -O ${FOLDER}/${FILE} ${URL}
          ls -l ${FOLDER}

qbalsdon avatar Oct 21 '24 15:10 qbalsdon

I have tried writing an awful workaround for my deployment pipeline, but it doesn't work... Could really use some help!

      - name: Missing performanceTesting jar hack fix
        run: |
          echo "see https://github.com/JetBrains/intellij-platform-gradle-plugin/issues/1738"
          FOLDER=/home/runner/.gradle/caches/transforms-3/e773a64bc76e36769f59d43df2c66fa6/transformed/android-studio-2024.2.1.10-linux/plugins                 
          mkdir -p ${FOLDER}/performanceTesting
          mkdir -p ${FOLDER}/performanceTesting/lib
          FOLDER=${FOLDER}/performanceTesting/lib
          
          FILE=performance-testing-242.23339.19.jar
          URL=https://www.jetbrains.com/intellij-repository/releases/com/jetbrains/intellij/performanceTesting/performance-testing/242.23339.19/${FILE}
          wget -O ${FOLDER}/${FILE} ${URL}
          ls -l ${FOLDER}

Does this workaround work on your laptop @qbalsdon ? You need to rename the downloaded file to "performanceTesting.jar"

dennisbordet avatar Oct 30 '24 15:10 dennisbordet

I took this one from the repository as a workaround. I renamed it "performanceTesting.jar" and moved it in the folder mentionned in the example

I try this solution and get error after Run plugin with exception

"performanceTesting.jar' contains invalid plugin descriptor". +"WARN: Cannot load performanceTesting.jar, Cannot resolve intellij.performanceTesting.remoteDriver.xml"

VDenis avatar Oct 30 '24 21:10 VDenis

I try this solution and get error after Run plugin with exception

"performanceTesting.jar' contains invalid plugin descriptor". +"WARN: Cannot load performanceTesting.jar, Cannot resolve intellij.performanceTesting.remoteDriver.xml"

I had the same. If you look at the repository link posted by @dennisbordet , you will notice there are multiple versions of the performance-Testing.jar file. You need to download the one corresponding to your target build. You can find the necessary build number by looking at this table and matching your Android Studio target version.

Alexs784 avatar Oct 31 '24 10:10 Alexs784

@dennisbordet no, lol - nothing works - that solution was an awful attempt for my github actions, and it definitely doesn't work

qbalsdon avatar Nov 06 '24 21:11 qbalsdon

Just FYI, on the Android Studio side, we plan to bundle the Performance Testing plugin starting in Android Studio M Canary 2 (coming soon).

gharrma avatar Nov 12 '24 20:11 gharrma

Unfortunately, the performancePlugin bundled module is listed in the Android Studio's product-info.json, and points to the file that doesn't exist. This bundled module comes to the org.jetbrains.android bundled plugin as a transitive dependency. Fortunately, it is possible to exclude such a transitive dependency with:

import org.jetbrains.intellij.platform.gradle.Constants.Configurations

configurations {
    named(Configurations.INTELLIJ_PLATFORM_BUNDLED_MODULES) {
        exclude(Configurations.Dependencies.BUNDLED_MODULE_GROUP, "com.jetbrains.performancePlugin")
    }
}

Note that this is just a workaround; the proper fix will be included in the upcoming IntelliJ Platform Gradle Plugin release.

hsz avatar Nov 18 '24 22:11 hsz

it is possible to exclude such a transitive dependency

Very helpful! Here's a groovy syntax version:

import org.jetbrains.intellij.platform.gradle.Constants
configurations.configureEach {
  if (it.name == Constants.Configurations.INTELLIJ_PLATFORM_BUNDLED_MODULES) {
    exclude group: Constants.Configurations.Dependencies.BUNDLED_MODULE_GROUP, module: "com.jetbrains.performancePlugin"
  }
}

joshfriend avatar Nov 19 '24 18:11 joshfriend

This is still an issue, see #1843

technoir42 avatar Jan 13 '25 16:01 technoir42