Skip to content

Commit 002f914

Browse files
Define InstallTspClient build target to avoid parallel npm ci conflicts (Azure#53295)
* Initial plan * Define new InstallTspClient build target to avoid parallel npm ci conflicts Co-authored-by: JoshLove-msft <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: JoshLove-msft <[email protected]>
1 parent e208e1d commit 002f914

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

eng/CodeGeneration.targets

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@
1212
<TypespecAdditionalOptions Condition="'$(GenerateTestProject)' != '' AND '$(TypespecAdditionalOptions)' == ''">generate-test-project=true</TypespecAdditionalOptions>
1313
<_TypespecAdditionalOptions Condition="'$(TypespecAdditionalOptions)' != ''">--emitter-options "$(TypespecAdditionalOptions)"</_TypespecAdditionalOptions>
1414
<_LocalSpecRepo Condition="'$(LocalSpecRepo)' != ''">--local-spec-repo $(LocalSpecRepo)</_LocalSpecRepo>
15+
<SkipTspClientInstall Condition="'$(SkipTspClientInstall)' == ''">false</SkipTspClientInstall>
1516
</PropertyGroup>
1617

1718
<!-- For projects using the new TypeSpec generator, we don't include the Autorest dependency which pulls in the GenerateCode target.
1819
So we need to add it here. -->
20+
<Target Name="InstallTspClient" Condition="'$(TypeSpecInput)' != ''">
21+
<Exec Command="npm ci --prefix $(_TspClientDir)" />
22+
</Target>
23+
1924
<Target Name="GenerateCode" Condition="'$(TypeSpecInput)' != ''">
2025
<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)' == 'true' AND !Exists('$(MSBuildProjectDirectory)/../TempTypeSpecFiles')" />
21-
<Exec Command="npm ci --prefix $(_TspClientDir)" />
26+
<CallTarget Condition="'$(SkipTspClientInstall)' != 'true'" Targets="InstallTspClient" />
2227
<Exec Condition="'$(SkipSync)' == 'true'" Command="$(_TypeSpecProjectGenerateCommand) $(_SaveInputs) $(_TypespecAdditionalOptions) $(_Trace)"/>
2328
<Exec Condition="'$(SkipSync)' != 'true'" Command="$(_TypeSpecProjectSyncAndGenerateCommand) $(_SaveInputs) $(_LocalSpecRepo) $(_TypespecAdditionalOptions) $(_Trace)"/>
2429
</Target>

eng/service.proj

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,18 @@
9999
</Target>
100100

101101

102-
<Target Name="GenerateCode">
102+
<Target Name="InstallTspClient">
103+
<MSBuild Projects="@(ProjectReference)"
104+
Targets="InstallTspClient"
105+
BuildInParallel="false"
106+
SkipNonexistentProjects="false"
107+
SkipNonexistentTargets="true" />
108+
</Target>
109+
110+
<Target Name="GenerateCode" DependsOnTargets="InstallTspClient">
103111
<MSBuild Projects="@(ProjectReference)"
104112
Targets="GenerateCode"
113+
Properties="SkipTspClientInstall=true"
105114
BuildInParallel="$(BuildInParallel)"
106115
SkipNonexistentProjects="false"
107116
SkipNonexistentTargets="true" />

0 commit comments

Comments
 (0)