Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

[Announcemend] New plugin: cbBuiltTools

(1/1)

BlueHazzard:
Hi,
i created a new plugin and would like to show it here:
https://github.com/bluehazzard/cbBuildTools

This plugin will add additional UI to the build process of codeblocks. At the moment only a "target window" is implemented. This window shows all targets in a tree control and allows you by double clicking to build this target. This allows a fast building of different targets.

This plugin is in heavy development and i will change the functionality and or the UI a lot in the near future.

And critique is welcome!

thanks

[edit:] Unix projects will follow tomorrow...

oBFusCATed:
I hope you're aware that the code below will break the moment we introduce -fvisibility-hidden to build options.
Also be aware that dynamic_cast doesn't work for dlopened shared libraries on linux (don't know if you've tried it already...).


--- Code: ---CompilerGCC* compiler = dynamic_cast<CompilerGCC*>(Manager::Get()->GetPluginManager()->FindPluginByName(_("Compiler")));
compiler->Build(target);

--- End code ---

The proper way to implement this is by adding the appropriate method to the cbCompilerPlugin class...

BlueHazzard:

--- Quote ---I hope you're aware that the code below will break the moment we introduce -fvisibility-hidden to build options.
Also be aware that dynamic_cast doesn't work for dlopened shared libraries on linux (don't know if you've tried it already...).
--- End quote ---
I know that this is a bad solution and no i have not tested it on linux yet. Thank you for the hint!

How do i come from a compiler ID (or better build target) to the corresponding compiler plugin? There seems no connection between

--- Code: ---class Compiler <-> class cbCompilerPlugin
--- End code ---

if i look at the debugger plugin it simply uses the first compiler it can find:

--- Code: ---  // make sure the target is compiled
        const std::vector<cbCompilerPlugin*> &compilers = Manager::Get()->GetPluginManager()->GetCompilerPlugins();
        if (compilers.empty())
            m_pCompiler = nullptr;
        else
            m_pCompiler = compilers.front();
        if (m_pCompiler)
        {
            // is the compiler already running?
            if (m_pCompiler->IsRunning())
            {
                Log(_("Compiler in use..."));
                Log(_("Aborting debugging session"));
                cbMessageBox(_("The compiler is currently in use. Aborting debugging session..."),
                             _("Compiler running"), wxICON_WARNING);
                return false;
            }

            Log(_("Building to ensure sources are up-to-date"));
            m_WaitingCompilerToFinish = true;
            m_pCompiler->Build();
            // now, when the build is finished, DoDebug will be launched in OnCompilerFinished()
        }
--- End code ---
Is this really the right way? Shouldn't the build process be called from a central instance, that knows the association between compiler id and compiler plugin?
I know at the moment there is only one central compiler plugin, but the API seems to suggest that there are multiple compiler plugins available, so this does not seem to be consequent...

Anyway, i will use the debugger way for now. Thank you again, you probably saved me a lot debugging work on linux.

Navigation

[0] Message Index

Go to full version