Skip to content

Fix: Cannot run 'filename' in 'debug' (Allow AutoCp run configurations to execute with CMake build targets)#150

Merged
Pushpavel merged 6 commits intoPushpavel:mainfrom
znzryb:main
Nov 30, 2025
Merged

Fix: Cannot run 'filename' in 'debug' (Allow AutoCp run configurations to execute with CMake build targets)#150
Pushpavel merged 6 commits intoPushpavel:mainfrom
znzryb:main

Conversation

@znzryb
Copy link
Contributor

@znzryb znzryb commented Nov 11, 2025

The pull request is to solve these two issues( the same problem).

Fixes #145

Fixes #127

In detailed, the expectation is that the top is cmake application configuration (Debug), when we click option+X (or Alt+X on windows), we can run easily. Howerver, we wiil get an error currently.

Image

the detailed log is stated below.

2025-11-11 11:50:03,470 [  51057]   INFO - #c.i.e.r.ExecutionUtil - Error running '#D2095. 求最长不下降子序列的个数和明细':<br>Cannot run &#39;#D2095. 求最长不下降子序列的个数和明细&#39; on &#39;Debug&#39;
com.intellij.execution.ExecutionException: Cannot run &#39;#D2095. 求最长不下降子序列的个数和明细&#39; on &#39;Debug&#39;
	at com.intellij.execution.impl.ExecutionManagerImpl.executeConfiguration(ExecutionManagerImpl.kt:741)
	at com.intellij.execution.impl.ExecutionManagerImpl.executeConfiguration$default(ExecutionManagerImpl.kt:732)
	at com.intellij.execution.impl.ExecutionManagerImpl$restartRunProfile$1.run$lambda$1(ExecutionManagerImpl.kt:629)
	at com.intellij.openapi.application.WriteIntentReadAction.lambda$run$0(WriteIntentReadAction.java:24)
	at com.intellij.openapi.application.impl.AppImplKt$rethrowCheckedExceptions$2.invoke(appImpl.kt:106)
	at com.intellij.platform.locking.impl.NestedLocksThreadingSupport.doRunWriteIntentReadAction(NestedLocksThreadingSupport.kt:666)
	at com.intellij.platform.locking.impl.NestedLocksThreadingSupport.runPreventiveWriteIntentReadAction(NestedLocksThreadingSupport.kt:640)
	at com.intellij.platform.locking.impl.NestedLocksThreadingSupport.runWriteIntentReadAction(NestedLocksThreadingSupport.kt:633)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteIntentReadAction(ApplicationImpl.java:1166)
	at com.intellij.openapi.application.WriteIntentReadAction.compute(WriteIntentReadAction.java:55)
	at com.intellij.openapi.application.WriteIntentReadAction.run(WriteIntentReadAction.java:23)
	at com.intellij.execution.impl.ExecutionManagerImpl$restartRunProfile$1.run(ExecutionManagerImpl.kt:600)
	at com.intellij.openapi.application.WriteIntentReadAction.lambda$run$0(WriteIntentReadAction.java:24)
	at com.intellij.openapi.application.impl.AppImplKt$rethrowCheckedExceptions$2.invoke(appImpl.kt:106)
	at com.intellij.platform.locking.impl.NestedLocksThreadingSupport.doRunWriteIntentReadAction(NestedLocksThreadingSupport.kt:666)
	at com.intellij.platform.locking.impl.NestedLocksThreadingSupport.runPreventiveWriteIntentReadAction(NestedLocksThreadingSupport.kt:640)
	at com.intellij.platform.locking.impl.NestedLocksThreadingSupport.runWriteIntentReadAction(NestedLocksThreadingSupport.kt:633)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteIntentReadAction(ApplicationImpl.java:1166)
	at com.intellij.openapi.application.WriteIntentReadAction.compute(WriteIntentReadAction.java:55)
	at com.intellij.openapi.application.WriteIntentReadAction.run(WriteIntentReadAction.java:23)
	at com.intellij.util.Alarm$Request$schedule$1$1.invokeSuspend(Alarm.kt:407)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
	at com.intellij.openapi.application.impl.EdtCoroutineDispatcher.wrapWithLocking$lambda$3$lambda$2(EdtCoroutineDispatcher.kt:71)
	at com.intellij.openapi.application.WriteIntentReadAction.lambda$run$0(WriteIntentReadAction.java:24)
	at com.intellij.openapi.application.impl.AppImplKt$rethrowCheckedExceptions$2.invoke(appImpl.kt:106)
	at com.intellij.platform.locking.impl.NestedLocksThreadingSupport.doRunWriteIntentReadAction(NestedLocksThreadingSupport.kt:666)
	at com.intellij.platform.locking.impl.NestedLocksThreadingSupport.runPreventiveWriteIntentReadAction(NestedLocksThreadingSupport.kt:640)
	at com.intellij.platform.locking.impl.NestedLocksThreadingSupport.runWriteIntentReadAction(NestedLocksThreadingSupport.kt:633)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteIntentReadAction(ApplicationImpl.java:1166)
	at com.intellij.openapi.application.WriteIntentReadAction.compute(WriteIntentReadAction.java:55)
	at com.intellij.openapi.application.WriteIntentReadAction.run(WriteIntentReadAction.java:23)
	at com.intellij.openapi.application.impl.EdtCoroutineDispatcher.wrapWithLocking$lambda$3(EdtCoroutineDispatcher.kt:70)
	at com.intellij.openapi.application.impl.DispatchedRunnable.run(DispatchedRunnable.kt:42)
	at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:240)
	at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:26)
	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:222)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:122)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:43)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:728)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:750)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:595)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:488)
	at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$12$lambda$11$lambda$10$lambda$9(IdeEventQueue.kt:313)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:865)
	at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$12$lambda$11$lambda$10(IdeEventQueue.kt:312)
	at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$3(IdeEventQueue.kt:974)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:110)
	at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:974)
	at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$12(IdeEventQueue.kt:307)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:347)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

With this fix, the autocp will run like expecting.

Image

update the plugin.xml.
Set run configuration producers to order="LAST" to prevent overriding default IDE run actions, so that fix shortcut conflict between AutoCp and default IDE "Run context configuration" action(Ctrl+Shift+R on Mac/Linux, Ctrl+Shift+F10 on Windows).
add some log and AutoCpProgramRunner.kt

override and add some functions in /Users/zzy/Documents/GitHub/AutoCp/src/main/kotlin/com/github/pushpavel/autocp/config/AutoCpConfig.kt
This commit does not revert gradle.properties modification and delete some log.

Fixes issue #3 ([https://github.com/Pushpavel/AutoCp/issues/145](https://github.com/Pushpavel/AutoCp/issues/145)

[https://github.com/Pushpavel/AutoCp/issues/127](https://github.com/Pushpavel/AutoCp/issues/127))where AutoCp run configurations failed to execute in CLion
when a CMake Debug/Release build target was active, showing error:
"Cannot run 'filename' in 'debug'".

Root cause: IntelliJ's ExecutionTargetManager.doCanRun() was rejecting
AutoCp configurations because they were incompatible with CMake build
targets (CMakeBuildProfileExecutionTarget).

Solution implemented:
1. Created AutoCpExecutionTarget - a custom ExecutionTarget that declares
   AutoCp's independence from build system targets
2. Created AutoCpExecutionTargetProvider - provides the custom target for
   AutoCp configurations
3. Modified RunAutoCpAction and RunAutoCpStressAction to explicitly use
   AutoCpExecutionTarget when creating ExecutionEnvironment, bypassing
   the active CMake target
4. Implemented TargetEnvironmentAwareRunProfile in AutoCpConfig to declare
   that AutoCp doesn't require target environment preparation
5. Implemented doExecute() in AutoCpProgramRunner to properly handle
   execution flow per GenericProgramRunner contract
6. Registered executionTargetProvider extension point in plugin.xml

Technical details:
- AutoCpConfig.canRunOn() now always returns true, as AutoCp is
  ExecutionTarget-independent
- ExecutionEnvironmentBuilder.target() is used to force AutoCpExecutionTarget
- Added proper ExecutionException handling in doExecute()
- All debug logging preserved for future troubleshooting

Result: AutoCp can now execute successfully regardless of which CMake build
configuration is currently active in CLion, while maintaining compatibility
with all existing functionality.
…gProducer

processing this modification is that after the last commit, in one file, clicking option+X with multiple times does not lead to run multiple times.

- Enabled isAllowRunningInParallel in both AutoCpConfig and AutoCpConfigProducer

With these modifications, the autoCp acts like before.
delete the log and revert gradle.properties plugin version modification

The modification is tested. Everything goes well. I will use this version continuously to check and ensure the compatibility and strength.
@codecov-commenter
Copy link

codecov-commenter commented Nov 11, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 96 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ub/pushpavel/autocp/config/AutoCpConfigProducer.kt 0.00% 28 Missing ⚠️
...pushpavel/autocp/config/actions/RunAutoCpAction.kt 0.00% 14 Missing ⚠️
...hub/pushpavel/autocp/config/AutoCpProgramRunner.kt 0.00% 12 Missing ⚠️
...com/github/pushpavel/autocp/config/AutoCpConfig.kt 0.00% 10 Missing ⚠️
...vel/autocp/config/actions/RunAutoCpStressAction.kt 0.00% 10 Missing ⚠️
...b/pushpavel/autocp/config/AutoCpExecutionTarget.kt 0.00% 8 Missing ⚠️
...pavel/autocp/tester/AutoCpTestingProcessHandler.kt 0.00% 7 Missing ⚠️
...vel/autocp/config/AutoCpExecutionTargetProvider.kt 0.00% 4 Missing ⚠️
...pavel/autocp/config/validators/solutionFilePath.kt 0.00% 3 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Files with missing lines Coverage Δ
...github/pushpavel/autocp/config/AutoCpConfigType.kt 0.00% <ø> (ø)
...m/github/pushpavel/autocp/config/AutoCpRunState.kt 0.00% <ø> (ø)
...pavel/autocp/config/validators/solutionFilePath.kt 0.00% <0.00%> (ø)
...vel/autocp/config/AutoCpExecutionTargetProvider.kt 0.00% <0.00%> (ø)
...pavel/autocp/tester/AutoCpTestingProcessHandler.kt 0.00% <0.00%> (ø)
...b/pushpavel/autocp/config/AutoCpExecutionTarget.kt 0.00% <0.00%> (ø)
...com/github/pushpavel/autocp/config/AutoCpConfig.kt 0.00% <0.00%> (ø)
...vel/autocp/config/actions/RunAutoCpStressAction.kt 0.00% <0.00%> (ø)
...hub/pushpavel/autocp/config/AutoCpProgramRunner.kt 0.00% <0.00%> (ø)
...pushpavel/autocp/config/actions/RunAutoCpAction.kt 0.00% <0.00%> (ø)
... and 1 more

... and 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@znzryb
Copy link
Contributor Author

znzryb commented Nov 18, 2025

@Pushpavel

When you have a moment, could you please take a quick look and let me know if anything needs to be adjusted?

save-file-before-run-it
@Pushpavel
Copy link
Owner

Hey @znzryb, my bad, I totally forgot about this one. Thanks for your patience. I'm jumping on this today.

@Pushpavel Pushpavel merged commit 2793dc5 into Pushpavel:main Nov 30, 2025
7 of 8 checks passed
@znzryb
Copy link
Contributor Author

znzryb commented Nov 30, 2025

Hey @znzryb, my bad, I totally forgot about this one. Thanks for your patience. I'm jumping on this today.

@Pushpavel That's okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot run 'filename' in 'debug. Error running 'Min Modular Subarray' Cannot run 'Min Modular Subarray' on 'Debug'

3 participants