~ubuntu-branches/debian/sid/scala/sid

« back to all changes in this revision

Viewing changes to project/RemoteDependencies.scala

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg, Mehdi Dogguy, Lucas Satabin, Frank S. Thomas, Emmanuel Bourg
  • Date: 2015-06-05 23:52:59 UTC
  • mfrom: (1.2.11)
  • Revision ID: package-import@ubuntu.com-20150605235259-wk00vgk83dh8o19g
Tags: 2.10.5-1
* Team upload.

[ Mehdi Dogguy ]
* New upstream release (Closes: #744278).

[ Lucas Satabin ]
* Update patches
* Update the clean target
* Update paths of elements to install
* Update watch file

[ Frank S. Thomas ]
* Remove myself from Uploaders.

[ Emmanuel Bourg ]
* The package has been adopted by the Java Team (Closes: #754935)
* Patched the build to avoid downloading libraries from the Internet
* Replaced the minified JavaScript files with unobfuscated ones
* No longer build scala-partest.jar until diffutils is packaged or replaced
* debian/watch: Fixed the versions matched (x.y.z instead of x.y.z..z)
* debian/rules:
  - Added the missing get-orig-source target (Closes: #724704)
  - Improved the clean target
* debian/control:
  - Build depend on scala (>= 2.10) and bnd
  - Use canonical URLs for the Vcs-* fields
  - Standards-Version updated to 3.9.6 (no changes)
* Switch to debhelper level 9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import sbt._
 
2
import Keys._
 
3
import ScalaBuildKeys._
 
4
 
 
5
 
 
6
object RemoteDependencies {
 
7
  def buildSettings(externalProjects: Set[URI], localScala: Setting[_]): Seq[Setting[_]] = Seq(
 
8
    commands += Command.command("fix-uri-projects") { (state: State) =>
 
9
      if(state.get(buildFixed) getOrElse false) state
 
10
      else {
 
11
        // TODO -fix up scalacheck's dependencies!
 
12
        val extracted = Project.extract(state)
 
13
        import extracted._
 
14
        val scalaVersionString = extracted get version
 
15
 
 
16
        def fix(s: Setting[_]): Setting[_] = s match {
 
17
          case ScopedExternalSetting(p, scalaInstance.key, setting) if externalProjects(p)        => localScala mapKey Project.mapScope(_ => s.key.scope)
 
18
          // TODO - Fix Actors dependency...
 
19
          //case ScopedExternalSetting(p, libraryDependencies.key, setting) if externalProjects(p)  => fixProjectDeps(s)
 
20
          case s                                                                                  => s
 
21
        }
 
22
        val transformed = session.mergeSettings map ( s => fix(s) )
 
23
        val scopes = transformed collect { case ScopedExternalSetting(p, _, s) if externalProjects(p) => s.key.scope } toSet
 
24
        // Create some fixers so we don't download scala or rely on it.
 
25
        // Also add dependencies that disappear in 2.10 for now...
 
26
        val fixers = for { scope <- scopes
 
27
                           setting <- Seq(autoScalaLibrary := false, 
 
28
                                          crossPaths := false,
 
29
                                          scalaVersion := scalaVersionString)
 
30
                     } yield setting mapKey Project.mapScope(_ => scope)
 
31
        val newStructure = Load.reapply(transformed ++ fixers, structure)
 
32
        Project.setProject(session, newStructure, state).put(buildFixed, true)
 
33
      }
 
34
    },
 
35
    onLoad in Global <<= (onLoad in Global) apply (_ andThen { (state: State) =>
 
36
      "fix-uri-projects" :: state
 
37
    })
 
38
  )
 
39
}
 
40
 
 
41
 
 
42
 
 
43
/** Matcher to make updated remote project references easier. */
 
44
object ScopedExternalSetting {
 
45
  def unapply[T](s: Setting[_]): Option[(URI, AttributeKey[_], Setting[_])] =
 
46
    s.key.scope.project match {
 
47
      case Select(p @ ProjectRef(uri, _)) => Some((uri, s.key.key, s))
 
48
      case _                              => None
 
49
    }
 
50
}
 
51
 
 
52
 
 
53