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

tasks.withType(ScalaCompile::class.java).configureEach fails on multi-project builds #6558

Closed
dsilva opened this issue Aug 29, 2018 · 7 comments
Assignees
Labels
Milestone

Comments

@dsilva
Copy link

dsilva commented Aug 29, 2018

On a multi-project build, using tasks.withType(ScalaCompile::class.java).configureEach leads to a ConcurrentModificationException in the compileScala task.

Here's a git repository that reproduces the issue: https://github.com/dsilva/repro-tasks-withtype-ScalaCompile-configureEach

Expected Behavior

Build should succeed.

Current Behavior

Gradle crashes.

Context

I'm trying to use the new tasks API:

https://blog.gradle.org/preview-avoiding-task-configuration-time
https://docs.gradle.org/current/userguide/task_configuration_avoidance.html

Steps to Reproduce (for bugs)

See https://github.com/dsilva/repro-tasks-withtype-ScalaCompile-configureEach

git clone https://github.com/dsilva/repro-tasks-withtype-ScalaCompile-configureEach.git
while ./gradlew clean :a:classes --no-build-cache -S; do sleep 1; done

Your Environment

  • Build scan URL:
@lacasseio
Copy link
Contributor

I can confirm this is still an issue on latest master. So most likely an issue for as well 4.10 since the wrapper of the repo is 4.9.

@big-guy
Copy link
Member

big-guy commented Sep 5, 2018

@oehme this may be a 4.10.1 candidate

@big-guy big-guy added this to the 4.10.1 milestone Sep 5, 2018
big-guy added a commit that referenced this issue Sep 5, 2018
big-guy added a commit that referenced this issue Sep 5, 2018
big-guy added a commit that referenced this issue Sep 6, 2018
big-guy added a commit that referenced this issue Sep 6, 2018
big-guy added a commit that referenced this issue Sep 10, 2018
big-guy added a commit that referenced this issue Sep 10, 2018
big-guy added a commit that referenced this issue Sep 11, 2018
* origin/release:
  Upgrade Kotlin DSL to 1.0-RC5
  Introduce `AutoAppliedBuildScanPlugin#addBuildScanPluginDependencySpecTo`
  Assert all tasks are executed as expected when tasks come from rules
  Workaround rule problems described in #6249
  Look for domain objects created by rules in named
  Fix unit test on Windows
  Ensure that ide destroy tasks always run before generate tasks
  Make binary compatibility check happy
  Reduce visibility of methods in AbstractScalaCompile
  Move configuration of the publication to Scala plugin
  Fix unit tests and doc TODOs
  Reintroduce separate configuration to resolve incremental analysis files
  Add publication late to avoid interfering with default publications
  Make task property validator happy
  Convert test to Spock
  Usage variant aware dependency management to share analysis files
  Rename test
  Avoid iterating over tasks in subprojects from ScalaCompile
  Reduce #6558 into generic task
  Reproduce failure in #6558
@wolfs
Copy link
Member

wolfs commented Sep 12, 2018

This is fixed in 4.10.1

@wolfs wolfs closed this as completed Sep 12, 2018
@drujd
Copy link

drujd commented Sep 13, 2018

This 'fix' breaks our build which worked flawlessly on 4.10.
Every scala project:

Cannot choose between the following variants of project XXX
          - apiElements
          - incrementalScalaAnalysisElements
          - runtimeElements
        All of them match the consumer attributes:
          - Variant 'apiElements': Found org.gradle.usage 'java-api' but wasn't required.
          - Variant 'incrementalScalaAnalysisElements': Found org.gradle.usage 'incremental-analysis' but wasn't required.
          - Variant 'runtimeElements': Found org.gradle.usage 'java-runtime-jars' but wasn't required.

@big-guy
Copy link
Member

big-guy commented Sep 13, 2018

@drujd can you describe a bit more about how your build is setup? Could you share a build scan?

Do you have a mixture of Scala and Java projects or just Scala projects or something else?

Thanks!

@big-guy
Copy link
Member

big-guy commented Sep 14, 2018

@drujd I think this is what you're running into: #6750

I'll have a nightly for you to try out early next week and we'll put out a 4.10.2.

@drujd
Copy link

drujd commented Sep 15, 2018

That's great! I unfortunately cannot share a build scan, but I will try out the nightly - if it does not work, I will try to create a sample project that replicates the issue. It really looks that #6750 is the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants