Skip to content

Commit

Permalink
Add debug
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelldi committed Dec 5, 2023
1 parent 8c1ddf6 commit 9714c1e
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,21 @@ class AspireSessionRunner(private val project: Project) {
) {
LOG.info("Starting a session for the project ${session.projectPath}")

val configuration = getOrCreateConfiguration(session, hostId)
val host = AspireSessionHostService.getInstance().getHost(hostId)
if (host == null) {
LOG.warn("Unable to find Aspire host with id=$hostId")
return
}

val configuration = getOrCreateConfiguration(session, host)
if (configuration == null) {
LOG.warn("Unable to find or create run configuration for the project ${session.projectPath}")
return
}

val isDebug = host.isDebug || session.debug
val executor =
if (!session.debug) DefaultRunExecutor.getRunExecutorInstance()
if (!isDebug) DefaultRunExecutor.getRunExecutorInstance()
else DefaultDebugExecutor.getDebugExecutorInstance()

val environment = ExecutionEnvironmentBuilder
Expand Down Expand Up @@ -102,19 +109,16 @@ class AspireSessionRunner(private val project: Project) {
ProgramRunnerUtil.executeConfiguration(environment, false, true)
}

private fun getOrCreateConfiguration(session: SessionModel, hostId: String): RunnerAndConfigurationSettings? {
private fun getOrCreateConfiguration(
session: SessionModel,
host: AspireSessionHostService.HostConfiguration
): RunnerAndConfigurationSettings? {
val projects = project.solution.runnableProjectsModel.projects.valueOrNull
if (projects == null) {
LOG.warn("Runnable projects model doesn't contain projects")
return null
}

val host = AspireSessionHostService.getInstance().getHost(hostId)
if (host == null) {
LOG.warn("Unable to find Aspire host with id=$hostId")
return null
}

val projectPath = Path(session.projectPath).systemIndependentPath
val runnableProject = projects.firstOrNull {
DotNetProjectConfigurationType.isTypeApplicable(it.kind) && it.projectFilePath == projectPath
Expand Down

0 comments on commit 9714c1e

Please sign in to comment.