From 8d23cce3f213d0c2ef7badf1bfa605a5d9e316ff Mon Sep 17 00:00:00 2001 From: Nikolay Rykunov Date: Tue, 3 Aug 2021 14:18:07 +0300 Subject: [PATCH] [space] IDEA-264046: Move Space credentials provider for jps build process to community part GitOrigin-RevId: c98993a3352888effa5039af3c93080e6ecfde6b --- .idea/modules.xml | 1 + intellij.idea.community.main.iml | 1 + .../jps-plugin/intellij.space.java.jps.iml | 13 ++++++++++ ...ncies.DependencyAuthenticationDataProvider | 1 + ...aceDependencyAuthenticationDataProvider.kt | 25 +++++++++++++++++++ 5 files changed, 41 insertions(+) create mode 100644 plugins/space/jps-plugin/intellij.space.java.jps.iml create mode 100644 plugins/space/jps-plugin/src/META-INF/services/org.jetbrains.jps.incremental.dependencies.DependencyAuthenticationDataProvider create mode 100644 plugins/space/jps-plugin/src/com/intellij/space/jps/SpaceDependencyAuthenticationDataProvider.kt diff --git a/.idea/modules.xml b/.idea/modules.xml index 0af9e70929fa..a220d9aa73ed 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -840,6 +840,7 @@ + diff --git a/intellij.idea.community.main.iml b/intellij.idea.community.main.iml index 24d411b01218..8698a86ab4f3 100644 --- a/intellij.idea.community.main.iml +++ b/intellij.idea.community.main.iml @@ -144,6 +144,7 @@ + diff --git a/plugins/space/jps-plugin/intellij.space.java.jps.iml b/plugins/space/jps-plugin/intellij.space.java.jps.iml new file mode 100644 index 000000000000..047f61d3ae4d --- /dev/null +++ b/plugins/space/jps-plugin/intellij.space.java.jps.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugins/space/jps-plugin/src/META-INF/services/org.jetbrains.jps.incremental.dependencies.DependencyAuthenticationDataProvider b/plugins/space/jps-plugin/src/META-INF/services/org.jetbrains.jps.incremental.dependencies.DependencyAuthenticationDataProvider new file mode 100644 index 000000000000..d7d9b3700f06 --- /dev/null +++ b/plugins/space/jps-plugin/src/META-INF/services/org.jetbrains.jps.incremental.dependencies.DependencyAuthenticationDataProvider @@ -0,0 +1 @@ +com.intellij.space.jps.SpaceDependencyAuthenticationDataProvider \ No newline at end of file diff --git a/plugins/space/jps-plugin/src/com/intellij/space/jps/SpaceDependencyAuthenticationDataProvider.kt b/plugins/space/jps-plugin/src/com/intellij/space/jps/SpaceDependencyAuthenticationDataProvider.kt new file mode 100644 index 000000000000..733cd370db0d --- /dev/null +++ b/plugins/space/jps-plugin/src/com/intellij/space/jps/SpaceDependencyAuthenticationDataProvider.kt @@ -0,0 +1,25 @@ +package com.intellij.space.jps + +import org.jetbrains.jps.incremental.dependencies.DependencyAuthenticationDataProvider + +class SpaceDependencyAuthenticationDataProvider : DependencyAuthenticationDataProvider() { + override fun provideAuthenticationData(url: String): AuthenticationData? { + if (PROVIDED_HOSTS.none { url.contains(it) }) { + return null + } + + val userName = System.getProperty("jps.auth.spaceUsername") + val password = System.getProperty("jps.auth.spacePassword") + if (userName != null && password != null) { + return AuthenticationData(userName, password) + } + return null + } + + companion object { + private val PROVIDED_HOSTS = listOf( + "jetbrains.team", + "jetbrains.space" + ) + } +} \ No newline at end of file