0.11.0-RC0 and plugins

474 views
Skip to first unread message

Mark Harrah

unread,
Sep 3, 2011, 11:51:22 PM9/3/11
to simple-b...@googlegroups.com
First, sbt itself now uses Scala 2.9.1. This is the main reason for
the minor version bump to 0.11. This means that plugins must now
build against 2.9.1 and use 2.9-compatible libraries. Also, the
default Scala version used for a project is the version sbt uses. So,
if you haven't specified the scalaVersion for your project, it will
now use 2.9.1.

Next, there have been some plugin-related changes to mitigate the
problems of publishing and using plugins for different sbt versions.
In the generated metadata for the plugin, either pom.xml or ivy.xml
depending on the value of publishMavenStyle, sbt includes the sbt and
Scala version that the plugin was built against.
Users should now declare dependencies on plugins by passing the
ModueID to the addSbtPlugin method. For example:

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse" % "1.3-RC3")

This is roughly equivalent to doing:

libraryDependencies <+= (scalaVersion in update, sbtVersion) {
(scalaV, sbtV) =>
"com.typesafe.sbteclipse" % "sbteclipse" % "1.3-RC3"
extra("scalaVersion" -> scalaV, "sbtVersion" -> sbtV)
}

The intent is to better avoid mixing plugins for different sbt
versions and to provide a better error message when that happens.
Additionally, please explicitly set publishMavenStyle for your plugin.
I changed it to be false by default for plugins, but I now think that
was a mistake and will change it back for 0.11.0.

The last plugins-related change migrates the contents of
project/plugins/ to project/. This means that:

1. Instead of project/plugins/build.sbt, defing project/plugins.sbt
2. Instead of project/plugins/project/Build.scala, define
project/project/Build.scala

Basically, you can remove plugins/ from the path. The double
project/project/ looks funny, but the model is that it is the project
definition for the project definition. If this is problematic, there
could possibly be an alias to better indicate the purpose of the
second project/ definition.

The 0.10-style project/plugins/ is still supported. If
project/plugins/ exists, the 0.10 style is used and the 0.11 style is
not. I believe the 0.11 style is simpler going forward and would like
to deprecate the 0.10 style for removal in 0.12. The only
disadvantages that I know of are 1) it is different 2) it is 0.1 s
slower on startup for projects that don't define plugins. Feedback on
this change is welcome.

Thanks,
Mark

Frédérick Dubois

unread,
Sep 4, 2011, 12:31:58 AM9/4/11
to simple-b...@googlegroups.com
I like the simplification.

Maybe project/project is funny, but project/plugins/project is funnier.

-Fred
> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To post to this group, send email to simple-b...@googlegroups.com.
> To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.
>
>

--
-Fred

Greg Price

unread,
Sep 4, 2011, 4:19:37 AM9/4/11
to simple-b...@googlegroups.com
On Sat, Sep 3, 2011 at 8:51 PM, Mark Harrah <dmha...@gmail.com> wrote:
> The only disadvantages that I know of are 1) it is different 2) it is 0.1 s
> slower on startup for projects that don't define plugins.  Feedback on
> this change is welcome.

The new names certainly look nicer to me. I'm curious, why does this
way take 0.1 s longer in the no-plugin case than the other way does?
It seems like you ought to be able to stat a lot of files (or do
plenty of other kinds of work) in less time than that.

Cheers,
Greg

Mark Harrah

unread,
Sep 4, 2011, 11:35:30 AM9/4/11
to simple-b...@googlegroups.com
Hi Greg,

Previously, project/*.scala sources were directly compiled without going through a full project. only project/plugins/ was a full project. Now, project/ is a full project. This means that before, if there was no plugins/ directory, a full project didn't have to get loaded. Now, it always does.

Specifically, I don't think any tasks needed to get run before sbt displayed the prompt. Now, sbt runs update+compile on an actual project to build the project definition. When fully warmed up, this doesn't take much time, but the first time probably requires a lot of classes to be loaded and any hotspots compiled. So, I expect you'd be paying that 0.1s anyway, but these things are especially noticeable at startup.

-Mark

> Cheers,
> Greg
>

eugene yokota

unread,
Sep 5, 2011, 12:36:39 AM9/5/11
to simple-b...@googlegroups.com
I just cross published sbt-assembly 0.6 for 0.11.0-RC0 for kicks. (publishMavenStyle := true)

I like the auto-artifact mangling, which lets me rid of the explicit version name mangling!


-eugene

Joachim Hofer

unread,
Sep 5, 2011, 5:19:40 PM9/5/11
to simple-build-tool
Great changes all around, imho!

However, now I have to again change my talk about sbt (and sbt
plugins) on Wednesday...

Cheers,
Joachim

Doug Tangren

unread,
Sep 5, 2011, 11:10:30 PM9/5/11
to simple-b...@googlegroups.com
A little late to the party but I tried to sbt-cross publish coffeescripted-sbt and ran into at least one potential issue which may be a bug on my part.

I caught there there was a change with out the filtering of sources worked so I had to change by code a bit [1] mostly having to do with the filters. I noticed that when I compile this code an empty directory named conspicuously "~" gets created in my project directory. Is this a new sbt 0.11 thing or is this a possible bug in the new filtering code.

Below is a tree of what my source looks like. The ~ is annoying because it gets generated not only with the compilation of plugin but also with the usage of my plugin

deploy@li47-20:~/gh/coffeescripted-sbt$ exit
logout
Connection to 66.246.75.20 closed.
~/code/scala/projects/coffeescripted-sbt (sbt-0.11.0-rc0) ✈ tree
   |---branches
   |---hooks
   |---info
   |---logs
   |-----refs
   |-------heads
   |-------remotes
   |---------origin
   |---objects
   |-----02
   |-----05
   |-----0f
   |-----18
   |-----1a
   |-----1b
   |-----1c
   |-----1d
   |-----1e
   |-----1f
   |-----20
   |-----26
   |-----27
   |-----28
   |-----31
   |-----35
   |-----36
   |-----3a
   |-----3f
   |-----40
   |-----45
   |-----4c
   |-----4f
   |-----57
   |-----58
   |-----59
   |-----5a
   |-----5d
   |-----5e
   |-----62
   |-----63
   |-----66
   |-----69
   |-----6a
   |-----6d
   |-----70
   |-----71
   |-----73
   |-----76
   |-----77
   |-----7a
   |-----80
   |-----82
   |-----84
   |-----88
   |-----8c
   |-----95
   |-----96
   |-----97
   |-----99
   |-----9d
   |-----a6
   |-----a7
   |-----a8
   |-----ad
   |-----b1
   |-----b2
   |-----b4
   |-----b5
   |-----b6
   |-----b7
   |-----b8
   |-----b9
   |-----ba
   |-----bc
   |-----be
   |-----c6
   |-----c8
   |-----ca
   |-----d0
   |-----d4
   |-----d7
   |-----da
   |-----db
   |-----de
   |-----e6
   |-----e8
   |-----ea
   |-----ed
   |-----f2
   |-----f4
   |-----f5
   |-----f7
   |-----f9
   |-----fb
   |-----fc
   |-----fd
   |-----info
   |-----pack
   |---refs
   |-----heads
   |-----remotes
   |-------origin
   |-----tags
   |-notes
   |-project
   |---boot
   |-----other
   |-------net.java.dev.jna
   |---------jna
   |-----------3.2.3
   |-----scala-2.8.1
   |-------lib
   |-------org.scala-tools.sbt
   |---------sbt
   |-----------0.10.1
   |-------------compiler-interface-bin_2.8.1.final
   |-------------compiler-interface-bin_2.9.0.1
   |-------------compiler-interface-src
   |-------------xsbti
   |---plugins
   |-----project
   |-------target
   |---------config-classes
   |---------scala_2.8.1
   |-----target
   |-------scala-2.8.1.final
   |---------cache
   |-----------compile
   |-----------update
   |-------scala-2.9.1
   |---------sbt-0.11.0-RC0
   |-----------cache
   |-------------compile
   |-------------update
   |-------streams
   |---------$global
   |-----------compilers
   |-------------$global
   |-----------ivy-configuration
   |-------------$global
   |-----------ivy-sbt
   |-------------$global
   |-----------project-descriptors
   |-------------$global
   |-----------streams
   |-------------$global
   |-----------update
   |-------------$global
   |---------compile
   |-----------compile
   |-------------$global
   |-----------compile-inputs
   |-------------$global
   |-----------copy-resources
   |-------------$global
   |-----------defined-sbt-plugins
   |-------------$global
   |-----------discovered-main-classes
   |-------------$global
   |---target
   |-----config-classes
   |-----scala_2.8.1
   |-----scala_2.9.1
   |-src
   |---main
   |-----resources
   |-----scala
   |-target
   |---scala-2.8.1.final
   |-----api
   |-------coffeescript
   |-------lib
   |-----cache
   |-------compile
   |---------doc
   |---------package
   |---------package-doc
   |---------package-src
   |-------update
   |-----classes
   |-------coffeescript
   |-------sbt
   |-----resource_managed
   |-------main
   |---------sbt
   |---scala-2.9.1
   |-----sbt-0.11.0-RC0
   |-------api
   |---------coffeescript
   |---------index
   |---------lib
   |-------cache
   |---------compile
   |-----------doc
   |-----------package-bin
   |-----------package-doc
   |-----------package-src
   |---------update
   |-------classes
   |---------coffeescript
   |---------sbt
   |-------resource_managed
   |---------main
   |-----------sbt
   |---streams
   |-----$global
   |-------compilers
   |---------$global
   |-------deliver-local
   |---------$global
   |-------ivy-configuration
   |---------$global
   |-------ivy-sbt
   |---------$global
   |-------make-pom
   |---------$global
   |-------project-descriptors
   |---------$global
   |-------publish-local
   |---------$global
   |-------streams
   |---------$global
   |-------update
   |---------$global
   |-----compile
   |-------compile
   |---------$global
   |-------compile-inputs
   |---------$global
   |-------copy-resources
   |---------$global
   |-------defined-sbt-plugins
   |---------$global
   |-------discovered-main-classes
   |---------$global
   |-------doc
   |---------$global
   |-------package
   |---------$global
   |-------package-bin
   |---------$global
   |-------package-doc
   |---------$global
   |-------package-src
   |---------$global
   |-~
   |-----0.11.0-RC0
   |-------boot
   |---------other
   |-----------net.java.dev.jna
   |-------------jna
   |---------------3.2.3
   |---------scala-2.9.1
   |-----------lib
   |-----------org.scala-tools.sbt
   |-------------sbt
   |---------------0.11.0-RC0
   |-----------------compiler-interface-bin_2.8.0.final
   |-----------------compiler-interface-bin_2.8.1.final
   |-----------------compiler-interface-bin_2.9.0.final
   |-----------------compiler-interface-bin_2.9.1.final
   |-----------------compiler-interface-src
   |-----------------xsbti


Also on a smaller note. I noticed :== was tagged as private now [2]. I had used that previously possible when looking at an example to see how source filtering was done in 0.10. What are the semantic deferences with that and :=. It looks like the main differences is :== takes a precomputed value. Is there a reason why this is now private? Or is it also on the track to becoming deprecated? If so, why is it so heavily used in Defaults.scala


-Doug Tangren
http://lessis.me



Doug Tangren

unread,
Sep 5, 2011, 11:13:11 PM9/5/11
to simple-b...@googlegroups.com
On Mon, Sep 5, 2011 at 11:10 PM, Doug Tangren <d.ta...@gmail.com> wrote:
A little late to the party but I tried to sbt-cross publish coffeescripted-sbt and ran into at least one potential issue which may be a bug on my part.

I caught there there was a change with out the filtering of sources worked so I had to change by code a bit [1] mostly having to do with the filters. I noticed that when I compile this code an empty directory named conspicuously "~" gets created in my project directory. Is this a new sbt 0.11 thing or is this a possible bug in the new filtering code.

Below is a tree of what my source looks like. The ~ is annoying because it gets generated not only with the compilation of plugin but also with the usage of my plugin


Also, I just very that the "~" directory does not get generated when I compile with the 0.10.* lines of sbt
 

Doug Tangren

unread,
Sep 5, 2011, 11:38:28 PM9/5/11
to simple-b...@googlegroups.com


Also, I just very that the "~" directory does not get generated when I compile with the 0.10.* lines of sbt
 

Found it.

I used the java -Dsbt.global.base=~/.sbt/0.11.0-RC0 in my sbt 0.11 shell script as noted in one of the other announcement email. This generates a ~ in my projects directory. Replacing that will the fully qualified path removed the issue. I cross posted the notice on the other thread.

Mark Harrah

unread,
Sep 6, 2011, 7:54:22 AM9/6/11
to simple-b...@googlegroups.com
Hey Doug,

On Mon, 5 Sep 2011 23:10:30 -0400
Doug Tangren <d.ta...@gmail.com> wrote:
>
> ...


>
> Also on a smaller note. I noticed :== was tagged as private now [2]. I had
> used that previously possible when looking at an example to see how source
> filtering was done in 0.10. What are the semantic deferences with that and
> :=. It looks like the main differences is :== takes a precomputed value. Is
> there a reason why this is now private? Or is it also on the track to
> becoming deprecated? If so, why is it so heavily used in Defaults.scala

:== is a size optimization. Every use of :== saves 1-2kB in class files (I haven't checked the exact size in 2.9 yet) and there are 85 uses of :== in Defaults.

It was never meant to be used in build definitions, maybe in plugins with large numbers of constant settings. In the end, it adds another method users think they need to learn and it isn't worth exposing it.

-Mark

Doug Tangren

unread,
Sep 6, 2011, 8:23:17 AM9/6/11
to simple-b...@googlegroups.com

:== is a size optimization.  Every use of :== saves 1-2kB in class files (I haven't checked the exact size in 2.9 yet) and there are 85 uses of :== in Defaults.

It was never meant to be used in build definitions, maybe in plugins with large numbers of constant settings.  In the end, it adds another method users think they need to learn and it isn't worth exposing it.

Gotcha. Thanks!

Artyom Olshevskiy

unread,
Sep 6, 2011, 12:37:04 PM9/6/11
to simple-b...@googlegroups.com
Should cross building be disabled from now on for plugins?

Mark Harrah

unread,
Sep 7, 2011, 8:51:45 PM9/7/11
to simple-b...@googlegroups.com
On Tue, 6 Sep 2011 09:37:04 -0700 (PDT)
Artyom Olshevskiy <siasi...@gmail.com> wrote:

> Should cross building be disabled from now on for plugins?

You don't need to set crossPaths := false, if that is what you are asking. sbt should set things up properly if you set sbtPlugin := true.

-Mark

Reply all
Reply to author
Forward
0 new messages