Commit Graph

330 Commits

Author SHA1 Message Date
Eugene Yokota 80aeb7eed9 add aggregate project for lower utils and upper modules 2019-12-27 00:24:03 -05:00
Ethan Atkins 2a47205ef7 Add utilLogging contraband directory to managedSourceDirectories
See https://github.com/sbt/contraband/issues/76.
2019-12-12 18:11:32 -08:00
Ethan Atkins ee56140f5c Use logger in scripted instead of println 2019-12-10 10:52:18 -08:00
Ethan Atkins 8bfae66b9d Update build.sbt to handle util projects
As part of re-integrating util into the sbt main project, I had to
update the build.sbt and a few dependencies (like the contraband plugin).
2019-12-08 10:28:31 -08:00
Ethan Atkins 6a32bd0c72 Optimize build.sbt imports 2019-12-08 10:28:14 -08:00
Guillaume Martres 437950266f Give a more precise type to mkIvyConfiguration
This makes it possible to do mkIvyConfiguration.value.withXXX(...) for
all the methods in InlineIvyConfiguration. (I need this to remove
inter-project resolvers when fetching dotty from sbt-dotty to avoid
accidentally fetching a local project in the build of dotty itself).
2019-12-05 18:14:56 +01:00
Ethan Atkins bb73730c00 Run scalafmtSbt
Also add scalafmtSbtCheck to travis.
2019-11-30 14:57:57 -08:00
Dale Wijnand 02e26465f7 Cleanup project/Transform.scala 2019-11-28 21:25:49 +00:00
xuwei-k fc94204e8c Update license url 2019-11-23 16:09:13 +09:00
Eugene Yokota 8f82014e31 mima 2019-11-22 14:37:07 -05:00
Eugene Yokota 033601c393 addPluginSbtFile command fixes
Ref #4211
Fixes #4395
Fixes #4600

This is a reimplementation of `--addPluginSbtFile`. #4211 implemented the command to load extra `*.sbt` files as part of the global plugin subproject. That had the unwanted side effects of not working when `.sbt/1.0/plugins` directory does not exist. This changes the strategy to load the `*.sbt` files as part of the meta build.

```
$ sbt -Dsbt.global.base=/tmp/hello/global --addPluginSbtFile=/tmp/plugins/plugin.sbt
[info] Loading settings for project hello-build from plugin.sbt ...
[info] Loading project definition from /private/tmp/hello/project
sbt:hello> plugins
In file:/private/tmp/hello/
	sbt.plugins.IvyPlugin: enabled in root
	sbt.plugins.JvmPlugin: enabled in root
	sbt.plugins.CorePlugin: enabled in root
	sbt.ScriptedPlugin
	sbt.plugins.SbtPlugin
	sbt.plugins.SemanticdbPlugin: enabled in root
	sbt.plugins.JUnitXmlReportPlugin: enabled in root
	sbt.plugins.Giter8TemplatePlugin: enabled in root
	sbtvimquit.VimquitPlugin: enabled in root
```
2019-11-10 20:03:09 -05:00
Eugene Yokota 6f49065a56 in-source sbt-houserules 2019-10-20 00:41:53 -04:00
Filipe Regadas 66da2f5926
Merge branch 'develop' into fix/5110 2019-10-19 15:27:34 +01:00
Filipe Regadas 562eae2bff
Add explicit return type to plugin settings 2019-10-19 09:38:54 +01:00
Filipe Regadas 0ef5b578f8
Fix MiMa 2019-10-18 18:39:39 +01:00
Filipe Regadas 4dced81408
Fix MiMa 2019-10-17 22:27:43 +01:00
Filipe Regadas cb46943cec
Fix librarymanagement project Id 2019-10-16 19:27:32 +01:00
Charles O'Farrell 67a3eca698 Use hedgehog in ParseKey, Delegates, and ParserSpec test 2019-09-30 01:52:57 -04:00
Ethan Atkins 8fd10bfb5f Make all test and run classloaders parallel capable
A number of users were reporting issues with deadlocking when using
1.3.2: https://github.com/sbt/sbt/issues/5116. This seems to be because
most of the sbt created classloaders were not actually parallel capable.
In order for a classloader to be registered as a parallel capable, ALL
of the parent classes except for object in the class hierarchy must be
registered as a parallel capable:
https://docs.oracle.com/javase/8/docs/api/java/lang/ClassLoader.html#registerAsParallelCapable--.
If a classloader is not registered as parallel capable, then a global
lock will be used internally for classloading and this can lead to deadlock.

It is impossible to register a scala 2 classloader as parallel capable
so I ported all of the classloaders to java.

This commit updates the java-serialization scripted test. Prior to the
port, the new version of the test would more or less always deadlock.
After this change, I haven't been able to reproduce a deadlock.

This had no significant performance impact when I reran
https://github.com/eatkins/scala-build-watch-performance
2019-09-27 13:23:42 -07:00
Ethan Atkins 231d7966d0 Add the ability to resurrect closed classloaders
There have been a number of complaints about the new classloader closing
behavior. It is too aggressive about closing classloaders after test and
run. This commit softens the behavior by allowing a classloader to be
resurrected after close by creating a new zombie classloader that has
the same urls as the original classloader. After this commit, we always
close the classloaders when we are done, but they can still leak
file descriptors if a zombie is created.

To configure the behavior, I add the allowZombieClassLoaders key. If it
is false (which is default), we will warn but still allow them. If it
is true, then we silence the warning. In a later version of sbt, we can
change the semantics to be strict.

I verified after this change that I could add a shutdown hook in `run`
and it would be evaluated so long as I set `bgCopyClasspath := false`.
Otherwise the needed jars were deleted before the hooks could run.

Bonus: delete unused ResourceLoaderImpl class
2019-09-18 19:26:11 -07:00
Ethan Atkins 46eaa564d5 Add 1.3.0 to mima 2019-09-18 19:12:48 -07:00
Ethan Atkins a82e7892ab Bump sbt version 2019-09-05 11:46:23 -07:00
Ethan Atkins 58b3d970d0 Merge remote-tracking branch 'origin/1.3.x' into 1.3.x-merge 2019-09-05 11:44:24 -07:00
Eugene Yokota 665eb8f870 sbt 1.3.0 2019-09-04 01:24:08 -04:00
Ethan Atkins 4e1074d175 Use turbo in sbt build 2019-09-01 19:20:27 -07:00
Ethan Atkins c8c8eb2ade Delete unnecessary flat classloader strategy setting 2019-09-01 19:17:50 -07:00
Ethan Atkins 9896f77012 Fix typo 2019-07-29 12:45:22 -07:00
Ethan Atkins 893f120dee Don't rewrite RunFromSource.classpath every time
In the sbt project, we often spuriously re-doc a number of projects that
haven't changed because we modify a file in the resource path.
2019-07-29 12:44:20 -07:00
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