Kotlin / kotlinx-atomicfu

The idiomatic way to use atomic operations in Kotlin
Other
827 stars 56 forks source link

java.io.IOException: Cannot create file Gradle__org_jetbrains_kotlinx_atomicfu_cinterop_interop_... #398

Open GuilhE opened 4 months ago

GuilhE commented 4 months ago

Every time I open my project I get this error.
It doesn't prevent the project to successfully build and the app to run, but why is it throwing?

Targets:

jvm()
androidTarget()
iosArm64()
iosSimulatorArm64()

atomicfu 0.23.1/0.23.2 is applied as a commonMain dependency.

Stack trace:

java.io.IOException: Cannot create file '.../.idea/libraries/Gradle__org_jetbrains_kotlinx_atomicfu_cinterop_interop__android_arm32__android_arm64__android_x64__android_x86__ios_arm64__ios_simulator_arm64__ios_x64__linux_arm64__linux_x64__macos_arm64__macos_x64__mingw_x64__tvos_arm64__tvos_simulator_arm64__tvos_x64__watchos_arm32__watchos_arm64__watchos_device_arm64__watchos_simulator_arm64__watchos_x64_.xml'
    at com.intellij.openapi.vfs.impl.local.LocalFileSystemBase.createChildFile(LocalFileSystemBase.java:407)
    at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.createChildFile(PersistentFSImpl.java:533)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.createChildData(VirtualFileSystemEntry.java:292)
    at com.intellij.configurationStore.schemeManager.SchemeLoaderKt$getOrCreateChild$1.invoke(schemeLoader.kt:295)
    at com.intellij.configurationStore.schemeManager.SchemeLoaderKt$getOrCreateChild$1.invoke(schemeLoader.kt:295)
    at com.intellij.configurationStore.StorageUtilKt.runAsWriteActionIfNeeded(storageUtil.kt:162)
    at com.intellij.configurationStore.schemeManager.SchemeLoaderKt.getOrCreateChild(schemeLoader.kt:295)
    at com.intellij.configurationStore.DirectoryBasedStorage$MySaveSession.saveStates(DirectoryBasedStorage.kt:211)
    at com.intellij.configurationStore.DirectoryBasedStorage$MySaveSession.save(DirectoryBasedStorage.kt:181)
    at com.intellij.configurationStore.SaveExecutorKt.executeSave(SaveExecutor.kt:91)
    at com.intellij.configurationStore.SaveExecutorKt.saveSessions(SaveExecutor.kt:85)
    at com.intellij.configurationStore.ProjectSaveSessionProducerManager$saveWithAdditionalSaveSessions$saveResult$1.invokeSuspend$lambda$0(ProjectSaveSessionProducerManager.kt:31)
    at com.intellij.openapi.application.impl.ApplicationImpl.lambda$runWriteAction$8(ApplicationImpl.java:965)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:944)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:965)
    at com.intellij.configurationStore.ProjectSaveSessionProducerManager$saveWithAdditionalSaveSessions$saveResult$1.invokeSuspend(ProjectSaveSessionProducerManager.kt:28)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at com.intellij.openapi.application.impl.DispatchedRunnable.run(DispatchedRunnable.kt:35)
    at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)
    at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
    at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:829)
    at com.intellij.openapi.application.impl.ApplicationImpl$3.run(ApplicationImpl.java:454)
    at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:79)
    at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:122)
    at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:41)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
    at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Unknown Source)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:667)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$7(IdeEventQueue.kt:571)
    at com.intellij.openapi.application.impl.ApplicationImpl.withoutImplicitRead(ApplicationImpl.java:1444)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:571)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:68)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:349)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:348)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:348)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:343)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:995)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:995)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$4(IdeEventQueue.kt:343)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:829)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:385)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
mvicsokolova commented 2 months ago

Hi! Could you please, share a build script, where you apply the kotlinx-atomicfu plugin, if you still face this problem. I could not reproduce locally it on a sample mpp project

And it's clear to me, what do you mean by:

atomicfu 0.23.1/0.23.2 is applied as a commonMain dependency.

GuilhE commented 2 months ago

Hello @mvicsokolova , I've two samples:

They both will show that message on Android Studio.

mvicsokolova commented 2 months ago

Thank you! I'll take a look.

GuilhE commented 1 month ago

Still happening with:

kotlin = "2.0.0-RC1"
kotlinxAtomicFu = "0.24.0"
Android Studio Iguana | 2023.2.1 Patch 2
Non-Bundled Plugins:
    com.jetbrains.kmm (0.8.2(232)-20)
    org.jetbrains.compose.desktop.ide (1.6.2)
mvicsokolova commented 1 month ago

Hi! I've tried to open and run both projects that you attached above in Android Studio 2023.2.1 Patch 2 with the latest KGP / atomicfu versions.
And I do not get this error neither during the project sync, nor during the build. Moreover the .idea/libraries/ directory is not created at all. Probably, this problem is platform dependent, I only checked that for MacOS.

So, I'll try to check that for other platforms, and also this may be a problem related to IDE imports

GuilhE commented 1 month ago

Hello!

So, I'll try to check that for other platforms, and also this may be a problem related to IDE imports

I'm also using on MacOS, but let me share the full data about Android Studio:

Android Studio Iguana | 2023.2.1 Patch 2
Build #AI-232.10300.40.2321.11668458, built on April 4, 2024
Runtime version: 17.0.9+0-17.0.9b1087.7-11185874 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.4.1 (Apple M1 Pro, 16 GB)
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 10
Metal Rendering is ON
Registry:
    debugger.watches.in.variables=false
    ide.windowSystem.autoShowProcessPopup=true

Non-Bundled Plugins:
    com.jetbrains.kmm (0.8.2(232)-20)
    org.jetbrains.compose.desktop.ide (1.6.2)

Maybe it helps 😊

Fun fact, with the newer versions (atomicfu, IDE, kotlin, etc) I haven't seen this error while the IDE is open, but when the projects screen is presented the error is there:

Screenshot 2024-04-19 at 11 22 43

mvicsokolova commented 1 month ago

Thanks a lot for the information! 🙏🏻 If I can not figure out the problem on the plugin side, I'll ask IDE Team for help and then leave a comment here.