Bug in boolean params; they produce wrong shell command string #7

Open
apinstein opened this Issue Jul 9, 2011 · 7 comments

Comments

Projects
None yet
2 participants
Collaborator

apinstein commented Jul 9, 2011

For my app I use "-use-network=false". It is not working as expected.

Instead of outputting "-use-network=false" it will just output "-use-network" which has no effect.

This bug probably affects all boolean-ish compile flags in all of sprout.

I did some debugging, and changing this:

sprout-1.1.15.pre/lib/sprout/executable/base.rb:948 to

add_param :use_network, Boolean, { :default => true, :show_on_false => true, :hidden_value => false, :delimiter => '=' }

Fixes the problem. I did some debugging, and even though in Param the
defaults are hidden_value=false, delimiter="=", somehow those are not
being respected. I did a dump of all instance vars in the
param.to_shell and the use_network is defaulting to hidden_value=true
which causes the problem.

Collaborator

apinstein commented Jul 9, 2011

Flash compilers expect all boolean params to be explicitly listed like param=true|false

http://livedocs.adobe.com/flex/3/html/compilers_06.html#149503

Many command-line options, such as show-actionscript-warnings and accessible, have true and false values. You specify these values by using the following syntax:

mxmlc -accessible=true -show-actionscript-warnings=true

I am trying to figure out the right way to do this. It seems based on this fact about the flash CLI compilers that we should have a DRY way to make all Boolean params output as =true|false rather than having to specify this behavior for each one.

Is there a reasonable place/way to make https://github.com/apinstein/sprout-flashsdk/blob/master/lib/flashsdk/compiler_base.rb automatically use a BooleanParam subclass that is correctly configured as appropriate?

I am sure there's an appropriate Ruby way to do that but I have no idea how.

Owner

lukebayes commented Jul 14, 2011

Their docs aren't quite correct. Where it says, "You specify these values by...", it should say, "You can specify these values by...."

As it turns out, this works just as well for any parameters that are false by default:

mxmlc --accessible --show-actionscript-warnings

This is much more convenient and much more consistent with how most other command line applications work. As far as I know, use_network is the only flag that is backwards (boolean parameter with default true value).

There are actually lots of other boolean flags in the Compiler Base class (Search this page for 'boolean', http://projectsprouts.org/docs/1.1/FlashSDK/CompilerBase.html). Do you know of any others that default to true?

Thanks,

Luke

Collaborator

apinstein commented Jul 14, 2011

Ah ok thanks for clarifying.

So I guess then the fix is just to make the use-network flag explicitly output its truthiness.

I don't personally know of any others that default to true but I just looked for a bit and found this:

http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_14.html

Looks like these default to true:
-as3
-benchmark
-debug
-optimize
-show-actionscript-warnings
-show-binding-warnings
-show-shadowed-device-font- warnings
-show-unused-type-selector- warnings
-static-link-runtime-shared- libraries
-strict
-use-network
-use-resource-bundle-metadata
-warnings

I am not sure I see the downside in just making all non-null values for boolean params explicitly printout true|false. Why don't we just do that and be done with it?

Alan

On Jul 14, 2011, at 12:41 PM, lukebayes wrote:

Their docs aren't quite correct. Where it says, "You specify these values by...", it should say, "You can specify these values by...."

As it turns out, this works just as well for any parameters that are false by default:

mxmlc --accessible --show-actionscript-warnings

This is much more convenient and much more consistent with how most other command line applications work. As far as I know, use_network is the only flag that is backwards (boolean parameter with default true value).

There are actually lots of other boolean flags in the Compiler Base class (Search this page for 'boolean', http://projectsprouts.org/docs/1.1/FlashSDK/CompilerBase.html). Do you know of any others that default to true?

Thanks,

Luke

Reply to this email directly or view it on GitHub:
#7 (comment)

Collaborator

apinstein commented Nov 2, 2011

Apparently Adobe changed the default for -static-link-runtime-shared-libraries from true to false when Flex 4 came out.

http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7add.html
http://opensource.adobe.com/wiki/display/flexsdk/Linking+RSLs+by+Default

apinstein added a commit to apinstein/sprout-flashsdk that referenced this issue Nov 2, 2011

[gh-7] Standardize the behavior of options for the flex compilers to …
…reflect the documentation. This actually fixes bugs where certain options were *not* properly manifested to the actual compilers. For instance it was impossible to set -use-network=false prior to this fix.

apinstein added a commit to apinstein/sprout-flashsdk that referenced this issue Nov 2, 2011

Collaborator

apinstein commented Nov 2, 2011

I think that this pull request is mature and ready to go... thoughts?

Owner

lukebayes commented Nov 6, 2011

Hey Alan,

I'm sorry for lagging on this stuff. I really appreciate all of your help on Sprouts!

I went ahead and made you a collaborator on the flashsdk and main project.

For future work like this, please check out the writable version of the repo and go ahead and check directly into it.

If you have any major changes in mind, please let me know before you go too far.

Collaborator

apinstein commented Nov 6, 2011

Cool, thanks!

Anyway you could take a quick look at what I did to make sure it seems sane? It's a very small patch but affects compiler options so I'd love to have someone else with experience give it a look.

Do you have any idea how many people use sprout for flash?

Alan

Sent from iPhone.

On Nov 6, 2011, at 1:41 AM, Luke Bayesreply@reply.github.com wrote:

Hey Alan,

I'm sorry for lagging on this stuff. I really appreciate all of your help on Sprouts!

I went ahead and made you a collaborator on the flashsdk and main project.

For future work like this, please check out the writable version of the repo and go ahead and check directly into it.

If you have any major changes in mind, please let me know before you go too far.


Reply to this email directly or view it on GitHub:
#7 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment