Skip to content

Commit 95826a2

Browse files
authored
Merge pull request #160 from julienrf/embed-version
Embed the version number in the application
2 parents 6dec14d + 47c3dba commit 95826a2

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,10 @@ Follow the procedure documented [here](https://stackoverflow.com/a/15505308/5617
7979

8080
## Publishing
8181

82-
Create a new [GitHub release](https://github.com/scylladb/scylla-migrator/releases), give it a tag name, a title, and a description, and then click Publish. A workflow will be triggered and will build the application fat-jar and upload it as a release asset.
82+
Create a new [GitHub release](https://github.com/scylladb/scylla-migrator/releases), give it a tag name (please see below), a title, and a description, and then click Publish. A workflow will be triggered and will build the application fat-jar and upload it as a release asset.
83+
84+
Rules for the release tag name:
85+
- Make sure to use tag names like `v1.2.3`, starting with `v` and followed by a [semantic version number](https://semver.org/).
86+
- Bump the major version number if the new release breaks the backward compatibility (e.g., an existing configuration or setup will not work anymore with the new release).
87+
- Bump the minor version number if the new release introduces new features in a backward compatible manner.
88+
- Bump the patch version number if the new release only introduces bugfixes in a backward compatible manner.

build.sbt

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ lazy val `spark-kinesis-dynamodb` = project.in(file("spark-kinesis-dynamodb")).s
2424
)
2525
)
2626

27-
lazy val migrator = (project in file("migrator")).settings(
27+
lazy val migrator = (project in file("migrator")).enablePlugins(BuildInfoPlugin).settings(
2828
name := "scylla-migrator",
29-
version := "0.0.1",
3029
mainClass := Some("com.scylladb.migrator.Migrator"),
3130
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
3231
javaOptions ++= Seq(
@@ -71,24 +70,12 @@ lazy val migrator = (project in file("migrator")).settings(
7170
oldStrategy(x)
7271
},
7372
assembly / assemblyJarName := s"${name.value}-assembly.jar",
73+
buildInfoKeys := Seq[BuildInfoKey](version),
74+
buildInfoPackage := "com.scylladb.migrator",
7475
// uses compile classpath for the run task, including "provided" jar (cf http://stackoverflow.com/a/21803413/3827)
7576
Compile / run := Defaults
7677
.runTask(Compile / fullClasspath, Compile / run / mainClass, Compile / run / runner)
77-
.evaluated,
78-
pomIncludeRepository := { x =>
79-
false
80-
},
81-
pomIncludeRepository := { x =>
82-
false
83-
},
84-
// publish settings
85-
publishTo := {
86-
val nexus = "https://oss.sonatype.org/"
87-
if (isSnapshot.value)
88-
Some("snapshots" at nexus + "content/repositories/snapshots")
89-
else
90-
Some("releases" at nexus + "service/local/staging/deploy/maven2")
91-
}
78+
.evaluated
9279
).dependsOn(`spark-kinesis-dynamodb`)
9380

9481
lazy val tests = project.in(file("tests")).settings(

migrator/src/main/scala/com/scylladb/migrator/Migrator.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ object Migrator {
2222
Logger.getLogger("org.apache.spark.scheduler.TaskSetManager").setLevel(Level.WARN)
2323
Logger.getLogger("com.datastax.spark.connector.cql.CassandraConnector").setLevel(Level.WARN)
2424

25+
log.info(s"ScyllaDB Migrator ${BuildInfo.version}")
26+
2527
val migratorConfig =
2628
MigratorConfig.loadFrom(spark.conf.get("spark.scylla.config"))
2729

migrator/src/main/scala/com/scylladb/migrator/Validator.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ object Validator {
3535
Logger.getLogger("org.apache.spark.scheduler.TaskSetManager").setLevel(Level.INFO)
3636
Logger.getLogger("com.datastax.spark.connector.cql.CassandraConnector").setLevel(Level.INFO)
3737

38+
log.info(s"ScyllaDB Migrator Validator ${BuildInfo.version}")
39+
3840
val migratorConfig =
3941
MigratorConfig.loadFrom(spark.conf.get("spark.scylla.config"))
4042

project/plugins.sbt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.2.0")
22

33
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1")
4+
5+
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1")
6+
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0")

0 commit comments

Comments
 (0)