Skip to content

[main] Source code updates from dotnet/dotnet #477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 3, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<Source Uri="https://github.com/dotnet/dotnet" Mapping="source-build-externals" Sha="78c5fa9a48d469a19ab5a61c16c955c1f370b5be" BarId="266331" />
<Source Uri="https://github.com/dotnet/dotnet" Mapping="source-build-externals" Sha="3b83017bbef1dd0918f7c2f894cfd07f56bcd689" BarId="266652" />
<ToolsetDependencies>
<Dependency Name="Microsoft.Build" Version="17.14.0-preview-24619-01">
<Uri>https://github.com/dotnet/msbuild</Uri>
<Sha>e9b99f554a3c298e1106ea171f5a0462780af2c5</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="10.0.0-beta.25229.109">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="10.0.0-beta.25251.105">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>78c5fa9a48d469a19ab5a61c16c955c1f370b5be</Sha>
<Sha>3b83017bbef1dd0918f7c2f894cfd07f56bcd689</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
2 changes: 1 addition & 1 deletion eng/common/core-templates/jobs/source-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ parameters:
# This is the default platform provided by Arcade, intended for use by a managed-only repo.
defaultManagedPlatform:
name: 'Managed'
container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9'
container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream-10-amd64'

# Defines the platforms on which to run build jobs. One job is created for each platform, and the
# object in this array is sent to the job template as 'platform'. If no platforms are specified,
Expand Down
11 changes: 0 additions & 11 deletions eng/common/core-templates/steps/source-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,3 @@ steps:
continueOnError: true
condition: succeededOrFailed()
sbomEnabled: false # we don't need SBOM for logs

# Manually inject component detection so that we can ignore the source build upstream cache, which contains
# a nupkg cache of input packages (a local feed).
# This path must match the upstream cache path in property 'CurrentRepoSourceBuiltNupkgCacheDir'
# in src\Microsoft.DotNet.Arcade.Sdk\tools\SourceBuild\SourceBuildArcade.targets
- template: /eng/common/core-templates/steps/component-governance.yml
parameters:
displayName: Component Detection (Exclude upstream cache)
is1ESPipeline: ${{ parameters.is1ESPipeline }}
componentGovernanceIgnoreDirectories: '$(Build.SourcesDirectory)/artifacts/sb/src/artifacts/obj/source-built-upstream-cache'
disableComponentGovernance: ${{ eq(variables['System.TeamProject'], 'public') }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.IO;
using System.Linq;
using System.Xml.Linq;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace Microsoft.DotNet.Build.Tasks
{
/// <summary>
/// This task adds a source to a well-formed NuGet.Config file with highest
/// priority, or replaces a source with the same name if present. The task
/// also by default adds a 'clear' element if none exists, to avoid
/// unintended leaks from the build environment.
/// </summary>
public class AddSourceToNuGetConfig : Task
{
[Required]
public string NuGetConfigFile { get; set; }

[Required]
public string SourceName { get; set; }

[Required]
public string SourcePath { get; set; }

public bool SkipEnsureClear { get; set; }

public override bool Execute()
{
XDocument document = XDocument.Load(NuGetConfigFile);

XName CreateQualifiedName(string plainName)
{
return document.Root.GetDefaultNamespace().GetName(plainName);
}

XElement packageSourcesElement = document.Root
.Element(CreateQualifiedName("packageSources"));

var sourceElementToAdd = new XElement(
"add",
new XAttribute("key", SourceName),
new XAttribute("value", SourcePath));

XElement existingSourceElement = packageSourcesElement
.Elements(CreateQualifiedName("add"))
.FirstOrDefault(e => e.Attribute("key").Value == SourceName);

XElement lastClearElement = packageSourcesElement
.Elements(CreateQualifiedName("clear"))
.LastOrDefault();

if (existingSourceElement != null)
{
existingSourceElement.ReplaceWith(sourceElementToAdd);
}
else if (lastClearElement != null)
{
lastClearElement.AddAfterSelf(sourceElementToAdd);
}
else
{
packageSourcesElement.AddFirst(sourceElementToAdd);
}

if (lastClearElement == null && !SkipEnsureClear)
{
packageSourcesElement.AddFirst(new XElement("clear"));
}

using (var fs = new FileStream(NuGetConfigFile, FileMode.Create, FileAccess.ReadWrite))
{
document.Save(fs);
}

return !Log.HasLoggedErrors;
}
}
}
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"dotnet": "10.0.100-preview.3.25201.16"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25229.109"
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25251.105"
}
}
2 changes: 1 addition & 1 deletion repo-projects/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<NuGetConfigFile Condition="'$(NuGetConfigFile)' == '' and Exists('$(ProjectDirectory)src\NuGet.Config')">$(ProjectDirectory)src\NuGet.Config</NuGetConfigFile>
</PropertyGroup>

<UsingTask TaskName="Microsoft.DotNet.Arcade.Sdk.SourceBuild.AddSourceToNuGetConfig" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" />
<UsingTask TaskName="AddSourceToNuGetConfig" AssemblyFile="$(XPlatSourceBuildTasksAssembly)" />
<UsingTask TaskName="UpdateJson" AssemblyFile="$(XPlatSourceBuildTasksAssembly)" />

<Target Name="BuildRepoReferences" Condition="'@(RepositoryReference)' != '' and '$(SkipRepoReferences)' != 'true'">
Expand Down
Loading