BowlerHatLLC / asconfigc

Command line utility that builds ActionScript projects configured with an asconfig.json file.
https://www.npmjs.com/package/asconfigc
Apache License 2.0
18 stars 5 forks source link

Constant bad formating #18

Closed Incubatio closed 6 years ago

Incubatio commented 6 years ago

Currently string constants are not generated properly, which will lead to the compilation error: col: 95 Error: The initializer for a configuration value must be a compile time constant.

in asconfig:

        "define": [
          { "name": "CONFIG::DEBUG_NS", "value": "*" }
       ]

generated line:

--define+=CONFIG::DEBUG_NS,*

Double or single quote have to be used(1), what it should look like:

--define+=CONFIG::DEBUG_NS,"*"

even using additionalOptions will trim double quote and single quote out:

   "additionalOptions": "--define+=CONFIG::DEBUG_NS,\"*\""

(1) "Using conditional compilation" in https://help.adobe.com/archive/en_US/flex/using/flex_4.6_help.pdf

joshtynjala commented 6 years ago

As I recall, you need to add another layer of quotes to define strings. I think this will work:

{ "name": "CONFIG::DEBUG_NS", "value": "\"*\"" }

I seem to remember that the compiler allows you to define non-string basic expressions (like "1+2", for instance) with quotes, so that's why you need to wrap strings with an extra set of quotes.

Incubatio commented 6 years ago

I already tried it. Quote and double quote get trimmed out.

joshtynjala commented 6 years ago

Hmmm... perhaps I misremembered. It looks like escaped strings don't work well. I just tested, and you can use single quotes on the inner string instead:

{ "name": "CONFIG::DEBUG_NS", "value": "'*'" }
Incubatio commented 6 years ago

Ok I kept having the issue, but I updated my node version. Now i can use quote and double quote, my bad. Thanks for the the answer.

joshtynjala commented 6 years ago

Interesting! Which Node version did you have installed before?

Incubatio commented 6 years ago

node/6.11.0

joshtynjala commented 6 years ago

Thanks!

Incubatio commented 6 years ago

I just tried to reproduce by re-switching to node/6.11.0, but I can't ... Probably a bug related to a npm dependancy, or to a local problem -_-.

joshtynjala commented 6 years ago

👹 Gremlins! Haha.