Author Topic: Enhancements to the CB Build System  (Read 22712 times)

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Enhancements to the CB Build System
« Reply #30 on: May 01, 2015, 12:56:00 pm »
I also changed my display name on Sourceforge to prevent confusion. Sorry again.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Enhancements to the CB Build System
« Reply #31 on: May 01, 2015, 03:08:01 pm »
I also changed my display name on Sourceforge to prevent confusion. Sorry again.
Ah, that clarifies things. I was curious anyways because it looked that similar... ;-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Enhancements to the CB Build System
« Reply #32 on: November 15, 2015, 06:24:03 pm »
Just to tell you that its not forgotten:

Here is an updated patch for recent C::B trunk. I would like to post-pone this patch to after the next release just to make sure we don't break things. Besides it works so far. I only see one issue:

When you have a non-C compiler (say Fortran) and save the project file it adds to every file a weight of "0". This should be fixed as it makes no sense.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Enhancements to the CB Build System
« Reply #33 on: November 15, 2015, 07:17:46 pm »
...btw: What about the tickets in this post:
http://forums.codeblocks.org/index.php/topic,20043.msg136830.html#msg136830

Are these obsolete and superseded by the qtSupport patch? At least they seem partially included.
What about closing these two tickets and opening a new one with the actual qtSupport patch?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Enhancements to the CB Build System
« Reply #34 on: November 16, 2015, 12:41:27 am »
Here is an updated patch for recent C::B trunk. I would like to post-pone this patch to after the next release just to make sure we don't break things.
Thanks for your interest. As always I respect your decision but the patch overall addresses some bugs in current cb trunk so at least you may want to include those parts of the patch in the next release. I don't know when the next version will be released but if it's not too soon, I can break the patch into smaller ones corresponding to the features (and bug fixes) I presented here:
http://forums.codeblocks.org/index.php/topic,20043.msg137653.html#msg137653
Please give me a couple of days if that suits you and I'll try to submit them to the patch tracker sequentially. I must make it clear that they will be incremental patches though (they may require the previous patches to be applied first). In case you prefer to include all of them, you may advertise the next cb version with (almost) native qt support. ;)

When you have a non-C compiler (say Fortran) and save the project file it adds to every file a weight of "0". This should be fixed as it makes no sense.
Thanks for pointing that out. I'll look into it and try to come up with a fix.

...btw: What about the tickets in this post:
http://forums.codeblocks.org/index.php/topic,20043.msg136830.html#msg136830

Are these obsolete and superseded by the qtSupport patch? At least they seem partially included.
What about closing these two tickets and opening a new one with the actual qtSupport patch?
Please discard them. The latest implementation has a different approach which makes them invalid. You may close them if you want or I can attach the updated patches as a reply. Just tell me how you prefer.

There is one thing that's troubling me though. In the first implementation (the one lacking the target macros), a compiler id was assigned to every file to make sure that the correct files were generated in case the file's designated compiler was changed by the user. I had to replace these compiler ids with target ids to allow for target macros to be used (which is definitely a necessity). Now that introduces a small problem. When the user changes the compiler of a target, checking which files the newly assigned compiler creates is unnecessarily complex and not included in the latest implementation. This may result in incorrect behavior. There are 2 solutions to correct this that I can think of. First, a simple dialog to warn the user to reload his/her project to take the new changes into effect. Second, a more complex design to assign both the compiler and target ids to each file to automatically decide which files to generate. Which one do you think will be a better approach?

There is also the file properties dialog bug which I don't have a fix for (other than reloading the project), explained below:
Quote
Build files (generated files box in 'file properties->advanced' tab) may sometimes require the project to be reloaded if they are modified. That's because of the current implementation of file properties.  In the current implementation, even if the user chooses to cancel the changes, they are saved to the original file the moment the compiler is switched when 'custom build command' is not empty. I believe a proper implementation would require a copy constructor for 'ProjectFile' class (or some copy function etc...) to make a temporary copy to work on. I'm not experienced enough with the contents of 'ProjectFile' to implement one, sorry.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Enhancements to the CB Build System
« Reply #35 on: November 16, 2015, 08:40:15 am »
I don't know when the next version will be released but if it's not too soon, I can break the patch into smaller ones corresponding to the features (and bug fixes) I presented here:
Please do so. And also mention shortly i the description what are the bugs you think that should be fixed (so no new features).

Thanks for pointing that out. I'll look into it and try to come up with a fix.
Great! :-)

Please discard them.
I think you can do this yourself. There might be more patches obsolete now. If you can't, just post a list of links to the patches that are obsolete here and I'll do.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Enhancements to the CB Build System
« Reply #36 on: November 19, 2015, 07:06:35 pm »
Sorry for the delay. As a start I tried to close the invalid tickets but sourceforge won't let me do that. I think a developer must do that. Please close the tickets listed below as they don't handle the features/bugs well enough. I'll post more appropriate ones when I split the big patch into smaller pieces. The one you applied is fine.
https://sourceforge.net/p/codeblocks/tickets/140/
https://sourceforge.net/p/codeblocks/tickets/141/
https://sourceforge.net/p/codeblocks/tickets/146/

I decided to go with the route of implementing a safer design for the problem I mentioned here:
Quote
There is one thing that's troubling me though. In the first implementation (the one lacking the target macros), a compiler id was assigned to every file to make sure that the correct files were generated in case the file's designated compiler was changed by the user. I had to replace these compiler ids with target ids to allow for target macros to be used (which is definitely a necessity). Now that introduces a small problem. When the user changes the compiler of a target, checking which files the newly assigned compiler creates is unnecessarily complex and not included in the latest implementation. This may result in incorrect behavior. There are 2 solutions to correct this that I can think of. First, a simple dialog to warn the user to reload his/her project to take the new changes into effect. Second, a more complex design to assign both the compiler and target ids to each file to automatically decide which files to generate. Which one do you think will be a better approach?
I'll try to implement both the compiler id and target id checks to handle different scenarios safely (at least not result in abnormal behavior). I want it to be a solid implementation so that might take longer than what I expected.

I'm in the process of moving to another country currently so my previous estimated time of submitting patches might not (probably won't) hold up. It might take a couple of weeks before I can settle things down but I assure you this won't be forgotten.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Enhancements to the CB Build System
« Reply #37 on: November 20, 2015, 07:25:08 am »
Sorry for the delay. As a start I tried to close the invalid tickets but sourceforge won't let me do that. I think a developer must do that. Please close the tickets listed below as they don't handle the features/bugs well enough. I'll post more appropriate ones when I split the big patch into smaller pieces. The one you applied is fine.
https://sourceforge.net/p/codeblocks/tickets/140/
https://sourceforge.net/p/codeblocks/tickets/141/
https://sourceforge.net/p/codeblocks/tickets/146/
Done that.

I'm in the process of moving to another country currently so my previous estimated time of submitting patches might not (probably won't) hold up. It might take a couple of weeks before I can settle things down but I assure you this won't be forgotten.
Take your time, we are not in a hurry... Just make sure you nag me once its done, if you like also via PM so I don't oversee things.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Enhancements to the CB Build System
« Reply #38 on: January 30, 2016, 11:52:47 am »
...is here any news?

The new release is out.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Enhancements to the CB Build System
« Reply #39 on: February 01, 2016, 02:06:32 pm »
Sorry for the delay. Currently I don't possess a capable enough computer to work on this. I only have this crap laptop that is of no use other than browsing the web (in a very slow manner). I didn't forget about this and will start working on it as soon as I get a decent computer. It may take another couple of weeks though. Sorry again.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Enhancements to the CB Build System
« Reply #40 on: February 01, 2016, 07:49:36 pm »
Sorry again.
No worries... just tell if you have to pull the trigger. :-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Enhancements to the CB Build System
« Reply #41 on: March 06, 2016, 03:07:51 pm »
Sorry for the long delay. After hours of struggling with memory/compiler problems, I finally managed to get cb to compile on my crappy laptop with an old gcc (v4.8.1). I also separated the big patch (by hand, not in the form of valid patches currently) to submit incremental patches. I will prioritize basic/core patches first then will come the feature patches.

1- Attached patch allows for $(project_dir) etc... style macros in 'settings->compiler->other settings tab->advanced options->commands tab->generated files'. I moved the macro replacements to 'macrosmanager.h' because these macros are required elsewhere in the upcoming patches, it's better to handle these in a single location.

Please test.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Enhancements to the CB Build System
« Reply #42 on: May 15, 2016, 09:28:38 am »
So much waiting for such a simple patch. Anyway, I attached another patch (unfortunately also including the one in my previous post) as a next step.

2- This one fixes a couple of errors in the build system which I tried to mention in comments and includes/fixes generated files build enhancements/support. As an example see below for what it fixes:
http://forums.codeblocks.org/index.php/topic,20768.msg141598.html
http://forums.codeblocks.org/index.php/topic,20075.msg136997.htmll

Ok, so I stop here unless I get some developer input. Otherwise it will grow into the same big patch again which I don't see any point in achieving. Thanks.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Enhancements to the CB Build System
« Reply #43 on: May 15, 2016, 12:23:46 pm »
Some comments after a quick look at the patch:
1. If you messed the @return comment line in the AddFile function
2. REPLACE_FILE_MACROS mustn't not be a macro, either a normal or template function!
3. I'd make generatingCompilerIDs to be vector<wxString> instead of wxArrayString. wxArrayString is terrible container, because there is wxString& operator [](...) const that allows the user to modify the contents of const objects.

Do you have a sample project that can be used to test this patch?
I don't see anything wrong in the patch, but I'm not very knowledgeable about the internals cb's build system.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]