View unanswered posts | View active topics



Reply to topic  [ 15 posts ] 
Better support for conditional compilation through CONFIG:: 
Author Message
Member

Joined: Tue Sep 18, 2012 9:26 am
Posts: 52
Reply with quote
This idea has been realized in a way of new plugin: viewtopic.php?f=4&t=10943


Hey guys, here's the deal:

If you want to change the value of some of your constants, you have to:

1. click mouse on Project->Properties, or better press ctrl+P
2. click mouse on the last tab Compiler options
3. click again on the small plus next to Compiler constants
4. click on the chosen CONFIG, backspace a few times, write the new value
5. because enter doesn't close the dialog, grab the mouse again and click OK

Now if you forgot to change also some other constant, you have to do the same again. And it's pretty much the same if you want to check what's the value of one of those constants.

Seems like a lot of time? It is, especially if you've based the configuration of your project on those CONFIGs, you're using them all day long, testing different builds. And in my case (probably not only in mine) that's what's happening - because they're incredibly useful, allow to quickly change the build of the app in a fundamental way, in an mutually independent way.

Here's the screenshots of the ways I'm using it:

Image

So for example I can build the version with ads in, stats in, but profiling out... or vice versa. And editor will still be in.

So what I'm asking is a way to tweak those values somewhere in the main UI of FD, just like it's already possible with debug/release. It could be a special toolbar Compiler constants, which when placed on UI, would iterate over all constants, and for each one with value true/false, add a checkbox. That's it :)


Last edited by Koshmaar on Fri Aug 30, 2013 8:37 am, edited 1 time in total.



Mon Jul 01, 2013 5:36 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
This would be a job for a plugin - most users (including FD developers) use very little configuration values.


Thu Jul 04, 2013 12:32 pm
Profile WWW
Member

Joined: Sun Mar 23, 2008 2:28 am
Posts: 176
Reply with quote
Since this is the only decent option for conditional compile, I would be surprised if it's not commonly used by advanced projects. I use them all over the place.

It would be great if this and compiler options were in an editable text file, and lines could be commented out.


Thu Aug 01, 2013 4:35 pm
Profile WWW
Member

Joined: Tue Sep 18, 2012 9:26 am
Posts: 52
Reply with quote
Ok, I am willing to make a plugin for that. I already downloaded FD source, setup the envinroment, compiled FD and sample plugin... question is - how can I access the Compiler Constants list? I've looked in Interfaces.cs, and IProject nor any other interface has something similiar to that. If it's not there, could the interface be extended?


Tue Aug 27, 2013 5:04 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
You will have to reference ProjectManager project (or DLL) and cast the IProject into an AS3Project.
Make sure to call project.Save() to persist your changes.


Tue Aug 27, 2013 10:42 pm
Profile WWW
Member

Joined: Tue Sep 18, 2012 9:26 am
Posts: 52
Reply with quote
Managed to do everything I wanted! And it was much easier than I thought :) Really nice separation of editor "components" into dlls. And C# with .net is really powerfull and fast (to write, and even run) - no wonder you've chosen this technology and FD has became what it is.

So here you go, fresh CONFIG::toggle plugin which allows to easily toggle the value of all compiler constants which have true or false after comma.

Image


... Ekhm, how can I attach something here? I don't see option, so I'm hosting it for now: http://hubert-rutkowski.pl/downloads/ConfigToggle.dll (just copy to yours FlashDevelop/Plugins and restart).

But after few days of public testing and perhaps bug fixing, plugin should be ready to be put in http://www.flashdevelop.org/wikidocs/in ... lugins_FD4 list


Wed Aug 28, 2013 9:56 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
Good job :)

We don't host extensions, but if you PM me your google account I can add you as a contributor to FDPlugins where you'll be able to host files:
https://code.google.com/p/fdplugins/

(BTW this project needs cleanup)


Wed Aug 28, 2013 10:31 pm
Profile WWW
Member

Joined: Tue Aug 31, 2010 1:39 pm
Posts: 134
Reply with quote
Many many many thanks!!

Well, there is some small issues:

My constants aren't precided by CONFIG, but divided by namespace, like this:
TEST::a
TEST::b
LOG::x
LOG::y
And go on...

Your plugin recognizes but mess with them.
E.g.: TEST::a becomes CONFIG::TEST::a

Another issue is that it doesn't recognize your constant if it have a space between comma and boolean value.
E.g.: CONFIG::a,true will work, but CONFIG::a, true won't.

Aside from that, it would be awesome to have a string/number editor too... ^_^

_________________
"Tu deviens responsable pour toujours de ce que tu as apprivoisé" - Antoine de Saint-Exupéry


Wed Aug 28, 2013 11:35 pm
Profile WWW
Member

Joined: Sun Mar 23, 2008 2:28 am
Posts: 176
Reply with quote
Cool, I'd still prefer the power of a plain text file though..


Thu Aug 29, 2013 5:19 am
Profile WWW
Member

Joined: Tue Sep 18, 2012 9:26 am
Posts: 52
Reply with quote
NemoStein - I changed lame string searches to regex, and now it supports all kinds of "NAMESPACE::stuff , value", including whitespaces around comma. Watch out not to have spaces after value, though.

I don't work with numbers in compiler constants, have little incentive and time to do that.

Created github repo, at https://github.com/Koshmaar/ConfigToggle

New version can be downloaded at https://github.com/Koshmaar/ConfigToggl ... Toggle.dll

So if anyone wants to fork/extend this plugin with new features to do that - you're welcome! Source is very simple.

Philippe - thanks, I already have good hosting :)


Thu Aug 29, 2013 10:18 am
Profile
Member

Joined: Thu Feb 09, 2006 10:58 am
Posts: 1095
Location: Israel
Reply with quote
Cool plugin, I'm already using it.

_________________
MovieClipCommander


Thu Aug 29, 2013 10:57 am
Profile
Member

Joined: Sun Mar 23, 2008 2:28 am
Posts: 176
Reply with quote
This is fantastic, great job Koshmaar!

I previously had a complex set of rules in my constants, switched on a string define:

COMPILER::buildName,'editorBeta'

Then rules like:

COMPILER::build_editorBeta,COMPILER::buildName=='editorBeta'
COMPILER::include_nonEditorAssets,COMPILER::buildName!='editorBeta'

Since this is so convenient, I just changed them all to bools.

Just one issue:

Can you expand the size of the field? build_editorBeta is being truncated to: "build_editorB"


Thu Aug 29, 2013 4:07 pm
Profile WWW
Member

Joined: Tue Sep 18, 2012 9:26 am
Posts: 52
Reply with quote
Adept - sure, when enough little things collect I will build new version. For now you can compile your own version (it's not that hard as I learned :) ).

So people please test and write here feature requests. Open source is cool :)


Thu Aug 29, 2013 6:56 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
Koshmaar I suggest you post a more formal thread in the Plugins section like that:
viewtopic.php?f=4&t=10939

(make sure to edit this thread's first post to add a big clear link to the plugin post)


Thu Aug 29, 2013 10:09 pm
Profile WWW
Member

Joined: Tue Sep 18, 2012 9:26 am
Posts: 52
Reply with quote
Yes good idea, did that :)

viewtopic.php?f=4&t=10943


Fri Aug 30, 2013 8:36 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 15 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.