| Author |
Message |
|
wvxvw
Member
Joined: Sun May 11, 2008 3:01 pm Posts: 891
|
 Special #startDebug and #endDebug directives.
This isn't probably something to ask FD developers, but, anyway, if such a thing existed in FD it would be really nice =) The idea is like this: You put some code in between #startDebug and #endDebug directives, and it makes compiler skip those lines when compiling in release mode. I understand this should be made a request to Adobe on compiler features, but, I believe this can be also done by some sort of preprocessing of AS files before compiling... so, technically, it can be achieved without making changes to compiler... It's plain nightmare to have to comment all the trace() and custom trace statements across big projects, taking in account that you may need to do this at least once a week =) Right now I'm doing it like this: I put the //TODO: startDebug comment before the lines intended for debugging only, than, when I have to compile the release version, I go through each such comment and comment it manually, but... having to use the same classes for 3 different projects at a time, that may be compiled both to debug and release versions may take me literary an hour to compile them all...
_________________ http://www.couchsurfing.com/people/wvxvw
|
| Thu Oct 02, 2008 11:04 pm |
|
 |
|
bjarneh
Member
Joined: Sun Mar 02, 2008 11:17 am Posts: 59 Location: Gothenburg, Sweden
|
 Re: Special #startDebug and #endDebug directives.
You could build your own debugger that handles different levels of debugging (such as info, warning etc) that also can be set to not display any traces at all for release versions of your code. Or you could use any already existing debugger that can filter out your traces, for example alcon3: http://osflash.org/projects/alcon/Bjarne
|
| Fri Oct 03, 2008 7:07 am |
|
 |
|
Philippe
Admin
Joined: Wed Aug 31, 2005 7:27 am Posts: 10749 Location: Paris, France
|
 Re: Special #startDebug and #endDebug directives.
There are some kind of compiler directives: http://livedocs.adobe.com/flex/3/html/compilers_21.htmlBut this is not properly integrated in FD atm (TODO).
|
| Fri Oct 03, 2008 7:38 am |
|
 |
|
wvxvw
Member
Joined: Sun May 11, 2008 3:01 pm Posts: 891
|
 Re: Special #startDebug and #endDebug directives.
Wow. I didn't know it exists (the -define key)  however... it will compile the code anyway, it'll just never execute it. Even so, it would be great to have some UI for it in FD.
_________________ http://www.couchsurfing.com/people/wvxvw
|
| Fri Oct 03, 2008 10:22 am |
|
 |
|
Philippe
Admin
Joined: Wed Aug 31, 2005 7:27 am Posts: 10749 Location: Paris, France
|
 Re: Special #startDebug and #endDebug directives.
wvxvw wrote: Wow. I didn't know it exists (the -define key)  however... it will compile the code anyway, it'll just never execute it. Even so, it would be great to have some UI for it in FD. This is applied at compile time so I think it shouldn't compile things that you exclude with the variables.
|
| Fri Oct 03, 2008 2:15 pm |
|
 |
|
wvxvw
Member
Joined: Sun May 11, 2008 3:01 pm Posts: 891
|
 Re: Special #startDebug and #endDebug directives.
Hm... I'll check it... Yes, you ware right, it doesn't compile whatever is inside the block which defined as false. Thanks for telling me this 
_________________ http://www.couchsurfing.com/people/wvxvw
|
| Fri Oct 03, 2008 8:42 pm |
|
 |
|
MindSpace
Member
Joined: Tue Sep 01, 2009 10:53 pm Posts: 3
|
 Re: Special #startDebug and #endDebug directives.
I'd be keen to see these directives integrated into FD, such that when I select "Release" mode from the dropdown, CONFIG::release automatically == true.
There are bound the be more elegant ways, but the simplest to implement would be if in the Project Properties -> Compiler Options -> Addittional compiler options, you could ad options that are only used in debug mode, and options that are only used in release mode.
The more elegant way could be if there was a variable that represented which mode FD was in, e.g. debugMode, and this variable was accessible from Addittional compiler options, then I could simply add one or two compiler options: -define=CONFIG::debug,debugMode -define=CONFIG::release,!debugMode
Cheers,
Eric
|
| Tue Sep 01, 2009 11:00 pm |
|
 |
|
rapit
Member
Joined: Fri Jan 23, 2009 10:52 am Posts: 34 Location: Kraków, Poland
|
 Re: Special #startDebug and #endDebug directives.
MindSpace, that would be a greate feature, but I think "Solution Configuration" like in C# should be a more flexible solution. You may create yours private configuration (i.e. for different language version or debug / release mode) and define set of yours compiler options. So sorry for my English 
_________________ English... still learning ;)
|
| Thu Sep 03, 2009 1:46 pm |
|
 |
|
MindSpace
Member
Joined: Tue Sep 01, 2009 10:53 pm Posts: 3
|
 Re: Special #startDebug and #endDebug directives.
rapit, that does makes a lot more sense (the only disadvantage being that it would be harder to implement, and thus take longet to get done).
Yes, I've been involved in a C# app, and being able to create different versions of the app (run at home, run in schools, run in a kiosk) in a single set of code is brilliant. I would love to see that in FD too.
|
| Fri Sep 04, 2009 11:52 pm |
|
 |
|
rapit
Member
Joined: Fri Jan 23, 2009 10:52 am Posts: 34 Location: Kraków, Poland
|
 Re: Special #startDebug and #endDebug directives.
3h of work (totally newbie in plugins SolutionConfigPlugin automatically add proper value for: -define=CONFIG::debug,debugMode -define=CONFIG::release,!debugMode to compiler options when TestMovie or BuildMovie button is pressed. ---- Edit: More advanced Solution Configuration plugin comming soon  Any suggestions will be good.
_________________ English... still learning ;)
Last edited by rapit on Fri Sep 11, 2009 1:05 pm, edited 1 time in total.
|
| Mon Sep 07, 2009 11:20 am |
|
 |
|
MindSpace
Member
Joined: Tue Sep 01, 2009 10:53 pm Posts: 3
|
 Re: Special #startDebug and #endDebug directives.
Wicked cool. I'll try it after I've recovered from my current deadline.
|
| Tue Sep 08, 2009 4:50 am |
|
 |
|
tiagojanz
Member
Joined: Tue Jun 05, 2007 9:26 am Posts: 52
|
 Re: Special #startDebug and #endDebug directives.
this is good to make automagically build numbers too.
|
| Tue Sep 08, 2009 8:19 am |
|
 |
|
Warappa
Member
Joined: Wed Jun 20, 2007 8:09 am Posts: 331
|
 Re: Special #startDebug and #endDebug directives.
Hi rapit,
if I compile an AS2 project it throws an exception saying that "ProjectManager.Projects.AS2.AS2Project" can't be converted to "ProjectManager.Projects.AS3.AS3Project".
So please check if the current project is of type AS3Project and otherwise it should disable itself.
Thanks.
Lg warappa
_________________ Practice always defeats theory
|
| Fri Sep 11, 2009 7:48 am |
|
 |
|
rapit
Member
Joined: Fri Jan 23, 2009 10:52 am Posts: 34 Location: Kraków, Poland
|
 Re: Special #startDebug and #endDebug directives.
Totally stuck with datagrdiview... ehh a lot of work yet Custom defines pluginFeatures: - allow create custom defines set, - allow define different value for debug/release mode - create automatically: CONFIG::debug, CONFIG::release (with proper value for build type) - increment automatically (on every build/test): CONFIG::buildVersion Value Type: Boolean:(valid values) true, false String: automatically append "" characters (to do: check/replace " and ' characters) RAW: unchanged Number: parse value to number (still working) TO DO: - validate value type, - import/export defines set - do magic with autocompletion for custom defines Questions: - Should be Namespace field editable?
_________________ English... still learning ;)
|
| Fri Sep 11, 2009 1:21 pm |
|
 |
|
Philippe
Admin
Joined: Wed Aug 31, 2005 7:27 am Posts: 10749 Location: Paris, France
|
 Re: Special #startDebug and #endDebug directives.
Added to SVN: - added "compiler constants" in Flex compiler options (format: NAMESPACE::variable,value) - built-in constants added by FD in the flex-config: CONFIG::debug,true|false CONFIG::release,true|false CONFIG::timeStamp,'30/12/2009 17:08' So that's kind of like SolutionConfig but the UI is not really fancy 
|
| Thu Dec 31, 2009 4:14 pm |
|
|