Merge pull request #192 from alexarchambault/topic/plugin-publish

Add project metadata and repositories in resolution cache in SBT plugin
This commit is contained in:
Alexandre Archambault 2016-03-07 01:43:30 +01:00
commit b0f437e99b
1 changed files with 31 additions and 23 deletions

View File

@ -147,6 +147,8 @@ object Tasks {
// FIXME More things should possibly be put here too (resolvers, etc.)
private case class CacheKey(
project: Project,
repositories: Seq[Repository],
resolution: Resolution,
withClassifiers: Boolean,
sbtClassifiers: Boolean
@ -250,29 +252,29 @@ object Tasks {
Files.write(cacheIvyPropertiesFile.toPath, "".getBytes("UTF-8"))
}
if (verbosity >= 2) {
println("InterProjectRepository")
for (p <- projects)
println(s" ${p.module}:${p.version}")
}
val globalPluginsRepo = IvyRepository(
new File(sys.props("user.home") + "/.sbt/0.13/plugins/target/resolution-cache/").toURI.toString +
"[organization]/[module](/scala_[scalaVersion])(/sbt_[sbtVersion])/[revision]/resolved.xml.[ext]",
withChecksums = false,
withSignatures = false,
withArtifacts = false
)
val interProjectRepo = InterProjectRepository(projects)
val ivyProperties = Map(
"ivy.home" -> (new File(sys.props("user.home")).toURI.getPath + ".ivy2")
) ++ sys.props
val repositories = Seq(globalPluginsRepo, interProjectRepo) ++ resolvers.flatMap(FromSbt.repository(_, ivyProperties))
def report = {
if (verbosity >= 2) {
println("InterProjectRepository")
for (p <- projects)
println(s" ${p.module}:${p.version}")
}
val globalPluginsRepo = IvyRepository(
new File(sys.props("user.home") + "/.sbt/0.13/plugins/target/resolution-cache/").toURI.toString +
"[organization]/[module](/scala_[scalaVersion])(/sbt_[sbtVersion])/[revision]/resolved.xml.[ext]",
withChecksums = false,
withSignatures = false,
withArtifacts = false
)
val interProjectRepo = InterProjectRepository(projects)
val ivyProperties = Map(
"ivy.home" -> (new File(sys.props("user.home")).toURI.getPath + ".ivy2")
) ++ sys.props
val repositories = Seq(globalPluginsRepo, interProjectRepo) ++ resolvers.flatMap(FromSbt.repository(_, ivyProperties))
val pool = Executors.newFixedThreadPool(parallelDownloads, Strategy.DefaultDaemonThreadFactory)
def createLogger() = new TermDisplay(new OutputStreamWriter(System.err))
@ -452,7 +454,13 @@ object Tasks {
}
resolutionsCache.getOrElseUpdate(
CacheKey(startRes.copy(filter = None), withClassifiers, sbtClassifiers),
CacheKey(
currentProject,
repositories,
startRes.copy(filter = None),
withClassifiers,
sbtClassifiers
),
report
)
}