It is possible to use gradle daemon from C/C++?


(BogDan) #1

It is possible to use gradle daemon from C/C++ ? I’d like to try to integrate it in a C++ IDE but I don’t know if the daemon can provide the needed informations & functionalities: e.g. the locations of sources files, include paths & preprocessor directives for C/C++ projects, build a file, build a subprojects, build the entire project, etc.


(Radim Kubacki) #2

Your best choice is to use Tooling API and wrap it with JNI layer to access it from C/C++ code. What IDE is your target?


(BogDan) #3

It about QtCreator, but using JNI is out of the question. I was hoping that gradle daemon can be queried/controlled using TCP/IP ( REST :slight_smile: ).


(Radim Kubacki) #4

Can you give us more details on why is JNI out of question for you? I am afraid there is no better answer for you at the moment and I’d like to understand better what you want to do and how.


(BogDan) #5

Because it will add extra dependencies, and java is one which will not be accepted by QtCreator developers. What it will be great is a way to use gradle daemon directly from C/C++ (via TCP/IP or local sockets) using a simple (HTTP RESTful based) API. I can easily create a REST client in C/C++… I’d like to use this API to get the info about the tasks, projects, source files, etc.


(Radim Kubacki) #6

Interesting. Does it mean that you have to integrate tightly into QtCreator? I’d expect that the IDE will allow to extend its functionality through some plug-in architecture. At least that’s the state of art in Java land (Eclipse, IntelliJ, NetBeans). Can’t you write a Gradle integration that will resolve its dependency (i.e. load JRE required for its runtime) dynamically/lazily when needed? You will need Java at some point anyway since you are integrating with Gradle that will run in its JVM. 
As for the REST API: yes, that would be nice. OTOH the current state is different and adding a new API is not a trivial task.


(BogDan) #7

It will be integrated via plugins. I’m afraid that creating a plugin for QtCreator which depends on JRE will be next to impossible to upstream it. Also using JNI is not an easy task at all :).

IMHO adding a new API to gradle daemon will open new frontiers, imagine that it can be used virtually from any language not only from Java, C/C++ and from anywhere (IDEs, web pages, etc.)! Of course the API should be powerful enough to allow nice integration into IDEs.

Anyway, if in the future you’ll consider to add such an API, I’l like to “test” it for you on QtCreator!