Commit Graph

536 Commits

Author SHA1 Message Date
Justin Kaeser 7fb8a4e88a port sddPluginSbtFile command from https://github.com/sbt/sbt/pull/4211/ to sbt 0.13 2018-08-23 18:21:16 +03:00
Dale Wijnand fdcdc140fb Upgrade Scala versions that ^^ uses
Refs #3907
2018-02-21 13:56:17 +09:00
Eugene Yokota 68f547a465 Filter auto compiler plugin to classpath JARs
Fixes #3784

For Ivy repos, sbt 1.x publishes source and scaladoc JARs under `compile` configuration with types `src` and `doc` respectively. The current 0.13 implementation of `autoPlugins(...)` is not filtering them out correctly, and ends up including a source JAR as a compiler plugin.
2018-01-06 18:44:27 -05:00
Dale Wijnand 9bf3b0a556
Preserve cleanFiles' type for bincompat 2018-01-02 10:25:18 +00:00
Eugene Yokota 377ff91484
Make clean task run exclusively
Cherry-picked acf6c1191e
2017-12-21 11:55:01 +00:00
Eugene Yokota 183adc3d23
Reimplement clean and cleanFiles tasks
cleanFiles is now a task that lists exactly what will be deleted recursively.

Cherry-picked 7acb8764f5
2017-12-21 11:51:14 +00:00
eugene yokota 96ddc33a3e Merge pull request #3397 from dwijnand/sbt-plugin-cross-version
Fix addSbtPlugin to use the correct version of sbt
2017-08-08 13:09:56 -04:00
Dale Wijnand 2fc0a6a571
Fix addSbtPlugin to use the correct version of sbt
Fixes #3393
2017-08-08 15:09:12 +01:00
eugene yokota b2b02a1dd7 Merge pull request #3403 from dwijnand/fix-doc-more
Remove a series of warnings from running `doc`
2017-08-04 17:39:32 -04:00
Dale Wijnand 47c4542a30
Remove a series of warnings from running `doc` 2017-08-04 11:34:27 +01:00
Dale Wijnand 684e2c3692
Drop the exec permission on random source files 2017-08-04 11:13:40 +01:00
Eugene Yokota 23bfcf58a5 Fix ^^ and don't inject scalaVersion by default
This no longer injects scalaVersion at the project level, which was interfering with crossScalaVersions delegation to ThisBuild scope.

Fixes sbt/sbt#3353
2017-07-25 13:05:40 -04:00
Eugene Yokota 92c46dd231 Override current project's scalaVersion on ^^
Both the default settings and ^^ together sets the correct scalaVersion based on `sbtVersion in pluginCrossBuild`, but frequently people set up `scalaVersion` on sbt plugin's subproject, which disables the feature.
This change appends the scalaVersionSetting on ^^ so scalaVersion gets switched to 2.12.2 on ^^ 1.0.0-RC2 etc.

Fixes #3205
2017-07-21 23:01:10 -04:00
Eugene Yokota 303ee137bd Scalariform changes 2017-05-21 13:18:53 -04:00
Dale Wijnand d3fa1e06c6
Deprecate BuildCommon's toError
Removed in sbt 1
2017-05-16 10:15:09 +01:00
Dale Wijnand f4cc3d2938
Remove the "hit [ENTER] to switch to interactive mode" feature
In sbt 0.13.15, in addition to notifying the user about the existence of
sbt's shell, a feature was added to allow the user to switch to sbt's
shell - a more pro-active approach to just displaying a message.

Unfortunately sbt is often unintentionally invoked in shell scripts in
"interactive mode" when no interaction is expected by, for exmaple,
invoking `sbt package` instead of `sbt package < /dev/null`. In that
case hitting [ENTER] would silently trigger sbt to run its shell,
easily wrecking the script. In addition to that I was unhappy with the
implementation as it created a tight coupling between sbt's command
processing abstraction to sbt's shell command.

If you want to stay in sbt's shell after running a task like `package`
then invoke sbt like so:

    sbt package shell

Fixes #3091
2017-04-28 11:00:16 +01:00
Dale Wijnand 54055835be
Notify users about shell only if compile is present
This is a change in strategy.

The motivation is the need to find a good balance between:

  + informing the uninformed that would benefit from this information, &
  + not spamming the already informed

Making it dependent on "compile" being present in remainingCommands will
probably make it trigger for, for example, Maven users who are used to
running "mvn compile" and always run "sbt compile", and who therefore
are unneccesarily suffering terribly slow compile speeds by starting up
the jvm and sbt every time.

Fixes #3091
2017-04-27 16:37:52 +01:00
Dale Wijnand 1c1be9a597
Introduce suppressSbtShellNotification
This requires moving the notification to after LoadProject, so much
later in time, sadly..

Refs #3091
2017-04-27 16:34:32 +01:00
Dale Wijnand a6af8c50c8
Notify users at info level & in 1 line
Refs #3091
2017-04-27 16:34:32 +01:00
Dale Wijnand 2ee0b3c064
Exclude "new" from startup messages
Fixes #3097
2017-04-27 16:34:27 +01:00
Dale Wijnand fdd3f56694
Allow --error to suppress warning messages
Specifically:

* Make them both commands, so they run after early commands (--error).
* Make notifyUsersAboutShell aware of "iflast shell" instead of "boot".
* Make writeSbtShell use a logger and tweak the message

Refs #3091
2017-04-27 16:32:48 +01:00
Eugene Yokota ff017eb475 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.
2017-04-22 06:04:56 -04:00
Eugene Yokota dea267c224 Improve IO.toFile's handling for Windows
Improve IO.toFile's handling for Windows, and use it for identifying resolvers.

This adds support to convert URL to File on Windows in several ways:

```
val u0 = new URL("file:C:\\Users\\foo/.sbt/preloaded")
val u1 = new URL("file:/C:\\Users\\foo/.sbt/preloaded")
val u2 = new URL("file://unc/Users/foo/.sbt/preloaded")
val u3 = new URL("file:///C:\\Users\\foo/.sbt/preloaded")
val u4 = new URL("file:////unc/Users/foo/.sbt/preloaded")
```

Note that `u0` and `u2` are something `new File(u.toURI)` won't handle. This also correctly handles UNC convention specified by Microsoft in https://blogs.msdn.microsoft.com/ie/2006/12/06/file-uris-in-windows/.

Fixes #3086
Fixes #2150
2017-04-08 03:56:34 -04:00
Dale Wijnand bd59f14f08
Notify about shell less
+ Don't notify ScriptMain users by moving the logic to xMain
+ Only trigger shell if shell is a defined command
+ Use existing Shell/BootCommand strings instead of new ones
2017-03-21 13:20:34 +00:00
Dale Wijnand aaaf254375
Tell the user we're setting sbt.version 2017-03-16 21:49:15 +00:00
Dale Wijnand 465a9be635
Add -Dsbt.skip.version.write=true opt-out 2017-03-16 19:42:17 +00:00
Dale Wijnand 155f764943
Write sbt.version to project/build.properties
Have sbt.version set in project/build.properties is a best practice
because it makes the build more deterministic and reproducible.

With this change sbt, after ensuring that the base directory is probably
an sbt project, writes out sbt.version in project/build.properties if it
is missing.

Fixes #754
2017-03-16 18:55:26 +00:00
Eugene Yokota 6f3e756871 bump to sbt-giter8-resolver 0.1.3 2017-03-11 01:12:54 -05:00
eugene yokota cc19d51f1d Merge pull request #2961 from ekrich/wip13/fix-2551
Fix #2551: scripted mode ignores quotation
2017-03-09 14:44:59 -05:00
Haochi Chen f2ff94f0f3 Backport #2941 to 0.13.x 2017-02-23 02:24:22 -03:00
Eric K Richardson 8a78de1ff3 Merge branch '0.13' into wip13/fix-2551 2017-02-14 10:05:15 -05:00
ekrich d74b24db42 Fix #2551: scripted mode ignores quotation 2017-02-14 09:55:27 -05:00
Eugene Yokota 70a2878dbc Adds an Append instance that extracts taskValue
This adds a macro-level hack to support += op for sourceGenerators and resourceGenerators using RHS of Initialize[Task[Seq[File]]].
When the types match up, the macro now calls `.taskValue` automatically.
2017-01-22 23:44:48 -05:00
Guillaume Martres 3c6db1ce5d Automatically choose proper compiler bridge for dotty
Before this commit, using dotty in your sbt project required to add:
  scalaCompilerBridgeSource := ("ch.epfl.lamp" % "dotty-sbt-bridge" %
    scalaVersion.value % "component").sources()
in your build.sbt. We might as well automatically do this, this reduces
the boilerplate for using dotty in your project to:
  scalaOrganization := "ch.epfl.lamp"
  scalaVersion := "0.1.1-SNAPSHOT"
  scalaBinaryVersion := "2.11" // dotty itself is only published as a
                               // 2.11 artefact currently
2017-01-11 16:06:45 +01:00
Eugene Yokota 00bab7b743 Add build-level keys to the tab completion
Fixes #2460
Fixes #2851
Ref #2707, #2708, #2469

Unlike the previous attempts at fixing the handling of build-level
keys, this change does not change the main parsing logic, which uses
`getKey` to retrieve the key from the key map.
The fact that shell worked pre-0.13.11 means that the parsing was ok.

What this changes is just the "example" keys supplied to the parser so
the tab completion works.
2016-11-30 02:33:05 -05:00
Eugene Yokota 49809056fc Revert "Completion for build-level keys"
This reverts commit e35f9bb11e.
2016-11-29 05:59:33 -05:00
Eugene Yokota 612d9555d0 Revert "Unspecified project axis means current project or its build"
This reverts commit 4fea604759.
2016-11-29 05:59:18 -05:00
Eugene Yokota 3e653f73b3 Revert "Fix key selection for build level keys"
This reverts commit 60bcc58852.
2016-11-29 05:57:43 -05:00
Petro Verkhogliad 08951436f0
Use sbt-giter8-resolver 0.1.2 2016-11-08 15:31:29 -05:00
Petro Verkhogliad 29a524e18d
Use sbt-giter8-resolver 0.1.1 2016-11-06 17:25:56 -05:00
Eugene Yokota cfac453c07 Add "-deprecattion" flag to metabuild
Fixes #2783
Ref #2716

`build.sbt` is treated a Scala source of metabuild, so to enable
deprecation flag on build.sbt we set the option here.
2016-10-14 14:19:53 -04:00
Eugene Yokota 81284081e2 Use non-deprecated constructor 2016-10-14 14:15:05 -04:00
Eugene Yokota f1055c79df Remove unused match 2016-10-13 18:15:54 -04:00
Eugene Yokota 4e09e9ef68 Refactoring per review 2016-10-13 18:12:40 -04:00
Eugene Yokota 6f3bbed47e Safer template resolver
Fixes #2761

With sbt 0.13.13-RC1 rediscovered that the dependency pulled in from
Giter8 was affecting the plugins. To avoid this, this change splits up
the template resolver implementation to another module called
sbt-giter8-resolver, and it will be downloaded using Ivy into
`~/.sbt/0.13/templates/`, and then launched reflectively using Java as
the interface.
2016-10-12 20:06:10 -04:00
Eugene Yokota 272ada1e74
Improve `show` when key returns a `Seq`
This changes the output to:

```
> show externalDependencyClasspath
[info] Updating {file:/xxx/hello/}root...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] *
Attributed(/Users/xxx/.sbt/boot/scala-2.11.8/lib/scala-library.jar)
[info] *
Attributed(/Users/xxx/.ivy2/cache/commons-io/commons-io/jars/commons-io-
2.4.jar)
```
2016-09-27 14:23:53 +01:00
Dale Wijnand 06cdefebb9 Replace var/set with withClassLoaderCache 2016-09-26 19:32:11 +10:00
Jason Zaugg 5005abfef2 SD-232 Recycle classloaders to be anti-hostile to JIT.
The compiler interface subclasses `scala.tools.nsc.Global`,
and loading this new subclass before each `compile` task forces
HotSpot JIT to deoptimize larges swathes of compiled code. It's
a bit like SBT has rigged the dice to always descend the longest
ladder in a game of Snakes and Ladders.

The slowdown seems to be larger with Scala 2.12. There are a number
of variables at play, but I think the main factor here is that
we now rely on JIT to devirtualize calls to final methods in traits
whereas we used to emit static calls. JIT does a good job at this,
so long as classloading doesn't undo that good work.

This commit extends the existing `ClassLoaderCache` to encompass
the classloader that includes the compiler interface JAR. I've
resorted to adding a var to `AnalyzingCompiler` to inject the
dependency to get the cache to the spot I need it without binary
incompatible changes to the intervening method signatures.
2016-09-26 14:49:47 +10:00
Dale Wijnand 86670caf37 Add back addPluginResolvers (#2749)
See https://github.com/sbt/sbt/pull/2715/files#r79729382
2016-09-22 13:35:03 +01:00
Eugene Yokota d945925d0e
Silent startup for scalas
Fixes #840
2016-09-15 22:08:56 +01:00