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

There is a bug in this logic of getting idea.platform.prefix and I made a solution. #772

Closed
allinprogram opened this issue Aug 24, 2021 · 2 comments
Assignees
Milestone

Comments

@allinprogram
Copy link

Problem description

Some intellij products installing by ToolBox, use this plugin to execute runIde, will got a blocking error that users are required to manually specify the idea.platform.prefix.

Problem analysis

org.jetbrains.intellij.tasks.RunIdeBase line 127: find the idea.platform.prefix by iterating the file who name have sh, this is not robust.

I found that some intellij products installing by ToolBox do not have this file. I think this should be obtained through product-info.json, not some files named *.sh.

we can get the productCode in product-info.json, finally get the idea.platform.prefix By comparing withorg.jetbrains.idea.devkit.projectRoots.IntelliJPlatformProduct and com.intellij.util.PlatformUtils.

As a result, we can delete the misleading code (!ideBuildNumber(ideDir.get().asFile).startsWith("IU-")):

// Inadvertently misleading users, only allowing ultimate use. 
// At least it looks like that from the code.
if (prefix == null && !ideBuildNumber(ideDir.get().asFile).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."))
}

In the end

I hope I can help solve this problem and I really want to submit a helpful pr, But limited by my code ability of kotlin.

@zolotov
Copy link
Member

zolotov commented Aug 26, 2021

I found that some intellij products installing by ToolBox do not have this file.

Please, describe exact scenario. What IDE you're talking about? What version?

By comparing withorg.jetbrains.idea.devkit.projectRoots.IntelliJPlatformProduct and com.intellij.util.PlatformUtils.

Thank you for the suggestions. We have considered product-info.json. Unfortunately, it doesn't fit to us, because we cannot find a prefix by product code:

  1. gradle-intellij-plugin doesn't have sources to match
  2. these classes don't contain information about IDEs made not by JetBrains

@allinprogram
Copy link
Author

allinprogram commented Aug 26, 2021

I found that some intellij products installing by ToolBox do not have this file.

Please, describe exact scenario. What IDE you're talking about? What version?

By comparing withorg.jetbrains.idea.devkit.projectRoots.IntelliJPlatformProduct and com.intellij.util.PlatformUtils.

Thank you for the suggestions. We have considered product-info.json. Unfortunately, it doesn't fit to us, because we cannot find a prefix by product code:

  1. gradle-intellij-plugin doesn't have sources to match
  2. these classes don't contain information about IDEs made not by JetBrains

I found the problem in the Idea Community 2021.2 MacOS installed by Toolbox.
Infact, I reproduced the problem in the Idea Community 2021.2 WIN10 installed by Toolbox.
They will throws this exception when using the plugin to exec runIde Task, then I must add the idea.platform.prefix manully to avoid the exception.

If need more information I provided, please contact me.

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

No branches or pull requests

3 participants