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

Plugin's tasks ignore configured java toolchain #176

Closed
fzhinkin opened this issue Dec 27, 2023 · 2 comments · Fixed by #181
Closed

Plugin's tasks ignore configured java toolchain #176

fzhinkin opened this issue Dec 27, 2023 · 2 comments · Fixed by #181
Labels
enhancement New feature or request

Comments

@fzhinkin
Copy link
Contributor

kotlinx-benchmarks tasks responsible for compiling and running benchmarks on JVM ignore a toolchain configured for a project and instead use the same JDK as Gradle do.

That to leads to compilation failures when a project is configured to use a toolchain that is newer than the java Gradle was launched with.

For example, a project's toolchain is JDK 21, but Gradle was started with JDK 17:

Execution failed for task ':kotlinx-io-benchmarks:jvmBenchmarkGenerate'.
> There was a failure while executing work items
   > A failure occurred while executing kotlinx.benchmark.gradle.JmhBytecodeGeneratorWorker
      > kotlinx/io/benchmarks/ShortBenchmark has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0

It would be nice to align kotlinx-benchmarks' tasks behavior with Kotlin Gradle plugins and use JDK configured using toolchains.

@fzhinkin
Copy link
Contributor Author

Related feature that would be nice to support (but it probably deserves a separate issue): allow configuring different toolchains for different benchmarks configurations, so that a user could execute the same set of benchmarks with different JDK versions. Something like:

configurations {
    create("jdk17") {
        mode = "avgt"
        outputTimeUnit = "ns"
        include("MyPreciousBenchmark")
        jvmToolchain {
            languageVersion.set(JavaLanguageVersion.of(17))
        }
    }
    create("jdk21") {
        mode = "avgt"
        outputTimeUnit = "ns"
        include("MyPreciousBenchmark")
        jvmToolchain {
            languageVersion.set(JavaLanguageVersion.of(21))
        }
    }
}

@fzhinkin
Copy link
Contributor Author

fzhinkin commented Feb 6, 2024

Filed #187 to track #176 (comment)

qurbonzoda added a commit that referenced this issue Sep 5, 2024
Otherwise, if the project using kotlinx-benchmark is configured with an older jvmToolchain than the Java with which Gradle was launched, the following error occurs:

Execution failed for task ':jvmBenchmarkGenerate'.
> There was a failure while executing work items
  > A failure occurred while executing kotlinx.benchmark.gradle.JmhBytecodeGeneratorWorker
    > kotlinx/benchmark/gradle/JmhBytecodeGeneratorWorkParameters has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Similar issue: #176
qurbonzoda added a commit that referenced this issue Sep 5, 2024
Otherwise, if the project using kotlinx-benchmark is configured with an older jvmToolchain than the Java with which Gradle was launched to assemble plugin or runtime, the following error occurs:

Execution failed for task ':jvmBenchmarkGenerate'.
> There was a failure while executing work items
  > A failure occurred while executing kotlinx.benchmark.gradle.JmhBytecodeGeneratorWorker
    > kotlinx/benchmark/gradle/JmhBytecodeGeneratorWorkParameters has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Similar issue: #176
qurbonzoda added a commit that referenced this issue Sep 10, 2024
Otherwise, if the project using kotlinx-benchmark is configured with an older jvmToolchain than the Java with which Gradle was launched to assemble plugin or runtime, the following error occurs:

Execution failed for task ':jvmBenchmarkGenerate'.
> There was a failure while executing work items
  > A failure occurred while executing kotlinx.benchmark.gradle.JmhBytecodeGeneratorWorker
    > kotlinx/benchmark/gradle/JmhBytecodeGeneratorWorkParameters has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Similar issue: #176
qurbonzoda added a commit that referenced this issue Sep 30, 2024
Otherwise, if the project using kotlinx-benchmark is configured with an older jvmToolchain than the Java with which Gradle was launched to assemble plugin or runtime, the following error occurs:

Execution failed for task ':jvmBenchmarkGenerate'.
> There was a failure while executing work items
  > A failure occurred while executing kotlinx.benchmark.gradle.JmhBytecodeGeneratorWorker
    > kotlinx/benchmark/gradle/JmhBytecodeGeneratorWorkParameters has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Similar issue: #176
qurbonzoda added a commit that referenced this issue Sep 30, 2024
Otherwise, if the project using kotlinx-benchmark is configured with an older jvmToolchain than the Java with which Gradle was launched to assemble plugin or runtime, the following error occurs:

Execution failed for task ':jvmBenchmarkGenerate'.
> There was a failure while executing work items
  > A failure occurred while executing kotlinx.benchmark.gradle.JmhBytecodeGeneratorWorker
    > kotlinx/benchmark/gradle/JmhBytecodeGeneratorWorkParameters has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Similar issue: #176
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants