|
1 | | -<Project Sdk="Microsoft.NET.Sdk"> |
| 1 | +<Project Sdk="Microsoft.NET.Sdk"> |
2 | 2 | <PropertyGroup> |
3 | 3 | <TargetFramework>netstandard2.0</TargetFramework> |
4 | 4 | <LangVersion>latest</LangVersion> |
|
131 | 131 | <AdditionalFiles Include="AnalyzerReleases.*.md" /> |
132 | 132 | </ItemGroup> |
133 | 133 | <PropertyGroup> |
| 134 | + <!-- Define properties for URL and Output Path --> |
134 | 135 | <_ProtocolJsonUrl>https://raw.githubusercontent.com/obsproject/obs-websocket/master/docs/generated/protocol.json</_ProtocolJsonUrl> |
135 | 136 | <_ProtocolJsonOutputPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\protocol.json'))</_ProtocolJsonOutputPath> |
| 137 | + <_ProtocolJsonOutputDirectory>$([System.IO.Path]::GetDirectoryName('$(_ProtocolJsonOutputPath)'))</_ProtocolJsonOutputDirectory> |
136 | 138 | </PropertyGroup> |
137 | 139 | <Target |
138 | 140 | Name="DownloadProtocolFile" |
|
144 | 146 | Text="protocol.json not found at '$(_ProtocolJsonOutputPath)'. Downloading from $(_ProtocolJsonUrl)..." |
145 | 147 | Importance="high" |
146 | 148 | /> |
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)')" |
151 | 162 | /> |
152 | | - <Message Text="protocol.json download attempt finished." Importance="high" /> |
153 | | - <!-- Verify download success (optional but good practice) --> |
154 | 163 | <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)')" |
161 | 166 | /> |
162 | 167 | </Target> |
163 | 168 | </Project> |
0 commit comments