-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NewProjectScaffolding-modification-for-mgmt #5167
base: main
Are you sure you want to change the base?
NewProjectScaffolding-modification-for-mgmt #5167
Conversation
src/AutoRest.CSharp/Common/AutoRest/Plugins/NewProjectScaffolding.cs
Outdated
Show resolved
Hide resolved
src/AutoRest.CSharp/Common/AutoRest/Plugins/NewProjectScaffolding.cs
Outdated
Show resolved
Hide resolved
src/AutoRest.CSharp/Common/AutoRest/Plugins/NewProjectScaffolding.cs
Outdated
Show resolved
Hide resolved
src/AutoRest.CSharp/Common/AutoRest/Plugins/NewProjectScaffolding.cs
Outdated
Show resolved
Hide resolved
…ng-modification-for-mgmt
<PackageTags>AzureSample.ResourceManager.Sample</PackageTags> | ||
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks> | ||
<IncludeOperationsSharedSource>true</IncludeOperationsSharedSource> | ||
<PackageTags>azure;management;arm;resource manager;sample</PackageTags> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at a real sample project: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Azure.ResourceManager.CosmosDB.Samples.csproj, the PackageTags and PackageId are not there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/AzureSample.ResourceManager.Sample.csproj.
Though it has keyword Sample, but it's under src directory and treat as src project not sample project.
@@ -1,9 +1,5 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering what is the intention of this empty test project generation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As normal, there are should be another two file existing : testbase and testenvironment which namespace lies in testframework. if so, some reference problmes would occur and hard to make a right package reference of testframework. so I blocked the geneartion of these two file in scaffolding but did not block the test project generation.
@@ -10,7 +10,8 @@ | |||
<IsTestGenerationTestProject Condition="$(MSBuildProjectName.EndsWith('.Tests'))">true</IsTestGenerationTestProject> | |||
<RequiredTargetFrameworks Condition="'$(IsTestGenerationSrcProject)' == 'true'">netstandard2.0</RequiredTargetFrameworks> | |||
<RequiredTargetFrameworks Condition="'$(IsTestGenerationTestProject)' == 'true'">net7.0;net6.0;net462</RequiredTargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be net8.0? And then, do we still need the new one for mgmt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. It should be net8.0
{ | ||
slnContent += @" {{ECC730C1-4AEA-420C-916A-66B19B79E4DC}}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{{ECC730C1-4AEA-420C-916A-66B19B79E4DC}}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{{ECC730C1-4AEA-420C-916A-66B19B79E4DC}}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{{ECC730C1-4AEA-420C-916A-66B19B79E4DC}}.Release|Any CPU.Build.0 = Release|Any CPU | ||
"; | ||
} | ||
if (Configuration.AzureArm && Configuration.Namespace.StartsWith("Azure.ResourceManager")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this limited to Azure.ResourceManager?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In autorest.csharp, there are no proper project or package reference. If we generate sample.csproj and added in solution file, then the pipeline would have many syntax error. I restrict the namespace to "Azure.ResourceManager", so it would only generate sample's csproj file and added to the solution file under real sdk management generation environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding a configuration "skip-test-project-scaffolding" to skip the test projects generation in autorest.csharp? Similar to
public const string SkipCSProj = "skip-csproj"; |
That will be clearer.
{ | ||
slnContent += @"Project(""{{9A19103F-16F7-4668-BE54-9A1E7A4F7556}}"") = ""Azure.Core.TestFramework"", ""..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj"", ""{{ECC730C1-4AEA-420C-916A-66B19B79E4DC}}"" | ||
EndProject | ||
"; | ||
} | ||
if (Configuration.AzureArm && Configuration.Namespace.StartsWith("Azure.ResourceManager")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is Azure.ResourceManager needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same reason as the above one.
await File.WriteAllBytesAsync(Path.Combine(_projectDirectory, "CHANGELOG.md"), Encoding.ASCII.GetBytes(GetChangeLog())); | ||
} | ||
} | ||
|
||
private string GetAssetJson() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this Json?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean the name is not good? maybe GetAssetsContent would be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adpoted: GetAssetsJson
@@ -333,7 +188,6 @@ private string GetBrandedSrcCSProj() | |||
|
|||
return builder.Write(); | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be better to keep new line between methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
if (_isAzureSdk) | ||
{ | ||
Directory.CreateDirectory(Path.Combine(_testDirectory, "SessionRecords")); | ||
Directory.CreateDirectory(Path.Combine(_testDirectory, "Scenario")); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we no longer need this after the test proxy update for test framework.
Therefore we could remove this.
Description
Add your description here!
Checklist
To ensure a quick review and merge, please ensure:
Ready to Land?