Closed stephanos closed 6 years ago
I tried adding
updateLockFile := {
import com.github.tkawachi.sbtlock._
val lockFile = new File(baseDirectory.value, sbtLockLockFile.value)
lockFile.delete()
val allModules = SbtLockKeys.collectLockModuleIDs.value
val depsHash = ModificationCheck.hash((libraryDependencies in Compile).value)
SbtLock.doLock(allModules, depsHash, lockFile, sLog.value)
},
onLoad in Global := { s: State => "updateLockFile" :: s },
but that doesn't seem to work: the hash is updated, but it still shows the old library version when I change one and run sbt compile
.
I'd appreciate any help you could give me :)
Never mind, I figured it out:
// update dependency lock file on startup if outdated
onLoad in Global := {
(s: State) => {
import com.github.tkawachi.sbtlock._
SbtLock.readDepsHash(new File(baseDirectory.value, sbtLockLockFile.value)) match {
case Some(hashInFile) if hashInFile != ModificationCheck.hash((libraryDependencies in Compile).value) => ";unlock ;reload" :: s
case Some(_) => s
case _ => "lock" :: s
}
}
},
I'm trying to integrate
sbt-lock
into our project. One thing I noticed is that it emits a warning when it detects that the dependencies have changed. Would it be possible to just regenerate the file in that case? That would make things way easier for me.