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

chore: Updated Kotlin from version 1.7.0 to 1.8.20 and respective linter/formatter tool #1291

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jeremytchang
Copy link
Collaborator

@jeremytchang jeremytchang commented Apr 5, 2023

This PR upgrades:

  • the Gradle version - the build files were rewritten in Kotlin for type safety
  • the Kotlin version, from 1.7.x to 1.8.x
  • the Kotlin coroutine library version, from release candidate to the latest stable version
  • the code linting gradle plugin and ktlint version, which prompted a code reformat

Not my PR. It is copied from #1284 to trigger CI.

@jkaster
Copy link
Contributor

jkaster commented Apr 6, 2023

This is what I'm currently getting:

> bin/smoke kotlin
yarn run v1.22.19
$ ts-node -O '{ "module": "commonjs", "target": "es2019" }' packages/sdk-codegen-scripts/src/yamlToJson.ts test/data.yml
Converted test/data.yml to test/data.yml.json
Done in 2.92s.
Unit testing SDKs: kotlin ...
Unit testing Kotlin SDK ...
Downloading https://services.gradle.org/distributions/gradle-8.0.2-bin.zip
...........10%............20%............30%............40%............50%............60%...........70%............80%............90%............100%

Welcome to Gradle 8.0.2!

Here are the highlights of this release:
 - Improvements to the Kotlin DSL
 - Fine-grained parallelism from the first build with configuration cache
 - Configurable Gradle user home cache cleanup

For more details see https://docs.gradle.org/8.0.2/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)
Invalid Java installation found at '/usr/lib/jvm/openjdk-17' (Common Linux Locations). It will be re-checked in the next build. This might have performance impact if it keeps failing. Run the 'javaToolchains' task for more details.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':test'.
> Could not resolve all dependencies for configuration ':testRuntimeClasspath'.
   > Failed to calculate the value of task ':compileJava' property 'javaCompiler'.
      > No matching toolchains found for requested specification: {languageVersion=8, vendor=any, implementation=vendor-specific}.
         > No locally installed toolchains match (see https://docs.gradle.org/8.0.2/userguide/toolchains.html#sec:auto_detection) and toolchain download repositories have not been configured (see https://docs.gradle.org/8.0.2/userguide/toolchains.html#sub:download_repositories).

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 50s
Unit tests completed
Smoking SDKs: kotlin ...
Smoking Kotlin SDK ...
Invalid Java installation found at '/usr/lib/jvm/openjdk-17' (Common Linux Locations). It will be re-checked in the next build. This might have performance impact if it keeps failing. Run the 'javaToolchains' task for more details.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':test'.
> Could not resolve all dependencies for configuration ':testRuntimeClasspath'.
   > Failed to calculate the value of task ':compileJava' property 'javaCompiler'.
      > No matching toolchains found for requested specification: {languageVersion=8, vendor=any, implementation=vendor-specific}.
         > No locally installed toolchains match (see https://docs.gradle.org/8.0.2/userguide/toolchains.html#sec:auto_detection) and toolchain download repositories have not been configured (see https://docs.gradle.org/8.0.2/userguide/toolchains.html#sub:download_repositories).

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 833ms
Smoke tests completed

@daniel-lopes-optimizely
Copy link
Contributor

daniel-lopes-optimizely commented Apr 11, 2023

@jkaster that issue seems related to gradle/gradle#24439

Did you run gradle from github actions? Was actions/setup-java@v3 previously invoked, or do you need to set the JAVA_HOME environment variable to a path with the installed binary?

@jkaster
Copy link
Contributor

jkaster commented Apr 11, 2023

Did you run gradle from github actions? Was actions/setup-java@v3 previously invoked, or do you need to set the JAVA_HOME environment variable to a path with the installed binary?

No, I'm trying to run it from a clone of the local repository, which is a requirement for our SDK development workflow.

@daniel-lopes-optimizely
Copy link
Contributor

@jkaster are you running it from your machine then? Is it Ubuntu? Newer Gradle versions seems to have some issues detecting the java toolchain automatically, and uses the Ubuntu source package instead of the binary package path.

I think setting the JAVA_HOME environment variable before running the command could help:

export JAVA_HOME=$(dirname $(dirname $(readlink -e /usr/bin/javac)))

bin/smoke kotlin

@daniel-lopes-optimizely
Copy link
Contributor

@jeremytchang @jkaster I believe the newest Gradle version fixes the issue with running the smoke tests in Linux.

Here's a commit of the upgrade d5c9383

@daniel-lopes-optimizely
Copy link
Contributor

@jeremytchang @jkaster what do we need to get this change merged?

@daniel-lopes-optimizely
Copy link
Contributor

@jeremytchang @jkaster can you close this PR in favour of #1343 please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants