Merge pull request #1392 from jaredpar/pdb

Make Portable PDB the default on Windows
This commit is contained in:
Jared Parsons 2016-03-03 17:14:51 -08:00
commit d7cabe152f
9 changed files with 45 additions and 11 deletions

View file

@ -32,6 +32,8 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
internal static readonly OptionTemplate s_publicSignTemplate = new OptionTemplate("public-sign");
internal static readonly OptionTemplate s_debugTypeTemplate = new OptionTemplate("debug-type");
internal static readonly OptionTemplate s_emitEntryPointTemplate = new OptionTemplate("emit-entry-point");
internal static readonly OptionTemplate s_generateXmlDocumentation = new OptionTemplate("generate-xml-documentation");
@ -44,6 +46,7 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
IReadOnlyList<string> suppressWarnings = null;
string languageVersion = null;
string platform = null;
string debugType = null;
bool? allowUnsafe = null;
bool? warningsAsErrors = null;
bool? optimize = null;
@ -62,6 +65,8 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
syntax.DefineOptionList(s_additionalArgumentsTemplate.LongName, ref additionalArguments, "Pass the additional argument directly to the compiler");
syntax.DefineOption(s_debugTypeTemplate.LongName, ref debugType, "The type of PDB to emit: portable or full");
syntax.DefineOption(s_languageVersionTemplate.LongName, ref languageVersion,
"The version of the language used to compile");
@ -104,6 +109,7 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
KeyFile = keyFile,
DelaySign = delaySign,
PublicSign = publicSign,
DebugType = debugType,
EmitEntryPoint = emitEntryPoint,
GenerateXmlDocumentation = generateXmlDocumentation,
AdditionalArguments = additionalArguments
@ -115,6 +121,7 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
var defines = options.Defines;
var suppressWarnings = options.SuppressWarnings;
var languageVersion = options.LanguageVersion;
var debugType = options.DebugType;
var platform = options.Platform;
var allowUnsafe = options.AllowUnsafe;
var warningsAsErrors = options.WarningsAsErrors;
@ -183,6 +190,11 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
args.Add(s_publicSignTemplate.ToLongArg(publicSign));
}
if (debugType != null)
{
args.Add(s_debugTypeTemplate.ToLongArg(debugType));
}
if (emitEntryPoint != null)
{
args.Add(s_emitEntryPointTemplate.ToLongArg(emitEntryPoint));

View file

@ -27,6 +27,8 @@ namespace Microsoft.DotNet.ProjectModel
public bool? PublicSign { get; set; }
public string DebugType { get; set; }
public bool? EmitEntryPoint { get; set; }
public bool? PreserveCompilationContext { get; set; }
@ -49,6 +51,7 @@ namespace Microsoft.DotNet.ProjectModel
KeyFile == other.KeyFile &&
DelaySign == other.DelaySign &&
PublicSign == other.PublicSign &&
DebugType == other.DebugType &&
EmitEntryPoint == other.EmitEntryPoint &&
GenerateXmlDocumentation == other.GenerateXmlDocumentation &&
PreserveCompilationContext == other.PreserveCompilationContext &&
@ -131,6 +134,11 @@ namespace Microsoft.DotNet.ProjectModel
result.PublicSign = option.PublicSign;
}
if (option.DebugType != null)
{
result.DebugType = option.DebugType;
}
if (option.EmitEntryPoint != null)
{
result.EmitEntryPoint = option.EmitEntryPoint;

View file

@ -45,6 +45,7 @@ namespace Microsoft.Extensions.DependencyModel
compilerOptions.KeyFile,
compilerOptions.DelaySign,
compilerOptions.PublicSign,
compilerOptions.DebugType,
compilerOptions.EmitEntryPoint,
compilerOptions.GenerateXmlDocumentation);
}

View file

@ -569,6 +569,7 @@ namespace Microsoft.DotNet.ProjectModel
KeyFile = rawOptions.ValueAsString("keyFile"),
DelaySign = rawOptions.ValueAsNullableBoolean("delaySign"),
PublicSign = rawOptions.ValueAsNullableBoolean("publicSign"),
DebugType = rawOptions.ValueAsString("debugType"),
EmitEntryPoint = rawOptions.ValueAsNullableBoolean("emitEntryPoint"),
GenerateXmlDocumentation = rawOptions.ValueAsNullableBoolean("xmlDoc"),
PreserveCompilationContext = rawOptions.ValueAsNullableBoolean("preserveCompilationContext")

View file

@ -26,6 +26,8 @@ namespace Microsoft.Extensions.DependencyModel
public bool? PublicSign { get; }
public string DebugType { get; }
public bool? EmitEntryPoint { get; }
public bool? GenerateXmlDocumentation { get; }
@ -40,6 +42,7 @@ namespace Microsoft.Extensions.DependencyModel
keyFile: null,
delaySign: null,
publicSign: null,
debugType: null,
emitEntryPoint: null,
generateXmlDocumentation: null);
@ -52,6 +55,7 @@ namespace Microsoft.Extensions.DependencyModel
string keyFile,
bool? delaySign,
bool? publicSign,
string debugType,
bool? emitEntryPoint,
bool? generateXmlDocumentation)
{
@ -64,8 +68,9 @@ namespace Microsoft.Extensions.DependencyModel
KeyFile = keyFile;
DelaySign = delaySign;
PublicSign = publicSign;
DebugType = debugType;
EmitEntryPoint = emitEntryPoint;
GenerateXmlDocumentation = generateXmlDocumentation;
}
}
}
}

View file

@ -55,6 +55,7 @@ namespace Microsoft.Extensions.DependencyModel
compilationOptionsObject[DependencyContextStrings.KeyFilePropertyName]?.Value<string>(),
compilationOptionsObject[DependencyContextStrings.DelaySignPropertyName]?.Value<bool>(),
compilationOptionsObject[DependencyContextStrings.PublicSignPropertyName]?.Value<bool>(),
compilationOptionsObject[DependencyContextStrings.DebugTypePropertyName]?.Value<string>(),
compilationOptionsObject[DependencyContextStrings.EmitEntryPointPropertyName]?.Value<bool>(),
compilationOptionsObject[DependencyContextStrings.GenerateXmlDocumentationPropertyName]?.Value<bool>()
);
@ -149,4 +150,4 @@ namespace Microsoft.Extensions.DependencyModel
public bool Serviceable;
}
}
}
}

View file

@ -43,8 +43,10 @@ namespace Microsoft.Extensions.DependencyModel
internal const string PublicSignPropertyName = "publicSign";
internal const string DebugTypePropertyName = "debugType";
internal const string EmitEntryPointPropertyName = "emitEntryPoint";
internal const string GenerateXmlDocumentationPropertyName = "xmlDoc";
}
}
}

View file

@ -71,6 +71,10 @@ namespace Microsoft.Extensions.DependencyModel
{
o[DependencyContextStrings.PublicSignPropertyName] = compilationOptions.PublicSign;
}
if (compilationOptions.DebugType != null)
{
o[DependencyContextStrings.DebugTypePropertyName] = compilationOptions.DebugType;
}
if (compilationOptions.EmitEntryPoint != null)
{
o[DependencyContextStrings.EmitEntryPointPropertyName] = compilationOptions.EmitEntryPoint;
@ -157,4 +161,4 @@ namespace Microsoft.Extensions.DependencyModel
);
}
}
}
}

View file

@ -89,7 +89,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Csc
// Generate assembly info
var assemblyInfo = Path.Combine(tempOutDir, $"dotnet-compile.assemblyinfo.cs");
File.WriteAllText(assemblyInfo, AssemblyInfoFileGenerator.GenerateCSharp(assemblyInfoOptions, sources));
allArgs.Add($"\"{assemblyInfo}\"");
@ -106,7 +106,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Csc
// Only the first should be quoted. This is handled
// in dotnet-compile where the information is present.
allArgs.AddRange(resources.Select(resource => $"-resource:{resource}"));
allArgs.AddRange(sources.Select(s => $"\"{s}\""));
var rsp = Path.Combine(tempOutDir, "dotnet-compile-csc.rsp");
@ -128,13 +128,9 @@ namespace Microsoft.DotNet.Tools.Compiler.Csc
var args = new List<string>()
{
"-nostdlib",
"-nologo"
"-nologo",
};
args.Add(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
? "-debug:full"
: "-debug:portable");
return args;
}
@ -217,6 +213,10 @@ namespace Microsoft.DotNet.Tools.Compiler.Csc
commonArgs.Add("-t:library");
}
commonArgs.Add((string.IsNullOrEmpty(options.DebugType) || options.DebugType == "portable")
? "-debug:portable"
: "-debug:full");
return commonArgs;
}