[svn] r6173: nemerle/trunk/ncc: CompilationOptions.n hierarchy/CustomAttribute.n

nazgul svnadmin at nemerle.org
Tue Apr 4 21:21:37 CEST 2006


Log:
Add the keyfile option for specifying strong key file name to be used in signing assembly

Author: nazgul
Date: Tue Apr  4 21:21:28 2006
New Revision: 6173

Modified:
   nemerle/trunk/ncc/CompilationOptions.n
   nemerle/trunk/ncc/hierarchy/CustomAttribute.n

Modified: nemerle/trunk/ncc/CompilationOptions.n
==============================================================================
--- nemerle/trunk/ncc/CompilationOptions.n	(original)
+++ nemerle/trunk/ncc/CompilationOptions.n	Tue Apr  4 21:21:28 2006
@@ -70,6 +70,19 @@
     private disabled_keywords : Hashtable [string, list [NamespaceTree.Node]] = Hashtable ();
     internal mutable CommandDefines : Map [string, bool];
     
+    public StrongAssemblyKeyName : string
+    {
+      mutable filename : string;
+      
+      get { filename }
+      
+      set {
+        when (value != null && filename != null) // it already exists
+          Message.Warning ($"assembly key filename was already specified (`$filename'), ignoring the `$value' one");
+        filename = value;
+      }
+    }
+        
     internal Validate () : void {
       when (System.IO.Path.GetExtension (OutputFileName) == "")
         OutputFileName +=
@@ -115,6 +128,7 @@
       disabled_keywords.Clear ();
       CommandDefines = Map ();
       MainClass = null;
+      StrongAssemblyKeyName = null;
     }
 
     /// default null value for [in_namespace] means that keyword 
@@ -425,6 +439,11 @@
                                    }
                                  }),
 
+        Getopt.CliOption.String (name = "-keyfile", 
+                                 aliases = [], 
+                                 help = "Specify a strong name key file",
+                                 handler = fun (x) { StrongAssemblyKeyName = x }),
+                                 
         Getopt.CliOption.Boolean (name = "-greedy-references", 
                                   aliases = ["-greedy"],
                                   help = "Recursive loading references of used assemblies",

Modified: nemerle/trunk/ncc/hierarchy/CustomAttribute.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/CustomAttribute.n	(original)
+++ nemerle/trunk/ncc/hierarchy/CustomAttribute.n	Tue Apr  4 21:21:28 2006
@@ -355,6 +355,10 @@
       def an = SR.AssemblyName ();
       an.CodeBase = string.Concat("file:///", Directory.GetCurrentDirectory());
 
+      when (Options.StrongAssemblyKeyName != null) {
+        an.KeyPair = read_keypair (Location.Default, Options.StrongAssemblyKeyName);
+      }
+      
       foreach ((env, attr) in List.Rev (assembly_attributes)) {
         /* store resolved attribute */
         def resolved = CheckAttribute (env, attr);
@@ -409,7 +413,7 @@
         {
           def key = take_string (parms);
           if (an.KeyPair != null)
-            Message.Error (attr.loc, "AssemblyKeyFile attribute specified twice")
+            Message.Warning (attr.loc, "AssemblyKeyFile attribute will be ignored, as key file was already specified")
           else
             when (key != "") an.KeyPair = read_keypair (attr.loc, key);
         }



More information about the svn mailing list