Skip to content

Commit

Permalink
Adding Properties to generated namespace and making ThisAssembly clas…
Browse files Browse the repository at this point in the history
…s and members internal
  • Loading branch information
kwpatrick committed Nov 15, 2018
1 parent 10d0aa1 commit 1594cb3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/NerdBank.GitVersioning.Tests/AssemblyInfoTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void FSharpGenerator()
info.AssemblyFileVersion = "1.3";
info.AssemblyVersion = "1.3.0";
info.CodeLanguage = "f#";

var built = info.BuildCode();

var expected = @"//------------------------------------------------------------------------------
Expand All @@ -31,16 +31,16 @@ public void FSharpGenerator()
// </auto-generated>
//------------------------------------------------------------------------------
namespace AssemblyInfo
namespace AssemblyInfo.Properties
[<assembly: System.Reflection.AssemblyVersionAttribute(""1.3.0"")>]
[<assembly: System.Reflection.AssemblyFileVersionAttribute(""1.3"")>]
[<assembly: System.Reflection.AssemblyInformationalVersionAttribute("""")>]
do()
type ThisAssembly() =
static member AssemblyVersion = ""1.3.0""
static member AssemblyFileVersion = ""1.3""
static member AssemblyCompany = ""company""
static member RootNamespace = """"
type internal ThisAssembly() =
static member internal AssemblyVersion = ""1.3.0""
static member internal AssemblyFileVersion = ""1.3""
static member internal AssemblyCompany = ""company""
static member internal RootNamespace = """"
do()
";
Assert.Equal(expected, built);
Expand Down
6 changes: 3 additions & 3 deletions src/Nerdbank.GitVersioning.Tasks/AssemblyVersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,12 @@ internal override void AddComment(string comment)

internal override void AddThisAssemblyMember(string name, string value)
{
this.codeBuilder.AppendLine($" static member {name} = \"{value}\"");
this.codeBuilder.AppendLine($" static member internal {name} = \"{value}\"");
}

internal override void StartNamespace(string ns)
{
this.codeBuilder.AppendLine($"namespace {ns}");
this.codeBuilder.AppendLine($"namespace {ns}.Properties");
}

internal override void DeclareAttribute(Type type, string arg)
Expand All @@ -383,7 +383,7 @@ internal override void EndThisAssemblyClass()

internal override void StartThisAssemblyClass()
{
this.codeBuilder.AppendLine("do()\r\ntype ThisAssembly() =");
this.codeBuilder.AppendLine("do()\r\ntype internal ThisAssembly() =");
}
}

Expand Down

0 comments on commit 1594cb3

Please sign in to comment.