Skip to content
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

Open
wants to merge 40 commits into
base: main
Choose a base branch
from

Conversation

welovej
Copy link
Member

@welovej welovej commented Nov 20, 2024

Description

Add your description here!

Checklist

To ensure a quick review and merge, please ensure:

  • The PR has a understandable title and description explaining the why and what.
  • The PR is opened in draft if not ready for review yet.
    • If opened in draft, please allocate sufficient time (24 hours) after moving out of draft for review
  • The branch is recent enough to not have merge conflicts upon creation.

Ready to Land?

  • Build is completely green
    • Submissions with test failures require tracking issue and approval of a CODEOWNER
  • At least one +1 review by a CODEOWNER
  • All -1 reviews are confirmed resolved by the reviewer
    • Override/Marking reviews stale must be discussed with CODEOWNERS first

<PackageTags>AzureSample.ResourceManager.Sample</PackageTags>
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
<IncludeOperationsSharedSource>true</IncludeOperationsSharedSource>
<PackageTags>azure;management;arm;resource manager;sample</PackageTags>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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">
Copy link
Member

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?

Copy link
Member Author

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.

src/AutoRest.CSharp/Assets/AssemblyInfo_publickey.txt Outdated Show resolved Hide resolved
@@ -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>
Copy link
Member

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?

Copy link
Member Author

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"))
Copy link
Member

@live1206 live1206 Nov 26, 2024

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?

Copy link
Member Author

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.

Copy link
Member

@live1206 live1206 Nov 28, 2024

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"))
Copy link
Member

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?

Copy link
Member Author

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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this Json?

Copy link
Member Author

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?

Copy link
Member Author

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();
}

Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment on lines 91 to 94
if (_isAzureSdk)
{
Directory.CreateDirectory(Path.Combine(_testDirectory, "SessionRecords"));
Directory.CreateDirectory(Path.Combine(_testDirectory, "Scenario"));
}
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants