Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

Script >64KB leads to Could not open cache directory: java.lang.IllegalArgumentException #1305

Closed
bhanutejags opened this issue Dec 30, 2018 · 8 comments

Comments

@bhanutejags
Copy link

bhanutejags commented Dec 30, 2018

Project Configuration fails when the build.gradle.kts is large.

Expected Behavior

Being able to write an arbitrarily large build script.

Current Behavior

When there are more than approximately 65K characters in my build.gradle.kts script, project configuration fails. This doesn't appear if I remove a couple of Gradle tasks to decrease the number of characters.

 gradlew.bat compileJava --stacktrace

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'project_name'.
> Could not open cache directory 5xdkp5yubb79383gig042ae0w (%HOME%\.gradle\caches\5.2-20181230000028+0000\gradle-kotlin-dsl\5xdkp5yubb79383gig042ae0w).
   > java.lang.IllegalArgumentException (no error message)

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'project_name'.
        at org.gradle.configuration.project.LifecycleProjectEvaluator.wrapException(LifecycleProjectEvaluator.java:79)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:72)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.access$600(LifecycleProjectEvaluator.java:53)
        at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject$1.run(LifecycleProjectEvaluator.java:108)
        at org.gradle.internal.Factories$1.create(Factories.java:25)
        at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183)
        at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withProjectLock(DefaultProjectStateRegistry.java:226)
        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:220)
        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:186)
        at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.run(LifecycleProjectEvaluator.java:95)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:67)
        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:695)
        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:143)
        at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35)
        at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:60)
        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:41)
        at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuild.run(DefaultGradleLauncher.java:302)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.initialization.DefaultGradleLauncher.configureBuild(DefaultGradleLauncher.java:210)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
        at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:134)
        at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:58)
        at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:55)
        at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:82)
        at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:75)
        at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183)
        at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
        at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:75)
        at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:55)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:31)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:58)
        at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
        at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:39)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:49)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:44)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:44)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:49)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:46)
        at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:78)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:46)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:31)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:42)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:28)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:52)
        at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:59)
        at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:36)
        at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:68)
        at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:38)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:37)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:26)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:60)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:32)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:48)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:32)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:81)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.cache.CacheOpenException: Could not open cache directory 5xdkp5yubb79383gig042ae0w (%HOME%\.gradle\caches\5.2-20181230000028+0000\gradle-kotlin-dsl\5xdkp5yubb79383gig042ae0w).
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:80)
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:42)
        at org.gradle.cache.internal.DefaultCacheFactory.doOpen(DefaultCacheFactory.java:94)
        at org.gradle.cache.internal.DefaultCacheFactory.open(DefaultCacheFactory.java:68)
        at org.gradle.cache.internal.DefaultCacheRepository$PersistentCacheBuilder.open(DefaultCacheRepository.java:118)
        at org.gradle.kotlin.dsl.cache.ScriptCache.cacheDirFor(ScriptCache.kt:67)
        at org.gradle.kotlin.dsl.provider.StandardKotlinScriptEvaluator$InterpreterHost.cacheDirFor(KotlinScriptEvaluator.kt:253)
        at org.gradle.kotlin.dsl.provider.StandardKotlinScriptEvaluator$InterpreterHost.cachedDirFor(KotlinScriptEvaluator.kt:242)
        at org.gradle.kotlin.dsl.execution.Interpreter.emitSpecializedProgramFor(Interpreter.kt:260)
        at org.gradle.kotlin.dsl.execution.Interpreter.eval(Interpreter.kt:187)
        at org.gradle.kotlin.dsl.provider.StandardKotlinScriptEvaluator.evaluate(KotlinScriptEvaluator.kt:114)
        at org.gradle.kotlin.dsl.provider.KotlinScriptPluginFactory$create$1.invoke(KotlinScriptPluginFactory.kt:51)
        at org.gradle.kotlin.dsl.provider.KotlinScriptPluginFactory$create$1.invoke(KotlinScriptPluginFactory.kt:36)
        at org.gradle.kotlin.dsl.provider.KotlinScriptPlugin.apply(KotlinScriptPlugin.kt:34)
        at org.gradle.configuration.BuildOperationScriptPlugin$1$1.run(BuildOperationScriptPlugin.java:69)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:66)
        at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:63)
        at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:48)
        at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:63)
        at org.gradle.configuration.project.BuildScriptProcessor$1.run(BuildScriptProcessor.java:44)
        at org.gradle.internal.Factories$1.create(Factories.java:25)
        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:200)
        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:186)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:41)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
        at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
        at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject$1.run(LifecycleProjectEvaluator.java:106)
        ... 104 more
Caused by: java.lang.IllegalArgumentException
        at org.jetbrains.org.objectweb.asm.ByteVector.putUTF8(ByteVector.java:213)
        at org.jetbrains.org.objectweb.asm.ClassWriter.newUTF8(ClassWriter.java:1141)
        at org.jetbrains.org.objectweb.asm.ClassWriter.newStringishItem(ClassWriter.java:1163)
        at org.jetbrains.org.objectweb.asm.ClassWriter.newConstItem(ClassWriter.java:1091)
        at org.jetbrains.org.objectweb.asm.MethodWriter.visitLdcInsn(MethodWriter.java:1165)
        at org.gradle.kotlin.dsl.support.bytecode.AsmExtensionsKt.LDC(AsmExtensions.kt:163)
        at org.gradle.kotlin.dsl.execution.ResidualProgramCompiler.emitCompileSecondStageScript(ResidualProgramCompiler.kt:357)
        at org.gradle.kotlin.dsl.execution.ResidualProgramCompiler.access$emitCompileSecondStageScript(ResidualProgramCompiler.kt:93)
        at org.gradle.kotlin.dsl.execution.ResidualProgramCompiler$overrideLoadSecondStageFor$1.invoke(ResidualProgramCompiler.kt:349)
        at org.gradle.kotlin.dsl.execution.ResidualProgramCompiler$overrideLoadSecondStageFor$1.invoke(ResidualProgramCompiler.kt:93)
        at org.gradle.kotlin.dsl.support.bytecode.AsmExtensionsKt.method(AsmExtensions.kt:117)
        at org.gradle.kotlin.dsl.support.bytecode.AsmExtensionsKt.publicMethod(AsmExtensions.kt:102)
        at org.gradle.kotlin.dsl.support.bytecode.AsmExtensionsKt.publicMethod$default(AsmExtensions.kt:99)
        at org.gradle.kotlin.dsl.execution.ResidualProgramCompiler.overrideLoadSecondStageFor(ResidualProgramCompiler.kt:331)
        at org.gradle.kotlin.dsl.execution.ResidualProgramCompiler.access$overrideLoadSecondStageFor(ResidualProgramCompiler.kt:93)
        at org.gradle.kotlin.dsl.execution.ResidualProgramCompiler$emitDynamicProgram$1.invoke(ResidualProgramCompiler.kt:132)
        at org.gradle.kotlin.dsl.execution.ResidualProgramCompiler$emitDynamicProgram$1.invoke(ResidualProgramCompiler.kt:93)
        at org.gradle.kotlin.dsl.execution.ResidualProgramCompiler$program$3.invoke(ResidualProgramCompiler.kt:523)
        at org.gradle.kotlin.dsl.execution.ResidualProgramCompiler$program$3.invoke(ResidualProgramCompiler.kt:93)
        at org.gradle.kotlin.dsl.support.bytecode.AsmExtensionsKt.publicClass-LgnzLRE(AsmExtensions.kt:37)
        at org.gradle.kotlin.dsl.execution.ResidualProgramCompiler.program-7MEG69U(ResidualProgramCompiler.kt:521)
        at org.gradle.kotlin.dsl.execution.ResidualProgramCompiler.access$program-7MEG69U(ResidualProgramCompiler.kt:93)
        at org.gradle.kotlin.dsl.execution.ResidualProgramCompiler.emitDynamicProgram(ResidualProgramCompiler.kt:638)
        at org.gradle.kotlin.dsl.execution.ResidualProgramCompiler.compile(ResidualProgramCompiler.kt:107)
        at org.gradle.kotlin.dsl.execution.Interpreter$emitSpecializedProgramFor$cachedDir$1.invoke(Interpreter.kt:296)
        at org.gradle.kotlin.dsl.execution.Interpreter$emitSpecializedProgramFor$cachedDir$1.invoke(Interpreter.kt:72)
        at org.gradle.kotlin.dsl.cache.ScriptCache.initializeCacheDir(ScriptCache.kt:114)
        at org.gradle.kotlin.dsl.cache.ScriptCache.access$initializeCacheDir(ScriptCache.kt:37)
        at org.gradle.kotlin.dsl.cache.ScriptCache$cacheDirFor$1.execute(ScriptCache.kt:60)
        at org.gradle.kotlin.dsl.cache.ScriptCache$cacheDirFor$1.execute(ScriptCache.kt:37)
        at org.gradle.cache.internal.DefaultPersistentDirectoryCache$Initializer.initialize(DefaultPersistentDirectoryCache.java:98)
        at org.gradle.cache.internal.FixedSharedModeCrossProcessCacheAccess$1.run(FixedSharedModeCrossProcessCacheAccess.java:85)
        at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.doWriteAction(DefaultFileLockManager.java:207)
        at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.writeFile(DefaultFileLockManager.java:197)
        at org.gradle.cache.internal.FixedSharedModeCrossProcessCacheAccess.open(FixedSharedModeCrossProcessCacheAccess.java:83)
        at org.gradle.cache.internal.DefaultCacheAccess.open(DefaultCacheAccess.java:142)
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:78)
        ... 137 more


* Get more help at https://help.gradle.org

BUILD FAILED in 2s

Context

  • I'm trying to migrate a large monolithic project from Ant to Gradle.
  • I'm not using any Ant targets in my Gradle build script.
  • When the Gradle Kotlin Built Script becomes sufficiently large, project configuration keeps failing.

Steps to Reproduce (for bugs)

  • I made a sample project, with a build script longer than 65K character, here is the link GitHub Link.
  • Running gradlew.bat, will give throw java.lang.IllegalArgumentException.

Your Environment

  • gradle --version
------------------------------------------------------------
Gradle 5.2-20181230000028+0000
------------------------------------------------------------

Build time:   2018-12-30 00:00:28 UTC
Revision:     5556139b12cca73f6e4e36d3c2d61b7d9fda159c

Kotlin DSL:   1.1.0
Kotlin:       1.3.11
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          1.8.0_192 (Oracle Corporation 25.192-b12)
OS:           Windows 10 10.0 amd64
  • Version of IntelliJ or Android Studio (in About menu you can copy version information)
IntelliJ IDEA 2018.3.3 (Ultimate Edition)
Build #IU-183.5153.8, built on December 24, 2018
JRE: 1.8.0_152-release-1343-b26 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
@JLLeitschuh
Copy link
Contributor

Could you please report an issue at https://kotl.in/issue and link back to it here?
I think this is just a bug in the Kotlin Compiler. Good find, and I like the really simple reproduction sample you have.

@bhanutejags
Copy link
Author

I created an issue at https://kotl.in/issue
Here is the link to the issue: https://youtrack.jetbrains.com/issue/KT-29109?project=kt

@abelkov
Copy link

abelkov commented Jan 11, 2019

Kotlin compiler bug that is causing the problem: https://youtrack.jetbrains.com/issue/KT-13213

@eskatos eskatos changed the title Could not open cache directory: java.lang.IllegalArgumentException Script >64KB leads to Could not open cache directory: java.lang.IllegalArgumentException Jan 18, 2019
@eskatos
Copy link
Member

eskatos commented Jan 18, 2019

Thank you for the report @bhanutejags.

The stacktraces are very similar but the issue reported here is with the Gradle Kotlin DSL, not the Kotlin compiler.

Caused by: java.lang.IllegalArgumentException
        at org.jetbrains.org.objectweb.asm.ByteVector.putUTF8(ByteVector.java:213)
        at org.jetbrains.org.objectweb.asm.ClassWriter.newUTF8(ClassWriter.java:1141)
        at org.jetbrains.org.objectweb.asm.ClassWriter.newStringishItem(ClassWriter.java:1163)
        at org.jetbrains.org.objectweb.asm.ClassWriter.newConstItem(ClassWriter.java:1091)
        at org.jetbrains.org.objectweb.asm.MethodWriter.visitLdcInsn(MethodWriter.java:1165)
        at org.gradle.kotlin.dsl.support.bytecode.AsmExtensionsKt.LDC(AsmExtensions.kt:163)
        at org.gradle.kotlin.dsl.execution.ResidualProgramCompiler.emitCompileSecondStageScript(ResidualProgramCompiler.kt:357)

vs.

Caused by: java.lang.IllegalArgumentException
 at org.jetbrains.org.objectweb.asm.ByteVector.putUTF8(ByteVector.java:213)
 at org.jetbrains.org.objectweb.asm.ClassWriter.newUTF8(ClassWriter.java:1092)
 at org.jetbrains.org.objectweb.asm.ClassWriter.newString(ClassWriter.java:1525)
 at org.jetbrains.org.objectweb.asm.ClassWriter.newConstItem(ClassWriter.java:1042)
 at org.jetbrains.org.objectweb.asm.MethodWriter.visitLdcInsn(MethodWriter.java:1126)
 at org.jetbrains.org.objectweb.asm.MethodVisitor.visitLdcInsn(MethodVisitor.java:595)
 at org.jetbrains.org.objectweb.asm.tree.LdcInsnNode.accept(LdcInsnNode.java:71)
 at org.jetbrains.org.objectweb.asm.tree.InsnList.accept(InsnList.java:162)
 at org.jetbrains.org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:817)
 at org.jetbrains.kotlin.codegen.optimization.OptimizationMethodVisitor.visitEnd(OptimizationMethodVisitor.java:90)

@bamboo bamboo self-assigned this Jan 23, 2019
@bamboo bamboo added this to the 1.1.2 milestone Jan 23, 2019
bamboo added a commit that referenced this issue Jan 23, 2019
By storing large scripts as a resource instead of a script constant in
the emitted bytecode.

Resolves #1305
@bamboo
Copy link
Member

bamboo commented Jan 24, 2019

Closing as fixed in 1.1.2.

@bamboo bamboo closed this as completed Jan 24, 2019
@pun-ky
Copy link

pun-ky commented Oct 3, 2019

still occurring:

------------------------------------------------------------
Gradle 5.6.2
------------------------------------------------------------

Build time:   2019-09-05 16:13:54 UTC
Revision:     55a5e53d855db8fc7b0e494412fc624051a8e781

Kotlin:       1.3.41
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.14 compiled on March 12 2019
JVM:          1.8.0_121 (Oracle Corporation 25.121-b13)
OS:           Windows 10 10.0 amd64

image

on https://github.com/Cognifide/gradle-aem-multi

@eskatos
Copy link
Member

eskatos commented Oct 3, 2019

@pun-ky this isn't related to this issue, the error message is very different.

Please open new issues with the Gradle Kotlin DSL on https://github.com/gradle/gradle/issues
This repository, kotlin-dsl-samples, is for samples only.

@pun-ky
Copy link

pun-ky commented Oct 3, 2019

sure

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

6 participants