From 015f479f480d5bdcb5d41756064ff23c963cf332 Mon Sep 17 00:00:00 2001 From: Daniel Sobral Date: Mon, 6 Apr 2020 11:09:25 -0600 Subject: [PATCH 1/2] Resolve the new revision instead of the old one --- src/main/scala/sbttrickle/Autobump.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/sbttrickle/Autobump.scala b/src/main/scala/sbttrickle/Autobump.scala index c38c55b..9aad2e8 100644 --- a/src/main/scala/sbttrickle/Autobump.scala +++ b/src/main/scala/sbttrickle/Autobump.scala @@ -40,7 +40,7 @@ trait Autobump { log: Logger): Seq[OutdatedRepository] = { val lm = new Resolver(dependencyResolution, workDir, log) outdatedRepositories.map { o => - val available = o.updates.filter(updateInfo => lm.isArtifactAvailable(updateInfo.dependency)) + val available = o.updates.filter(updateInfo => lm.isArtifactAvailable(updateInfo.dependency.withRevision(updateInfo.newRevision))) o.copy(updates = available) }.filterNot(_.updates.isEmpty) } From e7506bafc0cfc2056e640fd82ceb5f7aa0a2e93b Mon Sep 17 00:00:00 2001 From: Daniel Sobral Date: Tue, 7 Apr 2020 08:38:20 -0600 Subject: [PATCH 2/2] WIP --- src/main/scala/sbttrickle/TrickleKeys.scala | 1 + src/main/scala/sbttrickle/TricklePlugin.scala | 13 ++++++++++++- src/main/scala/sbttrickle/git/GitDb.scala | 10 +++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main/scala/sbttrickle/TrickleKeys.scala b/src/main/scala/sbttrickle/TrickleKeys.scala index 9dbbd85..ac39c3b 100644 --- a/src/main/scala/sbttrickle/TrickleKeys.scala +++ b/src/main/scala/sbttrickle/TrickleKeys.scala @@ -37,6 +37,7 @@ trait TrickleKeys { val trickleCheckDependencies = inputKey[Unit]("Verifies that a dependency has the expected version") val trickleIntransitiveResolve = settingKey[Boolean]("If true, only check direct dependency availability") val trickleLogUpdatableRepositories = taskKey[Unit]("Log what needs to be updates") + val trickleUpdatedDependencies = taskKey[Set[ModuleUpdateData]]("Set of all dependencies that were updated in this repository") val trickleOutdatedDependencies = taskKey[Set[ModuleUpdateData]]("Set of updates available on this repository") val trickleUpdateDependencies = taskKey[Unit]("Updates all managed dependencies to the latest version") val trickleUpdateSessionDependencies = taskKey[StateTransform]("Updates all managed dependencies to the latest version") diff --git a/src/main/scala/sbttrickle/TricklePlugin.scala b/src/main/scala/sbttrickle/TricklePlugin.scala index 1d7d433..9f33a4e 100644 --- a/src/main/scala/sbttrickle/TricklePlugin.scala +++ b/src/main/scala/sbttrickle/TricklePlugin.scala @@ -146,6 +146,16 @@ object TricklePlugin extends AutoPlugin { Autobump.checkSessionDependencies(project, dependencies, modules, log) } + lazy val trickleUpdatedDependenciesTask: Initialize[Task[Set[ModuleUpdateData]]] = Def.task { + val log = streams.value.log + val repository = trickleGitDbRepository.value + val sv = scalaBinaryVersion.value + val config = trickleGitConfig.value.withRemote(trickleDbURI.value).withDry(trickleDryMode.?.value) + val repository = trickleRepositoryName.value + val metadata = GitDb.getBuildMetadata(repository, sv, config, log) + val topology = BuildTopology(metadata) + } + lazy val trickleOutdatedDependenciesTask: Initialize[Task[Set[ModuleUpdateData]]] = Def.task { val buildTopology = trickleBuildTopology.value val repository = trickleRepositoryName.value @@ -306,6 +316,7 @@ object TricklePlugin extends AutoPlugin { commits ++ tags }.getOrElse(Seq.empty) - token(Space ~> NotQuoted.examples(FixedSetExamples(suggestions))) + // FIXME: bugged? + token(Space) ~> token(NotQuoted.examples(FixedSetExamples(suggestions))) } } diff --git a/src/main/scala/sbttrickle/git/GitDb.scala b/src/main/scala/sbttrickle/git/GitDb.scala index de1ce39..e416849 100644 --- a/src/main/scala/sbttrickle/git/GitDb.scala +++ b/src/main/scala/sbttrickle/git/GitDb.scala @@ -91,7 +91,7 @@ trait GitDb { /** * Reads all metadata from repository. * - * @param repository Repository directory, as in the return value of `getRepository` + * @param repository Repository directory, as in the return value of [[#getRepository]] */ def getBuildMetadata(repository: File, scalaBinaryVersion: String, @@ -111,7 +111,7 @@ trait GitDb { /** * Save metadata to repository and update remote if changed. * - * @param repository Repository directory, as in the return value of `getRepository` + * @param repository Repository directory, as in the return value of [[#getRepository]] * @param commitMsg Commit message in the git format * @return File where metadata was saved */ @@ -146,7 +146,7 @@ trait GitDb { /** * All commits reachable from HEAD. * - * @param repository Repository directory, as in the return value of `getRepository` + * @param repository Repository directory, as in the return value of [[#getRepository]] */ def commits(repository: File, config: GitConfig, log: Logger): Seq[String] = { if (isValidRepository(repository) && isConfigurationCorrect(repository, config, log)) { @@ -162,7 +162,7 @@ trait GitDb { /** * All tags. * - * @param repository Repository directory, as in the return value of `getRepository` + * @param repository Repository directory, as in the return value of [[#getRepository]] */ def tags(repository: File, config: GitConfig, log: Logger): Seq[String] = { if (isValidRepository(repository) && isConfigurationCorrect(repository, config, log)) { @@ -178,7 +178,7 @@ trait GitDb { * Resets HEAD to `commit`. * * @param commit sha-1 or reference (branches, tags and remotes), possibly abbreviated - * @param repository Repository directory, as in the return value of `getRepository` + * @param repository Repository directory, as in the return value of [[#getRepository]] */ def reset(commit: String, repository: File, config: GitConfig, log: Logger): Unit = { if (isValidRepository(repository) && isConfigurationCorrect(repository, config, log)) {