Index: default.build =================================================================== --- default.build (revision 2147) +++ default.build (working copy) @@ -68,7 +68,8 @@ target="exe" output="${build.dir}/boo.exe" verbose="${verbose}" - debug="${debug}"> + debug="${debug}" + keyfile="src\boo.snk"> @@ -163,7 +164,8 @@ target="library" output="${build.dir}/Boo.Lang.Interpreter.dll" verbose="${verbose}" - debug="${debug}"> + debug="${debug}" + keyfile="src\boo.snk"> @@ -207,7 +209,11 @@ - + @@ -300,7 +306,8 @@ output="${build.dir}/Boo.Microsoft.Build.Tasks.dll" failonerror="false" verbose="${verbose}" - debug="${debug}"> + debug="${debug}" + keyfile="src\boo.snk"> @@ -342,7 +349,8 @@ + debug="${debug}" + keyfile="src\boo.snk"> @@ -356,7 +364,8 @@ + debug="${debug}" + keyfile="src\boo.snk"> @@ -371,7 +380,8 @@ + optimize="${optimize}" + keyfile="src\boo.snk"> @@ -389,6 +399,7 @@ output="${build.dir}/Boo.Lang.dll" debug="${debug}" optimize="${optimize}" + keyfile="src\boo.snk" if="${string::starts-with(framework::get-target-framework(), 'net-')}"> @@ -411,6 +422,7 @@ output="${build.dir}/Boo.Lang.dll" debug="${debug}" optimize="${optimize}" + keyfile="src\boo.snk" unless="${string::starts-with(framework::get-target-framework(), 'net-')}"> @@ -601,7 +613,7 @@ + debug="${debug}" optimize="${optimize}" keyfile="src\boo.snk"> Index: src/Boo.Lang.Compiler/CompilerParameters.cs =================================================================== --- src/Boo.Lang.Compiler/CompilerParameters.cs (revision 2147) +++ src/Boo.Lang.Compiler/CompilerParameters.cs (working copy) @@ -70,6 +70,12 @@ bool _StdLib; + string _keyFile; + + string _keyContainer; + + bool _delaySign; + ArrayList _libpaths; string _systemDir; @@ -102,6 +108,8 @@ _generateInMemory = true; _StdLib = true; + _delaySign = false; + if (load_default_references) LoadDefaultReferences(); } @@ -506,5 +514,44 @@ _ducky = value; } } + + public string KeyFile + { + get + { + return _keyFile; + } + + set + { + _keyFile = value; + } + } + + public string KeyContainer + { + get + { + return _keyContainer; + } + + set + { + _keyContainer = value; + } + } + + public bool DelaySign + { + get + { + return _delaySign; + } + + set + { + _delaySign = value; + } + } } } Index: src/Boo.Lang.Compiler/Steps/EmitAssembly.cs =================================================================== --- src/Boo.Lang.Compiler/Steps/EmitAssembly.cs (revision 2147) +++ src/Boo.Lang.Compiler/Steps/EmitAssembly.cs (working copy) @@ -4376,27 +4376,69 @@ StrongNameKeyPair GetAssemblyKeyPair(string outputFile) { - string fname = GetAssemblyAttributeValue("System.Reflection.AssemblyKeyFileAttribute"); + if (Parameters.KeyContainer != null) + { + return new StrongNameKeyPair(Parameters.KeyContainer); + } + + string fname = null; + string srcFile = ""; + Attribute attribute = GetAssemblyAttribute("System.Reflection.AssemblyKeyFileAttribute"); + + if (Parameters.KeyFile != null) + { + fname = Parameters.KeyFile; + if (attribute != null) + { + //ignore, -keyfile specified on the command line overrides. + } + } + else if (attribute != null) + { + fname = ((StringLiteralExpression)attribute.Arguments[0]).Value; + if (attribute.LexicalInfo != null && attribute.LexicalInfo.FileName != null) + { + srcFile = attribute.LexicalInfo.FileName; + } + } + if (null != fname && fname.Length > 0) { if (!Path.IsPathRooted(fname)) { - fname = ResolveRelative(outputFile, fname); + fname = ResolveRelative(outputFile, srcFile, fname); } using (FileStream stream = File.OpenRead(fname)) { + //Parameters.DelaySign is ignored. return new StrongNameKeyPair(stream); } } return null; } - string ResolveRelative(string targetFile, string relativeFile) + string ResolveRelative(string targetFile, string srcFile, string relativeFile) { - return Path.GetFullPath( - Path.Combine( - Path.GetDirectoryName(targetFile), + //relative to current directory: + string fname = Path.GetFullPath(relativeFile); + if (File.Exists(fname)) + { + return fname; + } + + //relative to source file: + fname = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(srcFile), relativeFile)); + if (File.Exists(fname)) + { + return fname; + } + + //relative to output assembly: + fname = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(targetFile), + relativeFile)); + + return fname; } Version GetAssemblyVersion() Index: src/Boo.Microsoft.Build.Tasks/Booc.boo =================================================================== --- src/Boo.Microsoft.Build.Tasks/Booc.boo (revision 2147) +++ src/Boo.Microsoft.Build.Tasks/Booc.boo (working copy) @@ -277,6 +277,8 @@ commandLine.AppendSwitchIfNotNull('-o:', OutputAssembly) commandLine.AppendSwitchIfNotNull('-c:', Culture) commandLine.AppendSwitchIfNotNull('-srcdir:', SourceDirectory) + commandLine.AppendSwitchIfNotNull('-keyfile:', KeyFile) + commandLine.AppendSwitchIfNotNull('-keycontainer:', KeyContainer) if Pipelines: for pipeline in Pipelines: Index: src/Boo.NAnt.Tasks/BoocTask.boo =================================================================== --- src/Boo.NAnt.Tasks/BoocTask.boo (revision 2147) +++ src/Boo.NAnt.Tasks/BoocTask.boo (working copy) @@ -59,6 +59,10 @@ #endregion Private Static Fields + def constructor(): + SupportsKeyFile = true + SupportsKeyContainer = true + [FrameworkConfigurable("exename")] [TaskAttribute('exename')] public override ExeName as string: Index: src/booc/App.cs =================================================================== --- src/booc/App.cs (revision 2147) +++ src/booc/App.cs (working copy) @@ -445,7 +445,24 @@ } break; } - + + case 'k': + { + if (arg.Substring(1, 7) == "keyfile") + { + _options.KeyFile = StripQuotes(arg.Substring(9)); + } + else if (arg.Substring(1, 12) == "keycontainer") + { + _options.KeyContainer = StripQuotes(arg.Substring(14)); + } + else + { + InvalidOption(arg); + } + break; + } + case 'd': { switch (arg.Substring(1)) @@ -475,6 +492,12 @@ break; } + case "delaysign": + { + _options.DelaySign = true; + break; + } + default: { InvalidOption(arg);