Skip to content

Commit 20b1f64

Browse files
author
Simon Zhao (BEYONDSOFT CONSULTING INC)
committed
Merge branch 'release/10.0.2xx' of https://github.com/dotnet/sdk into merge/release/10.0.1xx-to-release/10.0.2xx
2 parents 1001343 + 51297ba commit 20b1f64

File tree

4 files changed

+70
-9
lines changed

4 files changed

+70
-9
lines changed

eng/Versions.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<PropertyGroup Label="Repo version information">
77
<VersionMajor>10</VersionMajor>
88
<VersionMinor>0</VersionMinor>
9-
<VersionSDKMinor>1</VersionSDKMinor>
9+
<VersionSDKMinor>2</VersionSDKMinor>
1010
<VersionFeature>00</VersionFeature>
1111
<!-- This property powers the SdkAnalysisLevel property in end-user MSBuild code.
1212
It should always be the hundreds-value of the current SDK version, never any
@@ -20,10 +20,10 @@
2020
<StabilizePackageVersion Condition="'$(StabilizePackageVersion)' == ''">false</StabilizePackageVersion>
2121
<DotNetFinalVersionKind Condition="'$(StabilizePackageVersion)' == 'true'">release</DotNetFinalVersionKind>
2222
<!-- Calculate prerelease label -->
23-
<PreReleaseVersionLabel Condition="'$(StabilizePackageVersion)' != 'true'">rtm</PreReleaseVersionLabel>
23+
<PreReleaseVersionLabel Condition="'$(StabilizePackageVersion)' != 'true'">preview</PreReleaseVersionLabel>
2424
<PreReleaseVersionLabel Condition="'$(StabilizePackageVersion)' == 'true' and $(VersionPrefix.EndsWith('00'))">rtm</PreReleaseVersionLabel>
2525
<PreReleaseVersionLabel Condition="'$(StabilizePackageVersion)' == 'true' and !$(VersionPrefix.EndsWith('00'))">servicing</PreReleaseVersionLabel>
26-
<PreReleaseVersionIteration Condition="'$(StabilizePackageVersion)' != 'true'"></PreReleaseVersionIteration>
26+
<PreReleaseVersionIteration Condition="'$(StabilizePackageVersion)' != 'true'">0</PreReleaseVersionIteration>
2727
<!-- In source-build the version of the compiler must be same or newer than the version of the
2828
compiler API targeted by analyzer assemblies. This is mostly an issue on source-build as
2929
in that build mode analyzer assemblies always target the live compiler API. -->

src/Cli/dotnet/Commands/Run/CSharpCompilerCommand.cs

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,18 @@ public int Execute(out bool fallbackToNormalBuild)
110110
if (BuildResultFile != null &&
111111
CSharpCommandLineParser.Default.Parse(CscArguments, BaseDirectory, sdkDirectory: null) is { OutputFileName: { } outputFileName } parsedArgs)
112112
{
113-
var objFile = parsedArgs.GetOutputFilePath(outputFileName);
114-
Reporter.Verbose.WriteLine($"Copying '{objFile}' to '{BuildResultFile}'.");
115-
File.Copy(objFile, BuildResultFile, overwrite: true);
113+
var objFile = new FileInfo(parsedArgs.GetOutputFilePath(outputFileName));
114+
var binFile = new FileInfo(BuildResultFile);
115+
116+
if (HaveMatchingSizeAndTimeStamp(objFile, binFile))
117+
{
118+
Reporter.Verbose.WriteLine($"Skipping copy of '{objFile}' to '{BuildResultFile}' because the files have matching size and timestamp.");
119+
}
120+
else
121+
{
122+
Reporter.Verbose.WriteLine($"Copying '{objFile}' to '{BuildResultFile}'.");
123+
File.Copy(objFile.FullName, binFile.FullName, overwrite: true);
124+
}
116125
}
117126

118127
return exitCode;
@@ -153,6 +162,27 @@ static int ProcessBuildResponse(BuildResponse response, out bool fallbackToNorma
153162
return 1;
154163
}
155164
}
165+
166+
// Inspired by MSBuild: https://github.com/dotnet/msbuild/blob/a7a4d5af02be5aa6dc93a492d6d03056dc811388/src/Tasks/Copy.cs#L208
167+
static bool HaveMatchingSizeAndTimeStamp(FileInfo sourceFile, FileInfo destinationFile)
168+
{
169+
if (!destinationFile.Exists)
170+
{
171+
return false;
172+
}
173+
174+
if (sourceFile.LastWriteTimeUtc != destinationFile.LastWriteTimeUtc)
175+
{
176+
return false;
177+
}
178+
179+
if (sourceFile.Length != destinationFile.Length)
180+
{
181+
return false;
182+
}
183+
184+
return true;
185+
}
156186
}
157187

158188
private void PrepareAuxiliaryFiles(out string rspPath)

src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers.sarif

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"tool": {
77
"name": "Microsoft.CodeAnalysis.CSharp.NetAnalyzers",
8-
"version": "10.0.100",
8+
"version": "10.0.200",
99
"language": "en-US"
1010
},
1111
"rules": {
@@ -708,7 +708,7 @@
708708
{
709709
"tool": {
710710
"name": "Microsoft.CodeAnalysis.NetAnalyzers",
711-
"version": "10.0.100",
711+
"version": "10.0.200",
712712
"language": "en-US"
713713
},
714714
"rules": {
@@ -6503,7 +6503,7 @@
65036503
{
65046504
"tool": {
65056505
"name": "Microsoft.CodeAnalysis.VisualBasic.NetAnalyzers",
6506-
"version": "10.0.100",
6506+
"version": "10.0.200",
65076507
"language": "en-US"
65086508
},
65096509
"rules": {

test/dotnet.Tests/CommandTests/Run/RunFileTests.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3604,6 +3604,37 @@ Release config
36043604
""");
36053605
}
36063606

3607+
/// <summary>
3608+
/// See <see cref="CscOnly_AfterMSBuild"/>.
3609+
/// If hard links are enabled, the <c>bin/app.dll</c> and <c>obj/app.dll</c> files are going to be the same,
3610+
/// so our "copy obj to bin" logic must account for that.
3611+
/// </summary>
3612+
[Fact]
3613+
public void CscOnly_AfterMSBuild_HardLinks()
3614+
{
3615+
var testInstance = _testAssetsManager.CreateTestDirectory(baseDirectory: OutOfTreeBaseDirectory);
3616+
var programPath = Path.Join(testInstance.Path, "Program.cs");
3617+
3618+
var code = $"""
3619+
#:property CreateHardLinksForCopyFilesToOutputDirectoryIfPossible=true
3620+
#:property CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible=true
3621+
{s_program}
3622+
""";
3623+
3624+
File.WriteAllText(programPath, code);
3625+
3626+
// Remove artifacts from possible previous runs of this test.
3627+
var artifactsDir = VirtualProjectBuildingCommand.GetArtifactsPath(programPath);
3628+
if (Directory.Exists(artifactsDir)) Directory.Delete(artifactsDir, recursive: true);
3629+
3630+
Build(testInstance, BuildLevel.All);
3631+
3632+
code = code.Replace("Hello", "Hi");
3633+
File.WriteAllText(programPath, code);
3634+
3635+
Build(testInstance, BuildLevel.Csc, expectedOutput: "Hi from Program");
3636+
}
3637+
36073638
/// <summary>
36083639
/// See <see cref="CscOnly_AfterMSBuild"/>.
36093640
/// This optimization currently does not support <c>#:project</c> references and hence is disabled if those are present.

0 commit comments

Comments
 (0)