Index: src/booc/App.cs =================================================================== --- src/booc/App.cs (revision 2030) +++ src/booc/App.cs (working copy) @@ -178,7 +178,20 @@ } else { - InvalidOption(arg); + switch (arg.Substring(1,9)) + { + case "win32icon": + { + _options.Win32IconFile = arg.Substring(arg.IndexOf(":")+1); + break; + } + + default: + { + InvalidOption(arg); + break; + } + } } break; } Index: src/Boo.Lang.Compiler/Steps/EmitAssembly.cs =================================================================== --- src/Boo.Lang.Compiler/Steps/EmitAssembly.cs (revision 2030) +++ src/Boo.Lang.Compiler/Steps/EmitAssembly.cs (working copy) @@ -4329,6 +4329,10 @@ // picks up the attribute when debugging dynamically generated code. _asmBuilder.SetCustomAttribute(CreateDebuggableAttribute()); } + if (string.Empty != Parameters.Win32IconFile) + { + EmbedWin32IconFile(); + } _moduleBuilder = _asmBuilder.DefineDynamicModule(asmName.Name, Path.GetFileName(outputFile), true); _sreResourceService = new SREResourceService (_asmBuilder, _moduleBuilder); ContextAnnotations.SetAssemblyBuilder(Context, _asmBuilder); @@ -4405,5 +4409,42 @@ } return null; } + + void EmbedWin32IconFile() + { + try + { + MethodInfo define_icon = typeof (AssemblyBuilder).GetMethod("DefineIconResource", BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic); + if (null != define_icon) { // Mono implementation + define_icon.Invoke(_asmBuilder, new object [] { Parameters.Win32IconFile }); + return; + } + // + // *********************************** + // implementation for .NET go here :-p + // *********************************** + // + // (meanwhile give a gentle compiler error to the developer) + Error(CompilerErrorFactory.CustomError("BCExxxx - Can't embed win32 icon resource on this runtime. There is only Mono implementation currently.")); + return; + } + catch (System.Exception x) + { + if (null != x.GetBaseException()) + { + x = x.GetBaseException(); + } + if ("System.IO.FileNotFoundException" == x.GetType().ToString()) + { + Error(CompilerErrorFactory.CustomError("BCE9900 - Could not find win32 icon file '" + Parameters.Win32IconFile + "'.")); + return; + } + else + { + Error(CompilerErrorFactory.CustomError("BCE9910 - " + x.Message + ".")); + return; + } + } + } } } Index: src/Boo.Lang.Compiler/CompilerParameters.cs =================================================================== --- src/Boo.Lang.Compiler/CompilerParameters.cs (revision 2030) +++ src/Boo.Lang.Compiler/CompilerParameters.cs (working copy) @@ -58,7 +58,9 @@ bool _ducky; - bool _generateInMemory; + bool _generateInMemory; + + string _win32IconFile; public readonly TraceSwitch TraceSwitch = new TraceSwitch("booc", "boo compiler"); @@ -77,7 +79,8 @@ _outputType = CompilerOutputType.ConsoleApplication; _outputWriter = System.Console.Out; _debug = true; - _generateInMemory = true; + _generateInMemory = true; + _win32IconFile = string.Empty; } /// @@ -244,6 +247,20 @@ { _ducky = value; } - } + } + + public string Win32IconFile + { + get + { + return _win32IconFile; + } + + set + { + _win32IconFile = value; + } + } + } }