dbankier / JAST

JAST is a boilerplate with a mash of tools for rapid Alloy development
91 stars 15 forks source link

--log-level param in ti_args breaks the build #16

Open shodanuk opened 9 years ago

shodanuk commented 9 years ago

Running grunt dev -p ios with:

var ti_args= {
  ios: ["-p","ios","-T", "simulator", "--device-id","xxx-xxx-xxx-xxx-xxx", "--log-level", "trace"]
};

results in:

[INFO] Alloy compiled in 1.44946s
[WARN] Nothing to update.
titanium build --log-level info --platform ios --project-dir . --no-banner --no-progress-bars --no-prompt -p ios -T simulator --device-id 1483CA77-1291-43A7-A246-F2F6E8C15FC8 --log-level trace --appify
[ERROR] Invalid "--log-level" value "info,trace"

Accepted values:
   trace
   debug
   info
   warn
   error

For help, run: titanium help build

Done, without errors.

Something (I suspect grunt-titanium) is adding --log-level info by default.

Not sure if the problem is JAST or over at grunt-titanium.

shodanuk commented 9 years ago

Same goes for grunt dev -p android.

I've done a bit of digging and it appears that grunt-titanium doesn't actually merge in anything passed in the args param of the grunt task definition but simply concatenates it to the end of the generated ti command, resulting in duplicate --platform & --log-level params if they've been specified in ti_args.

The defaults in grunt-titanium only specify platform, log-level & projectDir, hence why the problem only exists for select params.

See https://github.com/tonylukasavage/grunt-titanium/blob/master/tasks/titanium.js#L157

A fairly simple fix for the platform param is to pass the grunt -p param into a new platform param in the grunt task definition.

Will put together a pull request in a sec.