-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Consume generator as a package #15133
Changes from all commits
8dd64ea
de5f555
f6e507d
ad4ed57
483f20c
8239a63
c8ba73a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
<PropertyGroup> | ||
<_AutoRestVersion>https://github.com/Azure/autorest/releases/download/autorest-3.0.6236/autorest-3.0.6236.tgz</_AutoRestVersion> | ||
<_AutoRestCoreVersion>3.0.6306</_AutoRestCoreVersion> | ||
<_AutoRestCSharpVersion>https://github.com/Azure/autorest.csharp/releases/download/3.0.0-dev.20200911.1/autorest-csharp-v3-3.0.0-dev.20200911.1.tgz</_AutoRestCSharpVersion> | ||
<_AutoRestCSharpVersion>https://github.com/Azure/autorest.csharp/releases/download/3.0.0-dev.20200811.1/autorest-csharp-v3-3.0.0-dev.20200811.1.tgz</_AutoRestCSharpVersion> | ||
<_SupportsCodeGeneration Condition="'$(IsClientLibrary)' == 'true'">true</_SupportsCodeGeneration> | ||
<_DefaultInputName Condition="Exists('$(MSBuildProjectDirectory)/autorest.md')">$(MSBuildProjectDirectory)/autorest.md</_DefaultInputName> | ||
<AutoRestInput Condition="'$(AutoRestInput)' == ''">$(_DefaultInputName)</AutoRestInput> | ||
|
@@ -12,16 +12,11 @@ | |
use the following command line (remove the space between minus minus): dotnet msbuild /t:GenerateCode /p:AutoRestAdditionalParameters="- -interactive" | ||
--> | ||
<AutoRestAdditionalParameters></AutoRestAdditionalParameters> | ||
<_SharedCodeDirectory>$(MSBuildThisFileDirectory)../sdk/core/Azure.Core/src/Shared/</_SharedCodeDirectory> | ||
<_AutoRestSharedCodeDirectory>$(_SharedCodeDirectory)AutoRest/</_AutoRestSharedCodeDirectory> | ||
|
||
<_GenerateCode Condition="'$(_SupportsCodeGeneration)' == 'true' AND '$(AutoRestInput)' != ''">true</_GenerateCode> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<_AutoRestVersion Condition="'$(TemporaryUsePreviousGeneratorVersion)' == 'true'">https://github.com/Azure/autorest/releases/download/autorest-3.0.6236/autorest-3.0.6236.tgz</_AutoRestVersion> | ||
<_AutoRestCoreVersion Condition="'$(TemporaryUsePreviousGeneratorVersion)' == 'true'">3.0.6306</_AutoRestCoreVersion> | ||
<_AutoRestCSharpVersion Condition="'$(TemporaryUsePreviousGeneratorVersion)' == 'true'">https://github.com/Azure/autorest.csharp/releases/download/3.0.0-dev.20200811.1/autorest-csharp-v3-3.0.0-dev.20200811.1.tgz</_AutoRestCSharpVersion> | ||
</PropertyGroup> | ||
|
||
<Target Name="GenerateCode" Condition="'$(_GenerateCode)' == 'true'" > | ||
|
@@ -38,17 +33,9 @@ | |
<Error Text="Following GitHub URLs do not contain commit hash: @(GithubUrlsWithoutHash) please use permalinks for code generation inputs (see https://help.github.com/en/github/managing-files-in-a-repository/getting-permanent-links-to-files) " Condition="'@(GithubUrlsWithoutHash)' != ''" /> | ||
|
||
<RemoveDir Directories="$(MSBuildProjectDirectory)/Generated"/> | ||
<Exec Command="npx autorest@$(_AutoRestVersion) --version=$(_AutoRestCoreVersion) $(AutoRestInput) $(AutoRestAdditionalParameters) --use=$(_AutoRestCSharpVersion) --output-folder=$(MSBuildProjectDirectory) --title=$(RootNamespace) --namespace=$(RootNamespace) --shared-source-folder=$(_SharedCodeDirectory)" /> | ||
<Exec Command="npx autorest@$(_AutoRestVersion) --version=$(_AutoRestCoreVersion) $(AutoRestInput) $(AutoRestAdditionalParameters) --use=$(_AutoRestCSharpVersion) --output-folder=$(MSBuildProjectDirectory) --title=$(RootNamespace) --namespace=$(RootNamespace) --shared-source-folder=$(AutoRestSharedCodeDirectory).." /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reuse shared sources from the package. |
||
</Target> | ||
|
||
<PropertyGroup Condition="'$(_GenerateCode)' == 'true'"> | ||
<NoWarn>$(NoWarn);CA1812</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="'$(_GenerateCode)' == 'true'"> | ||
<Compile Include="$(_AutoRestSharedCodeDirectory)/**/*.cs" Link="Shared/AutoRest/%(RecursiveDir)/%(Filename)%(Extension)" /> | ||
</ItemGroup> | ||
|
||
</Project> | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,4 +152,12 @@ | |
<!-- Disable doc comments for test projects --> | ||
<DocumentationFile></DocumentationFile> | ||
</PropertyGroup> | ||
|
||
<!-- Code generation settings --> | ||
<PropertyGroup> | ||
<!-- Don't use code generator bundled Azure.Core shared source for code generation --> | ||
<AzureCoreSharedCodeDirectory>$(AzureCoreSharedSources)</AzureCoreSharedCodeDirectory> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand this? If the shared sources in the nuget package match the generator why wouldn't we always use those? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generator nuget package carries 2 kinds of shared sources:
We always use the former from the package but considering this repo has the original versions of Azure.Core shared files we doing used them from the package. |
||
<!-- Don't use code generator bundled Azure.Core shared source when building, projects in this repo include individual sources when needed --> | ||
<IncludeAzureCoreSharedCode>false</IncludeAzureCoreSharedCode> | ||
</PropertyGroup> | ||
</Project> |
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.
This target file goes away when the last user of
TemporaryUsePreviousGeneratorVersion
is gone.