Thursday 13 December 2012

JDK7 surprise

Noticed quite an un-documented change in JDK7 windows command-line argument parsing reging quotes escaping and spaces:


Now execute java -cp . ArgTest "-Dfoo=""foo"" <bar>"

With Sun Oracle JDK 1.3.1_18 / 1.4.2_12 / 1.5.0_07 / 6u21 / 6u33 / 6u38:

arg0:-Dfoo="foo
arg1:<bar>

(yes I keep old JDKs around for fun)


With Oracle JDK 7u00 / 7u03 / 7u07:

arg0:-Dfoo="foo" <bar>

One can argue that it's better (and closer to unix java parsing behavior, although not yet identical), another one can argue that compatibility time is over, I'm not picking sides on this one.

Now let's watch all tooling break !
(in my case it was gerrit + gradle + jenkins)

Note:
Strangely enough, escaping quotes with '\' works for all versions (and unix as well), but some guys (read Jenkins) seem to prefer quote doubling.

Note2:
Windows argument parsing (e.g. in batch files) has the exact opposite behavior, and will split the args unless the double quoting is used.

Sunday 30 January 2011

ILRepack - yet another ILMerge

In the company I work for, we use ILMerge to isolate DLL bundles in an application (bundles are developed by different teams).
What we want to share between bundles (aka contract, or API) is what is NOT merged, all other dependencies are merged into each bundle, bringing a feeling of "what you test is what is run".

ILMerge is fine, except it's closed-source, and has many issues:
- relies on COM component
- errors range from OutOfMemory to StackOverflow, all in COM parts, hard to debug
- no control over dependency resolving (only a list of search directories)
- [insert yours here]

I'm not good about commitments, and I didn't feel good with this one either, so I checked the alternatives:
- mono-merge: no longer supported, bugged, uses out-dated Cecil version
- ***fuscator pro: refusing to go commercial on this, the spec is open, so should be the tools

So I took a night shift to do this, and here it is: ILRepack
Based on renown Mono.Cecil (git trunk), it merges assemblies, and it's open source, so:
- if you don't like it, change it !
- if it doesn't work, fix it !

Tuesday 12 October 2010

ILMerge is a life saver

Seriously, you need some assembly/type isolation in your .Net application framework ?
Before taking the AppDomain route (or worse, the AddIn one), check if ILMerge isn't a better approach.

Simpler and faster it is, and it sure rescued a lot of people.