Commit Graph

302 Commits

Author SHA1 Message Date
Ethan Atkins a5db9e86d7 Rename typesafe release resolver in sbt build
I was still seeing a number of warnings in the sbt project itself in
spite of 9bb88cd342. This made those go
away.
2019-07-09 14:29:44 -07:00
Ethan Atkins 32c2afaf2d Revert "revert doc"
It was only a matter of time before this erroneously got merged in.

This reverts commit 05aab1035a.
2019-06-04 16:45:16 -07:00
eugene yokota e31fd3f082
Merge pull request #4765 from eatkins/watch-docs
Watch docs
2019-06-03 22:36:46 -04:00
Ethan Atkins 05aab1035a revert doc 2019-06-03 17:35:01 -07:00
Ethan Atkins ce6484f4b4 Set java source and target levels
Since sbt must run on jdk8, we should be setting the javac source and
target levels.
2019-06-03 17:26:14 -07:00
eugene yokota 0994b7c104
Merge pull request #4740 from dwijnand/remove-unused-Task-mapTask
Remove unused Task#mapTask
2019-05-29 17:12:50 -04:00
Dale Wijnand 5036f339f8
Remove unused Task#mapTask 2019-05-29 14:43:42 +01:00
Ethan Atkins 8765710a88 Set mainProj/Test/classLoaderLayeringStrategy
The TestDependencies strategy doesn't work as of 1.3.0-RC1 because some
of the tests need to access resources. The ScalaLibrary strategy is
broken in 1.3.0-RC1. That leaves Flat. I tested that with 1.3.0-SNAPSHOT
off the latest master, that the AllLibraryJars strategy works fine, but
I need this change now to get travis to work.
2019-05-28 11:45:09 -07:00
Ethan Atkins e6d2b32902 Add scripted watchTriggers
This allows the scripted test files to trigger a continuous scripted
build.
2019-05-28 09:53:35 -07:00
Eugene Yokota 08c49358c7 Reduce concurrency of scalafmtCheck
Ref scalameta/scalafmt#1399
2019-05-17 14:51:07 -04:00
Ethan Atkins e5b54a59ea Manage shutdown hooks
I discovered that some registered shutdown hooks would crash due to
67df72ab01 because they would try to load
classes from the closed classloader. To fix this, I add a internal
shutdown hooks mechanism that can be managed by sbt. Any unevaluated
shutdown hooks will be run when the sbt main method exits. This means
that they will be run when the user calls reboot. I think that is
reasonable.
2019-05-13 17:38:56 -07:00
Eugene Yokota 3f5a872001 lm-coursier 1.1.0-M14-2 2019-05-13 13:59:58 -04:00
Eugene Yokota b4ea530036 reduce the example size to 1000 2019-05-11 04:52:42 -04:00
Eugene Yokota a0aa828238 format build.sbt 2019-05-11 03:42:06 -04:00
Eugene Yokota b96925bbda run 10000 examples to reduce flakiness 2019-05-11 03:41:41 -04:00
Ethan Atkins 02e78bd31d Add scalaXml to testingProj dependencies
This also seemed to be missing once the sbt metabuild classpath stopped
leaking into the compiler clAdd scalaXml to testingProj dependencies

This also seemed to be missing once the sbt metabuild classpath stopped
leaking into the compiler clAdd scalaXml to testingProj dependencies

This also seemed to be missing once the sbt metabuild classpath stopped
leaking into the compiler clAdd scalaXml to testingProj dependencies

This also seemed to be missing once the sbt metabuild classpath stopped
leaking into the compiler classpath.
2019-05-08 19:34:01 -07:00
Ethan Atkins 0d8f0816bc Add launcher interface dependency
Previously the zincLmIntegrationProj would compile if the meta build classpath
leaked into the compilation classpath. I found that the project would
not compile a clean build running an sbt built off of origin/develop.
2019-05-08 18:29:58 -07:00
Ethan Atkins 507346f3f6 Simplify file management settings
I decided that there were too many settings related to the file
management that did similar things and had similar names but did
slightly different things. To improve this, I introduce the ChangedFiles
class to sbt.nio.file and switch to having just two task for file input
and output retrieval: all(Input|Output)Files and
changed(Input|Output)Files. If, for example, changedInputFiles returns
None that means that either the task has not yet been run or there were
no changes. If there have been any changes, then it will return
Some(changes) and the user can extract the relevant changes that they
are interested in.

The code may be slightly more verbose in a few places, but I think it's
worth it for the conceptual clarity.
2019-05-02 14:36:08 -07:00
Ethan Atkins 72df8f674c Add support for managed task inputs
In my recent changes to watch, I have been moving towards a world in
which sbt manages the file inputs and outputs at the task level. The
main idea is that we want to enable a user to specify the inputs and
outputs of a task and have sbt able to track those inputs across
multiple task evaluations. Sbt should be able to automatically trigger a
build when the inputs change and it also should be able to avoid task
evaluation if non of the inputs have changed.

The former case of having sbt automatically watch the file inputs of a
task has been present since watch was refactored. In this commit, I
make it possible for the user to retrieve the lists of new, modified and
deleted files. The user can then avoid task evaluation if none of the
inputs have changed.

To implement this, I inject a number of new settings during project
load if the fileInputs setting is defined for a task. The injected
settings are:

allPathsAndAttributes -- this retrieves all of the paths described by
  the fileInputs for the task along with their attributes
fileStamps -- this retrieves all of the file stamps for the files
  returned by allPathsAndAttributes

Using these two injected tasks, I also inject a number of derived tasks,
such as allFiles, which returns all of the regular files returned by
allPathsAndAttributes and changedFiles, which returns all of the regular
files that have been modified since the last run.

Using these injected settings, the user is able to write tasks that
avoid evaluation if the inputs haven't changed.

foo / fileInputs += baseDirectory.value.toGlob / ** / "*.scala"
foo := {
  foo.previous match {
    case Some(p) if (foo / changedFiles).value.isEmpty => p
    case _ => fooImpl((foo / allFiles).value
  }
}

To make this whole mechanism work, I add a private task key:
val fileAttributeMap = taskKey[java.util.HashMap[Path, Stamp]]("...")
This keeps track of the stamps for all of the files that are managed by
sbt. The fileStamps task will first look for the stamp in the attribute
map and, only if it is not present, it will update the cache. This
allows us to ensure that a given file will only be stamped once per task
evaluation run no matter how the file inputs are specified. Moreover, in
a continuous build, I'm able to reuse the attribute map which can
significantly reduce latency because the default file stamping
implementation used by zinc is fairly expensive (it can take anywhere
between 300-1500ms to stamp 5000 8kb source files on my mac).

I also renamed some of the watch related keys to be a bit more clear.
2019-05-02 14:33:29 -07:00
Eugene Yokota f5444f7715 Merge branch 'develop' into pr/4617 2019-04-28 17:22:54 -04:00
Eugene Yokota f354a626c7 use lm-coursier-shaded
This uses lm-coursier-shaded, and follows along the changes in https://github.com/coursier/sbt-coursier/pull/58.
2019-04-26 17:33:14 -04:00
Eugene Yokota 38f94a6e31 Coursier dependency resolution integration
This adds dependency to LM implemented using Coursier.
I had to copy paste a bunch of code from sbt-coursier-shared to break the dependency to sbt.

`Global / useCoursier := false` or `-Dsbt.coursier=false` be used to opt-out of using Coursier for the dependency resolution.
2019-04-26 12:25:52 -04:00
Dale Wijnand e978357e47
In-source zinc's LM integration code 2019-04-25 11:57:37 +01:00
Ethan Atkins cd744b2c35 Print consistent version
Java has dropped the leading "1." from the specification version in
later versions. No one really refers to java 1.8, so it makes sense to
strip the "1." from the suggested version.
2019-03-23 09:33:18 -07:00
Ethan Atkins 4e66b492e5 Singularize java version in welcome banner 2019-03-23 09:16:33 -07:00
Eugene Yokota db45b456ef switch to official sbt-scalafmt 2019-03-22 17:47:48 -04:00
Ethan Atkins 7675007e00 Add Ethan Atkins to developer list 2019-03-22 12:38:53 -07:00
Ethan Atkins 798145e81e Add sbt io to the sbt project
Without this, the sbt io version is used by the compiler which means
that apis added in later versions of io are not available. I don't
understand why the transitive dependency on io is not used, but this
fixes the issue.
2019-03-22 09:32:36 -07:00
Eugene Yokota b98b5dffa6 use tag when available 2019-03-22 02:28:14 -04:00
xuwei-k db4f3484a2 add scalacOptions for scaladoc 2019-03-22 02:24:37 -04:00
Eugene Yokota 86abe3ed60 open up ExecuteProgress, and adds a few keys
Fixes #4461

This opens up ExecuteProgress API that's been around under private[sbt].
Since the state passing mechanism hasn't been used, I got rid of it.

The build user can configure the build using two keys Boolean `taskProgress` and `State => Seq[TaskProgress]` `progressReports`. `useSuperShell` is lightweight key on/off switch for the super shell that can be used as follows:

```scala
Global / SettingKey[Boolean]("useSuperShell") := false
```
2019-03-19 00:42:46 -04:00
Eugene Yokota cd1d2e0994 Util 1.3.0-M5 2019-03-08 19:18:53 -05:00
Eugene Yokota 68d0da379e add Mima exclusion 2019-01-04 09:55:28 -05:00
Eugene Yokota 67e590d940 define whitesourceOnPush
whitesourceOnPush calls whitesourceCheckPolicies and whitesourceUpdate on push.
Since Travis CI secrets are not available during PR from a fork, there's no point in calling these during the PR validation.
2018-12-13 19:31:56 -05:00
Ethan Atkins 01b2e86a54 Fix Def cannot be used inside a taskDyn #3110
The illegalReference check did not actually validate whether the illegal
reference actually referred to an M[_] (which is pretty much always
Initialize[_]]). The means by which this failure was induces were fairly
obscure and go through multiple levels of macro transformations that I
attempt to explain in the comment in IllegalReferenceSpec.

Fixes #3110
2018-12-11 21:49:42 -08:00
Eugene Yokota d58b302a97 Fix prompt for task progress 2018-11-16 23:05:51 -08:00
andrea 39493f7869 adding a fatjar release (aka sbt-big) to the build 2018-11-07 08:37:49 +00:00
Andrea Peruffo e4c9fbad79
Merge branch 'develop' into configurableLibraryManagement 2018-10-11 18:59:38 +01:00
andrea 34e0fc159c [sbt-server] LSP completions support 2018-10-11 13:34:40 +01:00
Andrea Peruffo cd69a112bd
Merge branch 'develop' into configurableLibraryManagement 2018-10-10 17:43:50 +01:00
Ethan Atkins d31fae59f7 Add global file repository task
Every time that the compile task is run, there are potentially a large
number of iops that must occur in order for sbt to generate the source
file list as well as for zinc to check which files have changed since
the last build. This can lead to a noticeable delay between when a build
is started (either manually or by triggered execution) and when
compilation actually begins. To reduce this latency, I am adding a
global view of the file system that will be stored in
BasicKeys.globalFileTreeView.

To make this work, I introduce the StampedFile trait, which augments the
java.io.File class with a stamp method that returns the zinc stamp for
the file. For source files, this will be a hash of the file, while for
binaries, it is just the last modified time. In order to gain access to
the sbt.internal.inc.Stamper class, I had to append addSbtZinc to the
commandProj configurations.

This view may or may not use an in-memory cache of the file system tree
to return the results. Because there is always the risk of the cache
getting out of sync with the actual file system, I both make it optional
to use a cache and provide a mechanism for flushing the cache. Moreover,
the in-memory cache implementation in sbt.io, which is backed by a
swoval FileTreeRepository, has the property that touching a monitored
directory invalidates the entire directory within the cache, so the
flush command isn't even strictly needed in general.

Because caching is optional, the global is of a FileTreeDataView, which
doesn't specify a caching strategy. Subsequent commits will make use of
this to potentially speed up incremental compilation by caching the
Stamps of the source files so that zinc does not need to compute the
hashes itself and will allow for continuous builds to use the cache to
monitor events instead of creating a new, standalone FileEventMonitor.
2018-10-09 12:09:42 -07:00
andrea 0c11bc6add Build time configurable library management 2018-10-09 09:03:55 +01:00
Ethan Atkins 6725b39a84 Bump io to 1.3.0-M3
I had to turn off -Xfatal-warnings in commandProj because after updating
io, commandProj depends on the deprecated EventMonitor class. In #4335,
I stop using EventMonitor, but deprecate the Watched class which is both
defined and used (as an unused attribute key) in commandProj. I think we
can probably get rid of Watched in 1.4.x and certainly in a hypothetical
2.x, so hopefully we can restore -Xfatal-warnings sooner than later.

I also had to replace uses of IO.classLocationFile with
IO.classLocationPath to avoid compilation failures due to
-Xfatal-warnings.
2018-10-08 13:59:34 -07:00
Eugene Yokota c64166ea8d check PluginCross.scala consisntency 2018-10-05 13:32:40 -04:00
Eugene Yokota 0d788162ae add onLoadMessage 2018-10-05 03:04:22 -04:00
Eugene Yokota aec08f6760 1.3.0-SNAPSHOT 2018-09-25 11:25:24 -04:00
Eugene Yokota ef49a95b7d address more warnings 2018-09-18 17:45:24 -04:00
Eugene Yokota 3e1dac5161 -Xfatal-warnings in most subprojects 2018-09-18 11:47:55 -04:00
Eugene Yokota 96676e4c55 Apache License 2.0
https://discuss.lightbend.com/t/moving-sbt-and-zinc-to-the-apache-v2-license/1670
2018-09-14 03:38:58 -04:00
Eugene Yokota 0843cd6a3c sbt 1.2.3 2018-09-14 03:28:12 -04:00