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

name setting isn't taken from cross project but from lazy val name #4

Open
fkz opened this issue Jan 22, 2017 · 1 comment
Open

name setting isn't taken from cross project but from lazy val name #4

fkz opened this issue Jan 22, 2017 · 1 comment
Assignees
Labels

Comments

@fkz
Copy link

fkz commented Jan 22, 2017

Consider the following build.sbt:

lazy val somename := (project in file("somefile")).settings(
  name := "super-cool-name",
  organization := "organization-name"
  // ...
).cross

lazy val somename_2_11 = somename("2.11.8")
lazy val somename_2_12 = somename("2.12.1")

Let's test some values in sbt:

> somename-2_11/name
[info] somename
> somename-2_11/organization
[info] organization-name

so the name is used from the name of the lazy val instead of the name setting in the project. For organization, libraryDependencies and others it works perfectly though.

Workaround is to add .setting(name := "super-cool-name") to all subprojects. But it would be great if this wouldn't be needed.

pauldraper added a commit that referenced this issue Jan 24, 2017
Use originalName and AutoPlugin
@pauldraper
Copy link
Contributor

This happens because project is a macro equivalent to

lazy val somename = Project("somename", file("somefile"))

sbt-cross uniquifies somename id to somename-2_11. Since by default SBT uses the id as name, which would cause the undesirable somename-2_11 to appear in Ivy, etc., sbt-cross overrides name to be the original id somename.


Workaround 1

lazy val `some-cool-name` = (project in file("somefile")).settings(
  organization := "organization-name",
  // ...
)

Workaround 2

lazy val somename = Project("some-cool-name", file("somefile")).settings(
  organization := "organization-name",
  // ...
)

Workaround 3

Write name := "some-cool-name" in somefile/build.sbt.

Note: Workarounds 1 and 2 change ids (the things you use in the SBT console) to some-cool-name-2_11 and some-cool-name-2_12, which may or may not be acceptable.


I pushed a fix. See README.md for using latest master. Let me know if it works.

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

2 participants