Skip to content

Commit

Permalink
Add and remove the compatibility APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Mar 7, 2024
1 parent 7ebc1f0 commit e4e721c
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 5 deletions.
2 changes: 2 additions & 0 deletions binding/NativeAssets.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<DebugSymbols>false</DebugSymbols>
<!-- Don't generate docs -->
<SkipMDocGenerateDocs>true</SkipMDocGenerateDocs>
<!-- We don't use the build output so don't do extra work -->
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions binding/SkiaSharp/SKCanvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,10 @@ public void ResetMatrix ()
public void SetMatrix (in SKMatrix matrix) =>
SetMatrix ((SKMatrix44)matrix);

[Obsolete("Use SetMatrix(in SKMatrix) instead.", true)]
public void SetMatrix (SKMatrix matrix) =>
SetMatrix (in matrix);

public void SetMatrix (in SKMatrix44 matrix)
{
fixed (SKMatrix44* ptr = &matrix) {
Expand Down
1 change: 1 addition & 0 deletions binding/SkiaSharp/SkiaSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<AssemblyName>SkiaSharp</AssemblyName>
<PackagingGroup>SkiaSharp</PackagingGroup>
<Nullable>enable</Nullable>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
<DefineConstants>$(DefineConstants);USE_DELEGATES</DefineConstants>
Expand Down
18 changes: 18 additions & 0 deletions source/SkiaSharp.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,22 @@ internal partial class VersionConstants {
</ItemGroup>
</Target>

<!--
===================================================================================================================
_RemoveObsoleteItemsFromReferenceAssembly
Remove all the [Obsolete(error: true)] symbols from the reference assembly.
===================================================================================================================
-->
<ItemGroup Condition="'$(ProduceReferenceAssembly)' == 'true'">
<PackageReference Include="Mono.ApiTools.MSBuildTasks" Version="0.3.0" PrivateAssets="all" />
</ItemGroup>
<Target Name="_RemoveObsoleteItemsFromReferenceAssembly"
AfterTargets="CoreCompile"
Condition="'$(ProduceReferenceAssembly)' == 'true'">
<RemoveObsoleteSymbols Assembly="@(IntermediateRefAssembly)" />
</Target>

<!--
===================================================================================================================
_SignAssembly
Expand All @@ -157,6 +173,7 @@ internal partial class VersionConstants {
AfterTargets="$(_SignAssemblyAfterTargets)"
Condition=" $(IsWindows) and '$(SignAssembly)' == 'true' and '$(TargetPath)' != '' and '$(BuildingInsideVisualStudio)' != 'true' ">
<Exec Command="&quot;$(_SnExePath)&quot; -q -R @(IntermediateAssembly -> '&quot;%(Identity)&quot;') &quot;$(AssemblyOriginatorKeyFile)&quot;" />
<Exec Command="&quot;$(_SnExePath)&quot; -q -R @(IntermediateRefAssembly -> '&quot;%(Identity)&quot;') &quot;$(AssemblyOriginatorKeyFile)&quot;" Condition="'$(ProduceReferenceAssembly)' == 'true'" />
</Target>

<!--
Expand All @@ -175,6 +192,7 @@ internal partial class VersionConstants {
AfterTargets="$(_SignAssemblyVerifyAfterTargets)"
Condition=" $(IsWindows) and '$(SignAssembly)' == 'true' and '$(Configuration)' == 'Release' and '$(TargetPath)' != '' and '$(BuildingInsideVisualStudio)' != 'true' ">
<Exec Command="&quot;$(_SnExePath)&quot; -vf &quot;$(TargetPath)&quot;" StandardOutputImportance="Normal" />
<Exec Command="&quot;$(_SnExePath)&quot; -vf &quot;$(TargetRefPath)&quot;" StandardOutputImportance="Normal" Condition="'$(ProduceReferenceAssembly)' == 'true'" />
</Target>

<!--
Expand Down
67 changes: 62 additions & 5 deletions source/SkiaSharp.NuGet.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ $(PackageNotes)</PackageDescription>
<None Include="@(PackageFile)" Link="%(PackagePath)" Pack="True" />
</ItemGroup>

<!-- Generate the README -->
<Target Name="_IncludeAdditionalPackageFiles"
<!--
===================================================================================================================
_GeneratePackageReadmeFile
Generate the package README file.
===================================================================================================================
-->
<Target Name="_GeneratePackageReadmeFile"
BeforeTargets="_GetPackageFiles"
Condition="'$(PackageDescription)' != ''">
<WriteLinesToFile File="$(IntermediateOutputPath)$(PackageReadmeFile)" Lines="$(PackageDescription)" Overwrite="True" />
Expand All @@ -34,23 +40,74 @@ $(PackageNotes)</PackageDescription>
</ItemGroup>
</Target>

<!-- Add the xml docs -->
<!--
===================================================================================================================
_IncludeAdditionalTfmSpecificPackageFilesPrepare
Create all the properties needed to add additional files.
===================================================================================================================
-->
<Target Name="_IncludeAdditionalTfmSpecificPackageFilesPrepare">
<GetNuGetShortFolderName
TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
TargetPlatformMoniker="$(TargetPlatformMoniker)">
<Output TaskParameter="NuGetShortFolderName" PropertyName="NuGetShortFolderName" />
</GetNuGetShortFolderName>
</Target>

<!--
===================================================================================================================
IncludeMDocTfmSpecificPackageFiles
Include the XML docs in the package.
===================================================================================================================
-->
<Target Name="IncludeMDocTfmSpecificPackageFiles">
<ItemGroup>
<TfmSpecificPackageFile Include="$(MDocOutputPath)" PackagePath="lib\$(NuGetShortFolderName)\$(MDocOutputName)"
Exclude="@(DocumentationProjectOutputGroupOutput)" Condition="Exists('$(MDocOutputPath)')" />
</ItemGroup>
</Target>

<!--
===================================================================================================================
IncludeReferenceAssemblyTfmSpecificPackageFiles
Include the reference assembly in the package.
===================================================================================================================
-->
<Target Name="IncludeReferenceAssemblyTfmSpecificPackageFiles">
<ItemGroup>
<TfmSpecificPackageFile Include="$(TargetRefPath)" PackagePath="ref\$(NuGetShortFolderName)\$(TargetFileName)"
Condition="Exists('$(TargetRefPath)')" />
</ItemGroup>
</Target>

<!--
===================================================================================================================
_IncludeAdditionalTfmSpecificPackageFiles
Include all the additional files in the package.
===================================================================================================================
-->
<PropertyGroup>
<_IncludeAdditionalTfmSpecificPackageFilesDependsOn>
_IncludeAdditionalTfmSpecificPackageFilesPrepare;
IncludeMDocTfmSpecificPackageFiles;
IncludeReferenceAssemblyTfmSpecificPackageFiles;
IncludeAdditionalTfmSpecificPackageFiles;
</_IncludeAdditionalTfmSpecificPackageFilesDependsOn>
</PropertyGroup>
<Target Name="_IncludeAdditionalTfmSpecificPackageFiles"
DependsOnTargets="_IncludeAdditionalTfmSpecificPackageFilesPrepare;IncludeAdditionalTfmSpecificPackageFiles" />
DependsOnTargets="$(_IncludeAdditionalTfmSpecificPackageFilesDependsOn)" />

<!--
===================================================================================================================
_IncludeAdditionalVersionInfo
<!-- Set the package version properties -->
Set the package version properties.
===================================================================================================================
-->
<Target Name="_IncludeAdditionalVersionInfo">
<PropertyGroup>
<PackageVersion>$(Version)</PackageVersion>
Expand Down

0 comments on commit e4e721c

Please sign in to comment.