Skip to content

Commit 2a3a32a

Browse files
reidspencerclaude
andcommitted
Add Akka repository resolver and credentials to Akka helper
The Akka helper now automatically configures: - Akka repository resolver (https://repo.akka.io/maven) - Credentials from AKKA_REPO_TOKEN environment variable This removes the need for users to configure the Akka repo manually in ~/.sbt/1.0/ or their build files. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent dc56a8b commit 2a3a32a

1 file changed

Lines changed: 26 additions & 8 deletions

File tree

src/main/scala/com/ossuminc/sbt/helpers/Akka.scala

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,29 @@ import sbt.Keys.*
66
/** A helper that can be used to configure the complex dependencies in the Akka Platform.
77
*
88
* IMPORTANT: Akka is licensed under the Business Source License (BSL) 1.1 as of 2024.
9-
* A repository token is required to access Akka artifacts. Configure the Akka repository
10-
* resolver in ~/.sbt/1.0/ per Akka's instructions at https://akka.io/key
9+
* A repository token is required to access Akka artifacts. Set the AKKA_REPO_TOKEN
10+
* environment variable with your token from https://akka.io/key
1111
*
12-
* Akka artifacts are published for Scala 2.13 only. This helper automatically configures
13-
* CrossVersion.for3Use2_13 for Scala 3 projects.
12+
* This helper automatically:
13+
* - Adds the Akka repository resolver (https://repo.akka.io/maven)
14+
* - Configures credentials from AKKA_REPO_TOKEN environment variable
15+
* - Configures CrossVersion.for3Use2_13 for Scala 3 projects (Akka is Scala 2.13 only)
1416
*/
1517
object Akka extends AutoPluginHelper {
1618

19+
/** Akka repository URL */
20+
val akkaRepoUrl = "https://repo.akka.io/maven"
21+
22+
/** Akka repository resolver */
23+
val akkaResolver: MavenRepository = "Akka library repository".at(akkaRepoUrl)
24+
25+
/** Akka repository credentials from AKKA_REPO_TOKEN environment variable */
26+
def akkaCredentials: Seq[Credentials] = {
27+
sys.env.get("AKKA_REPO_TOKEN").map { token =>
28+
Credentials("Akka library repository", "repo.akka.io", "token", token)
29+
}.toSeq
30+
}
31+
1732
/** Helper to create Akka dependency with Scala 2.13 cross-version for Scala 3 compatibility */
1833
def akkaModule(org: String, name: String, version: String): ModuleID =
1934
(org %% name % version).cross(CrossVersion.for3Use2_13)
@@ -119,12 +134,14 @@ object Akka extends AutoPluginHelper {
119134

120135
/** Configure Akka dependencies for a specific release.
121136
*
122-
* NOTE: The Akka repository resolver must be configured separately in ~/.sbt/1.0/
123-
* per Akka's instructions at https://akka.io/key
137+
* Automatically adds:
138+
* - Akka repository resolver (https://repo.akka.io/maven)
139+
* - Credentials from AKKA_REPO_TOKEN environment variable
140+
* - Core Akka modules for the specified release
124141
*
125142
* @param release The Akka release version ("25.10" or "24.10"). Default is latest (25.10).
126143
* @param project The project to configure
127-
* @return The configured project with core Akka modules
144+
* @return The configured project with Akka resolver, credentials, and core modules
128145
*/
129146
def forRelease(release: String = "")(project: Project): Project = {
130147
val coreVersion = release match {
@@ -135,8 +152,9 @@ object Akka extends AutoPluginHelper {
135152
)
136153
}
137154

138-
// Only include core modules by default - users can add HTTP, gRPC etc. as needed
139155
project.settings(
156+
resolvers += akkaResolver,
157+
credentials ++= akkaCredentials,
140158
libraryDependencies ++= coreModules(coreVersion)
141159
)
142160
}

0 commit comments

Comments
 (0)