mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[platform] fix loading product-info.json from cross-platform distribution on macOS (IJPL-177862)
GitOrigin-RevId: 1486c5790241ee4408e9fcfe1f275c640a418ca0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
dcd9f3807c
commit
5282ebab13
+7
-2
@@ -15,7 +15,9 @@ import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.decodeFromStream
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.Path
|
||||
import kotlin.io.path.exists
|
||||
import kotlin.io.path.inputStream
|
||||
import kotlin.io.path.isDirectory
|
||||
import kotlin.io.path.name
|
||||
|
||||
internal class IdeProductInfoImpl : IdeProductInfo {
|
||||
@@ -32,7 +34,7 @@ internal class IdeProductInfoImpl : IdeProductInfo {
|
||||
|
||||
override fun loadProductInfo(ideHome: Path): ProductInfoData? {
|
||||
return try {
|
||||
if (SystemInfo.isMac && ideHome.name != "Contents") {
|
||||
if (SystemInfo.isMac && ideHome.name != "Contents" && ideHome.resolve("Contents").isDirectory()) {
|
||||
tryLoadingProductInfo(ideHome.resolve("Contents"))
|
||||
}
|
||||
else {
|
||||
@@ -47,7 +49,10 @@ internal class IdeProductInfoImpl : IdeProductInfo {
|
||||
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
private fun tryLoadingProductInfo(ideHome: Path): ProductInfoData {
|
||||
val productInfoRelativePath = if (SystemInfo.isMac) ApplicationEx.PRODUCT_INFO_FILE_NAME_MAC else ApplicationEx.PRODUCT_INFO_FILE_NAME
|
||||
val productInfoRelativePath =
|
||||
//cross-platform distribution used for plugin development has the product-info.json file at the root even on macOS
|
||||
if (SystemInfo.isMac && ideHome.resolve(ApplicationEx.PRODUCT_INFO_FILE_NAME_MAC).exists()) ApplicationEx.PRODUCT_INFO_FILE_NAME_MAC
|
||||
else ApplicationEx.PRODUCT_INFO_FILE_NAME
|
||||
val productInfoPath = ideHome.resolve(productInfoRelativePath)
|
||||
return productInfoPath.inputStream().buffered().use {
|
||||
json.decodeFromStream(ProductInfoData.serializer(), it)
|
||||
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
{
|
||||
"name": "IntelliJ IDEA",
|
||||
"version": "2025.1",
|
||||
"versionSuffix": "EAP",
|
||||
"buildNumber": "251.21418.34",
|
||||
"productCode": "IU",
|
||||
"envVarBaseName": "IDEA",
|
||||
"dataDirectoryName": "IntelliJIdea2025.1",
|
||||
"svgIconPath": "bin/idea.svg",
|
||||
"productVendor": "JetBrains",
|
||||
"launch": [
|
||||
{
|
||||
"os": "Windows",
|
||||
"arch": "amd64",
|
||||
"launcherPath": "bin/idea.bat",
|
||||
"vmOptionsFilePath": "bin/win/idea64.exe.vmoptions",
|
||||
"bootClassPathJarNames": [
|
||||
"platform-loader.jar",
|
||||
"util-8.jar",
|
||||
"util.jar"
|
||||
],
|
||||
"additionalJvmArguments": [
|
||||
"-Xbootclasspath/a:%IDE_HOME%/lib/nio-fs.jar",
|
||||
"-Djava.system.class.loader=com.intellij.util.lang.PathClassLoader"
|
||||
],
|
||||
"mainClass": "com.intellij.idea.Main"
|
||||
},
|
||||
{
|
||||
"os": "Linux",
|
||||
"arch": "amd64",
|
||||
"launcherPath": "bin/idea.sh",
|
||||
"vmOptionsFilePath": "bin/linux/idea64.vmoptions",
|
||||
"startupWmClass": "jetbrains-idea",
|
||||
"bootClassPathJarNames": [
|
||||
"platform-loader.jar",
|
||||
"util-8.jar",
|
||||
"util.jar"
|
||||
],
|
||||
"additionalJvmArguments": [
|
||||
"-Xbootclasspath/a:$IDE_HOME/lib/nio-fs.jar",
|
||||
"-Djava.system.class.loader=com.intellij.util.lang.PathClassLoader"
|
||||
],
|
||||
"mainClass": "com.intellij.idea.Main"
|
||||
},
|
||||
{
|
||||
"os": "macOS",
|
||||
"arch": "amd64",
|
||||
"launcherPath": "bin/idea.sh",
|
||||
"vmOptionsFilePath": "bin/mac/idea.vmoptions",
|
||||
"bootClassPathJarNames": [
|
||||
"platform-loader.jar",
|
||||
"util-8.jar",
|
||||
"util.jar"
|
||||
],
|
||||
"additionalJvmArguments": [
|
||||
"-Xbootclasspath/a:$APP_PACKAGE/lib/nio-fs.jar",
|
||||
"-Djava.system.class.loader=com.intellij.util.lang.PathClassLoader"
|
||||
],
|
||||
"mainClass": "com.intellij.idea.Main"
|
||||
},
|
||||
{
|
||||
"os": "Windows",
|
||||
"arch": "aarch64",
|
||||
"launcherPath": "bin/idea.bat",
|
||||
"vmOptionsFilePath": "bin/win/idea64.exe.vmoptions",
|
||||
"bootClassPathJarNames": [
|
||||
"platform-loader.jar",
|
||||
"util-8.jar",
|
||||
"util.jar"
|
||||
],
|
||||
"additionalJvmArguments": [
|
||||
"-Xbootclasspath/a:%IDE_HOME%/lib/nio-fs.jar",
|
||||
"-Djava.system.class.loader=com.intellij.util.lang.PathClassLoader"
|
||||
],
|
||||
"mainClass": "com.intellij.idea.Main"
|
||||
},
|
||||
{
|
||||
"os": "Linux",
|
||||
"arch": "aarch64",
|
||||
"launcherPath": "bin/idea.sh",
|
||||
"vmOptionsFilePath": "bin/linux/idea64.vmoptions",
|
||||
"startupWmClass": "jetbrains-idea",
|
||||
"bootClassPathJarNames": [
|
||||
"platform-loader.jar",
|
||||
"util-8.jar",
|
||||
"util.jar"
|
||||
],
|
||||
"additionalJvmArguments": [
|
||||
"-Xbootclasspath/a:$IDE_HOME/lib/nio-fs.jar",
|
||||
"-Djava.system.class.loader=com.intellij.util.lang.PathClassLoader"
|
||||
],
|
||||
"mainClass": "com.intellij.idea.Main"
|
||||
},
|
||||
{
|
||||
"os": "macOS",
|
||||
"arch": "aarch64",
|
||||
"launcherPath": "bin/idea.sh",
|
||||
"vmOptionsFilePath": "bin/mac/idea.vmoptions",
|
||||
"bootClassPathJarNames": [
|
||||
"platform-loader.jar",
|
||||
"util-8.jar"
|
||||
],
|
||||
"additionalJvmArguments": [
|
||||
"-Xbootclasspath/a:$APP_PACKAGE/lib/nio-fs.jar",
|
||||
"-Djava.system.class.loader=com.intellij.util.lang.PathClassLoader"
|
||||
],
|
||||
"mainClass": "com.intellij.idea.Main"
|
||||
}
|
||||
],
|
||||
"bundledPlugins": [
|
||||
"AngularJS"
|
||||
],
|
||||
"modules": [
|
||||
"com.intellij.java.frontback.impl"
|
||||
],
|
||||
"fileExtensions": [
|
||||
"*.java"
|
||||
],
|
||||
"layout": [
|
||||
]
|
||||
}
|
||||
+6
-1
@@ -31,7 +31,12 @@ class IdeProductInfoTest {
|
||||
assertEquals("2024.3.1", loadProductInfo("idea-2024.3.1-macOS").version)
|
||||
assertEquals("2024.3.1", loadProductInfo("idea-2024.3.1-macOS/Contents").version)
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun `idea 2025_1 cross platform`() {
|
||||
assertEquals("2025.1", loadProductInfo("idea-2025.1-cross-platform").version)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `idea community 2022_1_4`() {
|
||||
assumeTrue(SystemInfo.isLinux || SystemInfo.isWindows)
|
||||
|
||||
Reference in New Issue
Block a user