Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
16 changes: 8 additions & 8 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,19 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.25626.6">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.26063.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>ab5773ac30dce73227fa1dff6bf1a21eea67cbd0</Sha>
<Sha>c85f9aceddaf85296e3efbc463daaa34fef5a375</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="9.0.0-beta.25626.6">
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="9.0.0-beta.26063.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>ab5773ac30dce73227fa1dff6bf1a21eea67cbd0</Sha>
<Sha>c85f9aceddaf85296e3efbc463daaa34fef5a375</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="9.0.0-beta.25626.6">
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="9.0.0-beta.26063.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>ab5773ac30dce73227fa1dff6bf1a21eea67cbd0</Sha>
<Sha>c85f9aceddaf85296e3efbc463daaa34fef5a375</Sha>
</Dependency>
<Dependency Name="NuGet.Build.Tasks" Version="6.14.0-rc.116">
<Uri>https://github.com/nuget/nuget.client</Uri>
Expand All @@ -150,9 +150,9 @@
<Sha>46223204b646f96104bac46f9dfa4959da9d86ac</Sha>
<SourceBuild RepoName="roslyn" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.XUnitExtensions" Version="9.0.0-beta.25626.6">
<Dependency Name="Microsoft.DotNet.XUnitExtensions" Version="9.0.0-beta.26063.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>ab5773ac30dce73227fa1dff6bf1a21eea67cbd0</Sha>
<Sha>c85f9aceddaf85296e3efbc463daaa34fef5a375</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
<Project>
<PropertyGroup>
<VersionPrefix>17.14.42</VersionPrefix>
<VersionPrefix>17.14.43</VersionPrefix>
<DotNetFinalVersionKind>release</DotNetFinalVersionKind>
<PackageValidationBaselineVersion>17.13.9</PackageValidationBaselineVersion>
<AssemblyVersion>15.1.0.0</AssemblyVersion>
Expand Down Expand Up @@ -72,7 +72,7 @@
Otherwise, this version of dotnet will not be installed and the build will error out. -->
<DotNetCliVersion>$([System.Text.RegularExpressions.Regex]::Match($([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)..\global.json')), '"dotnet": "([^"]*)"').Groups.get_Item(1))</DotNetCliVersion>
<MicrosoftCodeAnalysisCollectionsVersion>4.2.0-1.22102.8</MicrosoftCodeAnalysisCollectionsVersion>
<MicrosoftDotNetXUnitExtensionsVersion>9.0.0-beta.25626.6</MicrosoftDotNetXUnitExtensionsVersion>
<MicrosoftDotNetXUnitExtensionsVersion>9.0.0-beta.26063.2</MicrosoftDotNetXUnitExtensionsVersion>
<MicrosoftNetCompilersToolsetVersion>4.14.0-3.25157.4</MicrosoftNetCompilersToolsetVersion>
<NuGetBuildTasksVersion>6.14.0-rc.116</NuGetBuildTasksVersion>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion eng/common/core-templates/job/publish-build-assets.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions eng/common/core-templates/post-build/post-build.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion eng/common/templates/variables/pool-providers.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"xcopy-msbuild": "17.12.0"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25626.6"
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.26063.2"
}
}
80 changes: 51 additions & 29 deletions src/Build.UnitTests/ProjectCache/ProjectCacheTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Build.CommandLine;
using Microsoft.Build.Construction;
using Microsoft.Build.Execution;
using Microsoft.Build.Experimental.ProjectCache;
using Microsoft.Build.Framework;
using Microsoft.Build.Graph;
using Microsoft.Build.Internal;
using Microsoft.Build.Shared;
using Microsoft.Build.Unittest;
using Microsoft.Build.UnitTests;
Expand All @@ -24,13 +24,14 @@
using Shouldly;
using Xunit;
using Xunit.Abstractions;
using Xunit.Sdk;
using Task = System.Threading.Tasks.Task;

namespace Microsoft.Build.Engine.UnitTests.ProjectCache
{
public class ProjectCacheTests : IDisposable
{
private static string s_currentTargetNETFramework = $"net{RunnerUtilities.BootstrapSdkVersion.Split('.')?.FirstOrDefault()}.0";

public ProjectCacheTests(ITestOutputHelper output)
{
_output = output;
Expand All @@ -47,22 +48,37 @@ public void Dispose()

private const string AssemblyMockCache = nameof(AssemblyMockCache);

private static readonly Lazy<string> SamplePluginAssemblyPath =
private const string Configuration =
#if DEBUG
"Debug";
#else
"Release";
#endif

private static readonly string s_currentFramework = GetCurrentFramework();

private static string GetCurrentFramework() =>
#if RUNTIME_TYPE_NETCORE
s_currentTargetNETFramework;
#else
"net472";
#endif

private static readonly string s_samplePluginPath = Path.Combine(
BuildEnvironmentHelper.Instance.CurrentMSBuildToolsDirectory,
"..",
"..",
"..",
"Samples",
"ProjectCachePlugin");

private static readonly Lazy<string> s_samplePluginAssemblyPath =
new Lazy<string>(
() =>
{
return Directory.EnumerateFiles(
Path.GetFullPath(
Path.Combine(
BuildEnvironmentHelper.Instance.CurrentMSBuildToolsDirectory,
"..",
"..",
"..",
"Samples",
"ProjectCachePlugin")),
"ProjectCachePlugin.dll",
SearchOption.AllDirectories).First();
});
() => Path.Combine(
Path.GetFullPath(s_samplePluginPath),
Configuration,
s_currentFramework,
"ProjectCachePlugin.dll"));

public class GraphCacheResponse
{
Expand All @@ -74,7 +90,7 @@ public class GraphCacheResponse
@$"
<ItemGroup>
<ProjectReferenceTargets Include=`Build` Targets=`Build` />
<{ItemTypeNames.ProjectCachePlugin} Include=`{SamplePluginAssemblyPath.Value}` />
<{ItemTypeNames.ProjectCachePlugin} Include=`{s_samplePluginAssemblyPath.Value}` />
</ItemGroup>

<Target Name=`Build` Returns=`@(ReturnValue)`>
Expand Down Expand Up @@ -919,7 +935,7 @@ public void CacheViaBuildParametersCanDiscoverAndLoadPluginFromAssembly()

var buildParameters = new BuildParameters
{
ProjectCacheDescriptor = ProjectCacheDescriptor.FromAssemblyPath(SamplePluginAssemblyPath.Value)
ProjectCacheDescriptor = ProjectCacheDescriptor.FromAssemblyPath(s_samplePluginAssemblyPath.Value)
};

MockLogger logger;
Expand Down Expand Up @@ -1029,7 +1045,7 @@ public void MultiplePlugins()
},
extraContentForAllNodes: @$"
<ItemGroup>
<{ItemTypeNames.ProjectCachePlugin} Include='{SamplePluginAssemblyPath.Value}' />
<{ItemTypeNames.ProjectCachePlugin} Include='{s_samplePluginAssemblyPath.Value}' />
</ItemGroup>
");
var mockCache = new InstanceMockCache();
Expand Down Expand Up @@ -1065,7 +1081,7 @@ public void NotAllNodesDefineAPlugin()
2,
@$"
<ItemGroup>
<{ItemTypeNames.ProjectCachePlugin} Include='{SamplePluginAssemblyPath.Value}' />
<{ItemTypeNames.ProjectCachePlugin} Include='{s_samplePluginAssemblyPath.Value}' />
</ItemGroup>
"
}
Expand Down Expand Up @@ -1127,7 +1143,7 @@ public void EngineShouldHandleExceptionsFromCachePluginViaBuildParameters(ErrorL
new BuildParameters
{
UseSynchronousLogging = true,
ProjectCacheDescriptor = ProjectCacheDescriptor.FromAssemblyPath(SamplePluginAssemblyPath.Value)
ProjectCacheDescriptor = ProjectCacheDescriptor.FromAssemblyPath(s_samplePluginAssemblyPath.Value)
});

logger = buildSession.Logger;
Expand Down Expand Up @@ -1237,7 +1253,7 @@ public void EngineShouldHandleExceptionsFromCachePluginViaGraphBuild(ErrorLocati
},
extraContentForAllNodes: @$"
<ItemGroup>
<{ItemTypeNames.ProjectCachePlugin} Include=`{SamplePluginAssemblyPath.Value}` />
<{ItemTypeNames.ProjectCachePlugin} Include=`{s_samplePluginAssemblyPath.Value}` />
<{ItemTypeNames.ProjectReferenceTargets} Include=`Build` Targets=`Build` />
</ItemGroup>
<Target Name=`Build`>
Expand Down Expand Up @@ -1332,7 +1348,7 @@ public void EndBuildShouldGetCalledOnceWhenItThrowsExceptionsFromGraphBuilds()
@$"
<Project>
<ItemGroup>
<{ItemTypeNames.ProjectCachePlugin} Include=`{SamplePluginAssemblyPath.Value}` />
<{ItemTypeNames.ProjectCachePlugin} Include=`{s_samplePluginAssemblyPath.Value}` />
</ItemGroup>
<Target Name=`Build`>
<Message Text=`Hello EngineShouldHandleExceptionsFromCachePlugin` Importance=`High` />
Expand Down Expand Up @@ -1668,10 +1684,10 @@ public void EmbeddedResourcesFileCompileCache()
{
var directory = _env.CreateFolder();
string content = ObjectModelHelpers.CleanupFileContents(
"""
$"""
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>{s_currentTargetNETFramework}</TargetFramework>
<OutputType>Exe</OutputType>
<OutputPath>bin/</OutputPath>
</PropertyGroup>
Expand All @@ -1681,7 +1697,8 @@ public void EmbeddedResourcesFileCompileCache()
</Project>
""");
var projectPath = directory.CreateFile("app.csproj", content).Path;
directory.CreateFile("Program.cs",
directory.CreateFile(
"Program.cs",
"""
using System;
using System.IO;
Expand Down Expand Up @@ -1715,15 +1732,20 @@ static void Main()
// Build and run the project
string output = RunnerUtilities.ExecBootstrapedMSBuild($"{projectPath} -restore", out bool success);
success.ShouldBeTrue(output);
output = RunnerUtilities.RunProcessAndGetOutput(Path.Combine(directory.Path, "bin/net8.0/app"), "", out success, false, _output);
string bootstrapCorePath = Path.Combine(RunnerUtilities.BootstrapRootPath, "core", NativeMethodsShared.IsWindows ? "dotnet.exe" : "dotnet");

// Use dotnet exec instead of running the exe directly to ensure using the bootstrap's runtime (which may be newer than the installed one)
string appDllPath = Path.Combine(directory.Path, $"bin/{s_currentTargetNETFramework}/app.dll");
output = RunnerUtilities.RunProcessAndGetOutput(bootstrapCorePath, $"exec \"{appDllPath}\"", out success, false, _output);
output.ShouldContain("A=1");
output.ShouldContain("B=1");

// Delete a file and build
FileUtilities.DeleteNoThrow(file1.Path);
output = RunnerUtilities.ExecBootstrapedMSBuild($"{projectPath}", out success);
success.ShouldBeTrue(output);
output = RunnerUtilities.RunProcessAndGetOutput(Path.Combine(directory.Path, "bin/net8.0/app"), "", out success, false, _output);

output = RunnerUtilities.RunProcessAndGetOutput(bootstrapCorePath, $"exec \"{appDllPath}\"", out success, false, _output);
output.ShouldNotContain("A=1");
output.ShouldContain("B=1");
}
Expand Down
13 changes: 12 additions & 1 deletion src/UnitTests.Shared/BootstrapLocationAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,20 @@
namespace Microsoft.Build.UnitTests.Shared;

[System.AttributeUsage(System.AttributeTargets.Assembly)]
internal sealed class BootstrapLocationAttribute(string bootstrapMsBuildBinaryLocation, string bootstrapSdkVersion) : System.Attribute
internal sealed class BootstrapLocationAttribute(string bootstrapRoot, string bootstrapMsBuildBinaryLocation, string bootstrapSdkVersion) : System.Attribute
{
/// <summary>
/// Path to the root of the bootstrap MSBuild (in artifacts folder).
/// </summary>
public string BootstrapRoot { get; } = bootstrapRoot;

/// <summary>
/// Resolves path to MSBuild.exe or MSBuild.dll, depending on the runtime.
/// </summary>
public string BootstrapMsBuildBinaryLocation { get; } = bootstrapMsBuildBinaryLocation;

/// <summary>
/// Returns the version of the SDK used by the bootstrap MSBuild.
/// </summary>
public string BootstrapSdkVersion { get; } = bootstrapSdkVersion;
}
5 changes: 3 additions & 2 deletions src/UnitTests.Shared/Microsoft.Build.UnitTests.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@

<ItemGroup>
<AssemblyAttribute Include="Microsoft.Build.UnitTests.Shared.BootstrapLocationAttribute">
<_Parameter1>$(TestBootstrapBinaryDestination)</_Parameter1>
<_Parameter2>$(BootstrapSdkVersion)</_Parameter2>
<_Parameter1>$(ArtifactsBinDir)bootstrap</_Parameter1>
<_Parameter2>$(TestBootstrapBinaryDestination)</_Parameter2>
<_Parameter3>$(BootstrapSdkVersion)</_Parameter3>
</AssemblyAttribute>

<AssemblyAttribute Include="Microsoft.Build.UnitTests.Shared.ArtifactsLocationAttribute">
Expand Down
8 changes: 8 additions & 0 deletions src/UnitTests.Shared/RunnerUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ public static class RunnerUtilities

public static ArtifactsLocationAttribute ArtifactsLocationAttribute = Assembly.GetExecutingAssembly().GetCustomAttribute<ArtifactsLocationAttribute>()
?? throw new InvalidOperationException("This test assembly does not have the ArtifactsLocationAttribute");

public static string BootstrapRootPath => BootstrapLocationAttribute.BootstrapRoot;

public static string BootstrapSdkVersion => BootstrapLocationAttribute.BootstrapSdkVersion;

internal static BootstrapLocationAttribute BootstrapLocationAttribute = Assembly.GetExecutingAssembly().GetCustomAttribute<BootstrapLocationAttribute>()
?? throw new InvalidOperationException("This test assembly does not have the BootstrapLocationAttribute");

#if !FEATURE_RUN_EXE_IN_TESTS
private static readonly string s_dotnetExePath = EnvironmentProvider.GetDotnetExePath();

Expand Down