sbt / sbt/sbt-eclipse

Wrong defaults for CrossProject builds in EclipseKeys.eclipseOutput

Open
#330 2 comments 1 reaction 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

There appears to be an issue with shared sources in ScalaJS crossProject builds with Eclipse.

Consider a standard setup of

lazy val test = crossProject.in(file(".")).
  settings(
    name := "Test",
    EclipseKeys.useProjectId := true
  ).
  jvmSettings(
    libraryDependencies += "org.scala-js" %% "scalajs-stubs" % scalaJSVersion % "provided"
  ).
  jsSettings(
    libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "0.9.1"
  )

If I import into eclipse like this, Eclipse finds the shared folders, but it sets their output folders to the source folder. See (from .classpath in the JS project):

  <classpathentry kind="src" path="src/main/scala"/>
  <classpathentry kind="src" path="src/main/resources"/>
  <classpathentry kind="src" path="src/test/scala"/>
  <classpathentry kind="src" path="src/test/resources"/>
  <classpathentry output="-Users-lkroll-Documents-Programming-test-shared-src-main-scala" kind="src" path="-Users-lkroll-Documents-Programming-test-shared-src-main-scala"/>
  <classpathentry output="-Users-lkroll-Documents-Programming-test-shared-src-test-scala" kind="src" path="-Users-lkroll-Documents-Programming-test-shared-src-test-scala"/>

When I set eclipseOutput manually to some other folder, it generates the correct output, as seen below.

lazy val test = crossProject.in(file(".")).
  settings(
    name := "Test",
    EclipseKeys.useProjectId := true,
    EclipseKeys.eclipseOutput := Some("./etarget")
  ).
  jvmSettings(
    libraryDependencies += "org.scala-js" %% "scalajs-stubs" % scalaJSVersion % "provided"
  ).
  jsSettings(
    libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "0.9.1"
  )
<classpathentry output="./etarget" kind="src" path="src/main/scala"/>
  <classpathentry output="./etarget" kind="src" path="src/main/resources"/>
  <classpathentry output="./etarget" kind="src" path="src/test/scala"/>
  <classpathentry output="./etarget" kind="src" path="src/test/resources"/>
  <classpathentry output="./etarget" kind="src" path="-Users-lkroll-Documents-Programming-test-shared-src-main-scala"/>
  <classpathentry output="./etarget" kind="src" path="-Users-lkroll-Documents-Programming-test-shared-src-test-scala"/>

I don't know how sbt-eclipse decides what output path to default to when eclipseOutput is None, but at least in this case it's not the right thing.
This might, of course, be an issue on the ScalaJS plugin side, I don't know.

Edit: Sorry forgot to write versions:

  • sbt 0.13.12
  • sbteclipse 5.1.0
  • sbtscalajs 0.6.14

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

Reproduce the provided Scala.js crossProject setup with sbt 0.13.12, sbteclipse 5.1.0, and sbtscalajs 0.6.14. Inspect the generated .classpath entries when EclipseKeys.eclipseOutput is None and compare them with the manually configured output. Done means shared source entries no longer use their source folders as output paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.