diff --git a/.scalafmt.conf b/.scalafmt.conf index 96e1dd6..72625ee 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,9 +1,17 @@ -version = "2.7.5" +version = "3.7.17" +runner.dialect = "scala213" maxColumn = 100 -docstrings = "ScalaDoc" +docstrings { + style = SpaceAsterisk +} assumeStandardLibraryStripMargin = true -continuationIndent.callSite = 2 -continuationIndent.defnSite = 2 -newlines.alwaysBeforeTopLevelStatements = true -rewrite.rules = [AvoidInfix, PreferCurlyFors, SortImports, SortModifiers] -spaces.inImportCurlyBraces = true +continuationIndent { + callSite = 2 + defnSite = 2 +} +rewrite { + rules = [AvoidInfix, PreferCurlyFors, SortImports, SortModifiers] +} +spaces { + inImportCurlyBraces = true +} diff --git a/core/build.sbt b/core/build.sbt index 946270e..0196bdd 100644 --- a/core/build.sbt +++ b/core/build.sbt @@ -3,12 +3,12 @@ enablePlugins(SbtPlugin) name := "sbt-codeartifact-core" libraryDependencies ++= Seq( - "software.amazon.awssdk" % "sso" % "2.17.103", - "software.amazon.awssdk" % "codeartifact" % "2.17.103", - "software.amazon.awssdk" % "sts" % "2.17.103", - "com.lihaoyi" %% "requests" % "0.6.9", - "com.lihaoyi" %% "os-lib" % "0.7.8", - "com.lihaoyi" %% "utest" % "0.7.10" % Test + "software.amazon.awssdk" % "sso" % "2.21.37", + "software.amazon.awssdk" % "codeartifact" % "2.21.37", + "software.amazon.awssdk" % "sts" % "2.21.37", + "com.lihaoyi" %% "requests" % "0.8.0", + "com.lihaoyi" %% "os-lib" % "0.9.2", + "com.lihaoyi" %% "utest" % "0.8.2" % Test ) testFrameworks += new TestFramework("utest.runner.Framework") diff --git a/core/src/main/scala/codeartifact/CodeArtifactRepo.scala b/core/src/main/scala/codeartifact/CodeArtifactRepo.scala index 1547e69..5fd45b6 100644 --- a/core/src/main/scala/codeartifact/CodeArtifactRepo.scala +++ b/core/src/main/scala/codeartifact/CodeArtifactRepo.scala @@ -22,14 +22,14 @@ object CodeArtifactRepo { // Url looks like: // https://-.d.codeartifact.us-west-2.amazonaws.com/maven/ - val jurl = new java.net.URL(url) + val juri = new java.net.URI(url) // Split on slashes, and get the last element: . - val name = jurl.getPath().split('/').last + val name = juri.getPath().split('/').last // Split on dots. Take the head, which is the - section. // Split on dashes. - val host = jurl.getHost() + val host = juri.getHost() val parts = host.split('.').head.split('-') // Last element is . val owner = parts.last diff --git a/core/src/test/scala/codeartifact/CodeArtifactRepoSpec.scala b/core/src/test/scala/codeartifact/CodeArtifactRepoSpec.scala new file mode 100644 index 0000000..8c5882c --- /dev/null +++ b/core/src/test/scala/codeartifact/CodeArtifactRepoSpec.scala @@ -0,0 +1,22 @@ +package codeartifact + +import utest._ + +object CodeArtifactRepoSpec extends TestSuite { + val tests = Tests { + test("fromUrl") { + val raw = + "https://com-example-1234567890.d.codeartifact.us-west-2.amazonaws.com/maven/private" + + val repo = CodeArtifactRepo.fromUrl(raw) + + assert(repo.name == "private") + assert(repo.domain == "com-example") + assert(repo.host == "com-example-1234567890.d.codeartifact.us-west-2.amazonaws.com") + assert(repo.owner == "1234567890") + assert(repo.url == raw) + assert(repo.realm == "com-example/private") + } + } + +} diff --git a/project/build.properties b/project/build.properties index 3161d21..e8a1e24 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.6.1 +sbt.version=1.9.7 diff --git a/project/plugins.sbt b/project/plugins.sbt index 3afda2f..3d1f028 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ -addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.20") +addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.4") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7") diff --git a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala index b09a081..4f412a8 100644 --- a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala +++ b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala @@ -6,7 +6,7 @@ trait CodeArtifactKeys { /////////// // Tasks // - //////////. + ////////// . val codeArtifactPublish: TaskKey[Unit] = taskKey[Unit]("Publish to AWS CodeArtifact.")