Nuget copy native Linux targeted library

This commit is contained in:
code liturgy 2022-11-28 17:41:46 +00:00
parent 1f7bbff842
commit be2366eb83
7 changed files with 48 additions and 13 deletions

9
Directory.Build.props Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning">
<Version>3.4.22</Version>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>

13
Sharp.Augeas/.nuspec Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Example</id>
<version>1.0.0</version>
<authors>Example</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Example</description>
</metadata>
<files>
<file src="libclAugeas.so" target="Platform\libclAugeas.so" />
</files>
</package>

View File

@ -9,6 +9,14 @@ namespace Sharp.Augeas
[SuppressUnmanagedCodeSecurity] [SuppressUnmanagedCodeSecurity]
public static unsafe class AugeasExtern public static unsafe class AugeasExtern
{ {
/// <summary>
/// Used by DllImport to load the native library
/// </summary>
///
private const string _libName = "clAugeas";
[DllImport(_libName)] [DllImport(_libName)]
public static extern IntPtr init_aug(AugSettings settings, int flags); public static extern IntPtr init_aug(AugSettings settings, int flags);
@ -18,10 +26,6 @@ namespace Sharp.Augeas
[DllImport(_libName)] [DllImport(_libName)]
public static extern void free_str(IntPtr str); public static extern void free_str(IntPtr str);
/// <summary>
/// Used by DllImport to load the native library
/// </summary>
private const string _libName = "clAugeas";
/// <summary>Test calling</summary> /// <summary>Test calling</summary>
[DllImport(_libName)] [DllImport(_libName)]

View File

@ -5,19 +5,28 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable> <Nullable>disable</Nullable>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RootNamespace>Sharp.Augeas</RootNamespace> <RootNamespace>Sharp.Augeas</RootNamespace>
<PackageProjectUrl>https://git.codeliturgy.com/P0/Sharp.Augeas</PackageProjectUrl>
<PackageVersion>$(Version)</PackageVersion>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RepositoryUrl>https://git.codeliturgy.com/P0/Sharp.Augeas</RepositoryUrl>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ContentWithTargetPath Include="root\**"> <PackageReference Update="Nerdbank.GitVersioning">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <Version>3.5.109</Version>
<TargetPath>root\%(RecursiveDir)\%(Filename)%(Extension)</TargetPath> </PackageReference>
</ContentWithTargetPath>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="./Platform/Linux/libclAugeas.so"> <PackageReference Update="Nerdbank.GitVersioning">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <Version>3.5.109</Version>
</Content> </PackageReference>
</ItemGroup>
<ItemGroup>
<Content Include="libclAugeas.so">
<Pack>true</Pack>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
</Project> </Project>

BIN
Sharp.Augeas/libclAugeas.so Executable file

Binary file not shown.

View File

@ -1,6 +1,6 @@
{ {
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "0.9", "version": "1.1",
"semVer1NumericIdentifierPadding": 1, "semVer1NumericIdentifierPadding": 1,
"publicReleaseRefSpec": [ "publicReleaseRefSpec": [
"^refs/heads/master$", "^refs/heads/master$",