Version 0.6.0

This commit is contained in:
Pat Garrity 2025-07-27 21:14:50 -05:00
parent f570c91b6b
commit dfa20f8530
Signed by: pfm
GPG key ID: 5CA5D21BAB7F3A76
3 changed files with 26 additions and 1 deletions

View file

@ -16,3 +16,9 @@ addSbtPlugin("gs" % "sbt-garrity-software" % "0.4.0")
```scala
ThisBuild / gsProjectName := "project-name"
```
## Publishing
```
sbt -Dversion=$VERSION -Drelease=true publish
```

View file

@ -14,4 +14,8 @@ object GsKeys {
"Name of the project and Git repository."
)
lazy val writeScalaVersionToFile = taskKey[Unit](
"Task to emit the Scala version used to build this project to a file."
)
}

View file

@ -1,5 +1,8 @@
package gs
import java.nio.charset.StandardCharsets
import java.nio.file.Files
import java.nio.file.Paths
import sbt._
import sbt.Keys._
@ -10,6 +13,8 @@ object GsPlugin extends AutoPlugin {
import autoImport._
val ScalaVersionFile: String = ".scala-version"
override def projectSettings: Seq[Setting[_]] = Seq(
publishMavenStyle := true,
Test / Keys.publishArtifact := false,
@ -33,7 +38,17 @@ object GsPlugin extends AutoPlugin {
},
scalacOptions := {
val prev = Keys.scalacOptions.value
prev ++ Gs.CompilerOptions
(prev ++ Gs.CompilerOptions).distinct
}
)
override lazy val buildSettings: Seq[Setting[_]] = Seq(
writeScalaVersionToFile := {
val outputFile = ScalaVersionFile
Files.write(
Paths.get(outputFile),
scalaVersion.value.getBytes(StandardCharsets.UTF_8)
)
}
)