mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-88674 create remote interpreters for the selected module
Propagate the originating module through target wizards and language runtime configuration so interpreter setup uses the selected subproject instead of the root module. Adjust target upload and download mappings to synchronize project files relative to the remote working directory for sub-projects. GitOrigin-RevId: ec0a7280ee1c266c4c9f14c653779c914905300a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
97f3665aae
commit
f01f966769
@@ -1124,6 +1124,7 @@ f:com.intellij.execution.target.TargetCustomToolWizardStepBase$Companion
|
||||
- f:getID():java.lang.Object
|
||||
f:com.intellij.execution.target.TargetEnvironmentLanguagesPanel
|
||||
- <init>(com.intellij.openapi.project.Project,com.intellij.execution.target.TargetEnvironmentType,java.util.function.Supplier,com.intellij.execution.target.ContributedConfigurationsList,kotlin.jvm.functions.Function0):V
|
||||
- <init>(com.intellij.openapi.project.Project,com.intellij.openapi.module.Module,com.intellij.execution.target.TargetEnvironmentType,java.util.function.Supplier,com.intellij.execution.target.ContributedConfigurationsList,kotlin.jvm.functions.Function0):V
|
||||
- f:applyAll():V
|
||||
- f:disposeUIResources():V
|
||||
- f:getComponent():javax.swing.JComponent
|
||||
@@ -1135,12 +1136,14 @@ f:com.intellij.execution.target.TargetEnvironmentWizard
|
||||
- com.intellij.ide.wizard.AbstractWizardEx
|
||||
- sf:Companion:com.intellij.execution.target.TargetEnvironmentWizard$Companion
|
||||
- <init>(com.intellij.openapi.project.Project,java.lang.String,com.intellij.execution.target.TargetEnvironmentConfiguration,java.util.List):V
|
||||
- sf:createWizard(com.intellij.openapi.module.Module,com.intellij.execution.target.TargetEnvironmentType,com.intellij.execution.target.LanguageRuntimeType):com.intellij.execution.target.TargetEnvironmentWizard
|
||||
- sf:createWizard(com.intellij.openapi.project.Project,com.intellij.execution.target.TargetEnvironmentType,com.intellij.execution.target.LanguageRuntimeType):com.intellij.execution.target.TargetEnvironmentWizard
|
||||
- doCancelAction():V
|
||||
- f:getProject():com.intellij.openapi.project.Project
|
||||
- f:getSubject():com.intellij.execution.target.TargetEnvironmentConfiguration
|
||||
- show():V
|
||||
f:com.intellij.execution.target.TargetEnvironmentWizard$Companion
|
||||
- f:createWizard(com.intellij.openapi.module.Module,com.intellij.execution.target.TargetEnvironmentType,com.intellij.execution.target.LanguageRuntimeType):com.intellij.execution.target.TargetEnvironmentWizard
|
||||
- f:createWizard(com.intellij.openapi.project.Project,com.intellij.execution.target.TargetEnvironmentType,com.intellij.execution.target.LanguageRuntimeType):com.intellij.execution.target.TargetEnvironmentWizard
|
||||
- f:defaultDialogInsets():com.intellij.util.ui.JBInsets
|
||||
a:com.intellij.execution.target.TargetEnvironmentWizardStepKt
|
||||
@@ -1175,6 +1178,7 @@ a:com.intellij.execution.target.TargetWizardModel
|
||||
- f:commit():V
|
||||
- p:doCommit():V
|
||||
- a:getLanguageConfigForIntrospection():com.intellij.execution.target.LanguageRuntimeConfiguration
|
||||
- a:getModule():com.intellij.openapi.module.Module
|
||||
- a:getProject():com.intellij.openapi.project.Project
|
||||
- a:getSubject():com.intellij.execution.target.TargetEnvironmentConfiguration
|
||||
- prepareTarget():V
|
||||
@@ -1605,6 +1609,7 @@ f:com.intellij.execution.wsl.target.WslTargetType
|
||||
- createDefaultConfig():com.intellij.execution.wsl.target.WslTargetEnvironmentConfiguration
|
||||
- createEnvironmentRequest(com.intellij.openapi.project.Project,com.intellij.execution.wsl.target.WslTargetEnvironmentConfiguration):com.intellij.execution.target.TargetEnvironmentRequest
|
||||
- createSerializer(com.intellij.execution.wsl.target.WslTargetEnvironmentConfiguration):com.intellij.execution.wsl.target.WslTargetEnvironmentConfiguration
|
||||
- createStepsForNewWizard(com.intellij.openapi.module.Module,com.intellij.execution.wsl.target.WslTargetEnvironmentConfiguration,com.intellij.execution.target.LanguageRuntimeType):java.util.List
|
||||
- createStepsForNewWizard(com.intellij.openapi.project.Project,com.intellij.execution.wsl.target.WslTargetEnvironmentConfiguration,com.intellij.execution.target.LanguageRuntimeType):java.util.List
|
||||
- duplicateConfig(com.intellij.execution.wsl.target.WslTargetEnvironmentConfiguration):com.intellij.execution.wsl.target.WslTargetEnvironmentConfiguration
|
||||
- getDisplayName():java.lang.String
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.execution.target
|
||||
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.options.Configurable
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.ui.ValidationInfo
|
||||
@@ -18,6 +19,7 @@ import javax.swing.JPanel
|
||||
@ApiStatus.Internal
|
||||
class TargetCustomToolPanel(
|
||||
private val project: Project,
|
||||
private val module: Module?,
|
||||
private val targetEnvironmentType: TargetEnvironmentType<*>,
|
||||
private val targetSupplier: Supplier<TargetEnvironmentConfiguration>,
|
||||
private val language: LanguageRuntimeConfiguration,
|
||||
@@ -69,7 +71,9 @@ class TargetCustomToolPanel(
|
||||
}
|
||||
|
||||
private fun createRuntimePanel(language: LanguageRuntimeConfiguration): LanguagePanel {
|
||||
val configurable = language.getRuntimeType().createConfigurable(project, language, targetEnvironmentType, targetSupplier)
|
||||
val configurable = module?.let {
|
||||
language.getRuntimeType().createConfigurable(it, language, targetEnvironmentType, targetSupplier)
|
||||
} ?: language.getRuntimeType().createConfigurable(project, language, targetEnvironmentType, targetSupplier)
|
||||
(configurable as? CustomToolLanguageConfigurable<*>)?.apply {
|
||||
introspectable?.let { setIntrospectable(it) }
|
||||
stateChangedCallback?.let { registerStateChangedCallback(it) }
|
||||
@@ -91,4 +95,4 @@ class TargetCustomToolPanel(
|
||||
val configurable: Configurable,
|
||||
val panel: JComponent,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -49,6 +49,7 @@ abstract class TargetCustomToolWizardStepBase<M : TargetWizardModel>(
|
||||
// TODO [targets] get rid of `!!` in `model.languageConfigForIntrospection!!`
|
||||
customToolPanel = TargetCustomToolPanel(
|
||||
project = model.project,
|
||||
module = model.module,
|
||||
targetEnvironmentType = model.subject.getTargetType(),
|
||||
targetSupplier = ::editingTargetConfiguration,
|
||||
language = model.languageConfigForIntrospection!!,
|
||||
|
||||
+27
-7
@@ -5,6 +5,7 @@ import com.intellij.execution.ExecutionBundle
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.options.Configurable
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.NlsActions
|
||||
@@ -26,11 +27,28 @@ import javax.swing.JPanel
|
||||
|
||||
typealias LanguagesList = ContributedConfigurationsList<LanguageRuntimeConfiguration, LanguageRuntimeType<out LanguageRuntimeConfiguration>>
|
||||
|
||||
class TargetEnvironmentLanguagesPanel(private val project: Project,
|
||||
private val targetEnvironmentType: TargetEnvironmentType<*>,
|
||||
private val targetSupplier: Supplier<TargetEnvironmentConfiguration>,
|
||||
val languagesList: LanguagesList,
|
||||
private val parentRefresh: () -> Unit) {
|
||||
class TargetEnvironmentLanguagesPanel(
|
||||
private val project: Project,
|
||||
private val module: Module?,
|
||||
private val targetEnvironmentType: TargetEnvironmentType<*>,
|
||||
private val targetSupplier: Supplier<TargetEnvironmentConfiguration>,
|
||||
val languagesList: LanguagesList,
|
||||
private val parentRefresh: () -> Unit,
|
||||
) {
|
||||
|
||||
constructor(
|
||||
project: Project,
|
||||
targetEnvironmentType: TargetEnvironmentType<*>,
|
||||
targetSupplier: Supplier<TargetEnvironmentConfiguration>,
|
||||
languagesList: LanguagesList,
|
||||
parentRefresh: () -> Unit,
|
||||
) :
|
||||
this(project = project,
|
||||
module = null,
|
||||
targetEnvironmentType = targetEnvironmentType,
|
||||
targetSupplier = targetSupplier,
|
||||
languagesList = languagesList,
|
||||
parentRefresh = parentRefresh)
|
||||
|
||||
private val languagePanels = mutableListOf<LanguagePanel>()
|
||||
|
||||
@@ -92,7 +110,9 @@ class TargetEnvironmentLanguagesPanel(private val project: Project,
|
||||
}
|
||||
|
||||
private fun createRuntimePanel(language: LanguageRuntimeConfiguration): LanguagePanel {
|
||||
val configurable = language.getRuntimeType().createConfigurable(project, language, targetEnvironmentType, targetSupplier)
|
||||
val configurable = module?.let {
|
||||
language.getRuntimeType().createConfigurable(it, language, targetEnvironmentType, targetSupplier)
|
||||
} ?: language.getRuntimeType().createConfigurable(project, language, targetEnvironmentType, targetSupplier)
|
||||
val panel = panel {
|
||||
row {
|
||||
val separator = TitledSeparator(language.getRuntimeType().configurableDescription)
|
||||
@@ -166,4 +186,4 @@ class TargetEnvironmentLanguagesPanel(private val project: Project,
|
||||
private data class LanguagePanel(val language: LanguageRuntimeConfiguration,
|
||||
val configurable: Configurable,
|
||||
val panel: JComponent)
|
||||
}
|
||||
}
|
||||
|
||||
+20
-2
@@ -4,6 +4,7 @@ package com.intellij.execution.target
|
||||
import com.intellij.execution.ExecutionBundle
|
||||
import com.intellij.ide.wizard.AbstractWizardEx
|
||||
import com.intellij.ide.wizard.AbstractWizardStepEx
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.ui.ValidationInfo
|
||||
import com.intellij.openapi.util.NlsContexts
|
||||
@@ -47,6 +48,18 @@ class TargetEnvironmentWizard(val project: Project,
|
||||
@JvmStatic
|
||||
fun <C : TargetEnvironmentConfiguration> createWizard(
|
||||
project: Project, targetType: TargetEnvironmentType<C>, runtimeType: LanguageRuntimeType<*>?
|
||||
): TargetEnvironmentWizard? = createWizard(project, null, targetType, runtimeType)
|
||||
|
||||
@JvmStatic
|
||||
fun <C : TargetEnvironmentConfiguration> createWizard(
|
||||
module: Module, targetType: TargetEnvironmentType<C>, runtimeType: LanguageRuntimeType<*>?
|
||||
): TargetEnvironmentWizard? = createWizard(module.project, module, targetType, runtimeType)
|
||||
|
||||
private fun <C : TargetEnvironmentConfiguration> createWizard(
|
||||
project: Project,
|
||||
module: Module?,
|
||||
targetType: TargetEnvironmentType<C>,
|
||||
runtimeType: LanguageRuntimeType<*>?,
|
||||
): TargetEnvironmentWizard? {
|
||||
|
||||
if (!targetType.providesNewWizard(project, runtimeType)) {
|
||||
@@ -54,7 +67,12 @@ class TargetEnvironmentWizard(val project: Project,
|
||||
}
|
||||
|
||||
val config = targetType.createDefaultConfig()
|
||||
val steps = targetType.createStepsForNewWizard(project, config, runtimeType) ?: return null
|
||||
val steps = if (module == null) {
|
||||
targetType.createStepsForNewWizard(project, config, runtimeType)
|
||||
}
|
||||
else {
|
||||
targetType.createStepsForNewWizard(module, config, runtimeType)
|
||||
} ?: return null
|
||||
|
||||
return TargetEnvironmentWizard(
|
||||
project, ExecutionBundle.message("run.on.targets.wizard.title.new.target"), config, steps)
|
||||
@@ -69,4 +87,4 @@ class TargetEnvironmentWizard(val project: Project,
|
||||
interface ValidationCallbackConsumer : Consumer<() -> Unit> {
|
||||
fun doValidateAll(): MutableList<ValidationInfo>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.execution.target
|
||||
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.project.Project
|
||||
|
||||
abstract class TargetWizardModel {
|
||||
abstract val project: Project
|
||||
abstract val module: Module?
|
||||
|
||||
abstract val subject: TargetEnvironmentConfiguration
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.intellij.execution.wsl.target.wizard.WslTargetWizardModel
|
||||
import com.intellij.execution.wsl.ui.browseWslPath
|
||||
import com.intellij.icons.AllIcons
|
||||
import com.intellij.ide.wizard.AbstractWizardStepEx
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.options.Configurable
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.ui.TextComponentAccessor
|
||||
@@ -46,8 +47,16 @@ class WslTargetType : TargetEnvironmentType<WslTargetEnvironmentConfiguration>(T
|
||||
|
||||
override fun createStepsForNewWizard(project: Project,
|
||||
configToConfigure: WslTargetEnvironmentConfiguration,
|
||||
runtimeType: LanguageRuntimeType<*>?): List<AbstractWizardStepEx> {
|
||||
val model = WslTargetWizardModel(project, configToConfigure, runtimeType, null)
|
||||
runtimeType: LanguageRuntimeType<*>?): List<AbstractWizardStepEx> =
|
||||
createStepsForNewWizard(WslTargetWizardModel(project, configToConfigure, runtimeType, null), runtimeType)
|
||||
|
||||
override fun createStepsForNewWizard(module: Module,
|
||||
configToConfigure: WslTargetEnvironmentConfiguration,
|
||||
runtimeType: LanguageRuntimeType<*>?): List<AbstractWizardStepEx> =
|
||||
createStepsForNewWizard(WslTargetWizardModel(module, configToConfigure, runtimeType, null), runtimeType)
|
||||
|
||||
private fun createStepsForNewWizard(model: WslTargetWizardModel,
|
||||
runtimeType: LanguageRuntimeType<*>?): List<AbstractWizardStepEx> {
|
||||
val isCustomToolConfiguration = runtimeType is CustomToolLanguageRuntimeType
|
||||
model.isCustomToolConfiguration = isCustomToolConfiguration
|
||||
return listOf(
|
||||
|
||||
+2
-2
@@ -31,8 +31,8 @@ internal class WslTargetLanguageStep(model: WslTargetWizardModel) : WslTargetSte
|
||||
model.applyChanges()
|
||||
val targetSupplier: () -> TargetEnvironmentConfiguration = { model.subject }
|
||||
|
||||
languagesPanel = TargetEnvironmentLanguagesPanel(model.project, model.subject.getTargetType(),
|
||||
targetSupplier, languagesForEditing) {
|
||||
languagesPanel = TargetEnvironmentLanguagesPanel(model.project, model.module,
|
||||
model.subject.getTargetType(), targetSupplier, languagesForEditing) {
|
||||
forceMainPanelLayout()
|
||||
}.also {
|
||||
mainPanel.addToCenter(it.component)
|
||||
|
||||
+23
-4
@@ -8,13 +8,32 @@ import com.intellij.execution.target.getRuntimeType
|
||||
import com.intellij.execution.target.getTargetType
|
||||
import com.intellij.execution.wsl.WSLDistribution
|
||||
import com.intellij.execution.wsl.target.WslTargetEnvironmentConfiguration
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.annotations.Nls
|
||||
|
||||
class WslTargetWizardModel(override val project: Project,
|
||||
override val subject: WslTargetEnvironmentConfiguration,
|
||||
runtimeType: LanguageRuntimeType<*>?,
|
||||
var distribution: WSLDistribution?) : TargetWizardModel() {
|
||||
class WslTargetWizardModel private constructor(
|
||||
override val project: Project,
|
||||
override val subject: WslTargetEnvironmentConfiguration,
|
||||
runtimeType: LanguageRuntimeType<*>?,
|
||||
var distribution: WSLDistribution?,
|
||||
override val module: Module?,
|
||||
) : TargetWizardModel() {
|
||||
|
||||
constructor(
|
||||
project: Project,
|
||||
subject: WslTargetEnvironmentConfiguration,
|
||||
runtimeType: LanguageRuntimeType<*>?,
|
||||
distribution: WSLDistribution?,
|
||||
) : this(project, subject, runtimeType, distribution, null)
|
||||
|
||||
constructor(
|
||||
module: Module,
|
||||
subject: WslTargetEnvironmentConfiguration,
|
||||
runtimeType: LanguageRuntimeType<*>?,
|
||||
distribution: WSLDistribution?,
|
||||
) : this(module.project, subject, runtimeType, distribution, module)
|
||||
|
||||
internal var isCustomToolConfiguration: Boolean = false
|
||||
|
||||
override var languageConfigForIntrospection: LanguageRuntimeConfiguration? = runtimeType?.createDefaultConfig()
|
||||
|
||||
@@ -700,6 +700,7 @@ f:com.intellij.execution.target.LanguageRuntimeConfiguration$VolumeState
|
||||
a:com.intellij.execution.target.LanguageRuntimeType
|
||||
- sf:Companion:com.intellij.execution.target.LanguageRuntimeType$Companion
|
||||
- sf:EXTENSION_NAME:com.intellij.openapi.extensions.ExtensionPointName
|
||||
- createConfigurable(com.intellij.openapi.module.Module,com.intellij.execution.target.LanguageRuntimeConfiguration,com.intellij.execution.target.TargetEnvironmentType,java.util.function.Supplier):com.intellij.openapi.options.Configurable
|
||||
- a:createConfigurable(com.intellij.openapi.project.Project,com.intellij.execution.target.LanguageRuntimeConfiguration,com.intellij.execution.target.TargetEnvironmentType,java.util.function.Supplier):com.intellij.openapi.options.Configurable
|
||||
- createIntrospector(com.intellij.execution.target.LanguageRuntimeConfiguration):com.intellij.execution.target.LanguageRuntimeType$Introspector
|
||||
- a:findLanguageRuntime(com.intellij.execution.target.TargetEnvironmentConfiguration):com.intellij.execution.target.LanguageRuntimeConfiguration
|
||||
@@ -835,6 +836,7 @@ a:com.intellij.execution.target.TargetEnvironmentType
|
||||
- sf:EXTENSION_NAME:com.intellij.openapi.extensions.ExtensionPointName
|
||||
- a:createConfigurable(com.intellij.openapi.project.Project,com.intellij.execution.target.TargetEnvironmentConfiguration,com.intellij.execution.target.LanguageRuntimeType,com.intellij.openapi.options.Configurable):com.intellij.openapi.options.Configurable
|
||||
- a:createEnvironmentRequest(com.intellij.openapi.project.Project,com.intellij.execution.target.TargetEnvironmentConfiguration):com.intellij.execution.target.TargetEnvironmentRequest
|
||||
- createStepsForNewWizard(com.intellij.openapi.module.Module,com.intellij.execution.target.TargetEnvironmentConfiguration,com.intellij.execution.target.LanguageRuntimeType):java.util.List
|
||||
- createStepsForNewWizard(com.intellij.openapi.project.Project,com.intellij.execution.target.TargetEnvironmentConfiguration,com.intellij.execution.target.LanguageRuntimeType):java.util.List
|
||||
- sf:duplicateTargetConfiguration(com.intellij.execution.target.TargetEnvironmentType,com.intellij.execution.target.TargetEnvironmentConfiguration):com.intellij.execution.target.TargetEnvironmentConfiguration
|
||||
- sf:findInstance(java.lang.Class):com.intellij.execution.target.TargetEnvironmentType
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.intellij.execution.RunnerAndConfigurationSettings
|
||||
import com.intellij.execution.process.ProcessOutput
|
||||
import com.intellij.execution.target.LanguageRuntimeType.Companion.EXTENSION_NAME
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.options.Configurable
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.NlsContexts
|
||||
@@ -62,6 +63,13 @@ abstract class LanguageRuntimeType<C : LanguageRuntimeConfiguration>(id: String)
|
||||
targetSupplier: Supplier<TargetEnvironmentConfiguration>,
|
||||
): Configurable
|
||||
|
||||
open fun createConfigurable(
|
||||
module: Module,
|
||||
config: C,
|
||||
targetEnvironmentType: TargetEnvironmentType<*>,
|
||||
targetSupplier: Supplier<TargetEnvironmentConfiguration>,
|
||||
): Configurable = createConfigurable(module.project, config, targetEnvironmentType, targetSupplier)
|
||||
|
||||
abstract fun findLanguageRuntime(target: TargetEnvironmentConfiguration): C?
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.intellij.execution.target.TargetEnvironmentType.Companion.getTargetTy
|
||||
import com.intellij.ide.wizard.AbstractWizardStepEx
|
||||
import com.intellij.openapi.components.PersistentStateComponent
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.options.Configurable
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
@@ -41,6 +42,12 @@ abstract class TargetEnvironmentType<C : TargetEnvironmentConfiguration>(id: Str
|
||||
open fun createStepsForNewWizard(project: Project, configToConfigure: C, runtimeType: LanguageRuntimeType<*>?)
|
||||
: List<AbstractWizardStepEx>? = null
|
||||
|
||||
/**
|
||||
* Prepares the wizard for setting up the new configuration instance of this type.
|
||||
*/
|
||||
open fun createStepsForNewWizard(module: Module, configToConfigure: C, runtimeType: LanguageRuntimeType<*>?)
|
||||
: List<AbstractWizardStepEx>? = createStepsForNewWizard(module.project, configToConfigure, runtimeType)
|
||||
|
||||
/**
|
||||
* Instantiates a new environment factory for given prepared [configuration][config].
|
||||
*/
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ abstract class TargetEnvironmentRequestHandler<T : TargetEnvironmentRequest>(pri
|
||||
}
|
||||
}
|
||||
localDirs.filterNot { localPath ->
|
||||
request.uploadVolumes.any { it.localRootPath == localPath }
|
||||
request.uploadVolumes.any { localPath.startsWith(it.localRootPath) }
|
||||
}.associateWith { localPath ->
|
||||
val localPathToTargetRes = localPathToTarget(localPath)
|
||||
val root = TargetEnvironment.UploadRoot(
|
||||
|
||||
+8
-2
@@ -242,13 +242,19 @@ private class TargetProcessCommands(
|
||||
|
||||
private suspend fun downloadAfterExecution() {
|
||||
if (downloadConfig == null) return
|
||||
val workingDirOnTarget = info.cwd ?: return
|
||||
|
||||
targetEnv.downloadVolumes.forEach { (_, volume) ->
|
||||
if (!workingDirOnTarget.startsWith(volume.targetRoot)) return@forEach
|
||||
val downloadRelativeDir = if (workingDirOnTarget != volume.targetRoot) {
|
||||
workingDirOnTarget.substringAfter(volume.targetRoot + "/") + "/"
|
||||
}
|
||||
else workingDirOnTarget
|
||||
val paths = downloadConfig.relativePaths.takeIf { it.isNotEmpty() } ?: listOf(".")
|
||||
for (path in paths) {
|
||||
coroutineToIndicator {
|
||||
try {
|
||||
volume.download(path, it)
|
||||
volume.download(downloadRelativeDir + path, it)
|
||||
}
|
||||
catch (e: IOException) {
|
||||
fileLogger().warn("Could not download $path: ${e.message}")
|
||||
@@ -326,7 +332,7 @@ private fun mapDownloadRoots(
|
||||
|
||||
if (matchingUpload != null) {
|
||||
TargetEnvironment.DownloadRoot(
|
||||
localRootPath = localDir,
|
||||
localRootPath = matchingUpload.localRootPath,
|
||||
targetRootPath = matchingUpload.targetRootPath,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -93,12 +93,12 @@ fun collectAddInterpreterActions(moduleOrProject: ModuleOrProject, onSdkCreated:
|
||||
if (targetModuleSitsOn == null) {
|
||||
add(createAddLocalInterpreterAction(moduleOrProject, onSdkCreated::accept))
|
||||
}
|
||||
addAll(collectNewInterpreterOnTargetActions(moduleOrProject.project, targetModuleSitsOn, onSdkCreated::accept))
|
||||
addAll(collectNewInterpreterOnTargetActions(moduleOrProject, targetModuleSitsOn, onSdkCreated::accept))
|
||||
}
|
||||
}
|
||||
|
||||
private fun collectNewInterpreterOnTargetActions(
|
||||
project: Project,
|
||||
moduleOrProject: ModuleOrProject,
|
||||
targetTypeModuleSitsOn: TargetConfigurationWithLocalFsAccess?,
|
||||
onSdkCreated: (Sdk) -> Unit,
|
||||
): List<DialogAction> =
|
||||
@@ -106,8 +106,8 @@ private fun collectNewInterpreterOnTargetActions(
|
||||
.filter { it.getTargetType().isSystemCompatible() }
|
||||
.filter { targetTypeModuleSitsOn == null || targetTypeModuleSitsOn.allowCreationTargetOfThisType(it.getTargetType()) }
|
||||
// filter create new interpreter actions on targets that need to be associated with module like PyDockerComposeTargetEnvironmentFactory
|
||||
.filterNot { project.isDefault && it.needAssociateWithModule() }
|
||||
.map { AddInterpreterOnTargetAction(project, it.getTargetType(), onSdkCreated) }
|
||||
.filterNot { moduleOrProject.project.isDefault && it.needAssociateWithModule() }
|
||||
.map { AddInterpreterOnTargetAction(moduleOrProject, it.getTargetType(), onSdkCreated) }
|
||||
|
||||
internal class AddLocalInterpreterAction(
|
||||
private val moduleOrProject: ModuleOrProject,
|
||||
@@ -131,17 +131,21 @@ internal class AddLocalInterpreterAction(
|
||||
}
|
||||
|
||||
internal class AddInterpreterOnTargetAction(
|
||||
private val project: Project,
|
||||
private val moduleOrProject: ModuleOrProject,
|
||||
private val targetType: TargetEnvironmentType<*>,
|
||||
private val onSdkCreated: (Sdk) -> Unit,
|
||||
) : DialogAction(
|
||||
dynamicText = PyBundle.messagePointer("python.sdk.action.add.interpreter.based.on.target.text", targetType.displayName),
|
||||
icon = targetType.icon,
|
||||
target = targetType.displayName,
|
||||
project = project,
|
||||
project = moduleOrProject.project,
|
||||
), DumbAware {
|
||||
override fun createDialog(): TargetEnvironmentWizard? {
|
||||
val wizard = TargetEnvironmentWizard.createWizard(project, targetType, PythonLanguageRuntimeType.Helper.getInstance())
|
||||
val runtimeType = PythonLanguageRuntimeType.Helper.getInstance()
|
||||
val wizard = when (moduleOrProject) {
|
||||
is ModuleAndProject -> TargetEnvironmentWizard.createWizard(moduleOrProject.module, targetType, runtimeType)
|
||||
is ProjectOnly -> TargetEnvironmentWizard.createWizard(moduleOrProject.project, targetType, runtimeType)
|
||||
}
|
||||
|
||||
wizard?.let {
|
||||
Disposer.register(it.disposable, Disposable {
|
||||
|
||||
@@ -117,4 +117,4 @@ internal suspend fun <P : PathHolder> createUvCli(
|
||||
PyResult.localizedError(error.message)
|
||||
}
|
||||
else PyResult.success(UvCliImpl(dispatcher, path!!, fileSystem))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,10 @@ import com.intellij.execution.target.LanguageRuntimeType
|
||||
import com.intellij.execution.target.TargetEnvironmentConfiguration
|
||||
import com.intellij.execution.target.TargetEnvironmentType
|
||||
import com.intellij.openapi.components.PersistentStateComponent
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.options.Configurable
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.project.modules
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
import com.jetbrains.python.PyBundle
|
||||
import com.jetbrains.python.parser.icons.PythonParserIcons
|
||||
@@ -47,7 +49,14 @@ internal class PythonLanguageRuntimeType : LanguageRuntimeType<PythonLanguageRun
|
||||
config: PythonLanguageRuntimeConfiguration,
|
||||
targetEnvironmentType: TargetEnvironmentType<*>,
|
||||
targetSupplier: Supplier<TargetEnvironmentConfiguration>): Configurable =
|
||||
PythonLanguageRuntimeUI(project, config, targetSupplier)
|
||||
PythonLanguageRuntimeUI(project.modules.first(), config, targetSupplier)
|
||||
|
||||
override fun createConfigurable(
|
||||
module: Module,
|
||||
config: PythonLanguageRuntimeConfiguration,
|
||||
targetEnvironmentType: TargetEnvironmentType<*>,
|
||||
targetSupplier: Supplier<TargetEnvironmentConfiguration>,
|
||||
): Configurable = PythonLanguageRuntimeUI(module, config, targetSupplier)
|
||||
|
||||
override fun findLanguageRuntime(target: TargetEnvironmentConfiguration): PythonLanguageRuntimeConfiguration? =
|
||||
target.runtimes.findByType()
|
||||
@@ -56,4 +65,4 @@ internal class PythonLanguageRuntimeType : LanguageRuntimeType<PythonLanguageRun
|
||||
@JvmStatic
|
||||
fun getInstance(): PythonLanguageRuntimeType = EXTENSION_NAME.findExtensionOrFail(PythonLanguageRuntimeType::class.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,18 +8,19 @@ import com.intellij.execution.target.getTargetType
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.observable.properties.AtomicProperty
|
||||
import com.intellij.openapi.options.BoundConfigurable
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.project.modules
|
||||
import com.intellij.openapi.projectRoots.Sdk
|
||||
import com.intellij.openapi.ui.DialogPanel
|
||||
import com.intellij.openapi.ui.ValidationInfo
|
||||
import com.intellij.openapi.ui.validation.WHEN_PROPERTY_CHANGED
|
||||
import com.intellij.openapi.util.io.toNioPathOrNull
|
||||
import com.intellij.ui.dsl.builder.panel
|
||||
import com.intellij.util.concurrency.annotations.RequiresEdt
|
||||
import com.intellij.util.ui.launchOnShow
|
||||
import com.jetbrains.python.PyBundle.message
|
||||
import com.jetbrains.python.TraceContext
|
||||
import com.jetbrains.python.errorProcessing.ErrorSink
|
||||
import com.jetbrains.python.errorProcessing.emit
|
||||
import com.jetbrains.python.errorProcessing.withProject
|
||||
import com.jetbrains.python.newProjectWizard.projectPath.ProjectPathFlows
|
||||
import com.jetbrains.python.onFailure
|
||||
import com.jetbrains.python.sdk.ModuleOrProject
|
||||
@@ -29,10 +30,9 @@ import com.jetbrains.python.sdk.add.v2.PythonAddCustomInterpreter
|
||||
import com.jetbrains.python.sdk.add.v2.PythonInterpreterSelectionMode
|
||||
import com.jetbrains.python.sdk.add.v2.PythonLocalAddInterpreterModel
|
||||
import com.jetbrains.python.sdk.add.v2.TargetFileSystem
|
||||
import com.jetbrains.python.sdk.baseDir
|
||||
import com.jetbrains.python.sdk.configurePythonSdk
|
||||
import com.jetbrains.python.sdk.runWithSdkConfigurationLock
|
||||
import com.jetbrains.python.errorProcessing.ErrorSink
|
||||
import com.jetbrains.python.errorProcessing.withProject
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.supervisorScope
|
||||
import kotlinx.coroutines.withContext
|
||||
@@ -41,11 +41,12 @@ import java.nio.file.Path
|
||||
import java.util.function.Supplier
|
||||
|
||||
internal class PythonLanguageRuntimeUI(
|
||||
val project: Project,
|
||||
val module: Module,
|
||||
val config: PythonLanguageRuntimeConfiguration,
|
||||
val targetSupplier: Supplier<TargetEnvironmentConfiguration>,
|
||||
) : BoundConfigurable(message("configurable.name.python.language")), CustomToolLanguageConfigurable<Sdk> {
|
||||
private val module: Module = project.modules.first() // TODO get the real one, this behaviour was copied from legacy "createSdkForTarget"
|
||||
private val project get() = module.project
|
||||
|
||||
private var introspectable: LanguageRuntimeType.Introspectable? = null
|
||||
private var stateChangedCallback: (() -> Unit)? = null
|
||||
|
||||
@@ -56,7 +57,7 @@ internal class PythonLanguageRuntimeUI(
|
||||
override fun createPanel(): DialogPanel {
|
||||
val targetEnvironmentConfiguration = targetSupplier.get()
|
||||
val model = PythonLocalAddInterpreterModel(
|
||||
ProjectPathFlows.create(Path.of(project.basePath!!)),
|
||||
ProjectPathFlows.create(getProjectPath()),
|
||||
TargetFileSystem(
|
||||
targetEnvironmentConfiguration = targetEnvironmentConfiguration,
|
||||
pythonLanguageRuntimeConfiguration = config,
|
||||
@@ -129,4 +130,8 @@ internal class PythonLanguageRuntimeUI(
|
||||
}
|
||||
|
||||
override fun validate(): Collection<ValidationInfo> = validationErrors
|
||||
|
||||
private fun getProjectPath(): Path =
|
||||
module.baseDir?.path?.toNioPathOrNull()
|
||||
?: project.basePath?.toNioPathOrNull()!!
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user