Skip to content

Commit 87df74f

Browse files
committed
Update ObsWebSocket.SourceGenerators.csproj
overcomplicated this step too much. There's a build target for it..
1 parent 1571dfd commit 87df74f

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

ObsWebSocket.SourceGenerators/ObsWebSocket.SourceGenerators.csproj

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFramework>netstandard2.0</TargetFramework>
44
<LangVersion>latest</LangVersion>
@@ -131,8 +131,10 @@
131131
<AdditionalFiles Include="AnalyzerReleases.*.md" />
132132
</ItemGroup>
133133
<PropertyGroup>
134+
<!-- Define properties for URL and Output Path -->
134135
<_ProtocolJsonUrl>https://raw.githubusercontent.com/obsproject/obs-websocket/master/docs/generated/protocol.json</_ProtocolJsonUrl>
135136
<_ProtocolJsonOutputPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\protocol.json'))</_ProtocolJsonOutputPath>
137+
<_ProtocolJsonOutputDirectory>$([System.IO.Path]::GetDirectoryName('$(_ProtocolJsonOutputPath)'))</_ProtocolJsonOutputDirectory>
136138
</PropertyGroup>
137139
<Target
138140
Name="DownloadProtocolFile"
@@ -144,20 +146,23 @@
144146
Text="protocol.json not found at '$(_ProtocolJsonOutputPath)'. Downloading from $(_ProtocolJsonUrl)..."
145147
Importance="high"
146148
/>
147-
<Exec
148-
Command="curl '$(_ProtocolJsonUrl)' -o '$(_ProtocolJsonOutputPath)'"
149-
ConsoleToMSBuild="true"
150-
ContinueOnError="false"
149+
<DownloadFile
150+
SourceUrl="$(_ProtocolJsonUrl)"
151+
DestinationFolder="$(_ProtocolJsonOutputDirectory)"
152+
DestinationFileName="protocol.json"
153+
SkipUnchangedFiles="false"
154+
Retries="3"
155+
>
156+
<Output TaskParameter="DownloadedFile" ItemName="DownloadedProtocolFileItem" />
157+
</DownloadFile>
158+
<Message
159+
Text="protocol.json downloaded to @(DownloadedProtocolFileItem)."
160+
Importance="high"
161+
Condition="Exists('%(DownloadedProtocolFileItem.Identity)')"
151162
/>
152-
<Message Text="protocol.json download attempt finished." Importance="high" />
153-
<!-- Verify download success (optional but good practice) -->
154163
<Error
155-
Text="Failed to download protocol.json. Check curl command output and network connection."
156-
Condition="!Exists('$(_ProtocolJsonOutputPath)') AND '$(OS)' != 'Windows_NT'"
157-
/>
158-
<Warning
159-
Text="Could not verify protocol.json download on Windows using curl. Ensure curl is in PATH."
160-
Condition="!Exists('$(_ProtocolJsonOutputPath)') AND '$(OS)' == 'Windows_NT'"
164+
Text="Failed to download protocol.json using DownloadFile task. URL: $(_ProtocolJsonUrl)"
165+
Condition="!Exists('$(_ProtocolJsonOutputPath)')"
161166
/>
162167
</Target>
163168
</Project>

0 commit comments

Comments
 (0)