/** Add a new transform to the given pack, dealing properly with
* options specified in the transformer.
*/
public static void addTransform(Pack pack, String name,
Transformer transformer, String defaultOptions) {
Transform t = new Transform(name, transformer);
if (transformer instanceof HasPhaseOptions) {
HasPhaseOptions options = (HasPhaseOptions) transformer;
// Note: First appearance of an option has precendence
t
.setDefaultOptions(defaultOptions + " "
+ options.getDefaultOptions() + " "
+ t.getDefaultOptions());
t.setDeclaredOptions(options.getDeclaredOptions() + " "
+ t.getDeclaredOptions());
} else {
t.setDefaultOptions(defaultOptions + " " + t.getDefaultOptions());
}
pack.add(t);
}