Skip to content

Commit

Permalink
Use GitVersion plugin to pick OSS version tags
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 40731d3f6baf3147443d716ceefbb983f6ce7c35
  • Loading branch information
emanb29 authored and thatbot-copy[bot] committed Jan 24, 2024
1 parent 87bb95e commit a0e090e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/copy.bara.sky
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ PUSH_INCLUDE = [
".scalafix.conf",
".scalafmt.conf",
".gitignore",
"project/GitVersionPrefix.scala", # While we don't want to copy this file in-place, the rule in PR_TRANSFORMATIONS will handle moving it appropriately
] + ["project/" + f for f in PROJECT_LEVEL_INCLUDE]

PUSH_EXCLUDE = []
Expand All @@ -43,9 +42,6 @@ PR_TRANSFORMATIONS = [
core.move("public/.scalafmt.conf", ".scalafmt.conf"),
core.move("public/.gitignore", ".gitignore"),
core.move("public/project/", "project/", paths = glob(PROJECT_LEVEL_INCLUDE)),
# GitVersionPrefix.scala is specifically NOT copied between repos, because quine-plus uses a different tag scheme.
# Invariant: These files will both contain an object `GitVersionPrefix` with a single member `string` with type `String`
core.move("public/project/GitVersionPrefix.scala", "project/GitVersionPrefix.scala")
]

SCRUB_MESSAGE = [
Expand Down
8 changes: 6 additions & 2 deletions project/GitVersion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ object GitVersion extends AutoPlugin {
import autoImport._

override lazy val projectSettings = Seq(
tagPrefix := GitVersionPrefix.string,
tagPrefix := "quine/",
version := {
val prefix = tagPrefix.value
gitReader.value.withGit(_.describedVersion(Seq(prefix + '*'))).fold("UNKNOWN")(_.stripPrefix(prefix))
gitReader.value
.withGit(_.describedVersion(Seq(prefix + '*')).map(_.stripPrefix(prefix)))
// When running in the OSS repo, expect a "v" prefix instead of "quine/"
.orElse(gitReader.value.withGit(_.describedVersion(Seq("v*"))).map(_.stripPrefix("v")))
.getOrElse("UNKNOWN")
}
)

Expand Down
3 changes: 0 additions & 3 deletions project/GitVersionPrefix.scala

This file was deleted.

0 comments on commit a0e090e

Please sign in to comment.