Skip to content

Commit 2e6efe3

Browse files
dotnet-maestro[bot]marcpopMSFTCopilot
authored
[main] Source code updates from dotnet/deployment-tools (#6208)
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Marc Paine <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent dd7fa71 commit 2e6efe3

7 files changed

Lines changed: 37 additions & 32 deletions

File tree

‎src/deployment-tools/eng/Version.Details.props‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This file should be imported by eng/Versions.props
66
<Project>
77
<PropertyGroup>
88
<!-- dotnet-dotnet dependencies -->
9-
<MicrosoftDotNetArcadeSdkPackageVersion>11.0.0-beta.26170.109</MicrosoftDotNetArcadeSdkPackageVersion>
9+
<MicrosoftDotNetArcadeSdkPackageVersion>11.0.0-beta.26172.108</MicrosoftDotNetArcadeSdkPackageVersion>
1010
</PropertyGroup>
1111
<!--Property group for alternate package version names-->
1212
<PropertyGroup>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Dependencies>
2-
<Source Uri="https://github.com/dotnet/dotnet" Mapping="deployment-tools" Sha="e921c3d511279a7ed37f83dbd346019c5b3ffc0e" BarId="307118" />
2+
<Source Uri="https://github.com/dotnet/dotnet" Mapping="deployment-tools" Sha="491bbab262d2f8179cf5f5651bc0689d9c12739a" BarId="307311" />
33
<ProductDependencies>
44
</ProductDependencies>
55
<ToolsetDependencies>
6-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="11.0.0-beta.26170.109">
6+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="11.0.0-beta.26172.108">
77
<Uri>https://github.com/dotnet/dotnet</Uri>
8-
<Sha>e921c3d511279a7ed37f83dbd346019c5b3ffc0e</Sha>
8+
<Sha>491bbab262d2f8179cf5f5651bc0689d9c12739a</Sha>
99
</Dependency>
1010
</ToolsetDependencies>
1111
</Dependencies>

‎src/deployment-tools/global.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"sdk": {
3-
"version": "11.0.100-preview.3.26161.119",
3+
"version": "11.0.100-preview.3.26170.106",
44
"allowPrerelease": true,
55
"rollForward": "major"
66
},
77
"tools": {
8-
"dotnet": "11.0.100-preview.3.26161.119"
8+
"dotnet": "11.0.100-preview.3.26170.106"
99
},
1010
"msbuild-sdks": {
11-
"Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.26170.109",
11+
"Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.26172.108",
1212
"Microsoft.Build.NoTargets": "3.7.0",
1313
"Microsoft.Build.Traversal": "3.4.0"
1414
}

‎src/deployment-tools/src/Microsoft.Deployment.DotNet.Releases/src/Product.cs‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ public async Task<ReadOnlyCollection<ProductRelease>> GetReleasesAsync(string pa
182182
{
183183
await Utils.GetLatestFileAsync(path, downloadLatest, ReleasesJson).ConfigureAwait(false);
184184

185-
using TextReader reader = File.OpenText(path);
185+
using FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 4096, useAsync: true);
186186

187-
return await GetReleasesAsync(reader, this).ConfigureAwait(false);
187+
return await GetReleasesAsync(stream, this).ConfigureAwait(false);
188188
}
189189

190190
/// <summary>
@@ -201,9 +201,8 @@ public async Task<ReadOnlyCollection<ProductRelease>> GetReleasesAsync(Uri addre
201201
}
202202

203203
using var stream = new MemoryStream(await Utils.s_httpClient.GetByteArrayAsync(address).ConfigureAwait(false));
204-
using var reader = new StreamReader(stream);
205204

206-
return await GetReleasesAsync(reader, this).ConfigureAwait(false);
205+
return await GetReleasesAsync(stream, this).ConfigureAwait(false);
207206
}
208207

209208
/// <summary>
@@ -224,19 +223,19 @@ public bool IsOutOfSupport()
224223
/// <returns>A collection of releases. The releases are not linked to a specific <see cref="Product"/>.</returns>
225224
public static async Task<ReadOnlyCollection<ProductRelease>> GetReleasesAsync(string path)
226225
{
227-
using TextReader reader = File.OpenText(path);
226+
using FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 4096, useAsync: true);
228227

229-
return await GetReleasesAsync(reader, null).ConfigureAwait(false);
228+
return await GetReleasesAsync(stream, null).ConfigureAwait(false);
230229
}
231230

232-
private static async Task<ReadOnlyCollection<ProductRelease>> GetReleasesAsync(TextReader reader, Product product)
231+
private static async Task<ReadOnlyCollection<ProductRelease>> GetReleasesAsync(Stream stream, Product product)
233232
{
234-
if (reader == null)
233+
if (stream == null)
235234
{
236-
throw new ArgumentNullException(nameof(reader));
235+
throw new ArgumentNullException(nameof(stream));
237236
}
238237

239-
using var releasesDocument = JsonDocument.Parse(await reader.ReadToEndAsync().ConfigureAwait(false));
238+
using var releasesDocument = await JsonDocument.ParseAsync(stream).ConfigureAwait(false);
240239
JsonElement root = releasesDocument.RootElement;
241240
var releases = new List<ProductRelease>();
242241
var enumerator = root.GetProperty("releases").EnumerateArray();

‎src/deployment-tools/src/Microsoft.Deployment.DotNet.Releases/src/ProductCollection.cs‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,8 @@ public static async Task<ProductCollection> GetAsync(Uri releasesIndexUrl)
7979
}
8080

8181
using var stream = new MemoryStream(await Utils.s_httpClient.GetByteArrayAsync(releasesIndexUrl).ConfigureAwait(false));
82-
using var reader = new StreamReader(stream);
8382

84-
return await GetAsync(reader).ConfigureAwait(false);
83+
return await GetAsync(stream).ConfigureAwait(false);
8584
}
8685

8786
/// <summary>
@@ -101,19 +100,19 @@ public static async Task<ProductCollection> GetFromFileAsync(string path, bool d
101100
{
102101
await Utils.GetLatestFileAsync(path, downloadLatest, ReleasesIndexDefaultUrl).ConfigureAwait(false);
103102

104-
using TextReader reader = File.OpenText(path);
103+
using FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 4096, useAsync: true);
105104

106-
return await GetAsync(reader).ConfigureAwait(false);
105+
return await GetAsync(stream).ConfigureAwait(false);
107106
}
108107

109-
private static async Task<ProductCollection> GetAsync(TextReader reader)
108+
private static async Task<ProductCollection> GetAsync(Stream stream)
110109
{
111-
if (reader == null)
110+
if (stream == null)
112111
{
113-
throw new ArgumentNullException(nameof(reader));
112+
throw new ArgumentNullException(nameof(stream));
114113
}
115114

116-
using var releasesIndexDocument = JsonDocument.Parse(await reader.ReadToEndAsync().ConfigureAwait(false));
115+
using var releasesIndexDocument = await JsonDocument.ParseAsync(stream).ConfigureAwait(false);
117116
var root = releasesIndexDocument.RootElement.GetProperty("releases-index");
118117
var products = new List<Product>();
119118

‎src/deployment-tools/src/Microsoft.Deployment.DotNet.Releases/src/ReleaseFile.cs‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,20 @@ public class ReleaseFile : IEquatable<ReleaseFile>
1616
{
1717
private static readonly SHA512 s_defaultHashAlgorithm = SHA512.Create();
1818

19+
private Uri _address;
20+
private string _addressString;
21+
1922
/// <summary>
2023
/// The URL from where to download the file.
2124
/// </summary>
2225
public Uri Address
2326
{
24-
get;
25-
private set;
27+
get => _address ??= _addressString != null ? new Uri(_addressString) : null;
28+
private set
29+
{
30+
_address = value;
31+
_addressString = value?.OriginalString;
32+
}
2633
}
2734

2835
/// <summary>
@@ -63,7 +70,7 @@ public string Rid
6370
/// <param name="fileElement">The <see cref="JsonElement"/> to deserialize.</param>
6471
internal ReleaseFile(JsonElement fileElement)
6572
{
66-
Address = fileElement.GetUriOrDefault("url");
73+
_addressString = fileElement.GetStringOrDefault("url");
6774
Hash = fileElement.GetStringOrDefault("hash");
6875
Name = fileElement.GetStringOrDefault("name");
6976
Rid = fileElement.GetStringOrDefault("rid");
@@ -149,15 +156,15 @@ public bool Equals(ReleaseFile other)
149156
Name == other.Name &&
150157
Rid == other.Rid &&
151158
Hash == other.Hash &&
152-
Address == other.Address;
159+
_addressString == other._addressString;
153160
}
154161

155162
/// <summary>
156163
/// Returns the hash code for this release file.
157164
/// </summary>
158165
/// <returns>A hash code for the current object.</returns>
159166
public override int GetHashCode() =>
160-
Hash.GetHashCode() ^ Name.GetHashCode() ^ Rid.GetHashCode() ^ Address.GetHashCode();
167+
Hash.GetHashCode();
161168

162169
internal static ReleaseFile Create(string hash, string name, string rid, string address) =>
163170
new ReleaseFile(new Uri(address), hash, name, rid);

‎src/source-manifest.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
"commitSha": "99db1e31826f24ec672efe70b36074a59464c29a"
2626
},
2727
{
28-
"barId": 307357,
28+
"barId": 311206,
2929
"path": "deployment-tools",
3030
"remoteUri": "https://github.com/dotnet/deployment-tools",
31-
"commitSha": "73e2836a5d7397d203c12809f1f9ee7a09beac8d"
31+
"commitSha": "84df736229b2b8352af19ce09769728512a03c66"
3232
},
3333
{
3434
"barId": 298531,

0 commit comments

Comments
 (0)