Commit Graph

56 Commits

Author SHA1 Message Date
Eugene Yokota 4ac724e529 bump to sbt-contraband 0.3.0-M7 and latest util 2017-07-01 19:44:49 -04:00
Eugene Yokota 31d519a003 Fix toString 2017-06-30 04:46:54 -04:00
Dale Wijnand 7e87603b5f Merge pull request #6 from jozic/updateoptions-tostring
add toString to UpdateOptions
2017-06-27 15:55:05 +01:00
Guillaume Martres f325d466de Add tests for CrossVersion.constant 2017-06-23 16:50:29 +02:00
Dale Wijnand e45d9a254b
Switch version patterns to Long instead of Int
For sbt/sbt#3011 reasons.
2017-06-09 15:36:06 +01:00
Dale Wijnand 039e2e6b6a
Change the sbt API/binary version for sbt 1.x to be 1.0 2017-06-09 12:17:46 +01:00
Dale Wijnand 1bbc4719c6
Cleanup CrossVersion code & tests 2017-06-09 11:47:38 +01:00
eugene yokota fae2b0de51 Merge pull request #105 from scalacenter/managed-checksums
Implement `managedChecksums` in ivy
2017-05-27 18:01:57 -04:00
eugene yokota be972124c6 Merge pull request #107 from eed3si9n/fport/3202
[fport] Improve the eviction warning presentation
2017-05-27 00:19:34 -04:00
Eugene Yokota 182b50a12b Improve the eviction warning presentation.
Fixes sbt/sbt#2699

Before:

    [warn] There may be incompatibilities among your library dependencies.
    [warn] Here are some of the libraries that were evicted:
    [warn]  * com.google.code.findbugs:jsr305:2.0.1 -> 3.0.0
    [warn] Run 'evicted' to see detailed eviction warnings

After:

    [warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
    [warn]
    [warn] 	* com.typesafe.akka:akka-actor_2.12:2.5.0 is selected over 2.4.17
    [warn] 	    +- de.heikoseeberger:akka-log4j_2.12:1.4.0            (depends on 2.5.0)
    [warn] 	    +- com.typesafe.akka:akka-parsing_2.12:10.0.6         (depends on 2.4.17)
    [warn] 	    +- com.typesafe.akka:akka-stream_2.12:2.4.17 ()       (depends on 2.4.17)
    [warn]
    [warn] Run 'evicted' to see detailed eviction warnings
2017-05-26 23:21:33 -04:00
Eugene Yokota 182a07402a update EvictionWarningSpec 2017-05-26 23:07:25 -04:00
Guillaume Martres 87a53986e3 Fix default scalaBinaryVersion for Dotty
Dotty is versioned as 0.*, but `CrossVersionUtil#binaryScalaVersion`
will return the full version instead of just `major.minor` for all
compiler versions < 2.10, add a special case for Dotty to avoid this.
2017-05-26 22:11:51 -04:00
jvican 27bf130853
Move `managedChecksums` to InlineIvyConfiguration
`UpdateOptions` is only meant for user-provided options. Since this
option should not be exposed to users, it's moved to inline ivy
configuration, whose parameters require information about the build and
is usually defined project-wide instead of `Global`-wide.
2017-05-26 20:10:53 +02:00
jvican 7bf60557d9
Implement `managedChecksums` in ivy
Managed checksums tells ivy to forget about checking checksums for jar
files and just persist them in the cache.

The user that enables that option will take care of verifying they are
correct.

This is a big deal because:

1. Ivy takes *a lot of time* checking timestamps for big jars, and does
   it sequentially. The user (sbt) can do better by running these checks
   in parallel, speeding up the whole resolution process!
2. The fact that the sha files are not present in the cache means that
   build tools cannot check if a checksum is correct without preprocessing
   the jar.

Note that the user is responsible for keeping the cache consistent. If
the checksum is not correct, the user should report it and overwrite the
checksum file with the valid digest.
2017-05-26 12:43:06 +02:00
jvican 4c8036c7cb
Add `managedChecksums` to `UpdateOptions` 2017-05-26 12:43:06 +02:00
jvican 80ee35b01c
Add custom checksum checks to ivy 2017-05-26 12:42:56 +02:00
eugene yokota 9e799a80f3 Merge pull request #97 from scalacenter/unique-resolvers
Allow to define concrete resolvers for dependencies
2017-05-12 22:57:53 -04:00
jvican 8bb1676e61
Allow to define concrete resolvers for dependencies
Sometimes, for predictability and performance, we may be interested in
specifying the concrete resolver that a `ModuleID` should use.

This patch achieves this by adding a new field to `UpdateOptions` and
then getting this information from the `SbtChainResolver`, that will
select the concrete resolver for a given dependency descriptor.

Why is this useful? Well, two reasons:

* Predictable behaviour. We have the guarantee that an artifact only
  comes from a concrete resolver.
* Resolution speedup. Around 1/3 or 1/2 times faster than normal
  resolution in a moderate test case scenario. If there is a lot of
  latency or network connection is poor, speedups will be higher.

LOGS:

```
NORMAL RESOLUTION TIME 1790
FASTER RESOLUTION TIME 1054
```

```
NORMAL RESOLUTION TIME 2078
FASTER RESOLUTION TIME 1055
```

Lots of projects can benefit from this option, as well as organizations
and companies. This will eventually integrate with the dependency lock
file, but can be used independently of it.
2017-05-12 23:47:05 +02:00
jvican 5ff32f2a99
Add a frozen mode to update configuration
The frozen mode is used by the dependency lock file.

It makes sure that the resolution is always intransitive and that ivy
does not check for changed dependencies and stores that information in
the resolved ivy files. Following the ivy documentation, the last change
may bring a slight performance improvement:

http://ant.apache.org/ivy/history/latest-milestone/use/resolve.html
2017-05-11 18:00:24 +02:00
jvican 96c775c445
Remove previous custom offline implementation
The previous custom offline implementation was not working on 100% of
the cases and relied on the TTL of ivy. As the previous commit
enabled the native offline implementation provided by ivy as of 2.3.0,
this functionality is not useful anymore.

The current place to specify offline is `UpdateConfiguration`, and not
`InlineIvyConfiguration` that is required to instantiate sbt. With the
current approach, we can be online or offline without having to
instantiate ivy sbt twice.

I will provide a Scalafix rewrite for this change.
2017-05-09 11:02:34 +02:00
jvican 67d9012a17
Add offline mode to `UpdateConfiguration`
The following commit tries to address the well-known issue that sbt
cannot be used in offline mode. In order to enable that use case, this
commit adds support for a flag in update configuration called `offline`
that users can change as they wish (and that sbt will expose via
settings).

It adds tests to check that the resolution uses the caches instead of
trying to resolve from the Internet. Unfortunately, ivy does not expose
a way to know whether a resolution was made from the cache or the
Internet, so the test case invents a metric to check that resolution
indeed happens from cache.

In order to benefit from this 100%, we need to update to ivy 2.4.0 or
cherry-pick a commit because a major issue in `useCacheOnly` has been
fixed: https://issues.apache.org/jira/browse/IVY-1515.

In short, this is good for the dependency lock file too. Since we can
make sure that once we have downloaded and resolved all the dependencies
locally, we do resolve from the cache.
2017-05-09 11:02:34 +02:00
jvican e1d98a1ec2
Fix sbt/sbt#1518: Handle cross-versioned exclusions
The following PR does two things:

* Removes the unnecessary `SbtExclusionRule` that was introduced to
  exclude artifacts at the project level (and not the dependency level).
  This change was done in an independent class to avoid breaking
  bincompat in 0.13.x series.
* Handle exclusion rules correctly, propagating the cross version to the
  exclusions of the dependencies.

To fix sbt/sbt#1518, this PR takes the avenue taken in
`SbtExclusionRule`, it accepts `GroupArtifactID` which should be the
preferred way to specify dependencies from now on. Unlike
`SbtExclusionRule`, it also supports `ModuleID` for those that want to
exclude a concrete dependency.

`InclExcl` did not have any tests. The following commit also adds a
testing suite for it, showing how the issue it's fixed and how you
should use `exclude` if you're calling directly `ExclusionRule` instead
of passing in `GroupArtifactID` and `ModuleID`.
2017-04-26 23:44:14 +02:00
jvican d42ea869d0
Apply formatting 2017-04-26 22:55:38 +02:00
Eugene Yokota 4b0b3a05f9 Bump to util 1.0.0-M23
I'm now going to use `CacheStore.apply` in `JsonUtil` (used by cached resolution). This gets rid of `fileToStore` parameter from a bunch of classes and simplifies the setup around librarymanagement.
2017-04-17 13:29:02 -04:00
eugene yokota 6fe4d820ed Merge pull request #81 from eed3si9n/fport/3017
[fport] Fix version parsing
2017-04-04 17:50:58 -07:00
Eugene Yokota 36121bed74 Fix version parsing
Fixes sbt/sbt#3011
2017-04-04 18:34:37 -04:00
Eugene Yokota bb258f42a6 Maven version range improvement
Previously, when the dependency resolver (Ivy) encountered a Maven version range such as `[1.3.0,)`
it would go out to the Internet to find the latest version.
This would result to a surprising behavior where the eventual version keeps changing over time
*even when there's a version of the library that satisfies the range condition*.

This changes to some Maven version ranges would be replaced with its lower bound
so that when a satisfactory version is found in the dependency graph it will be used.
You can disable this behavior using the JVM flag `-Dsbt.modversionrange=false`.

Fixes #2954
Ref #2291 / #2953
2017-04-04 16:22:28 -04:00
Dale Wijnand 92cc7c4cb1
Remove some compile warnings 2017-03-31 10:19:47 +01:00
Eugene Yokota c793c33740 fix test 2017-02-15 23:41:23 -05:00
Eugene Yokota 27397de8cf Adjust to upstream 2017-01-15 22:54:15 -05:00
Miles Sabin f495291edd fport: CrossVersion.patch
CrossVersion.full strips off -bin-suffix.
Ref https://github.com/sbt/sbt/pull/2757
2017-01-15 07:55:40 -05:00
Eugene Yokota df53eefbb0 Fixes merged ModuleID dropping configuration specification
Fixes #2002/#1500

Given a dependency graph such as:

    libraryDependencies += "com.google.guava" % "guava-tests" % "18.0"
    libraryDependencies += "com.google.guava" % "guava-tests" % "18.0"
% "test" classifier "tests"

previous releases of sbt would drop the Test configuration from the
classifier "tests" artifacts, and end up including the test JARs into
the Compile configuration instead of the Test configuration, which
would result in runtime error.

This fix configures the explicit artifacts into the configuration
during merge even when it says `"*"`.
2017-01-14 07:05:52 -05:00
Dale Wijnand 71fddd5e3f
Upgrade from sbt/datatype to sbt/contraband 2017-01-05 15:42:29 +00:00
Dale Wijnand af1c19034b
Remove unused imports 2016-11-16 11:17:27 +00:00
Dale Wijnand 3192b3ee1a
Remove unused warnings 2016-11-16 11:14:42 +00:00
Dale Wijnand f2efa10af1
Switch to sbt-datatype, sjson-new & Vectors 2016-11-15 23:59:34 +00:00
Dale Wijnand ffcad3cdad Make CrossVersion & ModuleId more commonly equal
Two instance of functions defined in the same way don't equal themselves, but
the same instance of a function does. So by using a val idStringFun for full and
binary, and making Binary and Full case classes there are much better chances
that ModuleId's defined in the same way will be equal.
2016-07-08 03:10:37 +01:00
Miles Sabin 52867b8c95 Override scala organization and version transitively at the Ivy level 2016-06-02 22:15:06 +01:00
Eugene Yokota 87b3ca04c0 Don't depend on other projects' tests 2016-05-11 14:12:10 -04:00
Eugene Yokota d304a95b24 Bump dependencies 2016-05-04 22:49:03 -04:00
Martin Duhem 65adc869d4 Implement static launcher for sbt
This is a combination of 13 commits. I squashed these 13 commits to make
forward porting those changes easier, since some commit undo the changes
of other commits.

The PRs that include these changes can be found at
https://github.com/sbt/sbt/pull/2564 and
https://github.com/sbt/sbt/pull/2576.

Static launcher, get bridge sources from resources

This commit introduces a new "static" launcher that does not use Ivy to
gather all the artifacts that it requires, but rather expect them to be
immediately available.

To be able to use sbt without Internet access, we add a new
`ComponentCompiler` that is able to retrieve the bridge sources from the
resources on classpath and compile it.

Fix classpath issues in static launcher

The launcher defines a top classloader that willbe used by all
`ScalaInstance`s. Previously, this top classloader had a parent that
contained the scala library 2.10, which prevented the correct
compilation of the compiler bridge for scala 2.11.

Also, we no longer need the scala-reflect JAR.

Tests for FakeResolver

Add `scala-reflect.jar` to JARs of `StaticScalaProvider`

It turns out we need to have `scala-reflect.jar` on classpath to compile
the compiler bridge for the static scala instance of the launcher.

Comply to Ivy's specification in `FakeResolver`

Remove `CompilerBridgeProvider` and `ResourceBridgeProvider`

It turns out that we can leverage the`FakeResolver` that has been
implemented to use with the static launcher, and resolve a "fake
compiler bridge" using it, rather than copying it from the resources.

This also has the advantage of not requiring to change the build
definition.

Fix NPE in FakeResolver

Add compiler bridge sources to fake resolver

This allows sbt to resolve the compiler bridge sources when using the
static launcher

Don't hardcode sbt version in static launcher

Add scala compiler and library to fake resolver

This allows us to still resolve them if we have no other resolver
configured.

Add `RepositoriesParser`

This parser is used by the static launcher to parse the definition of
resolvers that override the build resolvers.

Support repositories override in static launcher

The static launcher will now parse user-defined repositories like the
usual launcher does.

Specifically, the static launcher now uses the following configuration:

 - `sbt.boot.directory`: specifies the boot directory that sbt will use.
   Defaults to `~/.sbt/boot`.
 - `sbt.override.build.repos`: indicate whether we want to override the
   build resolvers. Defaults to false.
 - `sbt.repository.config`: specifies the path to the files that
   contains repositories definition. Defaults to
   `${sbt.boot.directory}/repositories`.

Notes for sbt/sbt#2564 & sbt/sbt#2576
2016-04-27 10:14:47 +02:00
Dan Sanduleac 01030a197a Add IvyRepoSpec which tests that source artifacts (in this case, with type=src, though in the same "compile" configuration) are resolved correctly when using IvyActions.updateClassifiers, and NOT resolved when using the normal IvyActions.updateEither. 2016-02-10 14:44:49 +00:00
Dan Sanduleac fcd52ee283 Expose the default UpdateConfiguration in BaseIvyConfiguration 2016-02-10 13:21:22 +00:00
Dan Sanduleac 31440bb147 Fix BaseIvySpeficiation's init of UpdateConfiguration with a sensible default ArtifactTypeFilter 2016-02-10 13:21:22 +00:00
Dale Wijnand f87eabdc98 FPORT: Make Make JCenter opt in
Forward-port of sbt/sbt#2335.
2016-01-16 15:44:55 +00:00
Martin Duhem 4831da8f4b Don't warn on inconsistent versions in different configurations
(This is a port of sbt/sbt#2258)

sbt was reporting warning abouts inconsistent versions of dependencies
even if these dependencies didn't have the same configuration (as in
`provided` vs `compile`).

This commit fixes this problem by comparing the dependencies by
organization, artifact name and configuration.
2015-11-11 15:12:05 +01:00
Eugene Platonov a217178d02 add toString to UpdateOptions 2015-09-17 11:39:38 -04:00
Martin Duhem 699dcfdee5 Update to latest sbt-houserules, formatting 2015-09-16 14:57:00 +02:00
Martin Duhem d00b7d8b61 Fix more warnings
Undeprecated `CustomPomParser` because it looks like nothing has
replaced it yet.

Removed usage of trait `scala.NotNull`, because it has been deprecated
as of Scala 2.11 and its support has never been implemented in scalac.
2015-09-10 16:10:51 +02:00
Martin Duhem 6822671f01 Add recommended compiler flags, fix warnings
Remove `JavaNet1Repository` which was deprecated.
2015-09-10 16:08:59 +02:00