Commit Graph

90 Commits

Author SHA1 Message Date
Ethan Atkins 63f2684219 Bump sbt snapshot version 2020-10-06 11:34:12 -07:00
Ethan Atkins 2f66304a48 Remove SNAPSHOTS from sbt boot directory
If the sbt snapshot builds are cached, then we don't actually dogfood
sbt when we publish a local sbt version because sbt will load with the
version from the last build
2020-09-28 07:28:24 -07:00
Eugene Yokota 4fe2f8eff1 Split to MiniDependencyTreePlugin
Ref https://github.com/sbt/sbt/pull/5880

This split the dependency-graph plugin into MiniDependencyTreePlugin and DependencyTreePlugin.
2020-09-22 21:21:01 -04:00
Eugene Yokota 17b75453b5 In-source sbt-dependency-graph
Ref https://github.com/sbt/sbt-dependency-graph/issues/178

This in-sources sbt-dependency-graph.
2020-09-21 21:43:16 -04:00
Ethan Atkins c641ebd55e Use latest sbt version in a travis build
Moving forward, it would be great for sbt to use the latest code to run
the scripted tests. This could help detect regressions that aren't
noticed by manual dogfooding. We can do this by first publishing
1.4.0-SNAPSHOT binaries before running tests. I didn't want to do this
for all of the builds because it does make each build that publishes
binaries take about a minute longer. The last build in the matrix is
much faster than the other builds though so I made just that build use
the snapshot version. Since that build almost always finishes first,
this should have little effect on the actual time to run ci even though
the cpu time will increase a bit.
2020-08-19 12:00:02 -07:00
Ethan Atkins b2d7ba3aec Disable virtual io in CI
The travis tty does not work with virtual io. We should disable virtual
io by default when sbt detects that it's being run in CI but until we
release 1.4.0-M3 or 1.4.0-RC1, we need this flag to fix the travis
output.
2020-08-19 11:26:38 -07:00
Eugene Yokota c85e5b8bc0 Upgrade scala version to 2.12.12
This introduces `Def.unit(...)` to workaround the pure expression does nothing warning.
2020-08-11 23:33:12 -04:00
Ethan Atkins 3a9d349065 Check server test project scalafmt on travis 2020-08-05 18:14:11 -07:00
Anil Kumar Myla 887eb17f9e
Update scala to 2.12.11 2020-03-18 00:49:14 -07:00
Eugene Yokota 02152cc41b Refactor server test
This refactors the server test to reuse the server instance for the tests against the same build.
2020-02-13 23:31:09 -05:00
Ethan Atkins 813864ec0f Add swoval java formatting plugin
The swoval javafmt plugin uses the google java formatter (which I
believe is the only widely used java formatter) to format source files.
It does not provide an automatic javafmtOnCompile method like the
scalafmt plugin so I had to manually implement that functionality. In
general the java formatter is much faster than scalafmt so the impact of
having javafmtOnCompile set to true is very low.
2020-01-14 14:20:23 -08:00
Ethan Atkins 45a2cd5985 Add util tests to the jdk8 build
The existing .travis.yml in the util project runs:
mimaReportBinaryIssues
scalafmtCheckAll
whitesourceCheckPolicies
test

The first three are already handled by the first build in the matrix. I
add the util tests to the first jdk11 build and the jdk8 build.
2019-12-08 10:28:31 -08:00
Ethan Atkins 094d730b06 Bump scalafmt 2019-11-30 14:57:20 -08:00
Eugene Yokota 2cd134cb61 Switch to xenial image
The majority of Travis CI builds have probalby migrated to using Xenial now, so it's better to migrate with the pack.
2019-10-03 17:18:14 -04:00
Ethan Atkins feb8c84b28 Bump travis java 8 version 2019-09-27 13:23:42 -07:00
Ethan Atkins ec281d8a14 Add coursier cache to CI
These locations are taken from https://get-coursier.io/docs/cache.
2019-08-01 11:57:29 -07:00
Ethan Atkins 995a1c6b8b Add nio tests to .travis.yml
These were inadvertently excluded when I refactored this file.
2019-07-16 20:48:07 -07:00
Ethan Atkins 00d2bc95de Consolidate travis builds
There is a large fixed overhead of about O(7minutes) per travis run. We
seem to be limited to five build agents at a time so I consolidated the
.travis.yml into five builds. I tried to distribute the tasks fairly
evenly so that all of the builds take about the same amount of time. On
my personal travis build, where I only get three build agents, the total
run time of the build dropped to 50 minutes from one hour forty minutes.
2019-05-28 15:10:18 -07:00
Ethan Atkins 36d6abd899 Don't set sbt version in .travis.yml
We should test the version specified in build.properties.
2019-05-28 10:29:00 -07:00
Eugene Yokota f999f6a62e always reresolve sbt artifacts when using Coursier
Ref #4589

This requires sbt server tests to resolve sbt off of local.
2019-04-27 14:31:13 -04:00
Eugene Yokota 24db77edc5 copy some tests from coursier/sbt-coursier
Copying over sbt-coursier integration tests that do not depend on Coursier-specific things, but excercises sbt integration.
2019-04-26 12:27:38 -04:00
Eugene Yokota 78c007c910 sbt-scalafmt 2.0.0 2019-04-20 03:23:08 -04:00
Ethan Atkins 81481a8af5 Disable supershell in CI
The supershell output is distracting in CI. I added a system property,
sbt.ci, to explicitly set whether or not sbt is running in a ci build.
It was not at all obvious to me if the BUILD_NUMBER or CI environment
variables were set on travis or appveyor.
2019-03-30 11:51:47 -07:00
Eugene Yokota db45b456ef switch to official sbt-scalafmt 2019-03-22 17:47:48 -04:00
Ethan Atkins aca541898d Add scripted tests for classloader-cache
Normally I'd include these with the previous commit, but the diff is so
large that I put them in their own commit. The tests handle 5 scenarios:

1) akka-actor-system -- a project that has Akka as a dependency and a
   simple main method that creates and terminates an ActorSystem. What
   is interesting about this test is that if scriptedBufferLog := false,
   we notice that the first call to run is slow, but subsequent calls to
   run and test are fast. The test does at least ensure that recycling
   the runtime layer in test works ok.

2) jni -- verifies that a project with native libraries will be able to
   load the library with each run. It actually swaps out the underlying
   library so that the it really ensures that the library is reloaded
   between runs.

3) library-mismatch -- verifies that the layered classloaders can work
   when the test dependencies are incompatible with the runtime
   dependencies. In this test, the test dependencies use an api in a
   library called foo-lib that isn't available in the version used by
   the runtime dependencies. Because of this incompatibility, the test
   will not work if Test / layeringStrategy := LayeringStrategy.Full.

4) scalatest -- verifies that a test runs using the scalatest framework
5) utest -- verifies that a test runs using the utest framework

The reason for (4) and (5) is to ensure that both the in sourced test
frameworks and external frameworks work with the new loaders.
2019-01-30 08:55:22 -08:00
Eugene Yokota 0bcb648448 test everything on JDK11 2019-01-03 22:32:32 -05:00
Eugene Yokota 3962ee297c add some AdoptOpenJDK JDK11 tests 2019-01-02 14:37:29 -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
Eugene Yokota 7c4412d960 use AdoptOpenJDK 8 2018-11-27 18:48:22 -05:00
Eugene Yokota fe8a74c229 drop notification override 2018-11-27 18:29:56 -05:00
Ethan Atkins 7d3d3c71d6 Refactor Watched
This commit reworks Watched to be more testable and extensible. It also
adds some small features. The previous implementation presented a number
of challenges:

1) It relied on external side effects to terminate the watch, which was
   difficult to test
2) It exposed irrelevant implementation details to the user in the
   methods that exposed the WatchState as a parameter.
3) It spun up two worker threads. One was to monitor System.in for user
   input. The other was to poll the watch service for events and write
   them to a queue. The user input thread actually broke '~console'
   because nearly every console session will hit the <enter> key, which
   would eventually cause the watch to stop when the user exited the
   console.

To address (1), I add the shouldTerminate method to WatchConfig. This
takes the current watch iteration is input and if the function returns
true, the watch will stop.

To address (2), I replace the triggeredMessage and watchingMessage keys
with watchTriggeredMessage and watchStartMessage. The latter two keys
are functions that do not take the WatchState as parameters. Both
functions take the current iteration count as a parameter and the
watchTriggeredMessage also has a parameter for the path that triggered
the build.

To address (3), I stop using the sbt.internal.io.EventMonitor and
instead use the sbt.io.FileEventMonitor. The latter class is similar to
the former except that it's polling method accepts a duration, which may
be finite or infinite) and returns all of the events that occurred since
it was last polled. By adding the ability to poll for a finite amount of
time, we can interleave polling for events with polling System.in for
user input, all on the main thread. This eliminates the two extraneous
threads and fixes the '~console' use case I described before.

I also let the user configure the function that reads from System.in via
the watchHandleInput method. In fact, this method need not read from
System.in at all since it's just () => Watched.Action. The reason that
it isn't () => Boolean is that I'd like to leave open the option for the
ability to trigger a build via user input, not just terminating the
watch. My initial idea was to add the ability to type 'r' to re-build in
addition to <enter> to exit. This doesn't work without integrating
jline though because the input is buffered. Regardless, for testing
purposes, it gives us the ability to add a timeout to the watch by
making handleInput return true when a deadline expires.

The tests are a bit wonky because I still need to rely on side effects
in the logging methods to orchestrate the sequence of file events that
I'd like to test. While I could move some of this logic into a
background thread, there still needs to be coordination between the
state of the watch and the background thread. I think it's easier to
reason about when all of the work occurs on the same thread, even if it
makes these user provided functions impure.

I deprecated all of the previous watch related keys that are no longer
used with the new infrastructure. To avoid breaking existing builds, I
make the watchConfig task use the deprecated logging methods if they are
defined in the user's builds, but sbt will not longer set the default
values. For the vast majority of users, it should be straightforward to
migrate their builds to use the new keys.  My hunch is that the of the
deprecated keys, only triggeredMessage is widely used (in conjunction
with the clear screen method) and it is dead simple to replace it with
watchTriggeredMessage.

Note: The FileTreeViewConfig class is not really necessary for this commit.
It will become more important in a subsequent commit which introduces an
optional global file system cache.
2018-10-08 22:00:50 -07:00
Filipe Regadas 68d6cd5338
Add doc task to travis-ci 2018-06-19 13:27:50 -04:00
Eugene Yokota dc73fcfece Split server unit test on its own
Ref https://github.com/sbt/sbt/issues/4186
This is an attempt to fix the flaky server test issue.
2018-06-18 04:43:11 -04:00
Eugene Yokota 72ebdeb199 jabba 0.10.1
https://github.com/shyiko/jabba/blob/master/CHANGELOG.md#0101---2018-05-07
Ref https://github.com/shyiko/jabba/issues/190
2018-05-30 00:16:27 -04:00
Eugene Yokota 951eaa646f jabba 0.9.6 (no sudo)
Ref https://github.com/shyiko/jabba/issues/190
Bumping to jabba 0.9.6 fixes sporaditc permission issues.
2018-05-30 00:16:27 -04:00
Eugene Yokota 2da1aa61eb implement cross JDK forking
```
sbt:helloworld> java++ 10
[info] Reapplying settings...
sbt:helloworld> run
[info] Running (fork) Hello
[info] 10.0.1

sbt:helloworld> java++ 8
[info] Reapplying settings...

sbt:helloworld> run
[info] Running (fork) Hello
[info] 1.8.0_171
```
2018-05-30 00:16:27 -04:00
Eugene Yokota 1f9a8bf310 start an instance of sbt in the background 2018-01-30 23:46:12 -05:00
Dale Wijnand cdba3e6bea
Add, configure & enforce sbt-whitesource 2018-01-11 14:13:21 +00:00
Dale Wijnand a41727fb17
Add, configure & enforce file headers 2017-10-05 09:03:40 +01:00
Eugene Yokota 6b8e716428 implement server handshake test 2017-09-16 22:29:58 -04:00
Eugene Yokota 97e1049d57 Undo _JAVA_OPTIONS enrivonment variable
Ref sbt/sbt#3520

This undoes the environment variable addedin 2017-09-06 update of Travis CI:
https://docs.travis-ci.com/user/build-environment-updates/2017-09-06/
2017-09-12 21:29:40 -04:00
Eugene Yokota c562a17358 Split the source-dependencies tests 2017-08-26 15:35:34 -04:00
Dale Wijnand 805b76f3d4
Add back, re-configure & re-enable Scalafmt 2017-08-10 16:35:23 +01:00
Dale Wijnand c103950b10
Add, configure & enable MiMa 2017-07-26 14:14:04 +01:00
Eugene Yokota b2220fe9d4
sbt 1.0.0-RC2 2017-07-20 06:56:37 +01:00
jvican 7b8e8cadf4
Execute macro tests in Travis 2017-05-25 18:39:24 +02:00
jvican fd4bf0e635
Replace previous scalafmt plugin by neo-scalafmt
The previous scalafmt plugin had two problems:

* Caching with Coursier did not work correctly
* It failed after the upgrade to 1.0 in my computer (from a clean fork):

```
[error] (testingProj/compile:scalafmtInc) java.lang.NoClassDefFoundError: Could not initialize class scala.meta.package$
[error] (runProj/compile:scalafmtInc) java.lang.NoClassDefFoundError: Could not initialize class scala.meta.package$
[error] (taskProj/compile:scalafmtInc) java.lang.NoClassDefFoundError: Could not initialize class scala.meta.package$
[error] (stdTaskProj/compile:scalafmtInc) java.lang.NoClassDefFoundError: Could not initialize class scala.meta.package$
[error] (actionsProj/compile:scalafmtInc) java.lang.NoClassDefFoundError: Could not initialize class scala.meta.package$
[error] (protocolProj/compile:scalafmtInc) java.lang.NoClassDefFoundError: Could not initialize class scala.meta.package$
[error] (commandProj/compile:scalafmtInc) java.lang.NoClassDefFoundError: Could not initialize class scala.meta.package$
[error] (mainSettingsProj/compile:scalafmtInc) java.lang.NoClassDefFoundError: Could not initialize class scala.meta.package$
[error] (mainProj/compile:scalafmtInc) java.lang.NoClassDefFoundError: Could not initialize class scala.meta.package$
[error] (sbtProj/compile:scalafmtInc) java.lang.NoClassDefFoundError: Could not initialize class scala.meta.package$
[error] (scriptedPluginProj/compile:scalafmtInc) java.lang.NoClassDefFoundError: Could not initialize class scala.meta.package$
[error] (scriptedSbtProj/compile:scalafmtInc) java.lang.NoClassDefFoundError: Could not initialize class scala.meta.package$
[error] Total time: 19 s, completed May 24, 2017 10:44:56 AM
```

This commit replaces the previous scalafmt integration by the one
created by Lucidsoftware, big shoutout! (/cc @pauldraper)

https://github.com/lucidsoftware/neo-sbt-scalafmt
2017-05-24 11:15:22 +02:00
Dale Wijnand 0b33c195ef
Upgrade the build to sbt 1.0.0-M5
Some plugins remain commented out, for now.

sbt-doge is no longer needed because a variant of it has been folded
into sbt 1.

For some reason scripted requires src/doc jars of sbt, so switch back to
using `publishAll` rather than `publishLocalBinAll`. :(

Also, the sys.prop change in scripted is to force log4j2 to not use a
thread context classloader, and avoid the following:

    ERROR StatusLogger Unable to create custom ContextSelector. Falling back to default.
     java.lang.ClassCastException: Cannot cast org.apache.logging.log4j.core.async.AsyncLoggerContextSelector to org.apache.logging.log4j.core.selector.ContextSelector
    	at java.lang.Class.cast(Class.java:3369)
    	at org.apache.logging.log4j.util.LoaderUtil.newCheckedInstanceOf(LoaderUtil.java:201)
    	at org.apache.logging.log4j.util.LoaderUtil.newCheckedInstanceOfProperty(LoaderUtil.java:226)
    	at org.apache.logging.log4j.core.impl.Log4jContextFactory.createContextSelector(Log4jContextFactory.java:97)
    	at org.apache.logging.log4j.core.impl.Log4jContextFactory.<init>(Log4jContextFactory.java:58)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    	at java.lang.Class.newInstance(Class.java:442)
    	at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:94)
    	at org.apache.logging.log4j.spi.ThreadContextMapFactory.createThreadContextMap(ThreadContextMapFactory.java:73)
    	at org.apache.logging.log4j.ThreadContext.init(ThreadContext.java:223)
    	at org.apache.logging.log4j.ThreadContext.<clinit>(ThreadContext.java:202)
    	at org.apache.logging.log4j.core.impl.ContextDataInjectorFactory.createDefaultInjector(ContextDataInjectorFactory.java:83)
    	at org.apache.logging.log4j.core.impl.ContextDataInjectorFactory.createInjector(ContextDataInjectorFactory.java:67)
    	at org.apache.logging.log4j.core.lookup.ContextMapLookup.<init>(ContextMapLookup.java:34)
    	at org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:117)
    	at org.apache.logging.log4j.core.config.AbstractConfiguration.<init>(AbstractConfiguration.java:125)
    	at org.apache.logging.log4j.core.config.DefaultConfiguration.<init>(DefaultConfiguration.java:46)
    	at org.apache.logging.log4j.core.layout.PatternLayout$Builder.build(PatternLayout.java:650)
    	at org.apache.logging.log4j.core.layout.PatternLayout.createDefaultLayout(PatternLayout.java:487)
    	at sbt.internal.util.ConsoleAppender.<init>(ConsoleAppender.scala:245)
    	at sbt.internal.util.ConsoleAppender$.apply(ConsoleAppender.scala:196)
    	at sbt.internal.util.ConsoleLogger.<init>(ConsoleAppender.scala:42)
    	at sbt.internal.util.ConsoleLogger$.apply(ConsoleAppender.scala:34)
    	at sbt.test.ScriptedRunner.run(ScriptedTests.scala:221)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at Scripted$.doScripted(Scripted.scala:125)
    	at $0483e89d182e9d240274$.$anonfun$scriptedTask$5(build.sbt:301)
2017-05-11 09:44:42 +01:00
jvican f967f6c1d7
Split project and aggregate project-load 2017-05-10 21:40:23 +02:00
jvican 272afa9d73
Try another travis structure + build tweaks
I've tried to put together some scripted tests to remove the overhead of
compiling the whole sbt, which is around 3 minutes every time.

This new structure *should* make the scripted tests run faster.

Aside from this, we do some more tweaks:

* Increase memory.
* Fork processes to compile and run (to see if it makes a difference).
* Pass in the server flag to sbt.
2017-05-10 21:40:23 +02:00