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

Root project aggregation broken by plugin overriding `extraProjects` #4185

Open
dotta opened this Issue Jun 8, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@dotta

dotta commented Jun 8, 2018

steps

A minimized project to reproduce the issue is included in the attached zip, but here are the steps:

  1. Create an autoplugin that adds a project to the build via the extraProjects hook:
import sbt._

object MyPlugin extends AutoPlugin {
  override def requires: Plugins = plugins.JvmPlugin
  override def trigger: PluginTrigger = allRequirements

  private val myExtraProject = Project("my-extra-project", file("target"))
  
  override def extraProjects: Seq[Project] = super.extraProjects ++ Seq(myExtraProject)
}
  1. Create a build.sbt file:
// build.sbt
lazy val a = (project in file("a"))
  1. Create a Foo.scala file defined inside a/src/main/scala, e.g.,:
// a/src/main/scala/Foo.scala
class Foo

sbt-bug2.zip

problem

Execute sbt compile and you'll see no classfile is generated:

$ sbt compile
...
[info] Done updating.
[success] Total time: 0 s, completed Jun 8, 2018 5:54:52 PM
$ ls -l a/
total 0
drwxr-xr-x  3 mirco  staff  102 Jun  8 17:47 src/

The problem is the aggregation of the automatically created root project, which is aggregating on the project created by the plugin (i.e., my-extra-project) instead of aggregating the projects in the build.

expectation

A target folder inside the a project should exist, and a Foo.class should be in there. Said otherwise, root project aggregation should work as usual.

notes

sbt version: 1.1.5 (but the same happens with 0.13.15)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment