Skip to content

Conversation

paul-dingemans
Copy link
Collaborator

Description

Set system properties to prevent failure when running in ktlint-intellij-plugin with custom installation

Ktlint contains the embedded Kotlin compiler. When running in a process in Intellij IDEA, the initialization of the compiler requires some system properties to be set. When not set, this results in the exception reported, but only when running as (sub)process in context of Intellij IDEA. When using as standalone version, the exception is not run (because it is not running inside the IDEA).

Setting the properties to a non-null value during initialization of the embedded Kotlin compiler, prevents the exception from being thrown.

Closes #2969

Checklist

Before submitting the PR, please check following (checks which are not relevant may be ignored):

  • Commit message are well written. In addition to a short title, the commit message also explain why a change is made.
  • At least one commit message contains a reference Closes #<xxx> or Fixes #<xxx> (replace<xxx> with issue number)
  • Tests are added
  • KtLint format has been applied on source code itself and violations are fixed
  • PR title is short and clear (it is used as description in the release changelog)
  • PR description added (background information)

Documentation is updated. See difference between snapshot and release documentation

  • Snapshot documentation in case documentation is to be released together with a code change
  • Release documentation in case documentation is related to a released version of ktlint and has to be published as soon as the change is merged to master

…lij-plugin with custom installation

Ktlint contains the embedded Kotlin compiler. When running in a process in Intellij IDEA, the initialization of the compiler requires some system properties to be set. When not set, this results in the exception reported, but only when running as (sub)process in context of Intellij IDEA. When using as standalone version, the exception is not run (because it is not running inside the IDEA).

Setting the properties to a non-null value during initialization of the embedded Kotlin compiler, prevents the exception from being thrown.

Closes #2969
@paul-dingemans paul-dingemans added this to the 1.6 milestone Apr 23, 2025
@paul-dingemans paul-dingemans merged commit 7d56c83 into master Apr 23, 2025
10 checks passed
@paul-dingemans paul-dingemans deleted the 2969 branch April 23, 2025 15:07
paul-dingemans added a commit to nbadal/ktlint-intellij-plugin that referenced this pull request Apr 23, 2025
The snapshot version published by pinterest/ktlint#2970 sets some system properties that should resolve the problem with initializing the embedded Kotlin compiler of ktlint when running in IntelliJ IDEA for user that have a custom installation

Closes #614

Add latest released version of ktlint ruleset as separate ruleset project in ktlint-lib module.

Add latest release SNAPSHOT version of ktlint ruleset as separate ruleset project in ktlint-lib module.

Extract the label of the ktlint ruleset version from the enum entry in KtlintRulesetVersion.

Set version to 0.26.2-dev-1
paul-dingemans added a commit to nbadal/ktlint-intellij-plugin that referenced this pull request Apr 23, 2025
* Update ktlint to 1.5.1-SNAPSHOT

The snapshot version published by pinterest/ktlint#2970 sets some system properties that should resolve the problem with initializing the embedded Kotlin compiler of ktlint when running in IntelliJ IDEA for user that have a custom installation

Closes #614

Add latest released version of ktlint ruleset as separate ruleset project in ktlint-lib module.

Add latest release SNAPSHOT version of ktlint ruleset as separate ruleset project in ktlint-lib module.

Extract the label of the ktlint ruleset version from the enum entry in KtlintRulesetVersion.

Set version to 0.26.2-dev-1

* Fix repository locations
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.

Set system properties to prevent failure when running in ktlint-intellij-plugin with custom installation
1 participant