Skip to content

Commit

Permalink
Support for JetBrains Runtime 2022.2 directories layout #1016
Browse files Browse the repository at this point in the history
  • Loading branch information
hsz committed Jul 6, 2022
1 parent db6d2be commit 2105dfc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- `classpathIndexCleanup` task is added to remove `classpath.index` files created by `PathClassLoader` [#1039](../../issues/1039)
- Improve Plugin Verifier error messages [#1040](../../issues/1040)
- Added `FailureLevel.SCHEDULED_FOR_REMOVAL_API_USAGES` to the Plugin Verifier task
- Support for JetBrains Runtime 2022.2 directories layout [#1016](../../issues/1016)

### Changed
- Set minimum supported Gradle version from `6.7` to `6.7.1`
Expand Down
11 changes: 8 additions & 3 deletions src/main/kotlin/org/jetbrains/intellij/IntelliJPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1065,9 +1065,14 @@ open class IntelliJPlugin : Plugin<Project> {
// the same as previous – setting appClassLoader but outdated. Works for part of 203 builds.
task.systemProperty("idea.use.core.classloader.for", pluginIds.joinToString(","))

task.outputs.dir(systemDirectoryProvider).withPropertyName("System directory")
task.inputs.dir(configDirectoryProvider).withPropertyName("Config Directory").withPathSensitivity(PathSensitivity.RELATIVE)
task.inputs.files(pluginsDirectoryProvider).withPropertyName("Plugins directory").withPathSensitivity(PathSensitivity.RELATIVE)
task.outputs.dir(systemDirectoryProvider)
.withPropertyName("System directory")
task.inputs.dir(configDirectoryProvider)
.withPropertyName("Config Directory")
.withPathSensitivity(PathSensitivity.RELATIVE)
task.inputs.files(pluginsDirectoryProvider)
.withPropertyName("Plugins directory")
.withPathSensitivity(PathSensitivity.RELATIVE)
.withNormalizer(ClasspathNormalizer::class.java)

task.dependsOn(IntelliJPluginConstants.SETUP_DEPENDENCIES_TASK_NAME)
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/org/jetbrains/intellij/jbr/JbrResolver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,14 @@ open class JbrResolver @Inject constructor(
}

private fun getJbrRoot(javaHome: File): File {
val jbr = javaHome.listFiles()?.firstOrNull { it.name == "jbr" || it.name == "jbrsdk" }?.takeIf(File::exists)
val jbr = javaHome.listFiles()?.firstOrNull { it.name.startsWith("jbr") }?.takeIf(File::exists)
return when {
operatingSystem.isMacOsX -> when {
javaHome.endsWith("Contents/Home") -> javaHome
jbr != null -> jbr.resolve("Contents/Home")
else -> javaHome.resolve("jdk/Contents/Home")
}

else -> when {
jbr != null -> jbr
else -> javaHome
Expand Down
10 changes: 7 additions & 3 deletions src/main/kotlin/org/jetbrains/intellij/tasks/RunIdeBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,13 @@ abstract class RunIdeBase(runAlways: Boolean) : JavaExec() {
if (!systemProperties.containsKey("idea.platform.prefix")) {
val prefix = findIdePrefix()
if (prefix == null && !ideBuildNumber(ideDir.get()).startsWith("IU-")) {
throw TaskExecutionException(this,
GradleException("Cannot find IDE platform prefix. Please create a bug report at https://github.com/jetbrains/gradle-intellij-plugin. " +
"As a workaround specify `idea.platform.prefix` system property for task `${this.name}` manually."))
throw TaskExecutionException(
this,
GradleException(
"Cannot find IDE platform prefix. Please create a bug report at https://github.com/jetbrains/gradle-intellij-plugin. " +
"As a workaround specify `idea.platform.prefix` system property for task `${this.name}` manually."
)
)
}

if (prefix != null) {
Expand Down

0 comments on commit 2105dfc

Please sign in to comment.