Skip to content

Commit 3d3177f

Browse files
committed
fix auth in maven
1 parent 1618b69 commit 3d3177f

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

build.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
*/
44

55
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
6-
import util.getSpacePassword
6+
import util.configureApiValidation
7+
import util.configureNpm
8+
import util.configureProjectReport
79
import util.libs
810

911
plugins {
@@ -30,7 +32,7 @@ println("kotlinx.rpc project version: $version, Kotlin version: $kotlinVersionFu
3032
// If the prefix of the kPRC version is not Kotlin gradle plugin version – you have a problem :)
3133
// Probably some dependency brings kotlin with the later version.
3234
// To mitigate so, refer to `versions-root/kotlin-version-lookup.json`
33-
// and its usage in `gradle-conventions-settings/src/main/kotlin/settings-conventions.settings.gradle.kts`
35+
// and its usage in `gradle-conventions-settings/src/main/kotlin/conventions-version-resolution.settings.gradle.kts`
3436
val kotlinGPVersion = getKotlinPluginVersion()
3537
if (kotlinVersionFull != kotlinGPVersion) {
3638
error("KGP version mismatch. Project version: $kotlinVersionFull, KGP version: $kotlinGPVersion")

gradle-conventions-settings/src/main/kotlin/conventions-repositories.settings.gradle.kts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,16 @@ pluginManagement {
3939
name = repoName.split("-").joinToString("") { it.replaceFirstChar { c -> c.titlecase() } }
4040
url = uri("https://packages.jetbrains.team/maven/p/krpc/$repoName")
4141

42-
val spaceUsername = getSpaceUsername()
4342
val spacePassword = getSpacePassword()
4443

45-
if (spaceUsername != null && spacePassword != null) {
46-
credentials {
47-
username = spaceUsername
48-
password = spacePassword
44+
if (spacePassword != null) {
45+
credentials(HttpHeaderCredentials::class.java) {
46+
name = "Authorization"
47+
value = "Bearer ${getSpacePassword()}"
48+
}
49+
50+
authentication {
51+
create<HttpHeaderAuthentication>("http_auth_header")
4952
}
5053
} else {
5154
logger.info("Skipping adding credentials for Space repository '$repoName'")
@@ -95,16 +98,18 @@ gradle.rootProject {
9598
fun RepositoryHandler.jbTeamPackages(repoName: String) {
9699
maven {
97100
name = repoName.split("-").joinToString("") { it.replaceFirstChar { c -> c.titlecase() } }
98-
99101
url = uri("https://packages.jetbrains.team/maven/p/krpc/$repoName")
100102

101-
val spaceUsername = getSpaceUsername()
102103
val spacePassword = getSpacePassword()
103104

104-
if (spaceUsername != null && spacePassword != null) {
105-
credentials {
106-
username = spaceUsername
107-
password = spacePassword
105+
if (spacePassword != null) {
106+
credentials(HttpHeaderCredentials::class.java) {
107+
name = "Authorization"
108+
value = "Bearer $spacePassword"
109+
}
110+
111+
authentication {
112+
create<HttpHeaderAuthentication>("http_auth_header")
108113
}
109114
} else {
110115
logger.info("Skipping adding credentials for Space repository '$repoName'")

0 commit comments

Comments
 (0)