Skip to content

Commit 8de4a9f

Browse files
authored
Merge branch 'main' into merge/release/9.0.3xx-to-main
2 parents b39bdf2 + bf4223b commit 8de4a9f

File tree

15 files changed

+988
-482
lines changed

15 files changed

+988
-482
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"microsoft.dotnet.darc": {
6-
"version": "1.1.0-beta.25257.6",
6+
"version": "1.1.0-beta.25259.3",
77
"commands": [
88
"darc"
99
]

eng/Version.Details.xml

Lines changed: 281 additions & 281 deletions
Large diffs are not rendered by default.

eng/Versions.props

Lines changed: 132 additions & 132 deletions
Large diffs are not rendered by default.

eng/common/core-templates/steps/source-build.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,9 @@ steps:
3838
targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}'
3939
fi
4040
41-
runtimeOsArgs=
42-
if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then
43-
runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}'
44-
fi
45-
46-
baseOsArgs=
47-
if [ '${{ parameters.platform.baseOS }}' != '' ]; then
48-
baseOsArgs='/p:BaseOS=${{ parameters.platform.baseOS }}'
41+
baseRidArgs=
42+
if [ '${{ parameters.platform.baseRID }}' != '' ]; then
43+
baseRidArgs='/p:BaseRid=${{ parameters.platform.baseRID }}'
4944
fi
5045
5146
portableBuildArgs=
@@ -59,8 +54,7 @@ steps:
5954
${{ parameters.platform.buildArguments }} \
6055
$internalRuntimeDownloadArgs \
6156
$targetRidArgs \
62-
$runtimeOsArgs \
63-
$baseOsArgs \
57+
$baseRidArgs \
6458
$portableBuildArgs \
6559
/p:DotNetBuildSourceOnly=true \
6660
/p:DotNetBuildRepo=true \
@@ -71,7 +65,7 @@ steps:
7165
is1ESPipeline: ${{ parameters.is1ESPipeline }}
7266
args:
7367
displayName: Publish BuildLogs
74-
targetPath: artifacts/log/$[ coalesce(variables._BuildConfig, 'Release') ]/
68+
targetPath: artifacts/log/${{ coalesce(variables._BuildConfig, 'Release') }}
7569
artifactName: BuildLogs_SourceBuild_${{ parameters.platform.name }}_Attempt$(System.JobAttempt)
7670
continueOnError: true
7771
condition: succeededOrFailed()

eng/common/tools.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
# CI mode - set to true on CI server for PR validation build or official build.
66
ci=${ci:-false}
77

8+
# Build mode
9+
source_build=${source_build:-false}
10+
811
# Set to true to use the pipelines logger which will enable Azure logging output.
912
# https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md
1013
# This flag is meant as a temporary opt-opt for the feature while validate it across
@@ -58,7 +61,8 @@ use_installed_dotnet_cli=${use_installed_dotnet_cli:-true}
5861
dotnetInstallScriptVersion=${dotnetInstallScriptVersion:-'v1'}
5962

6063
# True to use global NuGet cache instead of restoring packages to repository-local directory.
61-
if [[ "$ci" == true ]]; then
64+
# Keep in sync with NuGetPackageroot in Arcade SDK's RepositoryLayout.props.
65+
if [[ "$ci" == true || "$source_build" == true ]]; then
6266
use_global_nuget_cache=${use_global_nuget_cache:-false}
6367
else
6468
use_global_nuget_cache=${use_global_nuget_cache:-true}

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
}
1515
},
1616
"msbuild-sdks": {
17-
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25257.101",
18-
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25257.101",
17+
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25260.104",
18+
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25260.104",
1919
"Microsoft.Build.NoTargets": "3.7.0",
2020
"Microsoft.Build.Traversal": "3.4.0"
2121
}

src/Cli/dotnet/Commands/Project/Convert/ProjectConvertCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public override int Execute()
3030

3131
// Find directives (this can fail, so do this before creating the target directory).
3232
var sourceFile = VirtualProjectBuildingCommand.LoadSourceFile(file);
33-
var directives = VirtualProjectBuildingCommand.FindDirectivesForConversion(sourceFile, force: _force);
33+
var directives = VirtualProjectBuildingCommand.FindDirectives(sourceFile, reportAllErrors: !_force, errors: null);
3434

3535
Directory.CreateDirectory(targetDirectory);
3636

@@ -50,7 +50,7 @@ public override int Execute()
5050
string projectFile = Path.Join(targetDirectory, Path.GetFileNameWithoutExtension(file) + ".csproj");
5151
using var stream = File.Open(projectFile, FileMode.Create, FileAccess.Write);
5252
using var writer = new StreamWriter(stream, Encoding.UTF8);
53-
VirtualProjectBuildingCommand.WriteProjectFile(writer, directives);
53+
VirtualProjectBuildingCommand.WriteProjectFile(writer, directives, isVirtualProject: false);
5454

5555
return 0;
5656
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System.Collections.Immutable;
5+
using System.CommandLine;
6+
using System.Text.Json;
7+
using System.Text.Json.Serialization;
8+
9+
namespace Microsoft.DotNet.Cli.Commands.Run.Api;
10+
11+
/// <summary>
12+
/// Takes JSON from stdin lines, produces JSON on stdout lines, doesn't perform any changes.
13+
/// Can be used by IDEs to see the project file behind a file-based program.
14+
/// </summary>
15+
internal sealed class RunApiCommand(ParseResult parseResult) : CommandBase(parseResult)
16+
{
17+
public override int Execute()
18+
{
19+
for (string? line; (line = Console.ReadLine()) != null;)
20+
{
21+
if (string.IsNullOrWhiteSpace(line))
22+
{
23+
continue;
24+
}
25+
26+
try
27+
{
28+
RunApiInput input = JsonSerializer.Deserialize(line, RunFileApiJsonSerializerContext.Default.RunApiInput)!;
29+
RunApiOutput output = input.Execute();
30+
Respond(output);
31+
}
32+
catch (Exception ex)
33+
{
34+
Respond(new RunApiOutput.Error { Message = ex.Message, Details = ex.ToString() });
35+
}
36+
}
37+
38+
return 0;
39+
40+
static void Respond(RunApiOutput message)
41+
{
42+
string json = JsonSerializer.Serialize(message, RunFileApiJsonSerializerContext.Default.RunApiOutput);
43+
Console.WriteLine(json);
44+
}
45+
}
46+
}
47+
48+
[JsonDerivedType(typeof(GetProject), nameof(GetProject))]
49+
internal abstract class RunApiInput
50+
{
51+
private RunApiInput() { }
52+
53+
public abstract RunApiOutput Execute();
54+
55+
public sealed class GetProject : RunApiInput
56+
{
57+
public string? ArtifactsPath { get; init; }
58+
public required string EntryPointFileFullPath { get; init; }
59+
60+
public override RunApiOutput Execute()
61+
{
62+
var sourceFile = VirtualProjectBuildingCommand.LoadSourceFile(EntryPointFileFullPath);
63+
var errors = ImmutableArray.CreateBuilder<SimpleDiagnostic>();
64+
var directives = VirtualProjectBuildingCommand.FindDirectives(sourceFile, reportAllErrors: true, errors);
65+
string artifactsPath = ArtifactsPath ?? VirtualProjectBuildingCommand.GetArtifactsPath(EntryPointFileFullPath);
66+
67+
var csprojWriter = new StringWriter();
68+
VirtualProjectBuildingCommand.WriteProjectFile(csprojWriter, directives, isVirtualProject: true, targetFilePath: EntryPointFileFullPath, artifactsPath: artifactsPath);
69+
70+
return new RunApiOutput.Project
71+
{
72+
Content = csprojWriter.ToString(),
73+
Diagnostics = errors.ToImmutableArray(),
74+
};
75+
}
76+
}
77+
}
78+
79+
[JsonDerivedType(typeof(Error), nameof(Error))]
80+
[JsonDerivedType(typeof(Project), nameof(Project))]
81+
internal abstract class RunApiOutput
82+
{
83+
private RunApiOutput() { }
84+
85+
/// <summary>
86+
/// When the API shape or behavior changes, this should be incremented so the callers (IDEs) can act accordingly
87+
/// (e.g., show an error message when an incompatible SDK version is being used).
88+
/// </summary>
89+
[JsonPropertyOrder(-1)]
90+
public int Version { get; } = 1;
91+
92+
public sealed class Error : RunApiOutput
93+
{
94+
public required string Message { get; init; }
95+
public required string Details { get; init; }
96+
}
97+
98+
public sealed class Project : RunApiOutput
99+
{
100+
public required string Content { get; init; }
101+
public required ImmutableArray<SimpleDiagnostic> Diagnostics { get; init; }
102+
}
103+
}
104+
105+
[JsonSerializable(typeof(RunApiInput))]
106+
[JsonSerializable(typeof(RunApiOutput))]
107+
internal partial class RunFileApiJsonSerializerContext : JsonSerializerContext;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System.CommandLine;
5+
6+
namespace Microsoft.DotNet.Cli.Commands.Run.Api;
7+
8+
internal sealed class RunApiCommandParser
9+
{
10+
public static Command GetCommand()
11+
{
12+
Command command = new("run-api")
13+
{
14+
Hidden = true,
15+
};
16+
17+
command.SetAction((parseResult) => new RunApiCommand(parseResult).Execute());
18+
return command;
19+
}
20+
}

0 commit comments

Comments
 (0)