Version 0.6.0
This commit is contained in:
parent
f570c91b6b
commit
dfa20f8530
3 changed files with 26 additions and 1 deletions
|
@ -16,3 +16,9 @@ addSbtPlugin("gs" % "sbt-garrity-software" % "0.4.0")
|
||||||
```scala
|
```scala
|
||||||
ThisBuild / gsProjectName := "project-name"
|
ThisBuild / gsProjectName := "project-name"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Publishing
|
||||||
|
|
||||||
|
```
|
||||||
|
sbt -Dversion=$VERSION -Drelease=true publish
|
||||||
|
```
|
||||||
|
|
|
@ -14,4 +14,8 @@ object GsKeys {
|
||||||
"Name of the project and Git repository."
|
"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."
|
||||||
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package gs
|
package gs
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets
|
||||||
|
import java.nio.file.Files
|
||||||
|
import java.nio.file.Paths
|
||||||
import sbt._
|
import sbt._
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
|
|
||||||
|
@ -10,6 +13,8 @@ object GsPlugin extends AutoPlugin {
|
||||||
|
|
||||||
import autoImport._
|
import autoImport._
|
||||||
|
|
||||||
|
val ScalaVersionFile: String = ".scala-version"
|
||||||
|
|
||||||
override def projectSettings: Seq[Setting[_]] = Seq(
|
override def projectSettings: Seq[Setting[_]] = Seq(
|
||||||
publishMavenStyle := true,
|
publishMavenStyle := true,
|
||||||
Test / Keys.publishArtifact := false,
|
Test / Keys.publishArtifact := false,
|
||||||
|
@ -33,7 +38,17 @@ object GsPlugin extends AutoPlugin {
|
||||||
},
|
},
|
||||||
scalacOptions := {
|
scalacOptions := {
|
||||||
val prev = Keys.scalacOptions.value
|
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)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue