From f570c91b6bdb34ac272bc4bb8ad1d181ffe87cf0 Mon Sep 17 00:00:00 2001 From: Pat Garrity Date: Sat, 22 Mar 2025 11:11:08 -0500 Subject: [PATCH] Release 0.5.0: Minor updates --- .scalafmt.conf | 2 +- project/build.properties | 2 +- src/main/scala/gs/Gs.scala | 83 +++++++++++++++----------------- src/main/scala/gs/GsKeys.scala | 4 +- src/main/scala/gs/GsPlugin.scala | 12 ++--- 5 files changed, 50 insertions(+), 53 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index 80e6cc9..224d753 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,5 +1,5 @@ // See: https://github.com/scalameta/scalafmt/tags for the latest tags. -version = 3.7.17 +version = 3.9.4 runner.dialect = scala3 maxColumn = 80 diff --git a/project/build.properties b/project/build.properties index 04267b1..cc68b53 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.9 +sbt.version=1.10.11 diff --git a/src/main/scala/gs/Gs.scala b/src/main/scala/gs/Gs.scala index ec1519b..32e4fff 100644 --- a/src/main/scala/gs/Gs.scala +++ b/src/main/scala/gs/Gs.scala @@ -3,95 +3,91 @@ package gs; import sbt._ object Gs { - /** - * Standard compiler options used by GS projects. + + /** Standard compiler options used by GS projects. */ val CompilerOptions: Seq[String] = Seq( "-encoding", - "utf8", // Set source file character encoding. - "-deprecation", // Emit warning and location for usages of deprecated APIs. - "-feature", // Emit warning and location for usages of features that should be imported explicitly. - "-explain", // Explain errors in more detail. - "-unchecked", // Enable additional warnings where generated code depends on assumptions. - "-explain-types", // Explain type errors in more detail. - "-Xfatal-warnings", // Fail the compilation if there are any warnings. + "utf8", // Set source file character encoding. + "-deprecation", // Emit warning and location for usages of deprecated APIs. + "-feature", // Emit warning and location for usages of features that should be imported explicitly. + "-explain", // Explain errors in more detail. + "-unchecked", // Enable additional warnings where generated code depends on assumptions. + "-explain-types", // Explain type errors in more detail. + "-Xfatal-warnings", // Fail the compilation if there are any warnings. "-language:strictEquality", // Enable multiversal equality (require CanEqual) - "-Wunused:implicits", // Warn if an implicit parameter is unused. - "-Wunused:explicits", // Warn if an explicit parameter is unused. - "-Wunused:imports", // Warn if an import selector is not referenced. - "-Wunused:locals", // Warn if a local definition is unused. - "-Wunused:privates", // Warn if a private member is unused. - "-Wsafe-init" // Enable the safe initialization check. + "-Wunused:implicits", // Warn if an implicit parameter is unused. + "-Wunused:explicits", // Warn if an explicit parameter is unused. + "-Wunused:imports", // Warn if an import selector is not referenced. + "-Wunused:locals", // Warn if a local definition is unused. + "-Wunused:privates", // Warn if a private member is unused. + "-Wsafe-init" // Enable the safe initialization check. ) - /** - * Host of the GS Git server. + /** Host of the GS Git server. */ val GitHost: String = "git.garrity.co" - /** - * Host of the Maven server. + /** Host of the Maven server. */ val MavenHost: String = "maven.garrity.co" - /** - * Realm of the Maven server. + /** Realm of the Maven server. */ val MavenRealm: String = "Reposilite" - /** - * Organization name used to organize projects in Git. + /** Organization name used to organize projects in Git. */ val GitOrganization: String = "garrity-software" - /** - * Human readable organization name. + /** Human readable organization name. */ val OrganizationName: String = "Garrity Software" - /** - * Maven Group ID for GS projects. + /** Maven Group ID for GS projects. */ val GroupId: String = "gs" - /** - * Calculate the Git repository for a project. + /** Calculate the Git repository for a project. * - * @param projectName The project name. - * @return The HTTPS Git repository URL. + * @param projectName + * The project name. + * @return + * The HTTPS Git repository URL. */ - def gitRepo(projectName: String): String = + def gitRepo(projectName: String): String = s"https://$GitHost/$GitOrganization/$projectName" - /** - * Calculate the Git SSH target for a project. + /** Calculate the Git SSH target for a project. * - * @param projectName The project name. - * @return The SSH target. + * @param projectName + * The project name. + * @return + * The SSH target. */ def gitSsh(projectName: String): String = - s"git@$GitHost:$GitOrganization/${projectName}.git" + s"git@$GitHost:$GitOrganization/$projectName.git" object Environment { - val MavenUser: String = "GS_MAVEN_USER" + val MavenUser: String = "GS_MAVEN_USER" val MavenToken: String = "GS_MAVEN_TOKEN" } - /** - * Prefers to load credentials from file, if a file is available. Otherwise + /** Prefers to load credentials from file, if a file is available. Otherwise * mandates that the following environment variables exist: * * - `GS_MAVEN_USER` * - `GS_MAVEN_TOKEN` * - * @return The selected credentials for GS Maven. + * @return + * The selected credentials for GS Maven. */ def selectCredentials(): Credentials = if ((Path.userHome / ".sbt" / ".credentials").exists()) Credentials(Path.userHome / ".sbt" / ".credentials") else Credentials.apply( - realm =Gs.MavenRealm, + realm = Gs.MavenRealm, host = Gs.MavenHost, userName = sys.env .get(Gs.Environment.MavenUser) @@ -107,5 +103,6 @@ object Gs { s"You must either provide ~/.sbt/.credentials or specify the ${Gs.Environment.MavenToken} environment variable." ) ) - ) + ) + } diff --git a/src/main/scala/gs/GsKeys.scala b/src/main/scala/gs/GsKeys.scala index 6d7502e..1543ebd 100644 --- a/src/main/scala/gs/GsKeys.scala +++ b/src/main/scala/gs/GsKeys.scala @@ -6,12 +6,12 @@ import sbt._ */ object GsKeys { - /** - * Required setting for projects using the Garrity Software plugin. This + /** Required setting for projects using the Garrity Software plugin. This * value must match the Git repository name. This value is used to configure * publishing and generate sub-project names. */ lazy val gsProjectName = settingKey[String]( "Name of the project and Git repository." ) + } diff --git a/src/main/scala/gs/GsPlugin.scala b/src/main/scala/gs/GsPlugin.scala index 75b744c..44b2dc5 100644 --- a/src/main/scala/gs/GsPlugin.scala +++ b/src/main/scala/gs/GsPlugin.scala @@ -11,18 +11,18 @@ object GsPlugin extends AutoPlugin { import autoImport._ override def projectSettings: Seq[Setting[_]] = Seq( - publishMavenStyle := true, + publishMavenStyle := true, Test / Keys.publishArtifact := false, - pomIncludeRepository := Function.const(false), + pomIncludeRepository := Function.const(false), scmInfo := Some( ScmInfo( - browseUrl = url(Gs.gitRepo(gsProjectName.value)), + browseUrl = url(Gs.gitRepo(gsProjectName.value)), connection = Gs.gitSsh(gsProjectName.value) ) ), - homepage := Some(url(Gs.gitRepo(gsProjectName.value))), - organizationName := Gs.OrganizationName, - organization := Gs.GroupId, + homepage := Some(url(Gs.gitRepo(gsProjectName.value))), + organizationName := Gs.OrganizationName, + organization := Gs.GroupId, organizationHomepage := Some(url("https://garrity.co/")), publishTo := { val repo = "https://maven.garrity.co/"