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

Dependent module Scala compilation in test context fails for 4.10.1 #6735

Closed
hhandoko opened this issue Sep 13, 2018 · 10 comments

Comments

@hhandoko
Copy link

commented Sep 13, 2018

Expected Behavior

Compiling Scala in multi-module project which share some test classes should work, e.g. ./gradlew clean testClasses

Current Behavior

Gradle 4.10.1 fails to compile Scala test classes for a dependent module which share some test classes, the same project compiles fine in Gradle 4.10.

Context

The multi-module project is sharing some classes in the test context.

As an example, there are two modules: core and calculation (where calculation depends on core), the Gradle config in the dependent module as defined follows:

dependencies {
    testCompile project(':core').sourceSets.test.output
}

Trying to run testClasses for the dependent module resulted in the following error:

Execution failed for task ':calculation:compileTestScala'.
java.io.FileNotFoundException: /Users/hhandoko/some-project/modules/core/build/classes/scala/test (Is a directory)

Without a fix, test Scala classes cannot be compiled and tests cannot run.

Steps to Reproduce (for bugs)

  1. Create a Scala-based multi-module project which share / reuse classes in the test context
  2. Apply similar configuration as described in context section above
  3. Run compilation in the test context, e.g. ./gradlew testClasses and observe failure

Your Environment

  • OS: macOS High Sierra 10.13.6
  • JDK: Azul Zulu 1.8 U172
  • Build scan URL: N/A
@oehme

This comment has been minimized.

Copy link
Member

commented Sep 13, 2018

Please provide the full stacktrace.

@wolfs

This comment has been minimized.

Copy link
Member

commented Sep 13, 2018

@big-guy Has this maybe been caused by #6646?

@big-guy

This comment has been minimized.

Copy link
Member

commented Sep 13, 2018

@wolfs I think so.

@hhandoko as a workaround, can you try:

compileTestScala {
   analysisFiles.setFrom(files())
}
big-guy added a commit that referenced this issue Sep 13, 2018
@hhandoko

This comment has been minimized.

Copy link
Author

commented Sep 14, 2018

@oehme here's the stacktrace:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':calculation:compileTestScala'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
        at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
        at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
        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.api.UncheckedIOException: java.io.FileNotFoundException: /Users/hhandoko/some-project/modules/core/build/classes/scala/test (Is a directory)
        at org.gradle.language.scala.tasks.AbstractScalaCompile.resolveAnalysisMappingsForOtherProjects(AbstractScalaCompile.java:167)
        at org.gradle.language.scala.tasks.AbstractScalaCompile.configureIncrementalCompilation(AbstractScalaCompile.java:137)
        at org.gradle.language.scala.tasks.AbstractScalaCompile.compile(AbstractScalaCompile.java:101)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:801)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:768)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
        ... 31 more
Caused by: java.io.FileNotFoundException: /Users/hhandoko/some-project/modules/core/build/classes/scala/test (Is a directory)
        at com.google.common.io.Files$FileByteSource.openStream(Files.java:126)
        at com.google.common.io.Files$FileByteSource.openStream(Files.java:116)
        at com.google.common.io.ByteSource$AsCharSource.openStream(ByteSource.java:435)
        at com.google.common.io.CharSource.getInput(CharSource.java:94)
        at com.google.common.io.CharSource.getInput(CharSource.java:65)
        at com.google.common.io.CharStreams.readLines(CharStreams.java:344)
        at com.google.common.io.Files.readLines(Files.java:741)
        at com.google.common.io.Files.readLines(Files.java:712)
        at org.gradle.language.scala.tasks.AbstractScalaCompile.resolveAnalysisMappingsForOtherProjects(AbstractScalaCompile.java:163)
        ... 47 more

@hhandoko

This comment has been minimized.

Copy link
Author

commented Sep 14, 2018

@big-guy the workaround works. Can you tell me what exactly it does? Just wanting to know whether I should keep or remove it once a fix is available.

@big-guy

This comment has been minimized.

Copy link
Member

commented Sep 14, 2018

@hhandoko It prevents Zinc from doing incremental compilation when upstream changes occur in other projects. In your case, this never worked for dependencies like project(':core').sourceSets.test.output, but it would have worked for dependencies on the main source code (project(':core')).

You would remove this once we had a full fix.

@marcphilipp marcphilipp added this to the 4.10.2 milestone Sep 14, 2018

big-guy added a commit that referenced this issue Sep 17, 2018
@big-guy

This comment has been minimized.

Copy link
Member

commented Sep 17, 2018

@hhandoko Could you give 4.10.2-20180917175211+0000 a try without any of the workaround?

You can upgrade with gradlew wrapper --gradle-version=4.10.2-20180917175211+0000.

@big-guy big-guy closed this in b106f7a Sep 17, 2018

big-guy added a commit that referenced this issue Sep 17, 2018
Merge remote-tracking branch 'origin/release'
* origin/release:
  Bump to 4.10.2 nightly
  Recommend people update to 4.10.2, not base 4.10
  Reset public API and baseline for comparison
  Bump to 4.10.2
  Fix #6750
  Fix #6735
@big-guy

This comment has been minimized.

Copy link
Member

commented Sep 19, 2018

Hey @hhandoko, have you had a chance to try the nightly out? If it looks good to you, this will become 4.10.2

@hhandoko

This comment has been minimized.

Copy link
Author

commented Sep 20, 2018

Not yet @big-guy , I'll get back to you by Monday the latest.

I'll need some time to setup a new project to validate the fix, as I can only retrieve released and snapshot binaries (proxied via Artifactory) where I work.

@hhandoko

This comment has been minimized.

Copy link
Author

commented Sep 26, 2018

@big-guy I couldn't download the nightly version, but can confirm the 4.10.2 release version works. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.