Skip to content

Commit

Permalink
use sbt-buildinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
carueda committed Jan 20, 2022
1 parent b90c591 commit 1f771d7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

0.9.997

- use sbt-buildinfo

- fix #125 "Getter is created for shared object definition in Java"

- Re #127: just added tests as I was not able to reproduce this issue
Expand Down
18 changes: 6 additions & 12 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
lazy val tscfgVersion = setVersion("0.9.997")
enablePlugins(BuildInfoPlugin)

organization := "com.github.carueda"
name := "tscfg"
version := tscfgVersion
version := "0.9.997"
scalaVersion := "3.1.0"
crossScalaVersions := Seq("2.13.8", "3.1.0")

buildInfoKeys := Seq[BuildInfoKey](version)
buildInfoPackage := "tscfg"

libraryDependencies ++= Seq(
"com.outr" %% "scribe" % "3.6.9",
"com.typesafe" % "config" % "1.4.1",
Expand All @@ -25,7 +28,7 @@ scalacOptions ++= Seq("-deprecation", "-feature")

(assembly / mainClass) := Some("tscfg.Main")

(assembly / assemblyJarName) := s"tscfg-$tscfgVersion.jar"
(assembly / assemblyJarName) := s"tscfg-${version.value}.jar"

coverageExcludedPackages := "tscfg.example.*;tscfg.Main"
coverageMinimumStmtTotal := 80
Expand Down Expand Up @@ -88,12 +91,3 @@ pomExtra :=
</developers>

sonatypeProfileName := "com.github.carueda"

def setVersion(version: String): String = {
println(s"setting version $version")
IO.write(
file("src/main/resources/application.conf"),
s"tscfg.version = $version\n"
)
version
}
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
3 changes: 1 addition & 2 deletions src/main/scala/tscfg/Main.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package tscfg

import com.typesafe.config.ConfigFactory
import tscfg.generators.java.JavaGen
import tscfg.generators.scala.ScalaGen
import tscfg.generators.{GenOpts, Generator, TemplateGenerator, TemplateOpts}
Expand All @@ -13,7 +12,7 @@ import scala.annotation.tailrec
/** The main program. Run with no arguments to see usage.
*/
object Main {
val version: String = ConfigFactory.load().getString("tscfg.version")
val version: String = BuildInfo.version

val defaultGenOpts: GenOpts = GenOpts(
packageName = "tscfg.example",
Expand Down

0 comments on commit 1f771d7

Please sign in to comment.