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

Allow JBR runtime package of distributions to be used. #1438

Merged
merged 3 commits into from
Jul 31, 2023

Conversation

daym
Copy link
Contributor

@daym daym commented Jul 23, 2023

Pull Request Details

Make JbrResolver use those gradle javaToolchains where the vendor is JetBrains s.r.o.

Description

Make the JbrResolver also heed Jbr that are available in the gradle javaToolchains environment (even prefer those if they are set).

Related Issue

#1437

Motivation and Context

Sometimes, when making an IntelliJ IDEA plugin, it's not possible for the user to run the runIde or buildSearchableOptions tasks since those download a random JBR runtime and then try to run that, which fails.

It would be better to use the JBR that's available in the gradle javaToolchains already, if it is indeed available there.

How Has This Been Tested

This was successfully tested by building a IntelliJ IDEA plugin from source on GNU Guix on Linux with this PR, after it had not worked on the same machine without the PR.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

@hsz hsz merged commit 938f047 into JetBrains:master Jul 31, 2023
1 check passed
@hsz
Copy link
Member

hsz commented Jul 31, 2023

Thank you, Danny! That's an excellent contribution!

@hsz hsz added this to the 1.15.1 milestone Jul 31, 2023
@daym
Copy link
Contributor Author

daym commented Aug 4, 2023

Thanks!

I've also tested your cleaned-up version the same way and it worked.

@daym daym deleted the issue-1437 branch August 4, 2023 02:21
@hsz
Copy link
Member

hsz commented Aug 4, 2023

Yesterday I sent PR to Gradle (gradle/gradle#26014), which makes JetBrains the known JVM vendor.

Since Gradle 8.4, it'll be possible to use:

kotlin {
    jvmToolchain {
        languageVersion = JavaLanguageVersion.of(17)
        vendor = JvmVendorSpec.JETBRAINS
    }
}

@hsz
Copy link
Member

hsz commented Aug 4, 2023

Also, it was necessary to change the vendor name from JetBrains s.r.o to just JetBrains.

If you already have JBR available locally, Gradle still matches it correctly.
However, suppose you expect to get it downloaded when using the Foojay Toolchains Plugin. In that case, the JetBrains token will be correctly associated with JBR releases by the FooJay Disco API, but JetBrains s.r.o will not.

This change was also addressed with gradle/gradle#26022

hsz added a commit that referenced this pull request Aug 4, 2023
…properly resolve JBR when using Foojay Toolchains plugin. #1438
@daym
Copy link
Contributor Author

daym commented Aug 5, 2023

Since Gradle 8.4, it'll be possible to use:

kotlin {
    jvmToolchain {
        languageVersion = JavaLanguageVersion.of(17)
        vendor = JvmVendorSpec.JETBRAINS
    }
}

Nice!

Would it also make sense to update the intellij platform plugin template's https://github.com/JetBrains/intellij-platform-plugin-template/blob/main/build.gradle.kts to contain this (eventually)? (If it's indeed intended to also build the plugin using JBR--not just run it using JBR)

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

Successfully merging this pull request may close these issues.

2 participants