From 63f006f927710146497689674c7942e52755349f Mon Sep 17 00:00:00 2001 From: Pat Garrity Date: Sat, 23 Dec 2023 20:40:30 -0600 Subject: [PATCH] Updated for GS development. --- .pre-commit-config.yaml | 6 ++--- README.md | 2 +- build.sbt | 55 ++++++++++++++++++++++------------------- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d13a4e9..d84ba64 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,11 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace - - repo: https://git.meager.home/meager/meager-pre-commit-scala - rev: v0.1.2 + - repo: https://git.garrity.co/garrity-software/gs-pre-commit-scala + rev: v0.1.3 hooks: - id: scalafmt diff --git a/README.md b/README.md index 8bb0713..bb27656 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [License (Apache 2.0)](./LICENSE) UUID's for Scala 3 with generation based on JUG, and serialization based on code -from Jackson Databind. The only dependency is JUG, whereas the relevant Jackson +from Jackson Databind. The only dependency is JUG, whereas the relevant Jackson code is copied to this implementation (and slightly modified). - [Usage](#usage) diff --git a/build.sbt b/build.sbt index 1f4494d..dd5d446 100644 --- a/build.sbt +++ b/build.sbt @@ -13,12 +13,14 @@ externalResolvers := Seq( val ProjectName: String = "gs-uuid" val Description: String = "Garrity Software UUID Implementation" -/** - * Helper to extract the value from `-Dproperty=value`. +/** Helper to extract the value from `-Dproperty=value`. * - * @param name The property name. - * @param conv The conversion function to the output type. - * @return The converted value, or `None` if no value exists. + * @param name + * The property name. + * @param conv + * The conversion function to the output type. + * @return + * The converted value, or `None` if no value exists. */ def getProperty[A]( name: String, @@ -26,53 +28,50 @@ def getProperty[A]( ): Option[A] = Option(System.getProperty(name)).map(conv) -/** - * Use `sbt -Dversion=` to provide the version, minus the SNAPSHOT +/** Use `sbt -Dversion=` to provide the version, minus the SNAPSHOT * modifier. This is the typical approach for producing releases. */ val VersionProperty: String = "version" -/** - * Use `sbt -Drelease=true` to trigger a release build. +/** Use `sbt -Drelease=true` to trigger a release build. */ val ReleaseProperty: String = "release" -/** - * The value of `-Dversion=`. +/** The value of `-Dversion=`. * - * @return The version passed as input to SBT. + * @return + * The version passed as input to SBT. */ lazy val InputVersion: Option[String] = getProperty(VersionProperty, identity) -/** - * @return "-SNAPSHOT" if this is NOT a release, empty string otherwise. +/** @return + * "-SNAPSHOT" if this is NOT a release, empty string otherwise. */ lazy val Modifier: String = if (getProperty(ReleaseProperty, _.toBoolean).getOrElse(false)) "" else "-SNAPSHOT" -/** - * Version used if no version is passed as input. This helps with default/local +/** Version used if no version is passed as input. This helps with default/local * builds. */ val DefaultVersion: String = "0.1.0-SNAPSHOT" -/** - * This is the output version of the published artifact. If this build is not - * a release, the suffix "-SNAPSHOT" will be appended. +/** This is the output version of the published artifact. If this build is not a + * release, the suffix "-SNAPSHOT" will be appended. * - * @return The project version. + * @return + * The project version. */ lazy val SelectedVersion: String = InputVersion .map(v => s"$v$Modifier") .getOrElse(DefaultVersion) -/** - * The major version (first segment) value. Used to label releases. +/** The major version (first segment) value. Used to label releases. * - * @return The major version of the project. + * @return + * The major version of the project. */ lazy val MajorVersion: String = SelectedVersion.split('.').apply(0) @@ -96,10 +95,13 @@ lazy val publishSettings = Seq( licenses := List( "Apache 2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.html") ), - homepage := Some(url(s"https://git.garrity.co/garrity-software/$ProjectName")), + homepage := Some( + url(s"https://git.garrity.co/garrity-software/$ProjectName") + ), publishTo := { val repo = "https://maven.garrity.co/" - if (SelectedVersion.endsWith("SNAPSHOT")) Some("snapshots" at repo + "snapshots") + if (SelectedVersion.endsWith("SNAPSHOT")) + Some("snapshots" at repo + "snapshots") else Some("releases" at repo + "releases") } ) @@ -110,7 +112,8 @@ lazy val testSettings = Seq( ) ) -lazy val `gs-uuid` = (project.in(file("."))) +lazy val `gs-uuid` = project + .in(file(".")) .settings(sharedSettings) .settings(publishSettings) .settings(testSettings)