forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wasm] Performance sample - remove public nugets and clean up (dotnet…
…#107030) * Simplify nuget.config reading + remove "nuget.org". * Feedback from @radekdoulik
- Loading branch information
1 parent
b54c8de
commit 2aca5e5
Showing
2 changed files
with
66 additions
and
20 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
src/mono/sample/wasm/browser-bench/Common/GetNugetConfigTask.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.IO; | ||
using System.Xml.Linq; | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
|
||
public class GetNugetConfigTask : Task | ||
{ | ||
[Required] | ||
public string InputFile { get; set; } | ||
|
||
[Required] | ||
public string ArtifactsDir { get; set; } | ||
|
||
[Required] | ||
public string Configuration { get; set; } | ||
|
||
[Output] | ||
public string NugetConfigContent { get; set; } | ||
|
||
public override bool Execute() | ||
{ | ||
try | ||
{ | ||
XDocument doc = XDocument.Load(InputFile); | ||
XElement packageSources = doc.Root.Element("packageSources"); | ||
|
||
if (packageSources == null) | ||
{ | ||
packageSources = new XElement("packageSources"); | ||
doc.Root.Add(packageSources); | ||
} | ||
|
||
XElement newSource = new XElement("add", | ||
new XAttribute("key", "nuget-local"), | ||
new XAttribute("value", Path.Combine(ArtifactsDir, "packages", Configuration, "Shipping")) | ||
); | ||
|
||
packageSources.Add(newSource); | ||
|
||
NugetConfigContent = doc.ToString(); | ||
return true; | ||
} | ||
catch (Exception ex) | ||
{ | ||
Log.LogErrorFromException(ex); | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters