Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Call a custom preprocessor and display its results in console

Thank you,

I'll have a look at them. In the meantime I am trying to call the preprocessor manually with ProcessBuilder but I have a very strange problem.

The situation is that I have the executable in my plugin jar. When I invoke a command I copy the executable in the Active project folder inside a folder I create. The executable is copied successfully but when I try to execute it I get "Permission Denied".

I use setExecutable(true, false) when I create the directory and the File after copying it but still the file does not get this permission. Even if I go into the projects folder with my explorer and try to manually add the permission to it, it does not stay and the executable flag is removed automatically.

Is there a way to make it executable by the system ? Like the normal compilers create output binary files that can be executed.

Thanks again.

On 18 June 2012 22:34, Andrew Gvozdev <angvoz.dev@xxxxxxxxx> wrote:
Hi  Lambros,

But if you are serious about writing plugins for CDT you should clone CDT git repository, see  http://wiki.eclipse.org/Getting_started_with_CDT_development 

Thanks,
Andrew


On Mon, Jun 18, 2012 at 6:34 AM, Lambros Petrou <lambrospower@xxxxxxxx> wrote:
Andrew,

I didn't like the buildConfiguration method I was trying so far so I am going to try your suggestion. I searched everywhere and only found this:
http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/BuildRunnerHelper.java?id=9e7c69f28952f708bfc1997c318043eee112a4c3

for BuildRunnerHelper class and I couldn't find anything about the AbstractBuiltinSpecsDetector class.

About the CommandLauncher I found this:
http://wiki.eclipse.org/CDT/cdt-core/designs/CommandLauncher and its implementation here http://code.google.com/p/cdtplugin/source/browse/trunk/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java?spec=svn5&r=5

Could you please link me to the other class in order to see how I should connect these ?

Thank you


On 15 June 2012 14:46, Lambros Petrou <lambrospower@xxxxxxxx> wrote:
Yes the thing is that I want to make it so every project that is created from my Custom Template Project will use that script in order to call the preprocessor. That's why I looked into the buildConfiguration extension point at first.


On 15 June 2012 14:21, Stéphane ANCELOT <sancelot@xxxxxxx> wrote:
Hi,
adding a custom script in the project Builders tab of your project should do it.
Regards
Steph




----- Mail original -----
De: "Lambros Petrou" <lambrospower@xxxxxxxx>
À: "CDT General developers list." <cdt-dev@xxxxxxxxxxx>
Envoyé: Vendredi 15 Juin 2012 12:55:02
Objet: Re: [cdt-dev] Call a custom preprocessor and display its results in      console


I have been reading a lot about the toolchains in cdt. I made a custom project template ( that copies some files necessary for my project into the project dir ) and I tried to make a toolchain where I have a tool definition with a command that calls a binary that is located in a dir inside the project ( it is one of the files I copy with my project template ). And at the end I set a builder that is just a subclass of the " org.eclipse.cdt.build.core.internal.builder ".


When I try to build my project using my toolchain I get Nothing in the console. Not even the builder is run. I followed the tutorial here: http://www.drdobbs.com/cpp/197002115?pgno=6


Is there a way to make a configuration JUST TO RUN MY PREPROCESSOR with a single file as input that is located in a dir inside the project ? Or the best way to do it is just make a class that adds a button somewhere and calls the preprocessor manually and then display its output to the console ?


The problem is that I cannot define the toolchain completely because of some other tools used externally to make the final build of the project. I just want to call my preprocessor, that's all.


Thank you.


On 12 June 2012 12:48, Lambros Petrou < lambrospower@xxxxxxxx > wrote:


About the preprocessor calling, I am looking into the MBS configurations and I am trying to make a custom buildConfiguration but it seems that I need to define the WHOLE toolchain that's going to be used.

Is there any way to make a configuration that calls ONLY the preprocessor and display its results ?




On 11 June 2012 17:41, Andrew Gvozdev < angvoz.dev@xxxxxxxxx > wrote:


Hi Petrou,



On Sun, Jun 10, 2012 at 10:52 AM, Lambros Petrou < lambrospower@xxxxxxxx > wrote:


Hello,


I am making a plugin to support more preprocessor commands in C/C++. I made the Content Assist features to work as expected ( with the help of this mailing list ) and I made a Panel for some additional things. Now I'd like to have a button in my panel with the following functionality.



1) Get the text from the open and active editor
2) Call my custom preprocessor executable with some arguments given by a wizard or defaults at first
3) Display the results of the preprocessor at the Console Output or somewhere to be read by the user
In CDT, console functionality is implemented using CommandLauncher. I implemented CDT console fairly recently for scanner discovery to detect compiler built-in settings. It starts at AbstractBuiltinSpecsDetector.runForLanguage(), then you can take a look at BuildRunnerHelper.build() and CommandLauncher code.
The code in AbstractBuiltinSpecsDetector:
- Creates CDT build console which manages separate consoles for each project (like it is done for regular build)
- Connects ErrorParsers and scanner discovery parsers to parse console output
- Provides progress monitor for user to see progress or cancel the build


Andrew






My main problem is the 2-3 points. As for the 3rd one I think this will suffice:


http://www.jevon.org/wiki/Writing_to_a_Console_in_Eclipse


It's the 2nd part which I do not know how to do. Is there any easy way to do this or should I make my own Build System for CDT using my preprocessor ? If I have to, is there any tutorial or guide or even an example I can read ?


Thank you

--

Lambros Petrou


www.lambrospetrou.com
lambrospower@xxxxxxxx

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev




--

Lambros Petrou


www.lambrospetrou.com
lambrospower@xxxxxxxx




--

Lambros Petrou


www.lambrospetrou.com
lambrospower@xxxxxxxx

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



--
Lambros Petrou





--
Lambros Petrou



_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev




--
Lambros Petrou

www.lambrospetrou.com
lambrospower@xxxxxxxx


Back to the top