How to run cmake with clion.jar

I make clion plugin to run valgrind, so I need run cmake(cmake --build path/to/out --target target_name) to build specific target, how to run it, I don't understand /home/roroco/Downloads/clion-1.2.2/lib/clion.jar!/com/jetbrains/cidr/cpp/cmake/CMakeRunner.class#runCMake parameters

@org.jetbrains.annotations.NotNull
public com.intellij.execution.process.ProcessOutput runCMake(@org.jetbrains.annotations.NotNull java.io.File file, @org.jetbrains.annotations.NotNull java.io.File file1, @org.jetbrains.annotations.NotNull java.util.List<java.lang.String> list, boolean b, @org.jetbrains.annotations.NotNull java.util.Map<java.lang.String,java.lang.String> map) throws com.jetbrains.cidr.cpp.cmake.CMakeException { /* compiled code */ }

 

13 comments
Comment actions Permalink

How the user is supported to interact with the plugin, if it's using run configuration then you probably need another way to do it in code.

If you share some details on the workflow I'd be able to help you better.

0
Comment actions Permalink

see my https://youtu.be/UfRxziDPleU, I hope control start "Messages Build" and force kill "Messages Build" how to do that?

0
Comment actions Permalink

To build the selected run configuration you can use the following snippet:

new CMakeTargetAction.Build() {

@Override

public void doBuild(@NotNull Project project) { super.doBuild(project);}

}.doBuild(<pass project here>)

 

0
Comment actions Permalink

what about force kill "Messages Build", when I 

ExecutionManager.getInstance(pj).contentManager.allDescriptors //in groovy

I the return list size is 0, I can't find CMake Build Descriptors, How to get its process and kill it?

0
Comment actions Permalink

Sorry, I don't understand what you are trying to achieve.

Maybe you could describe your idea?

0
Comment actions Permalink

I use following code to run build

ProgramRunnerUtil.executeConfiguration(myPj, myConf,DefaultDebugExecutor.debugExecutorInstance)

If I run a build and I change code in this term and I run build again, the 2nd build doesn't run(see my screencast https://youtu.be/LyLLsf896cw), so I need to force kill previous cmake build.

0
Comment actions Permalink

In the original post you wrote

>I make clion plugin to run valgrind, so I need run cmake

If you plan to use run configuration, please see http://www.jetbrains.org/intellij/sdk/docs/basics/run_configurations.html documentation.

You'll probably need to extend CMakeAppRunConfiguration in order to get all 'build' and 'run' features for free.

 

0
Comment actions Permalink

"I make clion plugin to run valgrind, so I need run cmake", I think I fix it, "kill previous cmake build" is my extra problem.

I think extending CMakeAppRunConfiguration doesn't work since 

ExecutionManager.getInstance(pj).contentManager.allDescriptors

return list with size 0, that means, even I extending CMakeAppRunConfiguration, I have no way to get it, so is there other way?

0
Comment actions Permalink

another question: If I extend CMakeAppRunConfiguration, how to save build info(for instance, process pid) in whole clion running time?

0
Comment actions Permalink

Sorry, can't understand what you mean. Maybe step-by-step description of what you already have could help. Also, as I asked previously the general idea of the plugin might make things more clear

0
Comment actions Permalink

In action, I start debug session and I can get it's process pid, where to save process pid. I mean, as we know:

ExecutionManager.getInstance(pj).contentManager.allDescriptors

can get all RunContentDescriptor, where do these descriptors save, how should I do same thing?

0
Comment actions Permalink

If you run a CMake configuration it should be in the list of allDescriptors, and you can get ProcessHandler via com.intellij.execution.ExecutionManager#getRunningProcesses.

0
Comment actions Permalink

I'm very sure the descriptor is not exist(see my screencast https://youtu.be/PfR2GB7W264 > watch tool, the list size is 0) since in cmake build duration, the run configuration haven't run

My tmp solution is, when cmake build, I can find 

roroco   18367 15547  0 00:26 pts/4    00:00:00 /home/roroco/Downloads/clion-1.2.2/bin/cmake/bin/cmake --build /home/roroco/.clion12/system/plugins-sandbox/system/cmake/generated/aef44517/aef44517/Debug --target ro_vector_test -- -j 20

in process manager, so I can kill -s KILL it

again, please answer my question, how to persistently save java instance in action for other action use, for instance, save CMakeAppRunConfiguration instance and use it in another action

0

Please sign in to leave a comment.