Skip to content

Commit

Permalink
Rename to GenerateSupportedRuntime
Browse files Browse the repository at this point in the history
  • Loading branch information
William Li committed Aug 6, 2018
1 parent b67ccf1 commit 7f3d8aa
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Microsoft.NET.Build.Tasks.UnitTests
{
public class GivenAGeneratedAppConfig
public class GivenWriteAppConfigWithSupportedRuntimeTask
{
[Fact]
public void It_creates_startup_and_supportedRuntime_node_when_there_is_not_any()
Expand All @@ -19,7 +19,7 @@ public void It_creates_startup_and_supportedRuntime_node_when_there_is_not_any()
new XDeclaration("1.0", "utf-8", "true"),
new XElement("configuration"));

WriteAppConfig.AddSupportedRuntimeToAppconfigFile(doc, ".NETFramework", "v4.5.2");
WriteAppConfigWithSupportedRuntime.AddSupportedRuntimeToAppconfig(doc, ".NETFramework", "v4.5.2");

doc.Element("configuration")
.Elements("startup")
Expand All @@ -35,7 +35,7 @@ public void It_creates_supportedRuntime_node_when_there_is_startup()
new XDeclaration("1.0", "utf-8", "true"),
new XElement("configuration", new XElement("startup")));

WriteAppConfig.AddSupportedRuntimeToAppconfigFile(doc, ".NETFramework", "v4.5.2");
WriteAppConfigWithSupportedRuntime.AddSupportedRuntimeToAppconfig(doc, ".NETFramework", "v4.5.2");

doc.Element("configuration")
.Elements("startup")
Expand All @@ -55,7 +55,7 @@ public void It_does_not_change_supportedRuntime_node_when_there_is_supportedRunt
new XAttribute("version", "v4.0"),
new XAttribute("sku", ".NETFramework,Version=v4.7.2")))));

WriteAppConfig.AddSupportedRuntimeToAppconfigFile(doc, ".NETFramework", "v4.6.1");
WriteAppConfigWithSupportedRuntime.AddSupportedRuntimeToAppconfig(doc, ".NETFramework", "v4.6.1");

XElement supportedRuntime = doc.Element("configuration")
.Elements("startup")
Expand All @@ -72,7 +72,7 @@ public void It_does_not_change_supportedRuntime_node_when_there_is_supportedRunt
[InlineData(".NETFramework", "v1.1", "v1.1.4322")]
[InlineData(".NETFramework", "v2.0", "v2.0.50727")]
[InlineData(".NETFramework", "v3.5", "v2.0.50727")]
public void It_Generate_correct_version_and_sku_for_below40(
public void It_generate_correct_version_and_sku_for_below40(
string targetFrameworkIdentifier,
string targetFrameworkVersion,
string expectedVersion)
Expand All @@ -82,7 +82,7 @@ public void It_Generate_correct_version_and_sku_for_below40(
new XDeclaration("1.0", "utf-8", "true"),
new XElement("configuration"));

WriteAppConfig.AddSupportedRuntimeToAppconfigFile(doc, targetFrameworkIdentifier, targetFrameworkVersion);
WriteAppConfigWithSupportedRuntime.AddSupportedRuntimeToAppconfig(doc, targetFrameworkIdentifier, targetFrameworkVersion);

XElement supportedRuntime = doc.Element("configuration")
.Elements("startup")
Expand All @@ -103,7 +103,7 @@ public void It_Generate_correct_version_and_sku_for_below40(
[InlineData(".NETFramework", "v4.7", "v4.0", ".NETFramework,Version=v4.7")]
[InlineData(".NETFramework", "v4.7.1", "v4.0", ".NETFramework,Version=v4.7.1")]
[InlineData(".NETFramework", "v4.7.2", "v4.0", ".NETFramework,Version=v4.7.2")]
public void It_Generate_correct_version_and_sku_for_above40(
public void It_generate_correct_version_and_sku_for_above40(
string targetFrameworkIdentifier,
string targetFrameworkVersion,
string expectedVersion,
Expand All @@ -114,7 +114,7 @@ public void It_Generate_correct_version_and_sku_for_above40(
new XDeclaration("1.0", "utf-8", "true"),
new XElement("configuration"));

WriteAppConfig.AddSupportedRuntimeToAppconfigFile(doc, targetFrameworkIdentifier, targetFrameworkVersion);
WriteAppConfigWithSupportedRuntime.AddSupportedRuntimeToAppconfig(doc, targetFrameworkIdentifier, targetFrameworkVersion);

XElement supportedRuntime = doc.Element("configuration")
.Elements("startup")
Expand All @@ -127,7 +127,7 @@ public void It_Generate_correct_version_and_sku_for_above40(

[Theory]
[InlineData(".NETFramework", "v4.0", "Client", "v4.0", ".NETFramework,Version=v4.0,Profile=Client")]
public void It_Generate_correct_version_and_sku_and_profile(
public void It_generate_correct_version_and_sku_and_profile(
string targetFrameworkIdentifier,
string targetFrameworkVersion,
string targetFrameworkProfile,
Expand All @@ -139,7 +139,7 @@ public void It_Generate_correct_version_and_sku_and_profile(
new XDeclaration("1.0", "utf-8", "true"),
new XElement("configuration"));

WriteAppConfig.AddSupportedRuntimeToAppconfigFile(doc,
WriteAppConfigWithSupportedRuntime.AddSupportedRuntimeToAppconfig(doc,
targetFrameworkIdentifier,
targetFrameworkVersion,
targetFrameworkProfile);
Expand All @@ -166,7 +166,7 @@ public void It_does_not_generate_version_and_sku_for_non_supported(string target
new XElement("configuration"));

var parserdFramework = NuGetFramework.ParseFolder(targetframework);
WriteAppConfig.AddSupportedRuntimeToAppconfigFile(doc, parserdFramework.Framework, parserdFramework.Version.ToString());
WriteAppConfigWithSupportedRuntime.AddSupportedRuntimeToAppconfig(doc, parserdFramework.Framework, parserdFramework.Version.ToString());

doc.Element("configuration")
.Elements("startup").Should().BeNullOrEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Microsoft.NET.Build.Tasks
{
public sealed class WriteAppConfig : TaskBase
public sealed class WriteAppConfigWithSupportedRuntime : TaskBase
{
/// <summary>
/// Path to the app.config source file.
Expand All @@ -34,7 +34,7 @@ protected override void ExecuteCore()
{
XDocument doc = LoadAppConfig(AppConfigFile);

AddSupportedRuntimeToAppconfigFile(doc, TargetFrameworkIdentifier, TargetFrameworkVersion, TargetFrameworkProfile);
AddSupportedRuntimeToAppconfig(doc, TargetFrameworkIdentifier, TargetFrameworkVersion, TargetFrameworkProfile);

var fileStream = new FileStream(
OutputAppConfigFile.ItemSpec,
Expand All @@ -48,7 +48,7 @@ protected override void ExecuteCore()
}
}

public static void AddSupportedRuntimeToAppconfigFile(
public static void AddSupportedRuntimeToAppconfig(
XDocument doc,
string targetFrameworkIdentifier,
string targetFrameworkVersion,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
***********************************************************************************************
Microsoft.NET.GenerateAppConfig.targets
Microsoft.NET.GenerateSupportedRuntime.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
Expand All @@ -11,51 +11,51 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<UsingTask TaskName="WriteAppConfig" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
<UsingTask TaskName="WriteAppConfigWithSupportedRuntime" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
<UsingTask TaskName="SetGeneratedAppConfigMetadata" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />

<PropertyGroup>
<_GenerateAppConfigIntermediateAppConfig>$(IntermediateOutputPath)$(TargetFileName).withSupportedRuntime.config</_GenerateAppConfigIntermediateAppConfig>
<_GenerateSupportedRuntimeIntermediateAppConfig>$(IntermediateOutputPath)$(TargetFileName).withSupportedRuntime.config</_GenerateSupportedRuntimeIntermediateAppConfig>
</PropertyGroup>

<Target Name="GenerateAppConfig"
Condition="'$(GenerateAppConfig)' != 'false' and '$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(HasRuntimeOutput)' == 'true'"
DependsOnTargets="_WriteAppConfig"
BeforeTargets="GenerateBindingRedirects">
<Target Name="GenerateSupportedRuntime"
Condition="'$(GenerateSupportedRuntime)' != 'false' and '$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(HasRuntimeOutput)' == 'true'"
DependsOnTargets="_WriteAppConfigWithSupportedRuntime"
BeforeTargets="ResolveReferences">

<SetGeneratedAppConfigMetadata
AppConfigFile="@(AppConfigWithTargetPath)"
TargetName="$(TargetFileName).config"
GeneratedAppConfigFile="$(_GenerateAppConfigIntermediateAppConfig)"
GeneratedAppConfigFile="$(_GenerateSupportedRuntimeIntermediateAppConfig)"
>

<Output TaskParameter="OutputAppConfigFileWithMetadata" ItemName="_GenerateAppConfigAppConfigWithTargetPath" />
<Output TaskParameter="OutputAppConfigFileWithMetadata" ItemName="_GenerateSupportedRuntimeAppConfigWithTargetPath" />
</SetGeneratedAppConfigMetadata>

<!--Override the AppConfigWithTargetPath for downstream target-->
<ItemGroup>
<AppConfigWithTargetPath Remove="@(AppConfigWithTargetPath)" />
<AppConfigWithTargetPath Include="@(_GenerateAppConfigAppConfigWithTargetPath)" />
<AppConfigWithTargetPath Include="@(_GenerateSupportedRuntimeAppConfigWithTargetPath)" />
</ItemGroup>

</Target>

<Target Name="_WriteAppConfig"
<Target Name="_WriteAppConfigWithSupportedRuntime"
Inputs="$(MSBuildAllProjects);@(AppConfigWithTargetPath);$(ResolveAssemblyReferencesStateFile)"
Outputs="$(_GenerateAppConfigIntermediateAppConfig)"
Outputs="$(_GenerateSupportedRuntimeIntermediateAppConfig)"
DependsOnTargets="PrepareForBuild">

<WriteAppConfig
<WriteAppConfigWithSupportedRuntime
AppConfigFile="@(AppConfigWithTargetPath)"
TargetFrameworkIdentifier="$(TargetFrameworkIdentifier)"
TargetFrameworkVersion="$(TargetFrameworkVersion)"
TargetFrameworkProfile="$(TargetFrameworkProfile)"
OutputAppConfigFile="$(_GenerateAppConfigIntermediateAppConfig)"
OutputAppConfigFile="$(_GenerateSupportedRuntimeIntermediateAppConfig)"
>
</WriteAppConfig>
</WriteAppConfigWithSupportedRuntime>

<ItemGroup>
<FileWrites Include="@(_GenerateAppConfigAppConfigWithTargetPath)"/>
<FileWrites Include="@(_GenerateSupportedRuntimeAppConfigWithTargetPath)"/>
</ItemGroup>

</Target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ Copyright (c) .NET Foundation. All rights reserved.

<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.DisableStandardFrameworkResolution.targets" Condition="'$(DisableStandardFrameworkResolution)' == 'true'" />
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.GenerateAssemblyInfo.targets" />
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.GenerateAppConfig.targets" />
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.GenerateSupportedRuntime.targets" />
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.ComposeStore.targets" />
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.CrossGen.targets" />
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.ObsoleteReferences.targets" />
Expand Down

0 comments on commit 7f3d8aa

Please sign in to comment.