From 9ff26c81241a37d01cc2773a08ee06dab0b0762c Mon Sep 17 00:00:00 2001 From: Douglas Thomsen Date: Wed, 21 Aug 2024 15:22:31 -0600 Subject: [PATCH 1/6] Update error message. --- .../scala/codeartifact/CodeArtifactKeys.scala | 3 +++ .../codeartifact/CodeArtifactPlugin.scala | 23 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala index 34dab0a..7d8f65f 100644 --- a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala +++ b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala @@ -31,6 +31,9 @@ trait InternalCodeArtifactKeys { val codeArtifactToken = taskKey[Option[String]]( "CodeArtifact authentication. Provided by environment variable CODEARTIFACT_AUTH_TOKEN or fetched dynamically from available AWS credentials." ) + + val codeArtifactGetTokenInstructions = + taskKey[Option[String]]("Instructions on how to get a token for CodeArtifact") } object CodeArtifactKeys extends CodeArtifactKeys diff --git a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala index cdb25e6..47c0fa0 100644 --- a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala +++ b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala @@ -43,7 +43,28 @@ object CodeArtifactPlugin extends AutoPlugin { ), credentials ++= { val token = codeArtifactToken.value.getOrElse { - streams.value.log.warn("Unable to get AWS CodeArtifact auth token.") + streams.value.log.warn( + """ + | ___ ______ ____ _ _ _ _ __ _ + | / \ \ / / ___| / ___|___ __| | ___ / \ _ __| |_(_)/ _| __ _ ___| |_ + | / _ \ \ /\ / /\___ \ | | / _ \ / _` |/ _ \ / _ \ | '__| __| | |_ / _` |/ __| __| + | / ___ \ V V / ___) | | |__| (_) | (_| | __// ___ \| | | |_| | _| (_| | (__| |_ + |/_/ \_\_/\_/ |____/ \____\___/ \__,_|\___/_/ \_\_| \__|_|_| \__,_|\___|\__| + | + | + |The AWS CodeArtifact sbt plugin was not able to get a valid auth token. If you recieve and error due to + |the a dependency not being found then it could be caused by this. + | + |""".stripMargin + ) + + codeArtifactGetTokenInstructions.value.foreach { instructions => + streams.value.log.warn( + s""" + | ${instructions} + |""".stripMargin + ) + } "" } val repos = codeArtifactRepo.value +: codeArtifactResolvers.value From 74fbfdb4620446d12a3eee7d57abccc0819f8ec4 Mon Sep 17 00:00:00 2001 From: Douglas Thomsen Date: Wed, 21 Aug 2024 15:34:14 -0600 Subject: [PATCH 2/6] Update error message. --- .../src/main/scala/codeartifact/CodeArtifactPlugin.scala | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala index 47c0fa0..17b9585 100644 --- a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala +++ b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala @@ -54,16 +54,11 @@ object CodeArtifactPlugin extends AutoPlugin { | |The AWS CodeArtifact sbt plugin was not able to get a valid auth token. If you recieve and error due to |the a dependency not being found then it could be caused by this. - | |""".stripMargin ) codeArtifactGetTokenInstructions.value.foreach { instructions => - streams.value.log.warn( - s""" - | ${instructions} - |""".stripMargin - ) + streams.value.log.warn(instructions + "\n") } "" } From 47f1e34409e001a0773ae91789448ac656cf8d72 Mon Sep 17 00:00:00 2001 From: Douglas Thomsen Date: Wed, 21 Aug 2024 15:40:45 -0600 Subject: [PATCH 3/6] Update error message. --- .../src/main/scala/codeartifact/CodeArtifactPlugin.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala index 17b9585..917d864 100644 --- a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala +++ b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala @@ -58,7 +58,8 @@ object CodeArtifactPlugin extends AutoPlugin { ) codeArtifactGetTokenInstructions.value.foreach { instructions => - streams.value.log.warn(instructions + "\n") + val message = instructions + "\n" + streams.value.log.warn(message) } "" } From 7cb1698a9a18e5d6e4ec03df2d287eee6774fb6b Mon Sep 17 00:00:00 2001 From: Douglas Thomsen Date: Thu, 22 Aug 2024 08:04:40 -0600 Subject: [PATCH 4/6] Update error message. --- .../main/scala/codeartifact/CodeArtifactPlugin.scala | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala index 917d864..2241c28 100644 --- a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala +++ b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala @@ -53,14 +53,11 @@ object CodeArtifactPlugin extends AutoPlugin { | | |The AWS CodeArtifact sbt plugin was not able to get a valid auth token. If you recieve and error due to - |the a dependency not being found then it could be caused by this. - |""".stripMargin + |the a dependency not being found then it could be caused by this.""".stripMargin + ) + streams.value.log.warn( + codeArtifactGetTokenInstructions.value.map("\n" + _ + "\n").getOrElse("") ) - - codeArtifactGetTokenInstructions.value.foreach { instructions => - val message = instructions + "\n" - streams.value.log.warn(message) - } "" } val repos = codeArtifactRepo.value +: codeArtifactResolvers.value From 40b8b53207055888afaa343e8b17ae0f4dbc1328 Mon Sep 17 00:00:00 2001 From: Douglas Thomsen Date: Thu, 22 Aug 2024 08:21:27 -0600 Subject: [PATCH 5/6] Update error message. --- .../src/main/scala/codeartifact/CodeArtifactPlugin.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala index 2241c28..5a539c0 100644 --- a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala +++ b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala @@ -55,9 +55,8 @@ object CodeArtifactPlugin extends AutoPlugin { |The AWS CodeArtifact sbt plugin was not able to get a valid auth token. If you recieve and error due to |the a dependency not being found then it could be caused by this.""".stripMargin ) - streams.value.log.warn( - codeArtifactGetTokenInstructions.value.map("\n" + _ + "\n").getOrElse("") - ) + val instructions = codeArtifactGetTokenInstructions.value.map("\n" + _ + "\n").getOrElse("") + streams.value.log.warn(instructions) "" } val repos = codeArtifactRepo.value +: codeArtifactResolvers.value From a4ed8c17b076d0735d13cd2de0477a1b64b1a065 Mon Sep 17 00:00:00 2001 From: Douglas Thomsen Date: Thu, 22 Aug 2024 08:55:59 -0600 Subject: [PATCH 6/6] Update error message. --- .../src/main/scala/codeartifact/CodeArtifactKeys.scala | 6 +++--- .../src/main/scala/codeartifact/CodeArtifactPlugin.scala | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala index 7d8f65f..f8cefd3 100644 --- a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala +++ b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala @@ -20,6 +20,9 @@ trait CodeArtifactKeys { val codeArtifactResolvers: SettingKey[List[String]] = settingKey[List[String]]("Additional CodeArtifact repos from which to consume packages.") + + val codeArtifactGetTokenInstructions = + settingKey[Option[String]]("Instructions on how to get a token for CodeArtifact") } trait InternalCodeArtifactKeys { @@ -31,9 +34,6 @@ trait InternalCodeArtifactKeys { val codeArtifactToken = taskKey[Option[String]]( "CodeArtifact authentication. Provided by environment variable CODEARTIFACT_AUTH_TOKEN or fetched dynamically from available AWS credentials." ) - - val codeArtifactGetTokenInstructions = - taskKey[Option[String]]("Instructions on how to get a token for CodeArtifact") } object CodeArtifactKeys extends CodeArtifactKeys diff --git a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala index 5a539c0..1cfda85 100644 --- a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala +++ b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala @@ -18,6 +18,7 @@ object CodeArtifactPlugin extends AutoPlugin { def buildPublishSettings: Seq[Setting[_]] = Seq( ThisBuild / codeArtifactUrl := "", + ThisBuild / codeArtifactGetTokenInstructions := None, ThisBuild / codeArtifactResolvers := Nil )