Skip to content

Commit

Permalink
Fix native libs packaging without using SkiaSharp's black magic
Browse files Browse the repository at this point in the history
  • Loading branch information
myd7349 committed Jul 25, 2024
1 parent 45b9095 commit 0455b6a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 31 deletions.
3 changes: 1 addition & 2 deletions Source/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
<PropertyGroup Label="Build">
<TargetFrameworks>net35;netcoreapp3.1;net6.0</TargetFrameworks>
<AnalysisLevel>latest</AnalysisLevel>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<!--
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
-->
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
Expand Down
14 changes: 4 additions & 10 deletions Source/SharpLSL.Natives/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,16 @@
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />

<PropertyGroup Label="Build">
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<!--
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
-->
<IncludeBuildOutput>true</IncludeBuildOutput>
<BuildOutputTargetFolder>runtimes</BuildOutputTargetFolder>
<ExcludeSymbolsFromPackage>false</ExcludeSymbolsFromPackage>
<!--
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
-->
<DebugType>None</DebugType>
<DebugSymbols>false</DebugSymbols>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<PropertyGroup Label="Package">
<ExcludeSymbolsFromPackage>false</ExcludeSymbolsFromPackage>
<IncludeBuildOutput>false</IncludeBuildOutput>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<SuppressDependenciesWhenPacking>false</SuppressDependenciesWhenPacking>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,23 @@
</ItemGroup>

<Target Name="DownloadNativeAssets" Condition="$(SkipLocalBuild) != true">
<DownloadFile SourceUrl="$(LSLAssetUrl)" DestinationFolder="$(BaseIntermediateOutputPath)" DestinationFileName="$(LSLAssetArchive)" Condition="!Exists('$(BaseIntermediateOutputPath)$(LSLAssetArchive)')" />
<DownloadFile SourceUrl="$(LSLAssetUrl)"
DestinationFolder="$(BaseIntermediateOutputPath)"
DestinationFileName="$(LSLAssetArchive)"
Condition="!Exists('$(BaseIntermediateOutputPath)$(LSLAssetArchive)')" />

<Unzip SourceFiles="$(BaseIntermediateOutputPath)$(LSLAssetArchive)" DestinationFolder="$(BaseIntermediateOutputPath)" OverwriteReadOnlyFiles="true" Condition="!Exists('$(BaseIntermediateOutputPath)bin/$(LSLAssetFile)')" />
<Unzip SourceFiles="$(BaseIntermediateOutputPath)$(LSLAssetArchive)"
DestinationFolder="$(BaseIntermediateOutputPath)"
OverwriteReadOnlyFiles="true"
Condition="!Exists('$(BaseIntermediateOutputPath)bin/$(LSLAssetFile)')" />
</Target>

<Target Name="_IncludePlaceholders" AfterTargets="_IncludeAdditionalTfmSpecificPackageFilesPrepare">
<Touch Files="$(IntermediateOutputPath)_._" AlwaysCreate="True" />
<ItemGroup>
<FileWrites Include="$(IntermediateOutputPath)_._" />
<TfmSpecificPackageFile Include="$(IntermediateOutputPath)_._" PackagePath="lib\$(NuGetShortFolderName)\_._" />
<TfmSpecificPackageFile Include="$(IntermediateOutputPath)_._"
PackagePath="lib\$(NuGetShortFolderName)\_._" />
</ItemGroup>
</Target>

Expand All @@ -54,22 +61,10 @@

<Target Name="IncludeAdditionalTfmSpecificPackageFiles">
<ItemGroup Condition=" '$(TargetFramework)' == 'net35' ">
<TfmSpecificPackageFile Include="$(MSBuildThisFileDirectory)build\net35\$(PackageId).targets" PackagePath="build\net35\$(PackageId).targets" />
<TfmSpecificPackageFile Include="$(MSBuildThisFileDirectory)build\net35\$(PackageId).targets" PackagePath="buildTransitive\net35\$(PackageId).targets" />
</ItemGroup>
</Target>

<Target Name="_IncludeRuntimesPackageFiles" BeforeTargets="_GetPackageFiles">
<ItemGroup>
<_CompletedNativeWindowsPackageFile
Include="@(_NativeWindowsPackageFileToUse)"
TargetFramework="%(RuntimeIdentifier)"
TargetPath="%(Folder)\%(Filename)%(Extension)"
PackagePath="runtimes\%(RuntimeIdentifier)\%(Folder)\%(Filename)%(Extension)" />
<_BuildOutputInPackage Remove="@(_BuildOutputInPackage)" />
<_BuildOutputInPackage Include="@(_CompletedNativeWindowsPackageFile)" Condition="'%(Extension)' != '.pdb'" />
<_TargetPathsToSymbols Remove="@(_TargetPathsToSymbols)" />
<_TargetPathsToSymbols Include="@(_CompletedNativeWindowsPackageFile)" Condition="'%(Extension)' == '.pdb'" />
<TfmSpecificPackageFile Include="$(MSBuildThisFileDirectory)build\net35\$(PackageId).targets"
PackagePath="build\net35\$(PackageId).targets" />
<TfmSpecificPackageFile Include="$(MSBuildThisFileDirectory)build\net35\$(PackageId).targets"
PackagePath="buildTransitive\net35\$(PackageId).targets" />
</ItemGroup>
</Target>
</Project>

0 comments on commit 0455b6a

Please sign in to comment.