Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #1050: set git buildinfos for caching properly #1072

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -681,17 +681,22 @@ object vercors extends Module {
object test extends Tests

object buildInfo extends BuildInfo with ScalaModule {
def gitBranch() = T.command { os.proc("git", "rev-parse", "--abbrev", "HEAD").call().out.text() }
def gitCommit() = T.command { os.proc("git", "rev-parse", "HEAD").call().out.text() }
def gitShortCommit() = T.command { os.proc("git", "rev-parse", "--short=8", "HEAD").call().out.text() }
def gitHasChanges() = T.command { os.proc("git", "diff-index", "--name-only", "HEAD").call().out.text().nonEmpty }

def buildInfoPackageName = "vct.main"
override def buildInfoMembers = T {
Seq(
BuildInfo.Value("name", "VerCors"),
BuildInfo.Value("version", "2.0.0"),
BuildInfo.Value("scalaVersion", scalaVersion()),
BuildInfo.Value("sbtVersion", "-"),
BuildInfo.Value("currentBranch", "unknown branch"),
BuildInfo.Value("currentCommit", "unknown commit"),
BuildInfo.Value("currentShortCommit", "unknown commit"),
BuildInfo.Value("gitHasChanges", ""),
BuildInfo.Value("currentBranch", gitBranch()()),
BuildInfo.Value("currentCommit", gitCommit()()),
BuildInfo.Value("currentShortCommit", gitShortCommit()()),
BuildInfo.Value("gitHasChanges", gitHasChanges()().toString),
BuildInfo.Value("silverCommit", viper.silver.repo.commitish()),
BuildInfo.Value("siliconCommit", viper.silicon.repo.commitish()),
BuildInfo.Value("carbonCommit", viper.carbon.repo.commitish()),
Expand Down
2 changes: 1 addition & 1 deletion src/main/vct/cache/VerificationCache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ case object VerificationCache extends LazyLogging {
def getSiliconDirectory: Path = getViperDirectory(BuildInfo.siliconCommit).resolve("silicon").resolve("verified")

private def getViperDirectory(backendCommit: String): Path = {
val variate = BuildInfo.gitHasChanges == "false"
val variate = BuildInfo.gitHasChanges != "false"

if(variate) {
logger.warn("Caching is enabled, but results will be discarded, since there were uncommitted changes at compilation time.")
Expand Down
Loading