Skip to content
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
18 changes: 13 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,20 @@ lazy val docs = project
specularMetaProject := Some(LocalProject("hexis")),
specularArtifactKind := "library",
specularSiteDirectory := (ThisBuild / baseDirectory).value / "target" / "site",
// Do not strip -ci first. sbt-dynver-ci names a distance build 0.1.1-ci, and stripping
// that suffix yields 0.1.1, which is not the published coordinate. A raw version that
// contains -ci, +, or SNAPSHOT advertises the last Central tag.
// Chrome advertises the last published tag. Development version is the ship line
// plus -ci (0.1.1-ci). The docs workflow sets SPECULAR_STRIP_CI, and sbt-specular
// then ignores this setting and strips that suffix, which is not on Central.
// Update the string in the same commit that tags the next release.
specularDisplayVersion := { raw =>
val distance = raw.contains("-ci") || raw.contains("+") || raw.contains("SNAPSHOT")
if raw.nonEmpty && !distance then raw else "0.1.0"
val published = "0.1.0"
if raw.trim == published then published else published
},
// The forked builder reads -Dspecular.meta.displayVersion. Replace the stripped
// ship line with this setting's result.
specularMetaProps := Def.uncached {
val published = specularDisplayVersion.value("")
val pinned = s"-Dspecular.meta.displayVersion=$published"
specularMetaProps.value.filterNot(_.startsWith("-Dspecular.meta.displayVersion=")) :+ pinned
},
)

Expand Down
10 changes: 4 additions & 6 deletions docs/src/test/scala/hexis/docs/DocsVersion.scala
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package hexis.docs

/** Install coordinate. Judge the raw build version. Do not trust a version after `-ci` was stripped. */
/** Install coordinate. Always the last published tag. A bare next version is not on Central. */
object DocsVersion:

/** Last published tag. */
/** Last published tag. Update this in the release commit. */
val published = "0.1.0"

/** A dynver distance (`-ci`, `+`, `SNAPSHOT`) is the next line. Anything else is advertised as written. */
/** Returns [[published]]. A bare next version, `-ci`, `+`, and `SNAPSHOT` are unpublished. */
def advertise(raw: String): String =
val trimmed = raw.trim
val distance = trimmed.contains("-ci") || trimmed.contains("+") || trimmed.contains("SNAPSHOT")
if trimmed.nonEmpty && !distance then trimmed else published
if raw.trim == published then published else published

/** `specular.meta.version` is the raw build version. Absent in unit tests, so those use [[published]]. */
def version: String =
Expand Down
6 changes: 3 additions & 3 deletions docs/src/test/scala/hexis/docs/Front.scala
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ ${Install.coordinate}
!Install.coordinate.contains("-ci"),
!Install.coordinate.contains("SNAPSHOT"),
!Install.coordinate.contains("<version>"),
DocsVersion.advertise("0.1.1") == DocsVersion.published,
DocsVersion.advertise("0.1.1-ci") == DocsVersion.published,
DocsVersion.advertise("0.1.1-SNAPSHOT") == DocsVersion.published,
DocsVersion.advertise("0.1.0+4-abcdef") == DocsVersion.published,
DocsVersion.advertise("0.1.0") == "0.1.0",
DocsVersion.advertise("0.1.0+1-abc") == DocsVersion.published,
DocsVersion.advertise(DocsVersion.published) == DocsVersion.published,
)
},
test("the figure is evaluate, and fit keeps it inside a phone column") {
Expand Down
Loading