Watch
2
0
Fork
You've already forked raylib-cs
0

fix: version the native extract marker and chain download via DependsOnTargets

The .extracted marker now includes the raylib package name, so bumping
TargetRaylibTag re-extracts the new archive instead of silently keeping
(and packing/copying) the previous version's files.

_PrepareNativeLibrary and _StageWasmNative now depend directly on
_DownloadAndExtractInternal instead of CallTarget-ing it; dependency
targets run in the same project instance, so the resolved properties
(RaylibPackageName etc.) propagate naturally.
This commit is contained in:
tiger tiger tiger 2026-07-06 15:33:30 +02:00
commit 99cfdae6ed

View file

@ -102,11 +102,10 @@
<!-- ================================================================== -->
<!-- Resolve and download the native library for a given RID (used by ProjectReference consumers). -->
<Target Name="_PrepareNativeLibrary" DependsOnTargets="_ResolveRaylibNative" Outputs="@(_RaylibNativeLibraryItem)">
<Target Name="_PrepareNativeLibrary" DependsOnTargets="_DownloadAndExtractInternal" Outputs="@(_RaylibNativeLibraryItem)">
<PropertyGroup>
<_RaylibNativesDir>$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)/$(NativesRoot)'))</_RaylibNativesDir>
</PropertyGroup>
<CallTarget Targets="_DownloadAndExtractInternal"/>
<ItemGroup>
<_NativeCandidate Include="$(_RaylibNativesDir)$(RuntimeIdentifier)/**/$(LibPattern)"/>
<_RaylibNativeLibraryItem Include="@(_NativeCandidate)"/>
@ -114,13 +113,12 @@
</Target>
<!-- Stage libraylib.web.a as raylib.a for wasm linking (pinvoke module name must match LibraryImport). -->
<Target Name="_StageWasmNative" DependsOnTargets="_ResolveRaylibNative"
<Target Name="_StageWasmNative" DependsOnTargets="_DownloadAndExtractInternal"
Condition="'$(RuntimeIdentifier)' == 'browser-wasm'">
<PropertyGroup>
<_WasmNativeSrc>$(NativesRoot)browser-wasm/$(RaylibPackageName)/lib/libraylib.web.a</_WasmNativeSrc>
<_WasmNativeDst>$(MSBuildThisFileDirectory)obj/browser-wasm/raylib.a</_WasmNativeDst>
</PropertyGroup>
<CallTarget Targets="_DownloadAndExtractInternal"/>
<MakeDir Directories="$(MSBuildThisFileDirectory)obj/browser-wasm"/>
<Copy SourceFiles="$(_WasmNativeSrc)" DestinationFiles="$(_WasmNativeDst)" SkipUnchangedFiles="true"/>
</Target>
@ -136,7 +134,9 @@
<PropertyGroup>
<_WorkDir>$(NativesRoot)$(RuntimeIdentifier)/</_WorkDir>
<_ArchiveFile>$(_WorkDir)$(RaylibPackageName)$(ArchiveExt)</_ArchiveFile>
<_ExtractMarker>$(_WorkDir).extracted</_ExtractMarker>
<!-- Marker includes the package name so bumping TargetRaylibTag re-extracts
instead of silently keeping the old version's files. -->
<_ExtractMarker>$(_WorkDir)$(RaylibPackageName).extracted</_ExtractMarker>
</PropertyGroup>
<Message Text="Downloading raylib $(TargetRaylibTag) native for $(RuntimeIdentifier)"