sbt / sbt/sbt-eclipse

EclipseKeys.eclipseOutput isn't used for play generated routes

Open
#308 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
712
Forks
163
PR merge metrics
No merged PRs in 30d

Description

Using bin as the default output directory for eclipse generated class files can be problematic for projects that use that directory for scripts or other purposes. But if I override the eclipseOutput variable by adding the following line to build.sbt it isn't used as the target for Play Framework generated route files:

EclipseKeys.eclipseOutput in ThisBuild := Some(".target/bin")

To reproduce this in a Play Framework:

  • Add the line above to build.sbt.
  • Re-create the eclipse settings for example with: sbt 'eclipse with-source=true skip-parents=false'
  • Open your project in Eclipse and clean the project to force a build
  • Observe that there are files in both bin/ and .target/bin such as bin/Routes.class and .target/bin/routes
    The .classpath has entries to store some but not all objects in the dir (note in particular the last entry):
  <classpathentry output=".target/bin" kind="src" path="app-2.11"/>
  <classpathentry output=".target/bin" kind="src" path="app"/>
  <classpathentry output=".target/bin" kind="src" path="conf"/>
  <classpathentry output=".target/bin" kind="src" path="test/resources"/>
  <classpathentry output=".target/bin" kind="src" path="test-2.11"/>
  <classpathentry excluding="resources/" output=".target/bin" kind="src" path="test"/>
  <classpathentry kind="output" path="bin"/>

Glancing at the source, it appears that settings are using createSrc here and here but that the createSrc implementation does not use the setting. Should it use the eclipseOutput function to set this?
Empirically, if I manually edit the last entry from above to be the following, the source is all put in the proper place:

  <classpathentry kind="output" path=".target/bin"/>

It looks to my eye as though this line is where all the uses of "bin" could properly be set to the eclipseOutput setting.
Separately, not everyone on our team uses Eclipse, so it would be nice to be able to set this default in the global plugin settings without having to alter all the build.sbt files with tooling. Is there some way to do this?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/main/scala/com/typesafe/sbteclipse/core/Eclipse.scala and EclipsePlugin.scala, focusing on createSrc and the output entry assembled around the cited lines. Reproduce the Play Framework case with the given build.sbt setting and Eclipse command, then verify that generated routes and the .classpath output use .target/bin rather than bin.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.