Skip to content

Commit dad4cf6

Browse files
committed
Some cleanup and xml comments.
1 parent 8b81673 commit dad4cf6

3 files changed

Lines changed: 55 additions & 9 deletions

File tree

RoslynCodeProviderTest/CompilerSettingsHelper.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@
77
using System.Threading.Tasks;
88

99
namespace Microsoft.CodeDom.Providers.DotNetCompilerPlatformTest {
10+
11+
#pragma warning disable CS0618
12+
internal class TestCompilerSettings : ICompilerSettings {
13+
public string CompilerFullPath { get; set; }
14+
public int CompilerServerTimeToLive { get; set; }
15+
}
16+
1017
internal static class CompilerSettingsHelper {
1118

1219
private const int DefaultCompilerServerTTL = 0; // set TTL to 0 to turn of keepalive switch
1320

14-
//smolloy debug degub todo - these two lines, and the next two properties are obsolete.
15-
private static ICompilerSettings _csc = new CompilerSettings(CompilerFullPath(@"csc.exe"), DefaultCompilerServerTTL);
16-
private static ICompilerSettings _vb = new CompilerSettings(CompilerFullPath(@"vbc.exe"), DefaultCompilerServerTTL);
21+
private static ICompilerSettings _csc = new ProviderOptions(CompilerFullPath(@"csc.exe"), DefaultCompilerServerTTL);
22+
private static ICompilerSettings _vb = new ProviderOptions(CompilerFullPath(@"vbc.exe"), DefaultCompilerServerTTL);
1723

1824
public static ICompilerSettings CSC {
1925
get {
@@ -34,4 +40,5 @@ private static string CompilerFullPath(string relativePath) {
3440
return compilerFullPath;
3541
}
3642
}
43+
#pragma warning restore CS0618
3744
}

src/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/Util/IProviderOptions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
namespace Microsoft.CodeDom.Providers.DotNetCompilerPlatform {
77

8+
#pragma warning disable CS0618
9+
810
/// <summary>
911
/// Provides settings for the C# and VB CodeProviders
1012
/// </summary>
@@ -45,4 +47,6 @@ public interface IProviderOptions : ICompilerSettings {
4547
/// </summary>
4648
IDictionary<string, string> AllOptions { get; }
4749
}
50+
#pragma warning restore CS0618
51+
4852
}

src/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/Util/ProviderOptions.cs

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@
66
using System.Threading;
77

88
namespace Microsoft.CodeDom.Providers.DotNetCompilerPlatform {
9+
10+
/// <summary>
11+
/// A set of options for the C# and VB CodeProviders.
12+
/// </summary>
913
public sealed class ProviderOptions : IProviderOptions {
1014

1115
private IDictionary<string, string> _allOptions;
1216

17+
/// <summary>
18+
/// Create a default set of options for the C# and VB CodeProviders.
19+
/// </summary>
1320
public ProviderOptions()
1421
{
1522
this.CompilerFullPath = null;
@@ -31,7 +38,10 @@ public ProviderOptions()
3138
this.UseAspNetSettings = false;
3239
}
3340

34-
public ProviderOptions(IProviderOptions opts) : this()
41+
/// <summary>
42+
/// Create a set of options for the C# or VB CodeProviders using the specified inputs.
43+
/// </summary>
44+
public ProviderOptions(IProviderOptions opts)
3545
{
3646
this.CompilerFullPath = opts.CompilerFullPath;
3747
this.CompilerServerTimeToLive = opts.CompilerServerTimeToLive;
@@ -41,29 +51,54 @@ public ProviderOptions(IProviderOptions opts) : this()
4151
this.AllOptions = opts.AllOptions;
4252
}
4353

44-
internal ProviderOptions(ICompilerSettings settings) : this()
54+
/// <summary>
55+
/// Create a set of options for the C# or VB CodeProviders using some specified inputs.
56+
/// </summary>
57+
public ProviderOptions(string compilerFullPath, int compilerServerTimeToLive) : this()
4558
{
46-
this.CompilerFullPath = settings.CompilerFullPath;
47-
this.CompilerServerTimeToLive = settings.CompilerServerTimeToLive;
59+
this.CompilerFullPath = compilerFullPath;
60+
this.CompilerServerTimeToLive = compilerServerTimeToLive;
4861
}
4962

63+
#pragma warning disable CS0618
64+
internal ProviderOptions(ICompilerSettings settings) : this(settings.CompilerFullPath, settings.CompilerServerTimeToLive) { }
65+
#pragma warning restore CS0618
66+
67+
/// <summary>
68+
/// The full path to csc.exe or vbc.exe
69+
/// </summary>
5070
public string CompilerFullPath { get; internal set; }
5171

72+
/// <summary>
73+
/// TTL in seconds
74+
/// </summary>
5275
public int CompilerServerTimeToLive { get; internal set; }
5376

54-
// smolloy todo debug degub - we don't use this. It is used by the framework. Do we care to call it out like this?
77+
/// <summary>
78+
/// Used by in-box framework code providers to determine which compat version of the compiler to use.
79+
/// </summary>
5580
public string CompilerVersion { get; internal set; }
5681

82+
// smolloy todo debug degub - Does it really override everything? Is that the right thing to do?
83+
/// <summary>
84+
/// Treat all warnings as errors. Will override defaults and command-line options given for a compiler.
85+
/// </summary>
5786
public bool WarnAsError { get; internal set; }
5887

88+
/// <summary>
89+
/// Use the set of compiler options that was traditionally added programatically for ASP.Net.
90+
/// </summary>
5991
public bool UseAspNetSettings { get; internal set; }
6092

93+
/// <summary>
94+
/// A collection of all &lt;providerOptions&gt; specified in config for the given CodeDomProvider.
95+
/// </summary>
6196
public IDictionary<string, string> AllOptions {
6297
get {
6398
return _allOptions;
6499
}
65100
internal set {
66-
_allOptions = new ReadOnlyDictionary<string, string>(value);
101+
_allOptions = (value != null) ? new ReadOnlyDictionary<string, string>(value) : null;
67102
}
68103
}
69104
}

0 commit comments

Comments
 (0)