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

Add 2 new parameters to the code gen target #3416

Merged
merged 5 commits into from
May 22, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/AutoRest.CSharp/build/CodeGeneration.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
-->

<!--
<typespecAdditionalOptions></typespecAdditionalOptions>
<TypespecAdditionalOptions></TypespecAdditionalOptions>

Allows passing additional tsp command line arguments, for example to run special emitter
use the following command line: dotnet msbuild /t:GenerateCode /p:typespecAdditionalOptions="csharpGeneratorPath=/absolute/path/to/artifacts/bin/AutoRest.CSharp/Debug/net6.0/AutoRest.CSharp.dll"
use the following command line: dotnet msbuild /t:GenerateCode /p:TypespecAdditionalOptions="csharpGeneratorPath=/absolute/path/to/artifacts/bin/AutoRest.CSharp/Debug/net6.0/AutoRest.CSharp.dll"
-->

<IncludeAzureCoreSharedCode Condition="'$(IncludeAzureCoreSharedCode)' == ''">true</IncludeAzureCoreSharedCode>
Expand All @@ -32,6 +32,8 @@
<UseDefaultNamespaceAndOutputFolder Condition="'$(UseDefaultNamespaceAndOutputFolder)' == ''">true</UseDefaultNamespaceAndOutputFolder>
<_AutoRestCommand>node $(AutoRestEntryPoint) --max-memory-size=8192 --skip-csproj --skip-upgrade-check --version=$(AutoRestCoreVersion) $(AutoRestInput) $(AutoRestAdditionalParameters) --use=$(MSBuildThisFileDirectory)../tools/net6.0/any/ --clear-output-folder=true --shared-source-folders=&quot;$(AzureCoreSharedCodeDirectory);$(AutoRestSharedCodeDirectory)&quot;</_AutoRestCommand>
<_AutoRestCommand Condition="'$(UseDefaultNamespaceAndOutputFolder)' == 'true'">$(_AutoRestCommand) --output-folder=$(MSBuildProjectDirectory)/Generated --namespace=$(RootNamespace)</_AutoRestCommand>
<_SaveInputs Condition="'$(SaveInputs)' != ''">-SaveInputs</_SaveInputs>
m-nash marked this conversation as resolved.
Show resolved Hide resolved
m-nash marked this conversation as resolved.
Show resolved Hide resolved
<_TypespecAdditionalOptions Condition="'$(TypespecAdditionalOptions)' != ''">-TypespecAdditionalOptions "$(TypespecAdditionalOptions)"</_TypespecAdditionalOptions>
</PropertyGroup>

<Target Name="GenerateCode" DependsOnTargets="_GenerateCodeForAutorest;_GenerateCodeForTypeSpec"/>
Expand All @@ -52,8 +54,9 @@
</Target>

<Target Name="_GenerateCodeForTypeSpec" Condition="'$(_GenerateCode)' == 'true' AND '$(TypeSpecInput)' != ''" >
<Exec Command="$(PowerShellExe) -NoProfile -NonInteractive -executionpolicy Unrestricted -File $(TypeSpecProjectSyncScriptPath) $(MSBuildProjectDirectory)/.."/>
<Exec Command="$(PowerShellExe) -NoProfile -NonInteractive -executionpolicy Unrestricted -File $(TypeSpecProjectGenerateScriptPath) $(MSBuildProjectDirectory)/.. $(typespecAdditionalOptions)"/>
<Error Text="You used skipped sync but didn't have the TempTypeSpecFiles in your project directory. Please run dotnet 'build /t:GenerateCode /p:SaveInputs=true' without SkipSync first at least once" Condition="'$(SkipSync)' != '' AND !Exists('$(MSBuildProjectDirectory)/../TempTypeSpecFiles')" />
m-nash marked this conversation as resolved.
Show resolved Hide resolved
<Exec Condition="'$(SkipSync)' == ''" Command="$(PowerShellExe) -NoProfile -NonInteractive -executionpolicy Unrestricted -File $(TypeSpecProjectSyncScriptPath) $(MSBuildProjectDirectory)/.."/>
m-nash marked this conversation as resolved.
Show resolved Hide resolved
<Exec Command="$(PowerShellExe) -NoProfile -NonInteractive -executionpolicy Unrestricted -File $(TypeSpecProjectGenerateScriptPath) $(MSBuildProjectDirectory)/.. $(_TypespecAdditionalOptions) $(_SaveInputs)"/>
</Target>

<Target Name="GenerateTests" Condition="'$(AutoRestTestsInput)' != ''">
Expand Down