Author Topic: Batch build progres..  (Read 14270 times)

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Batch build progres..
« on: January 23, 2006, 02:37:01 pm »
I have tried the Batch build feature in Windows today, and it is very nice.
There is just one thing that I don't like. You can't see anywhere if Code::Blocks is still working on it. I know, after the work is done there is a messagebox, but I think that is not enough. Is there a way to get a message that Code::Blocks is working on the build? Or is it already there? (if so, I can't find it...)
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline AkiraDev

  • Multiple posting newcomer
  • *
  • Posts: 71
Re: Batch build progres..
« Reply #1 on: January 23, 2006, 10:51:05 pm »
Agreed. Maybe a wxTaskBarIcon could make C::B presence noticeable?

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Batch build progres..
« Reply #2 on: January 23, 2006, 11:23:07 pm »
note, no gui, is for batch build (so no interaction required, or even wanted). To try (later) : provide feedback immediately and not be dumping to file.

Offline AkiraDev

  • Multiple posting newcomer
  • *
  • Posts: 71
Re: Batch build progres..
« Reply #3 on: January 23, 2006, 11:46:22 pm »
note, no gui, is for batch build (so no interaction required, or even wanted). To try (later) : provide feedback immediately and not be dumping to file.

I'm sorry, I probably misunderstood you.

My thought was of having a tray icon (which is quite discrete) with a corresponding tooltip that shows which project CB is currently compiling, but only when the user points at it. Other than that, a tray icon would merely remind the user that a batch build is in progress. Once the compilation is complete, the tray icon disappears and a Messagebox appears instead (the way it already happens).

Do you think a tray icon would be too intrusive?

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Batch build progres..
« Reply #4 on: January 23, 2006, 11:59:32 pm »
that sounds like a very good idea, together with the 'good' direct feedback in the dos(console) box where you can find the details 'as the news happens'. While in the tray you can have a quick look on how things are progressing.

I like it, I support the idea. So now convincing a dev, who will implement it so 'much' later, and then surprises us by having it implemented the next day. ;-)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Batch build progres..
« Reply #5 on: January 24, 2006, 12:06:29 am »
The idea has one weak point, and that is that this would require OS-specific code. To my knowledge, wxWidgets offers no such thing as a task bar icon class. As far as Windows is concerned, I might even remember how to do it, but what about X? Assuming that the same code works for Gnome and KDE is probably a bit bold ;)

Except for that, it is a really good idea, though.

As an alternative, we might open an off-screen window and change its title as the build process goes on. It is not the same, but we could implement it cross-platform and with a lot less pain.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Batch build progres..
« Reply #6 on: January 24, 2006, 12:08:40 am »
The idea has one weak point, and that is that this would require OS-specific code. To my knowledge, wxWidgets offers no such thing as a task bar icon class.

Are you talking about this?
wxTaskBarIcon
:lol:
Be patient!
This bug will be fixed soon...

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Batch build progres..
« Reply #7 on: January 24, 2006, 12:11:23 am »
Oh right... must have misspelled it then. I did a search in the wxWidgets docs, but it did not find it... :lol:

Well, then it should not be so hard really.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline AkiraDev

  • Multiple posting newcomer
  • *
  • Posts: 71
Re: Batch build progres..
« Reply #8 on: January 24, 2006, 12:37:07 am »
I tried this little hack inside BatchJob:

Code
int CodeBlocksApp::BatchJob()
{
  if (!m_Batch)
    return -1;

  // find compiler plugin
  PluginsArray arr = Manager::Get()->GetPluginManager()->GetCompilerOffers();
  if (arr.GetCount() == 0)
    return -2;

  cbCompilerPlugin* compiler = static_cast<cbCompilerPlugin*>(arr[0]);
  if (!compiler)
    return -3;

  wxTaskBarIcon cbTaskBarIcon;
#ifdef __WXMSW__
  cbTaskBarIcon.SetIcon(wxICON(A_MAIN_ICON),_("Now compiling ") + wxString(argv[argc-1]));
#else
  cbTaskBarIcon.SetIcon(wxIcon(app),_("Now compiling ") + wxString(argv[argc-1]));
#endif // __WXMSW__

  if (m_ReBuild)
    compiler->RebuildWorkspace(m_BatchTarget);
  else if (m_Build)
    compiler->BuildWorkspace(m_BatchTarget);

  // wait for compiler to finish
  while (compiler->IsRunning())
  {
    wxMilliSleep(10);
    Manager::Yield();
  }
  int exitCode = compiler->GetExitCode();

  cbTaskBarIcon.RemoveIcon();

  if (m_BatchNotify)
  {
    wxString msg;
    msg.Printf(_("Batch build is complete.\nProcess exited with status code %d."), exitCode);
    wxMessageBox(msg, APP_NAME, exitCode == 0 ? wxICON_INFORMATION : wxICON_WARNING);
  }
  return exitCode;
}

...and it worked, at least until the compiler was done, then the application crashed.
« Last Edit: January 24, 2006, 12:52:57 am by AkiraDev »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Batch build progres..
« Reply #9 on: January 24, 2006, 12:43:05 am »
I won't be surprised if this shows up tomorrow in the change logs ...  :P

takeshimiya

  • Guest
Re: Batch build progres..
« Reply #10 on: January 24, 2006, 12:58:32 am »
A C::B taskbar icon with a mini-overlay icon: white when it's compiling, red when there is an error compiling, yellow when there are warnings, and green when all succesfull.

Of course, make this an option, some people might not like it. :P

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Batch build progres..
« Reply #11 on: January 24, 2006, 01:01:27 am »
...and it worked, at least until the compiler was done, then the application crashed.
That is almost good then ;)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Re: Batch build progres..
« Reply #12 on: January 24, 2006, 04:43:34 pm »
I will try to make it (so other devs please keep this for me :P)

--edit-- hmm. very strange indeed:
Quote
...and it worked, at least until the compiler was done, then the application crashed.
I got an RPT file on my laptop, I will post it when I am back home...
I don;t know where the problem is, but I don't think it is in that little code that is added. I saw the destructor of wxFlatbook ...  :shock:

Here is the RPT file..
Code
-------------------

Error occured on Wednesday, January 25, 2006 at 10:28:25.

C:\Program Files\CodeBlocks\codeblocks.exe caused an Access Violation at location 60639f85 in module C:\Program Files\CodeBlocks\codeblocks.dll Writing to location 00000160.

Registers:
eax=00000000 ebx=01619208 ecx=01f23cdc edx=0022f610 esi=10590730 edi=00090000
eip=60639f85 esp=0022f620 ebp=0022f7b8 iopl=0         nv up ei pl zr na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010246

Call stack:
60639F85  C:\Program Files\CodeBlocks\codeblocks.dll:60639F85  wxPageContainer::DoDeletePage(unsigned)  C:/Development/codeblocks/src/sdk/wxFlatNotebook/wxFlatNotebook.cpp:1202
606346D2  C:\Program Files\CodeBlocks\codeblocks.dll:606346D2  wxFlatNotebook::RemovePage(unsigned, bool)  C:/Development/codeblocks/src/sdk/wxFlatNotebook/wxFlatNotebook.cpp:471
6052C6A7  C:\Program Files\CodeBlocks\codeblocks.dll:6052C6A7  EditorManager::RemoveEditorBase(EditorBase*, bool)  C:/Development/codeblocks/src/sdk/editormanager.cpp:628
6052C5DD  C:\Program Files\CodeBlocks\codeblocks.dll:6052C5DD  EditorManager::RemoveCustomEditor(EditorBase*)  C:/Development/codeblocks/src/sdk/editormanager.cpp:600
60511B6A  C:\Program Files\CodeBlocks\codeblocks.dll:60511B6A  EditorBase::~EditorBase()  C:/Development/codeblocks/src/sdk/editorbase.cpp:92
604CF633  C:\Program Files\CodeBlocks\codeblocks.dll:604CF633  cbEditor::~cbEditor()  C:/Development/codeblocks/src/sdk/cbeditor.cpp:354
10209566  C:\Development\wxWidgetsDLL\wxmsw26u_gcc.dll:10209566  _ZN12wxWindowBase15DestroyChildrenEv
1010C362  C:\Development\wxWidgetsDLL\wxmsw26u_gcc.dll:1010C362  _ZN8wxWindowD2Ev
10230827  C:\Development\wxWidgetsDLL\wxmsw26u_gcc.dll:10230827  _ZN7wxPanelD2Ev
6063319C  C:\Program Files\CodeBlocks\codeblocks.dll:6063319C  wxFlatNotebook::~wxFlatNotebook()  C:/Development/codeblocks/src/sdk/wxFlatNotebook/wxFlatNotebook.cpp:60
10209566  C:\Development\wxWidgetsDLL\wxmsw26u_gcc.dll:10209566  _ZN12wxWindowBase15DestroyChildrenEv
1010C362  C:\Development\wxWidgetsDLL\wxmsw26u_gcc.dll:1010C362  _ZN8wxWindowD2Ev
10203998  C:\Development\wxWidgetsDLL\wxmsw26u_gcc.dll:10203998  _ZN20wxTopLevelWindowBaseD2Ev
101073E2  C:\Development\wxWidgetsDLL\wxmsw26u_gcc.dll:101073E2  _ZN19wxTopLevelWindowMSWD2Ev
101B3341  C:\Development\wxWidgetsDLL\wxmsw26u_gcc.dll:101B3341  _ZN11wxFrameBaseD2Ev
1013A4DF  C:\Development\wxWidgetsDLL\wxmsw26u_gcc.dll:1013A4DF  _ZN7wxFrameD2Ev
0041DCFC  C:\Program Files\CodeBlocks\codeblocks.exe:0041DCFC  MainFrame::~MainFrame()  C:/Development/codeblocks/src/src/main.cpp:459
10187588  C:\Development\wxWidgetsDLL\wxmsw26u_gcc.dll:10187588  _ZN9wxAppBase7CleanUpEv
100CB4B1  C:\Development\wxWidgetsDLL\wxmsw26u_gcc.dll:100CB4B1  _ZN5wxApp7CleanUpEv
100432F3  C:\Development\wxWidgetsDLL\wxmsw26u_gcc.dll:100432F3  _Z14wxEntryCleanupv
100435B2  C:\Development\wxWidgetsDLL\wxmsw26u_gcc.dll:100435B2  _Z14wxUninitializev
100B309A  C:\Development\wxWidgetsDLL\wxmsw26u_gcc.dll:100B309A  _Z7wxEntryP11HINSTANCE__S0_Pci
004014DA  C:\Program Files\CodeBlocks\codeblocks.exe:004014DA  WinMain  C:/Development/codeblocks/src/src/app.cpp:297
0045B2DA  C:\Program Files\CodeBlocks\codeblocks.exe:0045B2DA
00401237  C:\Program Files\CodeBlocks\codeblocks.exe:00401237
004012A8  C:\Program Files\CodeBlocks\codeblocks.exe:004012A8
7C816D4F  C:\WINDOWS\system32\kernel32.dll:7C816D4F  RegisterWaitForInputIdle

Could someone look at it? I don't know anymore  :(
« Last Edit: January 25, 2006, 10:41:18 am by mispunt »
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline AkiraDev

  • Multiple posting newcomer
  • *
  • Posts: 71
Re: Batch build progres..
« Reply #13 on: January 26, 2006, 11:53:29 pm »
I just used this feature in it's original form (without the taskbar icon code) on the codeblocks project file, and the behaviour was exactly the same - crash after compiler finishes build. I agree with mispunt that the crash is coming from somewhere else.

CodeBlocks.RPT:
Code
-------------------

Error occured on Thursday, January 26, 2006 at 23:20:37.

C:\CodeBlocks\codeblocks.exe caused an Access Violation at location 00ecd23a Reading from location ffffffff.

Registers:
eax=00ecd238 ebx=ffffffff ecx=ffffffff edx=003e0408 esi=6199cb90 edi=00000000
eip=00ecd23a esp=0022f4ec ebp=0022f5a8 iopl=0         nv up ei pl zr na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=0038  gs=0000             efl=00010246

Call stack:
00ECD23A
100DF764  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:100DF764  _ZN10wxWindowDC6InitDCEv
100DFCC5  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:100DFCC5  _ZN10wxClientDCC1EP8wxWindow
61995B26  C:\CodeBlocks\codeblocks.dll:61995B26  _ZN15wxPageContainer12DoDeletePageEj
61995D3C  C:\CodeBlocks\codeblocks.dll:61995D3C  _ZN14wxFlatNotebook10RemovePageEjb
618593B5  C:\CodeBlocks\codeblocks.dll:618593B5  _ZN13EditorManager16RemoveEditorBaseEP10EditorBaseb
61859425  C:\CodeBlocks\codeblocks.dll:61859425  _ZN13EditorManager18RemoveCustomEditorEP10EditorBase
6183077C  C:\CodeBlocks\codeblocks.dll:6183077C  _ZN10EditorBaseD2Ev
617E2012  C:\CodeBlocks\codeblocks.dll:617E2012  _ZN8cbEditorD0Ev
10206056  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:10206056  _ZN12wxWindowBase15DestroyChildrenEv
10109592  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:10109592  _ZN8wxWindowD2Ev
1022D107  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:1022D107  _ZN7wxPanelD2Ev
6199354B  C:\CodeBlocks\codeblocks.dll:6199354B  _ZN14wxFlatNotebookD0Ev
10206056  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:10206056  _ZN12wxWindowBase15DestroyChildrenEv
10109592  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:10109592  _ZN8wxWindowD2Ev
10200488  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:10200488  _ZN20wxTopLevelWindowBaseD2Ev
101046C2  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:101046C2  _ZN19wxTopLevelWindowMSWD2Ev
101AFD91  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:101AFD91  _ZN11wxFrameBaseD2Ev
101376EF  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:101376EF  _ZN7wxFrameD2Ev
00420C5E  C:\CodeBlocks\codeblocks.exe:00420C5E
101846F8  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:101846F8  _ZN9wxAppBase7CleanUpEv
100CB781  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:100CB781  _ZN5wxApp7CleanUpEv
100435E3  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:100435E3  _Z14wxEntryCleanupv
100438A2  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:100438A2  _Z14wxUninitializev
100B336A  C:\CodeBlocks\wxmsw26u_gcc_cb.dll:100B336A  _Z7wxEntryP11HINSTANCE__S0_Pci
00401497  C:\CodeBlocks\codeblocks.exe:00401497
0046E308  C:\CodeBlocks\codeblocks.exe:0046E308
00401236  C:\CodeBlocks\codeblocks.exe:00401236
00401288  C:\CodeBlocks\codeblocks.exe:00401288
77E814C7  C:\WINDOWS\system32\kernel32.dll:77E814C7  GetCurrentDirectoryW

I also agree with mispunt's suspicion on the wxFlatNotebook cleanup.

Since using a wxTaskBarIcon seems not to be the problem, I'll post a patch proposing this addition to app.cpp in sourceforge regardless.
« Last Edit: January 28, 2006, 10:15:51 am by AkiraDev »

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Re: Batch build progres..
« Reply #14 on: January 27, 2006, 11:08:30 pm »
tiwag? tiwag didn't answer on this post :P
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring