From c4cc0c0af784c155dbcdf02e66a202ed5b7fb904 Mon Sep 17 00:00:00 2001 From: UnicornFreedom Date: Tue, 20 Sep 2022 02:54:03 +0200 Subject: [PATCH] Version 1.1.0 & commit hash tracking --- .gitignore | 1 + .gitlab-ci.yml | 4 ++-- README.md | 7 +++++++ build.sbt | 14 ++++++++++++-- project/assembly.sbt | 2 +- project/build.properties | 2 +- project/buildinfo.sbt | 1 + src/main/scala/ocelot/desktop/OcelotDesktop.scala | 2 ++ .../ocelot/desktop/ui/swing/SplashScreen.scala | 4 +++- 9 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 project/buildinfo.sbt diff --git a/.gitignore b/.gitignore index e86fe31..fc299d5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # SBT target/ +/.bsp/ # Gradle /.gradle diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 88b9e0b..4e13718 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,7 +21,7 @@ build: - sbt assembly artifacts: paths: - - target/scala-2.13/ocelot-desktop-assembly-0.1.jar + - target/scala-2.13/ocelot-desktop.jar pages: stage: deploy @@ -31,7 +31,7 @@ pages: script: - rm -rf public - mkdir public - - cp target/scala-2.13/ocelot-desktop-assembly-0.1.jar public/ocelot.jar + - cp target/scala-2.13/ocelot-desktop.jar public/ocelot.jar cache: {} artifacts: paths: diff --git a/README.md b/README.md index b825fc3..373d5b5 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,13 @@ A few smaller features are worth mentioning, too: ## Download Decided to give Ocelot Desktop a shot? [**Download** the latest build][download]. +## How to build it? +Just import the project in your favorite IDE. +Make sure to have Scala and SBT installed (manually or through IDE). + +Use `sbt run` to start Ocelot Desktop. Use `sbt assembly` to generate JAR file. +(It will appear at `target/scala-2.13/ocelot-desktop.jar` location.) + ## Credits - **LeshaInc**, the author and maintainer of Ocelot Desktop. - **Totoro**, the creator of ocelot-brain and ocelot-online. diff --git a/build.sbt b/build.sbt index 8347ff3..6477171 100644 --- a/build.sbt +++ b/build.sbt @@ -1,10 +1,18 @@ name := "ocelot-desktop" -version := "0.1" +version := "1.1.0" scalaVersion := "2.13.8" lazy val root = project.in(file(".")) .dependsOn(brain % "compile->compile") .aggregate(brain) + .enablePlugins(BuildInfoPlugin) + .settings( + buildInfoKeys := Seq[BuildInfoKey]( + BuildInfoKey.action("commit") { + scala.sys.process.Process("git rev-parse HEAD").!!.trim + }, version + ) + ) lazy val brain = ProjectRef(file("lib/ocelot-brain"), "ocelot-brain") @@ -21,7 +29,9 @@ libraryDependencies += "org.lwjgl.lwjgl" % "lwjgl-platform" % lwjglVersion class libraryDependencies += "org.jcraft" % "jorbis" % "0.0.17" -assemblyMergeStrategy in assembly := { +assembly / assemblyMergeStrategy := { case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard case _ => MergeStrategy.first } + +assembly / assemblyJarName := s"ocelot-desktop.jar" diff --git a/project/assembly.sbt b/project/assembly.sbt index 813ce17..c46ce74 100644 --- a/project/assembly.sbt +++ b/project/assembly.sbt @@ -1 +1 @@ -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9") \ No newline at end of file +addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0") diff --git a/project/build.properties b/project/build.properties index 95cca09..d738b85 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version = 1.3.12 \ No newline at end of file +sbt.version = 1.7.1 diff --git a/project/buildinfo.sbt b/project/buildinfo.sbt new file mode 100644 index 0000000..71982a8 --- /dev/null +++ b/project/buildinfo.sbt @@ -0,0 +1 @@ +addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") diff --git a/src/main/scala/ocelot/desktop/OcelotDesktop.scala b/src/main/scala/ocelot/desktop/OcelotDesktop.scala index e3c2b19..d692d4e 100644 --- a/src/main/scala/ocelot/desktop/OcelotDesktop.scala +++ b/src/main/scala/ocelot/desktop/OcelotDesktop.scala @@ -1,5 +1,6 @@ package ocelot.desktop +import buildinfo.BuildInfo import li.flor.nativejfilechooser.NativeJFileChooser import ocelot.desktop.audio.{Audio, SoundSource} import ocelot.desktop.ui.UiHandler @@ -44,6 +45,7 @@ object OcelotDesktop extends Logging { def mainInner(args: mutable.HashMap[Argument, Option[String]]): Unit = { logger.info("Starting up Ocelot Desktop") + logger.info(s"Version: ${BuildInfo.version} (${BuildInfo.commit.take(7)})") splashScreen.setStatus("Initializing brain...", 0.10f) Ocelot.initialize(LogManager.getLogger(Ocelot)) diff --git a/src/main/scala/ocelot/desktop/ui/swing/SplashScreen.scala b/src/main/scala/ocelot/desktop/ui/swing/SplashScreen.scala index 7023e09..37b1161 100644 --- a/src/main/scala/ocelot/desktop/ui/swing/SplashScreen.scala +++ b/src/main/scala/ocelot/desktop/ui/swing/SplashScreen.scala @@ -1,5 +1,7 @@ package ocelot.desktop.ui.swing +import buildinfo.BuildInfo + import java.awt.Window.Type import java.awt.{BorderLayout, Color, Dimension, Insets, Rectangle} import java.time.Year @@ -45,7 +47,7 @@ class SplashScreen extends JDialog { // Application version private val applicationVersion: JLabel = addLabel( new Rectangle(0, 0, Width, Height), - s"Version: 1.0.0", + s"Version: ${BuildInfo.version} (${BuildInfo.commit.take(7)})", SwingConstants.LEFT, SwingConstants.BOTTOM )