We have a use case where we do not use the tag prefix (our projects are tagged like 4.1.2, 12.0.0...), and make use of DynVer.isSnapshot to determine where we want to publish projects.
ThisBuild / publishTo := {
val nexus: String = "https://nexus.example.net/repository/my-repository"
val a = if (DynVer.isSnapshot())
Some("Sonatype Nexus Repository Manager" at nexus + "-dev-snapshot")
else {
Some("Sonatype Nexus Repository Manager" at nexus + "-release")
}
a match {
case Some(v) => streams.value.log.log(Level.Info, s">>> ${v.toString()} hasNoTag:${DynVer.hasNoTags()} isDirty:${DynVer.isDirty()} ${DynVer.tagPrefix}")
}
a
}
However in this example we always log the dev-snapshot repository, because hasNoTag is always true, because it is implemented as follows:
def hasNoTags(): Boolean = !ref.isTag
And isTag is based on the prefix (which we do not use, we have set ThisBuild / dynverVTagPrefix := false:
def isTag: Boolean = value.startsWith(prefix)
I think it would be better to make use of inheritance on GitRef, so that a proper isTag could be implemented for GitCommit, GitTag, etc.
We have a use case where we do not use the tag prefix (our projects are tagged like 4.1.2, 12.0.0...), and make use of
DynVer.isSnapshot
to determine where we want to publish projects.However in this example we always log the dev-snapshot repository, because
hasNoTag
is always true, because it is implemented as follows:And
isTag
is based on the prefix (which we do not use, we have setThisBuild / dynverVTagPrefix := false
:I think it would be better to make use of inheritance on GitRef, so that a proper
isTag
could be implemented for GitCommit, GitTag, etc.