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

[sbt 0.13] Port sbt-cross-building's ^ and ^^ commands #3133

Merged
merged 1 commit into from Apr 24, 2017

Conversation

Projects
None yet
3 participants
@eed3si9n
Member

eed3si9n commented Apr 22, 2017

@jrudolph's sbt-cross-building is a plugin author's plugin. It adds cross command ^ and sbtVersion switch command ^^, similar to + and ++,
but for switching between multiple sbt versions across major versions. This PR merges these commands into sbt because the feature they provide is really useful as we migrate plugins to sbt 1.0.

sbtVersion switching

To switch the sbtVersion in pluginCrossBuild from the shell use:

^^ 1.0.0-M5
[info] Setting `sbtVersion in pluginCrossBuild` to 1.0.0-M5
[info] Set current project to sbt-buildinfo (in build file:/xxx/sbt-buildinfo/)

Your plugin will now build with sbt 1.0.0-M5 (and its Scala version 2.12.2).

sbt specific source directories

If you need to make changes specific to a sbt version, you can now include them into src/main/scala-sbt-0.13,
and src/main/scala-sbt-1.0.0-M5, where the binary sbt version number is used as postfix.

plugin cross command

To run a command across multiple sbt versions, set:

crossSbtVersions := Vector("0.13.15", "1.0.0-M5")

Then, run:

> ^compile
[info] Setting `sbtVersion in pluginCrossBuild` to 0.13.15
[info] Set current project to sbt-buildinfo (in build file:/xxx/sbt-buildinfo/)
[info] Updating {file:/xxx/sbt-buildinfo/}root...
[info] Resolving org.scala-sbt#sbt-launch;0.13.15 ...
[info] Done updating.
[info] Compiling 11 Scala sources to /xxx/sbt-buildinfo/target/scala-2.10/sbt-0.13/classes...
[success] Total time: 5 s, completed Apr 22, 2017 3:31:44 AM
[info] Setting `sbtVersion in pluginCrossBuild` to 1.0.0-M5
[info] Set current project to sbt-buildinfo (in build file:/xxx/sbt-buildinfo/)
[info] Updating {file:/xxx/sbt-buildinfo/}root...
[info] Resolving org.scala-sbt#launcher;1.0.0 ...
[info] Done updating.
[info] Compiling 11 Scala sources to /xxx/sbt-buildinfo/target/scala-2.12/sbt-1.0.0-M5/classes...
[success] Total time: 9 s, completed Apr 22, 2017 3:31:53 AM
[info] Setting `sbtVersion in pluginCrossBuild` to 0.13.15-SNAPSHOT
[info] Set current project to sbt-buildinfo (in build file:/xxx/sbt-buildinfo/)

notes

The idea of merging this in to sbt was first brought up in 2013 jrudolph/sbt-cross-building#17, and last year #2619.

@eed3si9n eed3si9n requested a review from dwijnand Apr 22, 2017

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Apr 22, 2017

Member

I though I should include the original history from sbt-cross-building in here, but I guess it gets confusing since the GitHub issue links are now all mess up.

Member

eed3si9n commented Apr 22, 2017

I though I should include the original history from sbt-cross-building in here, but I guess it gets confusing since the GitHub issue links are now all mess up.

Port sbt-cross-building's ^ and ^^ commands
This ports sbt-cross-building's cross (`^`) and switch (`^^`) commands.
Instead of making it a plugin, the default settings are now changed
to use `sbtVersion in pluginCrossBuild` for the sbt dependency.

@dwijnand dwijnand merged commit 4ab11d7 into sbt:0.13 Apr 24, 2017

2 checks passed

codacy/pr Good work! A positive pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@dwijnand dwijnand removed the in progress label Apr 24, 2017

@jrudolph

This comment has been minimized.

Show comment
Hide comment
@jrudolph

jrudolph Apr 24, 2017

Member

Nice ;) Did you check that the scripted plugin still works?

Member

jrudolph commented Apr 24, 2017

Nice ;) Did you check that the scripted plugin still works?

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Apr 24, 2017

Member

I did check scripted manually using sbt-buildinfo, and at least running one from sbt 1.0 worked without changing much:

> ^^1.0.0-M5
[info] Setting `sbtVersion in pluginCrossBuild` to 1.0.0-M5
[info] Set current project to sbt-buildinfo (in build file:/xxx/sbt-buildinfo/)
> scripted sbt-buildinfo/simple
[info] :: delivering :: com.eed3si9n#sbt-buildinfo;0.7.0-SNAPSHOT :: 0.7.0-SNAPSHOT :: integration :: Mon Apr 24 10:34:41 EDT 2017
[info] 	delivering ivy file to /xxx/sbt-buildinfo/target/scala-2.12/sbt-1.0.0-M5/ivy-0.7.0-SNAPSHOT.xml
....
/private/var/folders/7g/l96y5q310h90xsz109qqjpmc0000gn/T/sbt_70b902ac/simple/project/build.properties setting sbt.version to: 1.0.0-M5
[info] [info] Loading settings from plugins.sbt ...
[info] [info] Loading project definition from /private/var/folders/7g/l96y5q310h90xsz109qqjpmc0000gn/T/sbt_70b902ac/simple/project
[info] [info] Updating {file:/private/var/folders/7g/l96y5q310h90xsz109qqjpmc0000gn/T/sbt_70b902ac/simple/project/}simple-build...
[info] [warn] Choosing local for com.eed3si9n#sbt-buildinfo;0.7.0-SNAPSHOT
[info] [info] Done updating.
[info] [info] Loading settings from build.sbt ...
[info] [info] Set current project to helloworld (in build file:/private/var/folders/7g/l96y5q310h90xsz109qqjpmc0000gn/T/sbt_70b902ac/simple/)
[info] [info] Updating {file:/private/var/folders/7g/l96y5q310h90xsz109qqjpmc0000gn/T/sbt_70b902ac/simple/}root...
[info] [info] Done updating.
[info] [info] Compiling 1 Scala source to /private/var/folders/7g/l96y5q310h90xsz109qqjpmc0000gn/T/sbt_70b902ac/simple/target/scala-2.11/classes ...
[info] [info] Done compiling.
[info] [info] Total time: 4 s, completed Apr 24, 2017 10:35:04 AM
[info] [info] Total time: 0 s, completed Apr 24, 2017 10:35:04 AM
[info] + sbt-buildinfo / simple
[success] Total time: 25 s, completed Apr 24, 2017 10:35:06 AM
Member

eed3si9n commented Apr 24, 2017

I did check scripted manually using sbt-buildinfo, and at least running one from sbt 1.0 worked without changing much:

> ^^1.0.0-M5
[info] Setting `sbtVersion in pluginCrossBuild` to 1.0.0-M5
[info] Set current project to sbt-buildinfo (in build file:/xxx/sbt-buildinfo/)
> scripted sbt-buildinfo/simple
[info] :: delivering :: com.eed3si9n#sbt-buildinfo;0.7.0-SNAPSHOT :: 0.7.0-SNAPSHOT :: integration :: Mon Apr 24 10:34:41 EDT 2017
[info] 	delivering ivy file to /xxx/sbt-buildinfo/target/scala-2.12/sbt-1.0.0-M5/ivy-0.7.0-SNAPSHOT.xml
....
/private/var/folders/7g/l96y5q310h90xsz109qqjpmc0000gn/T/sbt_70b902ac/simple/project/build.properties setting sbt.version to: 1.0.0-M5
[info] [info] Loading settings from plugins.sbt ...
[info] [info] Loading project definition from /private/var/folders/7g/l96y5q310h90xsz109qqjpmc0000gn/T/sbt_70b902ac/simple/project
[info] [info] Updating {file:/private/var/folders/7g/l96y5q310h90xsz109qqjpmc0000gn/T/sbt_70b902ac/simple/project/}simple-build...
[info] [warn] Choosing local for com.eed3si9n#sbt-buildinfo;0.7.0-SNAPSHOT
[info] [info] Done updating.
[info] [info] Loading settings from build.sbt ...
[info] [info] Set current project to helloworld (in build file:/private/var/folders/7g/l96y5q310h90xsz109qqjpmc0000gn/T/sbt_70b902ac/simple/)
[info] [info] Updating {file:/private/var/folders/7g/l96y5q310h90xsz109qqjpmc0000gn/T/sbt_70b902ac/simple/}root...
[info] [info] Done updating.
[info] [info] Compiling 1 Scala source to /private/var/folders/7g/l96y5q310h90xsz109qqjpmc0000gn/T/sbt_70b902ac/simple/target/scala-2.11/classes ...
[info] [info] Done compiling.
[info] [info] Total time: 4 s, completed Apr 24, 2017 10:35:04 AM
[info] [info] Total time: 0 s, completed Apr 24, 2017 10:35:04 AM
[info] + sbt-buildinfo / simple
[success] Total time: 25 s, completed Apr 24, 2017 10:35:06 AM

@eed3si9n eed3si9n deleted the eed3si9n:wip/sbtcrossbuilding branch Apr 24, 2017

@dwijnand

This comment has been minimized.

Show comment
Hide comment
@dwijnand

dwijnand Apr 29, 2017

Member

This should've been it's own commit instead of being mixed with folding sbt-cross-building..

Member

dwijnand commented on main/src/main/scala/sbt/Defaults.scala in ff017eb Apr 29, 2017

This should've been it's own commit instead of being mixed with folding sbt-cross-building..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment