intellij-platform-gradle-plugin icon indicating copy to clipboard operation
intellij-platform-gradle-plugin copied to clipboard

Always set idea.home.path

Open abrooksv opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. Goland does not ship with the test-framework , go-testframework modules. In order to run tests in goland, you need to manually download the dependency.

The issue is that the test-fraemwork starts up the Log system which uses PathManager which tries to find the IDE through the location of the jar that holds PathManager.

Exception:

java.lang.RuntimeException: Could not find installation home path. Please reinstall the software.
	at com.intellij.openapi.application.PathManager.getHomePath(PathManager.java:99)
	at com.intellij.openapi.application.PathManager.getHomePath(PathManager.java:70)
	at com.intellij.testFramework.TestLoggerFactory.reconfigure(TestLoggerFactory.java:95)
	at com.intellij.testFramework.TestLoggerFactory.getLoggerInstance(TestLoggerFactory.java:69)
	at com.intellij.openapi.diagnostic.Logger.getInstance(Logger.java:95)
	at com.intellij.openapi.progress.impl.CoreProgressManager.<clinit>(CoreProgressManager.java:40)
	at com.intellij.openapi.application.impl.ApplicationImpl.getDefaultModalityState(ApplicationImpl.java:488)
	at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:466)
	at com.intellij.testFramework.EdtTestUtil.runInEdtAndWait(EdtTestUtil.java:49)
	at com.intellij.testFramework.UsefulTestCase.runBare(UsefulTestCase.java:485)
	at com.intellij.testFramework.UsefulTestCase.runBare(UsefulTestCase.java:477)
	at junit.framework.TestResult$1.protect(TestResult.java:122)
	at junit.framework.TestResult.runProtected(TestResult.java:142)
	at junit.framework.TestResult.run(TestResult.java:125)
	at junit.framework.TestCase.run(TestCase.java:130)
	at junit.framework.TestSuite.runTest(TestSuite.java:241)
	at junit.framework.TestSuite.run(TestSuite.java:236)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:108)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:40)
	at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:60)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:52)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at jdk.proxy1/jdk.proxy1.$Proxy2.processTestClass(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
java.lang.RuntimeException: Could not find installation home path. Please reinstall the software.
	at com.intellij.openapi.application.PathManager.getHomePath(PathManager.java:99)
	at com.intellij.openapi.application.PathManager.getHomePath(PathManager.java:70)
	at com.intellij.testFramework.TestLoggerFactory.reconfigure(TestLoggerFactory.java:95)
	at com.intellij.testFramework.TestLoggerFactory.getLoggerInstance(TestLoggerFactory.java:69)
	at com.intellij.openapi.diagnostic.Logger.getInstance(Logger.java:95)
	at com.intellij.util.ReflectionUtil.<clinit>(ReflectionUtil.java:20)
	at com.intellij.util.containers.Unsafe.find(Unsafe.java:57)
	at com.intellij.util.containers.Unsafe.<clinit>(Unsafe.java:33)
	at com.intellij.util.containers.ConcurrentLongObjectHashMap.<clinit>(ConcurrentLongObjectHashMap.java:2724)
	at com.intellij.util.containers.ContainerUtil.createConcurrentLongObjectMap(ContainerUtil.java:2595)
	at com.intellij.openapi.progress.impl.CoreProgressManager.<clinit>(CoreProgressManager.java:51)
	at com.intellij.openapi.application.impl.ApplicationImpl.getDefaultModalityState(ApplicationImpl.java:488)
	at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:466)
	at com.intellij.testFramework.EdtTestUtil.runInEdtAndWait(EdtTestUtil.java:49)
	at com.intellij.testFramework.UsefulTestCase.runBare(UsefulTestCase.java:485)
	at com.intellij.testFramework.UsefulTestCase.runBare(UsefulTestCase.java:477)
	at junit.framework.TestResult$1.protect(TestResult.java:122)
	at junit.framework.TestResult.runProtected(TestResult.java:142)
	at junit.framework.TestResult.run(TestResult.java:125)
	at junit.framework.TestCase.run(TestCase.java:130)
	at junit.framework.TestSuite.runTest(TestSuite.java:241)
	at junit.framework.TestSuite.run(TestSuite.java:236)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:108)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:40)
	at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:60)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:52)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at jdk.proxy1/jdk.proxy1.$Proxy2.processTestClass(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)

When running tests with IC or IU, this works fine, but with GO + go-testframework, the PathManager shows up from the util.jar from the transitive dependencies of the go-testframework so it is not a valid IDE home.

Repo cases: https://github.com/abrooksv/gradle-intellij-pluigin-test-bed/tree/golandTests (note all the excludes are required to prevent duplicates and downloading of some dependencies that are not public, taken from the tinygo example) https://github.com/JetBrains/tinygo-plugin (works but shows the workaround)

Describe the solution you'd like The idea.home.path is always set to the IDE downloaded through the intellij block

Describe alternatives you've considered You can manually set the idea.home.path system property like the tinygo plugin does.

Additional context Add any other context or screenshots about the feature request here.

abrooksv avatar Jul 14 '23 15:07 abrooksv