These are chat archives for sbt/sbt

14th
Aug 2017
Grant
@gavares
Aug 14 02:27
I'm not having any luck getting the new local-preloaded feature to work for me using sbt 1.0
We use internal artifactory to proxy all external libs and override the default set of repositories with -Dsbt.repository.config=project/repositories.conf
I'd found something suggesting that we might add local-preloaded as a repository entry to repositories.conf but any attempt to do that results in exceptions during sbt startup:
java.lang.RuntimeException: Expected one of local, maven-local, maven-central, scala-tools-releases, scala-tools-snapshots, sonatype-oss-releases, sonatype-oss-snapshots, jcenter, got 'local-preloaded'.
Wayne Wang
@WayneWang12
Aug 14 04:10
Hi guys~~~ I've updated my sbt to version 1.0 recently. However, there seems some problem. It stucks in downloading some plugins for almost two days and still not done. Is there any more configuration I need to do to download sbt-plugins?
Wayne Wang
@WayneWang12
Aug 14 06:14
Just my network problem...sorry for disrubtion..
Dale Wijnand
@dwijnand
Aug 14 08:52
@melrief TaskKey[T]("") creates a task key with an empty name (which I don't think will get you very far) and no description. taskKey[T]("") will use the val name on the left-hand side to define the key name, and it will have an empty description.
Ólafur Páll Geirsson
@olafurpg
Aug 14 09:14
is it possible to detect from a State if a project is a metabuild? What i'd like to do is to enable a compiler plugin only for sbt metabuilds but not users projects
Dale Wijnand
@dwijnand
Aug 14 09:15
yeah, but it's not an obvious key
Ólafur Páll Geirsson
@olafurpg
Aug 14 09:15
I'd like to do something like
libraryDependencies ++= {
  if (isMetabuild) compilerPlugin(magic) :: Nil
  else Nil
}
Ólafur Páll Geirsson
@olafurpg
Aug 14 09:20
@dwijnand /Users/ollie/.sbt/0.13/build.sbt:24: error: A setting cannot depend on a task :sob:
I suppose what I'm trying to accomplish is not meant to be, or I will need more powerful medicine
Ólafur Páll Geirsson
@olafurpg
Aug 14 09:31

@dwijnand Seems I can use this for starters

libraryDependencies ++= {
  val sbthost = "org.scalameta" % "sbthost-nsc" % "0.2.0" cross CrossVersion.full
  val isMetabuild = {
    val p = thisProject.value
    p.id.endsWith("-build") && p.base.getName == "project"
  }
  if (isMetabuild) compilerPlugin(sbthost) :: Nil
  else Nil
}

The heuristic can definitely be fine-tuned. Thanks for the help, I didn't know about Project.inPluginProject :smile:

Dale Wijnand
@dwijnand
Aug 14 09:38
yeah, just be careful how many of these precarious towers of cards you build your software on.. :-/
Ólafur Páll Geirsson
@olafurpg
Aug 14 09:47
If there is a better way to accomplish the same, then I'm all ears
Dale Wijnand
@dwijnand
Aug 14 09:49
None that I know currently.
But it sounds like a reasonable feature request.
Ólafur Páll Geirsson
@olafurpg
Aug 14 09:53
Reported sbt/sbt#3436 @dwijnand
Dale Wijnand
@dwijnand
Aug 14 09:53
:+1:
Will Sargent
@wsargent
Aug 14 14:07
I'm attempting a cross build of interplay, and i keep getting the following:
[warn]     Note: Unresolved dependencies path:
[warn]         com.jsuereth:sbt-pgp:1.1.0-M1 (scalaVersion=2.12, sbtVersion=0.13) (/home/wsargent/work/interplay/build.sbt#L9-10)
[warn]           +- com.typesafe.play:interplay:1.3.8-SNAPSHOT (scalaVersion=2.12, sbtVersion=1.0)
[warn]         com.github.gseitz:sbt-release:1.0.6 (scalaVersion=2.12, sbtVersion=0.13) (/home/wsargent/work/interplay/build.sbt#L8-9)
[warn]           +- com.typesafe.play:interplay:1.3.8-SNAPSHOT (scalaVersion=2.12, sbtVersion=1.0)
[warn]         org.xerial.sbt:sbt-sonatype:2.0 (scalaVersion=2.12, sbtVersion=0.13) (/home/wsargent/work/interplay/build.sbt#L11-12)
[warn]           +- com.typesafe.play:interplay:1.3.8-SNAPSHOT (scalaVersion=2.12, sbtVersion=1.0)
[warn]         com.lightbend:sbt-whitesource:0.1.5 (scalaVersion=2.12, sbtVersion=0.13) (/home/wsargent/work/interplay/build.sbt#L12-13)
[warn]           +- com.typesafe.play:interplay:1.3.8-SNAPSHOT (scalaVersion=2.12, sbtVersion=1.0)
[warn]         org.foundweekends:sbt-bintray:0.5.1 (scalaVersion=2.12, sbtVersion=0.13) (/home/wsargent/work/interplay/build.sbt#L10-11)
[warn]           +- com.typesafe.play:interplay:1.3.8-SNAPSHOT (scalaVersion=2.12, sbtVersion=1.0)
why is it trying to resolving 2.12 scala version with 0.13 sbt version?
also, I think bintray-sbt has been replaced by eedsign's sbt-bintray, but I am not sure about this
N.S. Cutler
@godenji
Aug 14 14:19
@wsargent what sbt version is in your project/build.properties?
Will Sargent
@wsargent
Aug 14 14:20
@godenji 0.13.16
N.S. Cutler
@godenji
Aug 14 14:20
and you get the warnings on startup or after compile?
Will Sargent
@wsargent
Aug 14 14:20
yah, in resolution
N.S. Cutler
@godenji
Aug 14 14:21
I have seen some plugin defs like addSbtPlugin("foo" %% "bar" % version)
Will Sargent
@wsargent
Aug 14 14:23
those are for project cross builds
N.S. Cutler
@godenji
Aug 14 14:23
hang on, just cloned the repo, it's downloading the universe.
k, yeah, I see, when ^^1.0.0 followed by compile I get the same as above
I don't get how the cross build urls work
brb
N.S. Cutler
@godenji
Aug 14 14:29
@wsargent hang on, did you set cross versions in the build? crossSbtVersions := Seq("1.0.0", "0.13.16")
Will Sargent
@wsargent
Aug 14 14:40
import java.util.Locale

libraryDependencies ++= Seq(
  "org.scala-sbt" % "scripted-plugin" % sbtVersion.value,
  "com.typesafe" % "config" % "1.3.1"
)

addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.6")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0-M1")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0")
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.5")

lazy val build = (project in file(".")).
  enablePlugins(BuildInfoPlugin).
  settings(
      buildInfoKeys := libraryDependencies.value.map { module =>
      val key = "-([a-z])".r.replaceAllIn(module.name, matched => matched.group(1).toUpperCase(Locale.ENGLISH)) + "Version"
      (key -> module.revision): BuildInfoKey
    }
  )  .settings(
  scalaVersion := "2.12.2",
  sbtVersion in Global := "1.0.0",
  crossSbtVersions := Seq("1.0.0", "0.13.16"),
  scalaCompilerBridgeSource := {
    val sv = appConfiguration.value.provider.id.version
    ("org.scala-sbt" % "compiler-interface" % sv % "component").sources
  }
)

unmanagedSourceDirectories in Compile += baseDirectory.value.getParentFile / "src" / "main" / "scala"
works a bunch better and I DO see some downloads
now I'm on to
[warn]     ::::::::::::::::::::::::::::::::::::::::::::::
[warn]     ::          UNRESOLVED DEPENDENCIES         ::
[warn]     ::::::::::::::::::::::::::::::::::::::::::::::
[warn]     :: org.scala-sbt#scripted-plugin;1.0.0: not found
[warn]     ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]     Note: Unresolved dependencies path:
[warn]         org.scala-sbt:scripted-plugin:1.0.0 (/home/wsargent/work/interplay/project/plugins.sbt#L3-7)
[warn]           +- build:build:0.1-SNAPSHOT (scalaVersion=2.12, sbtVersion=1.0)
sbt.ResolveException: unresolved dependency: org.scala-sbt#scripted-plugin;1.0.0: not found
    at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:313)
N.S. Cutler
@godenji
Aug 14 14:52
@wsargent try %% with scripted plugin, somewhere I saw that that is required for cross building
Will Sargent
@wsargent
Aug 14 14:53
@godenji okay that worked
now I am onto autoplugin issues
is %% with scripted documented anywhere?
otherwise I will file an issue
Dale Wijnand
@dwijnand
Aug 14 14:54
Not to my knowledge.
Will Sargent
@wsargent
Aug 14 14:57
also where is crossSbtVersions := Seq("1.0.0", "0.13.16") documented
docs also says "Hopefully the last step will be simplified using @jrudolph’s sbt-cross-building in the future. If you run into problems upgrading a plugin, please report to GitHub issue." but sbt-cross-building project is deprecated and says everything was merged into sbt
Will Sargent
@wsargent
Aug 14 15:05
filed sbt/sbt#3441
Will Sargent
@wsargent
Aug 14 15:51
gah, still failing
[error] /home/travis/build/playframework/interplay/src/main/scala/interplay/PlayBuildBase.scala:127: value scriptedSettings is not a member of object sbt.ScriptedPlugin
Will Sargent
@wsargent
Aug 14 16:01
am getting things like
[error] /home/wsargent/work/interplay/src/main/scala/interplay/Playdoc.scala:25: value *** is not a member of sbt.File
[error]         base.***.get pair relativeTo(base.getParentFile)
[error]              ^
[error] /home/wsargent/work/interplay/src/main/scala/interplay/Playdoc.scala:25: not found: value relativeTo
[error]         base.***.get pair relativeTo(base.getParentFile)
[error]                           ^
[error] /home/wsargent/work/interplay/src/main/scala/interplay/Playdoc.scala:28: value copy is not a member of sbt.librarymanagement.Artifact
[error]       artifact in playdocPackage ~= { _.copy(configurations = Seq(Docs)) }
[error]                                         ^
[error] /home/wsargent/work/interplay/src/main/scala/interplay/Playdoc.scala:28: not found: value configurations
[error]       artifact in playdocPackage ~= { _.copy(configurations = Seq(Docs)) }
[error]                                              ^
[warn] two warnings found
and there is nothing in the migration guide
There IS PathFinder’s .* method is renamed to .allPaths method but there is no error message tied to it
all renames and moves should be mentioned in the migration guide, plz
is sbt.librarymanagement.Artifact not a case class / Product any more?
Will Sargent
@wsargent
Aug 14 16:06
sbt/librarymanagement#123 ?
Dale Wijnand
@dwijnand
Aug 14 16:11
no case classes are impossible to change and maintain binary compatibility
so we shed them
Will Sargent
@wsargent
Aug 14 16:11
and there is no more relativeTo
but I don't see the replacement
"
A number of the methods on sbt.Path (such as relativeTo and rebase and flat) are now no longer in the default namespace by virtue of being mixed into the sbt package object. Use sbt.io.Path to access them again."
Again in the release notes!
this should all be in migration
Johannes Rudolph
@jrudolph
Aug 14 16:13
@wsargent seems like the documentation pointing to sbt-cross-building is outdated, the link release notes have more information about how it should work
Will Sargent
@wsargent
Aug 14 16:13
"dreprecations" is misspelled
so basically release notes is migrations but has wrong name?
@jrudolph any clue what value scriptedSettings is not a member of object sbt.ScriptedPlugin means?
Will Sargent
@wsargent
Aug 14 16:18
never mind, I am repeating playframework/interplay#32
Rob Norris
@tpolecat
Aug 14 21:52
If I say scalacOptions in (Compile, console) --= Seq(...) in my build file then how do I ask to see that setting at the sbt prompt?
show Compile:console::scalacOptions shows me nothing at all. If I leave out console it works, I guess because Compile is the default config or something?
How do I fully specify a key?
I spend so much time not being able to manipulate scalacOptions even though I have asked and had questions answered over and over.
Either sbt has a bug or I have a bug, or both.
eugene yokota
@eed3si9n
Aug 14 21:56
I am proposing the unified slash syntax for 1.1, but until then Compile becomes lower case compile:
Rob Norris
@tpolecat
Aug 14 21:56
what does it mean if i capitalize it? nothing?
it's not an error
eugene yokota
@eed3si9n
Aug 14 21:57
it probably should be an error, but it probably delegated up to an unscoped one
Rob Norris
@tpolecat
Aug 14 21:58
ok, i see
eugene yokota
@eed3si9n
Aug 14 21:58
configuration scoping is Stringly
Rob Norris
@tpolecat
Aug 14 21:58
how can i figure out the default config for a key?
eugene yokota
@eed3si9n
Aug 14 21:58
you mean what a particular key would delegate to?
Rob Norris
@tpolecat
Aug 14 21:58
i have a Tut config and a tut task and I type tut by itself which config is selected? I think I may have done something wrong
yes
eugene yokota
@eed3si9n
Aug 14 21:59
inspect tut should show you in the order it would look
and whatever it resolved to
Rob Norris
@tpolecat
Aug 14 22:02
[info] Delegates:
[info]  docs/*:tut
[info]  {.}/*:tut
[info]  */*:tut
so that means the config doesn't matter?
actually nevermind, i'm too frustrated to talk about this
Rob Norris
@tpolecat
Aug 14 22:10
evidently I wanted scalacOptions in Tut and not scalacOptions in (Tut, tut) if i wanted to set options for the tut task
OlegYch
@OlegYch
Aug 14 22:22
why do you have a separate scope?
Rob Norris
@tpolecat
Aug 14 22:39
so i could specify scalacOptions independent of the normal Compile config
so it starts off the same as Compile, test but then you can modify it independently
if, uh, you can figure out how
Moses Nakamura
@mosesn
Aug 14 23:40
hey crew
I’m trying to update to sbt 1.0.0 :sparkles: but we include a script that downloads an sbt-launcher and I can’t find a good place to point it at
this is what it looks like today, but it looks like http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch doesn’t point to something that can point me to 1.0.0