Skip to content

Commit

Permalink
Merge branch 'main' into dev/Jason/Update-the-sdk-target-to-net10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorHofer authored Nov 2, 2024
2 parents 18659d8 + 467d7ba commit 27a0734
Show file tree
Hide file tree
Showing 14 changed files with 296 additions and 329 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"microsoft.dotnet.darc": {
"version": "1.1.0-beta.24530.2",
"version": "1.1.0-beta.24367.3",
"commands": [
"darc"
]
Expand Down
404 changes: 202 additions & 202 deletions eng/Version.Details.xml

Large diffs are not rendered by default.

158 changes: 79 additions & 79 deletions eng/Versions.props

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"cmake": "latest"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24530.1",
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24530.1",
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24531.2",
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24531.2",
"Microsoft.Build.NoTargets": "3.7.0",
"Microsoft.DotNet.CMake.Sdk": "9.0.0-beta.24217.1"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ jobs:
/p:MsftSdkTarballPath=$(MsftSdkTarballPath)
/p:SdkTarballPath=$(SdkTarballPath)
/p:SourceBuiltArtifactsPath=$(SourceBuiltArtifactsPath)
/p:SourceBuildTestsWarnOnSdkContentDiffs=false
/p:TargetRid=${{ parameters.targetRid }}
/p:PortableRid=$(Platform)-${{ parameters.architecture }}
displayName: Run Tests
Expand Down
1 change: 0 additions & 1 deletion src/SourceBuild/content/eng/pipelines/vmr-license-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ extends:
-flp:LogFile=$(Build.SourcesDirectory)/artifacts/logs/BuildTests_$(date +"%m%d%H%M%S").log
-clp:v=m
/p:SourceBuildTestsLicenseScanPath=$(repoPath)
/p:SourceBuildTestsWarnOnLicenseScanDiffs=false
/p:TargetRid=linux-x64
/p:PortableRid=linux-x64
/p:SkipPrepareSdkArchive=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ public static void CompareEntries(string baselineFileName, IOrderedEnumerable<st
Assert.Null(message);
}

public static void CompareBaselineContents(string baselineFileName, string actualContents, ITestOutputHelper outputHelper, bool warnOnDiffs = false, string baselineSubDir = "")
public static void CompareBaselineContents(string baselineFileName, string actualContents, ITestOutputHelper outputHelper, string baselineSubDir = "")
{
string actualFilePath = Path.Combine(Config.LogsDirectory, $"Updated{baselineFileName}");
File.WriteAllText(actualFilePath, actualContents);

CompareFiles(GetBaselineFilePath(baselineFileName, baselineSubDir), actualFilePath, outputHelper, warnOnDiffs);
CompareFiles(GetBaselineFilePath(baselineFileName, baselineSubDir), actualFilePath, outputHelper);
}

public static void CompareFiles(string expectedFilePath, string actualFilePath, ITestOutputHelper outputHelper, bool warnOnDiffs = false)
public static void CompareFiles(string expectedFilePath, string actualFilePath, ITestOutputHelper outputHelper)
{
string baselineFileText = File.ReadAllText(expectedFilePath).Trim();
string actualFileText = File.ReadAllText(actualFilePath).Trim();
Expand All @@ -64,21 +64,11 @@ public static void CompareFiles(string expectedFilePath, string actualFilePath,
{
// Retrieve a diff in order to provide a UX which calls out the diffs.
string diff = DiffFiles(expectedFilePath, actualFilePath, outputHelper);
string prefix = warnOnDiffs ? "##vso[task.logissue type=warning;]" : string.Empty;
message = $"{Environment.NewLine}{prefix}Expected file '{expectedFilePath}' does not match actual file '{actualFilePath}`. {Environment.NewLine}"
message = $"{Environment.NewLine}Expected file '{expectedFilePath}' does not match actual file '{actualFilePath}`. {Environment.NewLine}"
+ $"{diff}{Environment.NewLine}";

if (warnOnDiffs)
{
outputHelper.WriteLine(message);
outputHelper.WriteLine("##vso[task.complete result=SucceededWithIssues;]");
}
}

if (!warnOnDiffs)
{
Assert.Null(message);
}
Assert.Null(message);
}

public static string DiffFiles(string file1Path, string file2Path, ITestOutputHelper outputHelper)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ internal static class Config
public static string? PrereqsPath => (string)AppContext.GetData(ConfigSwitchPrefix + nameof(PrereqsPath))!;
public static string? SdkTarballPath => (string)AppContext.GetData(ConfigSwitchPrefix + nameof(SdkTarballPath))!;
public static string? SourceBuiltArtifactsPath => (string)AppContext.GetData(ConfigSwitchPrefix + nameof(SourceBuiltArtifactsPath))!;
public static bool WarnOnLicenseScanDiffs => bool.TryParse((string)AppContext.GetData(ConfigSwitchPrefix + nameof(WarnOnLicenseScanDiffs))!, out bool warnOnLicenseScanDiffs) && warnOnLicenseScanDiffs;
public static bool WarnOnSdkContentDiffs => bool.TryParse((string)AppContext.GetData(ConfigSwitchPrefix + nameof(WarnOnSdkContentDiffs))!, out bool warnOnSdkContentDiffs) && warnOnSdkContentDiffs;

// Indicates whether the tests are being run in the context of a CI pipeline
public static bool RunningInCI => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DOTNET_CI")) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ public DotNetHelper(ITestOutputHelper outputHelper)

lock (s_lockObj)
{
if (!Directory.Exists(Config.DotNetDirectory))
{
if (!File.Exists(Config.SdkTarballPath))
{
throw new InvalidOperationException($"Tarball path '{Config.SdkTarballPath}' specified in {Config.SdkTarballPath} does not exist.");
}

Directory.CreateDirectory(Config.DotNetDirectory);
Utilities.ExtractTarball(Config.SdkTarballPath, Config.DotNetDirectory, outputHelper);
}
IsMonoRuntime = DetermineIsMonoRuntime(Config.DotNetDirectory);

if (!Directory.Exists(ProjectsDirectory))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void ScanForLicenses()
string actualFilePath = Path.Combine(Config.LogsDirectory, $"Updated{baselineName}");
File.WriteAllText(actualFilePath, json);

BaselineHelper.CompareFiles(expectedFilePath, actualFilePath, OutputHelper, Config.WarnOnLicenseScanDiffs);
BaselineHelper.CompareFiles(expectedFilePath, actualFilePath, OutputHelper);
}

private void FilterFiles(ScancodeResults scancodeResults)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<Value>$(ArtifactsTestResultsDir)</Value>
</RuntimeHostConfigurationOption>
<RuntimeHostConfigurationOption Include="$(MSBuildProjectName).DotNetDirectory">
<Value>$(TargetDir)extracted-sdk</Value>
<Value>$(DotNetSdkExtractDir)</Value>
</RuntimeHostConfigurationOption>
<RuntimeHostConfigurationOption Include="$(MSBuildProjectName).TargetRid">
<Value>$(TargetRid)</Value>
Expand Down Expand Up @@ -87,12 +87,6 @@
<RuntimeHostConfigurationOption Include="$(MSBuildProjectName).SourceBuiltArtifactsPath">
<Value>$(SourceBuiltArtifactsPath)</Value>
</RuntimeHostConfigurationOption>
<RuntimeHostConfigurationOption Include="$(MSBuildProjectName).WarnOnLicenseScanDiffs">
<Value>$(SourceBuildTestsWarnOnLicenseScanDiffs)</Value>
</RuntimeHostConfigurationOption>
<RuntimeHostConfigurationOption Include="$(MSBuildProjectName).WarnOnSdkContentDiffs">
<Value>$(SourceBuildTestsWarnOnSdkContentDiffs)</Value>
</RuntimeHostConfigurationOption>
</ItemGroup>
</Target>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Optional msbuild properties:
- SourceBuildTestsExcludeOmniSharpTests
- SourceBuildTestsLicenseScanPath
- SourceBuildTestsPrereqsPath
- SourceBuildTestsWarnOnLicenseScanDiffs
- SourceBuildTestsWarnOnSdkContentDiffs

Make sure to rebuild the test project when changing one of those values.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void CompareMsftToSbFileList()

string diff = BaselineHelper.DiffFiles(msftFileListingFileName, sbFileListingFileName, OutputHelper);
diff = RemoveDiffMarkers(diff);
BaselineHelper.CompareBaselineContents("MsftToSbSdkFiles.diff", diff, OutputHelper, Config.WarnOnSdkContentDiffs, BaselineSubDir);
BaselineHelper.CompareBaselineContents("MsftToSbSdkFiles.diff", diff, OutputHelper, BaselineSubDir);
}

[ConditionalFact(typeof(SdkContentTests), nameof(IncludeSdkContentTests))]
Expand Down Expand Up @@ -79,7 +79,7 @@ public void CompareMsftToSbAssemblyVersions()

string diff = BaselineHelper.DiffFiles(MsftVersionsFileName, SbVersionsFileName, OutputHelper);
diff = RemoveDiffMarkers(diff);
BaselineHelper.CompareBaselineContents("MsftToSbSdkAssemblyVersions.diff", diff, OutputHelper, Config.WarnOnSdkContentDiffs, BaselineSubDir);
BaselineHelper.CompareBaselineContents("MsftToSbSdkAssemblyVersions.diff", diff, OutputHelper, BaselineSubDir);
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Microsoft.DotNet.SourceBuild.Tests;
public class SourceBuiltArtifactsTests : SdkTests
{
public static bool IncludeSourceBuiltArtifactsTests => !string.IsNullOrWhiteSpace(Config.SourceBuiltArtifactsPath);

public SourceBuiltArtifactsTests(ITestOutputHelper outputHelper) : base(outputHelper) { }

[ConditionalFact(typeof(SourceBuiltArtifactsTests), nameof(IncludeSourceBuiltArtifactsTests))]
Expand Down Expand Up @@ -55,9 +55,8 @@ public void VerifyVersionFile()

string sdkVersion = versionLines[1];

// Find the expected SDK version by getting it from the SDK tarball
Utilities.ExtractTarball(Config.SdkTarballPath ?? string.Empty, outputDir, "./sdk/*/.version");
DirectoryInfo sdkDir = new DirectoryInfo(Path.Combine(outputDir, "sdk"));
// Find the expected SDK version by getting it from the source built SDK
DirectoryInfo sdkDir = new DirectoryInfo(Path.Combine(Config.DotNetDirectory, "sdk"));
string sdkVersionPath = sdkDir.GetFiles(".version", SearchOption.AllDirectories).Single().FullName;
string[] sdkVersionLines = File.ReadAllLines(Path.Combine(outputDir, sdkVersionPath));
string expectedSdkVersion = sdkVersionLines[3]; // Get the unique, non-stable, SDK version
Expand Down

0 comments on commit 27a0734

Please sign in to comment.