PR feedback
This commit is contained in:
parent
63faf3282d
commit
465fe07004
3 changed files with 10 additions and 82 deletions
|
@ -1,64 +0,0 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class JsonPropertyParser : Task
|
||||
{
|
||||
[Required]
|
||||
public string[] JFilenames
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Required]
|
||||
public string[] JPaths
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Output]
|
||||
public ITaskItem[] Value
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
Value = new TaskItem[JFilenames.Length];
|
||||
for (var i = 0; i < JFilenames.Length; i++)
|
||||
{
|
||||
Value[i] = new TaskItem(JFilenames[i]);
|
||||
try
|
||||
{
|
||||
using (var sr = new StreamReader(JFilenames[i]))
|
||||
{
|
||||
var json = sr.ReadToEnd();
|
||||
var o = JObject.Parse(json);
|
||||
foreach (var path in JPaths)
|
||||
{
|
||||
var lastDot = path.LastIndexOf('.');
|
||||
var name = lastDot == -1 ? path : path.Substring(lastDot + 1);
|
||||
Value[i].SetMetadata(name, o.SelectToken(path).Value<string>());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.LogErrorFromException(e);
|
||||
}
|
||||
}
|
||||
|
||||
return !Log.HasLoggedErrors;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,7 +35,6 @@
|
|||
<UsingTask TaskName="GetDependencyInfo" AssemblyFile="$(CoreSdkTaskDll)"/>
|
||||
<UsingTask TaskName="GetLinuxNativeInstallerDependencyVersions" AssemblyFile="$(CoreSdkTaskDll)"/>
|
||||
<UsingTask TaskName="GetRuntimePackRids" AssemblyFile="$(CoreSdkTaskDll)"/>
|
||||
<UsingTask TaskName="JsonPropertyParser" AssemblyFile="$(CoreSdkTaskDll)"/>
|
||||
<UsingTask TaskName="ReplaceDuplicateFilesWithHardLinks" AssemblyFile="$(CoreSdkTaskDll)"/>
|
||||
<UsingTask TaskName="ReplaceFileContents" AssemblyFile="$(CoreSdkTaskDll)" />
|
||||
<UsingTask TaskName="TarGzFileCreateFromDirectory" AssemblyFile="$(CoreSdkTaskDll)" />
|
||||
|
|
|
@ -105,29 +105,22 @@
|
|||
<Copy SourceFiles="@(ManifestContent)"
|
||||
DestinationFolder="$(RedistLayoutPath)sdk-manifests/%(DestinationPath)"/>
|
||||
|
||||
<ItemGroup>
|
||||
<FormattedManifestPaths Include="$(RedistLayoutPath)sdk-manifests\**\%(BundledManifests.Identity)\WorkloadManifest.json" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<WorkloadSetVersion Condition="'$(DotNetFinalVersionKind)' == 'release'">$(Version)-baseline.$(_PatchNumber)</WorkloadSetVersion>
|
||||
<WorkloadSetVersion Condition="'$(DotNetFinalVersionKind)' != 'release'">$(Version)</WorkloadSetVersion>
|
||||
<RealFormattedManifestPaths>$(RedistLayoutPath)sdk-manifests\$(NetFeatureBand)\workloadsets\$(WorkloadSetVersion)</RealFormattedManifestPaths>
|
||||
</PropertyGroup>
|
||||
|
||||
<JsonPropertyParser JFileNames="@(FormattedManifestPaths)" JPaths="version" Value="empty">
|
||||
<Output TaskParameter="Value" ItemName="BaselineManifestsWithVersion" />
|
||||
</JsonPropertyParser>
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<FormattedBaselineManifest Include="{" />
|
||||
<FormattedBaselineManifest Include=""$([System.IO.Path]::GetFileName(%(BaselineManifestsWithVersion.Identity)))": "%(BaselineManifestsWithVersion.Version)","/>
|
||||
<FormattedBaselineManifest Include=""Version": "$(WorkloadSetVersion)"," />
|
||||
<FormattedBaselineManifest Include=""%(BundledManifests.Identity)": "%(BundledManifests.Version)","/>
|
||||
<FormattedBaselineManifest Include="}" />
|
||||
</ItemGroup>
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
<WriteLinestoFile File="$(RedistLayoutPath)sdk-manifests\BaselineManifest.json" Lines="@(FormattedBaselineManifest)" />
|
||||
=======
|
||||
<PropertyGroup>
|
||||
<BaselineManifestFileName Condition="''$(DotNetFinalVersionKind)' == 'release'">BaselineManifest</BaselineManifestFileName>
|
||||
<BaselineManifestFileName Condition="''$(DotNetFinalVersionKind)' != 'release'">BaselineManifest</BaselineManifestFileName>
|
||||
</PropertyGroup>
|
||||
|
||||
<WriteLinestoFile File="$(RedistLayoutPath)sdk-manifests\$(BaselineManifestFileName).json" Lines="@(FormattedBaselineManifest)" />
|
||||
>>>>>>> Stashed changes
|
||||
<WriteLinestoFile File="$(RealFormattedManifestPaths)\Baseline.WorkloadSet.json" Lines="@(FormattedBaselineManifest)" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
Loading…
Reference in a new issue