You've already forked linux-packaging-mono
Imported Upstream version 4.4.0.122
Former-commit-id: a99f46acaeba3ab496c7afc02c29b839e30a0d0b
This commit is contained in:
@ -12,6 +12,7 @@ using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Security.Cryptography;
|
||||
@ -19,6 +20,7 @@ using System.Text;
|
||||
using System.Configuration.Assemblies;
|
||||
|
||||
using Mono.Security.Cryptography;
|
||||
using IKR = IKVM.Reflection;
|
||||
|
||||
namespace Mono.AssemblyLinker
|
||||
{
|
||||
@ -591,46 +593,8 @@ namespace Mono.AssemblyLinker
|
||||
* Emit Manifest
|
||||
* */
|
||||
|
||||
if (isTemplateFile) {
|
||||
// LAMESPEC: according to MSDN, the template assembly must have a
|
||||
// strong name but this is not enforced
|
||||
Assembly assembly = Assembly.LoadFrom (templateFile);
|
||||
|
||||
// inherit signing related settings from template, but do not
|
||||
// override command-line options
|
||||
object [] attrs = assembly.GetCustomAttributes (true);
|
||||
foreach (object o in attrs) {
|
||||
if (o is AssemblyKeyFileAttribute) {
|
||||
if (keyfile != null)
|
||||
// ignore if specified on command line
|
||||
continue;
|
||||
AssemblyKeyFileAttribute keyFileAttr = (AssemblyKeyFileAttribute) o;
|
||||
// ignore null or zero-length keyfile
|
||||
if (keyFileAttr.KeyFile == null || keyFileAttr.KeyFile.Length == 0)
|
||||
continue;
|
||||
keyfile = Path.Combine (Path.GetDirectoryName(templateFile),
|
||||
keyFileAttr.KeyFile);
|
||||
} else if (o is AssemblyDelaySignAttribute) {
|
||||
if (delaysign != DelaySign.NotSet)
|
||||
// ignore if specified on command line
|
||||
continue;
|
||||
AssemblyDelaySignAttribute delaySignAttr = (AssemblyDelaySignAttribute) o;
|
||||
delaysign = delaySignAttr.DelaySign ? DelaySign.Yes :
|
||||
DelaySign.No;
|
||||
} else if (o is AssemblyKeyNameAttribute) {
|
||||
if (keyname != null)
|
||||
// ignore if specified on command line
|
||||
continue;
|
||||
AssemblyKeyNameAttribute keynameAttr = (AssemblyKeyNameAttribute) o;
|
||||
// ignore null or zero-length keyname
|
||||
if (keynameAttr.KeyName == null || keynameAttr.KeyName.Length == 0)
|
||||
continue;
|
||||
keyname = keynameAttr.KeyName;
|
||||
}
|
||||
}
|
||||
aname.Version = assembly.GetName().Version;
|
||||
aname.HashAlgorithm = assembly.GetName().HashAlgorithm;
|
||||
}
|
||||
if (isTemplateFile)
|
||||
aname = ReadCustomAttributesFromTemplateFile (templateFile, aname);
|
||||
|
||||
SetKeyPair (aname);
|
||||
|
||||
@ -765,6 +729,85 @@ namespace Mono.AssemblyLinker
|
||||
}
|
||||
}
|
||||
|
||||
private AssemblyName ReadCustomAttributesFromTemplateFile (string templateFile, AssemblyName aname)
|
||||
{
|
||||
// LAMESPEC: according to MSDN, the template assembly must have a
|
||||
// strong name but this is not enforced
|
||||
const IKR.UniverseOptions options = IKR.UniverseOptions.MetadataOnly;
|
||||
|
||||
var universe = new IKR.Universe (options);
|
||||
var asm = universe.LoadFile (templateFile);
|
||||
|
||||
// Create missing assemblies, we don't want to load them!
|
||||
// Code taken from ikdasm
|
||||
var names = new HashSet<string> ();
|
||||
IKR.AssemblyName[] assembly_refs = asm.ManifestModule.__GetReferencedAssemblies ();
|
||||
|
||||
var resolved_assemblies = new IKR.Assembly [assembly_refs.Length];
|
||||
for (int i = 0; i < resolved_assemblies.Length; i++) {
|
||||
string name = assembly_refs [i].Name;
|
||||
|
||||
while (names.Contains (name)) {
|
||||
name = name + "_" + i;
|
||||
}
|
||||
names.Add (name);
|
||||
resolved_assemblies [i] = universe.CreateMissingAssembly (assembly_refs [i].FullName);
|
||||
}
|
||||
asm.ManifestModule.__ResolveReferencedAssemblies (resolved_assemblies);
|
||||
|
||||
foreach (var attr_data in asm.__GetCustomAttributes (null, false)) {
|
||||
string asm_name = attr_data.AttributeType.Assembly.GetName ().Name;
|
||||
if (asm_name != "mscorlib")
|
||||
continue;
|
||||
|
||||
switch (attr_data.AttributeType.FullName) {
|
||||
case "System.Reflection.AssemblyKeyFileAttribute": {
|
||||
if (keyfile != null)
|
||||
// ignore if specified on command line
|
||||
continue;
|
||||
|
||||
// / AssemblyKeyFileAttribute .ctor(string keyFile)
|
||||
string key_file_value = (string) attr_data.ConstructorArguments [0].Value;
|
||||
|
||||
if (!String.IsNullOrEmpty (key_file_value))
|
||||
keyfile = Path.Combine (Path.GetDirectoryName (templateFile), key_file_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case "System.Reflection.AssemblyDelaySignAttribute": {
|
||||
if (delaysign != DelaySign.NotSet)
|
||||
// ignore if specified on command line
|
||||
continue;
|
||||
|
||||
// AssemblyDelaySignAttribute .ctor(bool delaySign)
|
||||
bool delay_sign_value = (bool) attr_data.ConstructorArguments [0].Value;
|
||||
delaysign = delay_sign_value ? DelaySign.Yes : DelaySign.No;
|
||||
}
|
||||
break;
|
||||
|
||||
case "System.Reflection.AssemblyKeyNameAttribute": {
|
||||
if (keyname != null)
|
||||
// ignore if specified on command line
|
||||
continue;
|
||||
|
||||
// AssemblyKeyNameAttribute .ctor(string keyName)
|
||||
string key_name_value = (string) attr_data.ConstructorArguments [0].Value;
|
||||
|
||||
// ignore null or zero-length keyname
|
||||
if (!String.IsNullOrEmpty (key_name_value))
|
||||
keyname = key_name_value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var asm_name_for_template_file = asm.GetName ();
|
||||
aname.Version = asm_name_for_template_file.Version;
|
||||
aname.HashAlgorithm = asm_name_for_template_file.HashAlgorithm;
|
||||
|
||||
return aname;
|
||||
}
|
||||
|
||||
private void LoadArgs (string file, ArrayList args) {
|
||||
StreamReader f = null;
|
||||
string line;
|
||||
|
@ -2,7 +2,7 @@ thisdir = tools/al
|
||||
SUBDIRS =
|
||||
include ../../build/rules.make
|
||||
|
||||
LOCAL_MCS_FLAGS = -r:Mono.Security.dll
|
||||
LOCAL_MCS_FLAGS = -r:Mono.Security.dll -r:System.Security.dll -r:Mono.CompilerServices.SymbolWriter
|
||||
PROGRAM = al.exe
|
||||
|
||||
CLEAN_FILES = al.exe al.exe.mdb
|
||||
|
@ -1,2 +1,9 @@
|
||||
Al.cs
|
||||
../../build/common/Consts.cs
|
||||
../../../external/ikvm/reflect/*.cs
|
||||
../../../external/ikvm/reflect/Emit/*.cs
|
||||
../../../external/ikvm/reflect/Metadata/*.cs
|
||||
../../../external/ikvm/reflect/Reader/*.cs
|
||||
../../../external/ikvm/reflect/Writer/*.cs
|
||||
../../../external/ikvm/reflect/Impl/*.cs
|
||||
../../../external/ikvm/reflect/Properties/*.cs
|
||||
|
@ -596,6 +596,7 @@ namespace Mono.Terminal {
|
||||
|
||||
if (completions.Length == 1){
|
||||
InsertTextAtCursor (completions [0]);
|
||||
HideCompletions ();
|
||||
} else {
|
||||
int last = -1;
|
||||
|
||||
|
@ -404,7 +404,7 @@ namespace Mono {
|
||||
static void EscapeString (TextWriter output, string s)
|
||||
{
|
||||
foreach (var c in s){
|
||||
if (c > 32){
|
||||
if (c >= 32){
|
||||
output.Write (c);
|
||||
continue;
|
||||
}
|
||||
@ -416,7 +416,7 @@ namespace Mono {
|
||||
case '\b':
|
||||
output.Write ("\\b"); break;
|
||||
case '\n':
|
||||
output.Write ("\\n");
|
||||
output.Write ("\n");
|
||||
break;
|
||||
|
||||
case '\v':
|
||||
@ -448,7 +448,7 @@ namespace Mono {
|
||||
output.Write ("'\\''");
|
||||
return;
|
||||
}
|
||||
if (c > 32){
|
||||
if (c >= 32){
|
||||
output.Write ("'{0}'", c);
|
||||
return;
|
||||
}
|
||||
@ -482,7 +482,7 @@ namespace Mono {
|
||||
break;
|
||||
|
||||
default:
|
||||
output.Write ("'\\x{0:x}", (int) c);
|
||||
output.Write ("'\\x{0:x}'", (int) c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -510,8 +510,8 @@ namespace Mono.XBuild.CommandLine {
|
||||
if (solutionTarget.Configuration == targetInfo.Key.Configuration &&
|
||||
solutionTarget.Platform == targetInfo.Key.Platform) {
|
||||
solutionConfigurationContents.AppendFormat (
|
||||
"<ProjectConfiguration Project=\"{0}\">{1}|{2}</ProjectConfiguration>",
|
||||
guid.ToString ("B").ToUpper (), targetInfo.Value.Configuration, targetInfo.Value.Platform);
|
||||
"<ProjectConfiguration Project=\"{0}\" AbsolutePath=\"{1}\">{2}|{3}</ProjectConfiguration>",
|
||||
guid.ToString ("B").ToUpper (), projectInfo.FileName, targetInfo.Value.Configuration, targetInfo.Value.Platform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user