Compare commits

...

11 Commits
main ... rls

Author SHA1 Message Date
Wvader 607a30e728 Add lib for mac 2022-12-06 14:52:59 +00:00
code liturgy eae24d1b14 Use properties instead of fields in some elements to be ASP API friendly 2022-12-06 14:30:03 +00:00
code liturgy 29619765a8 Improve documentation 2022-12-05 02:24:50 +00:00
code liturgy f5c1368b8f Make AugSettings fields public 2022-12-04 23:07:02 +00:00
code liturgy dfba89a82f last try 2022-12-02 00:25:24 +00:00
code liturgy 766d451b52 bump 2022-12-01 23:56:32 +00:00
code liturgy 3759eec7cb bump version 2022-12-01 23:31:02 +00:00
code liturgy 2abeb3b379 Try other method to copy native lib 2022-12-01 23:30:19 +00:00
code liturgy 6949875891 Bump 2022-12-01 23:04:21 +00:00
code liturgy 0e4d02652f bump version 2022-12-01 22:55:18 +00:00
code liturgy 07ac032b99 Nuget copy native Linux targeted library 2022-11-28 17:42:11 +00:00
15 changed files with 65 additions and 33 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>

View File

@ -16,10 +16,6 @@
<PackageReference Include="NUnit.Analyzers" Version="3.3.0" />
<PackageReference Include="coverlet.collector" Version="3.1.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sharp.Augeas\Sharp.Augeas.csproj" />
</ItemGroup>
<ItemGroup>
<ContentWithTargetPath Include="root\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@ -32,4 +28,7 @@
<TargetPath>lens\%(RecursiveDir)\%(Filename)%(Extension)</TargetPath>
</ContentWithTargetPath>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sharp.Augeas\Sharp.Augeas.csproj" />
</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

@ -1,12 +1,12 @@
using System.Runtime.InteropServices;
namespace Sharp.Augeas.Test
namespace Sharp.Augeas
{
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct AugSettings {
[MarshalAs(UnmanagedType.LPStr)] internal string root;
[MarshalAs(UnmanagedType.LPStr)] internal string loadPath;
[MarshalAs(UnmanagedType.LPStr)] public string root;
[MarshalAs(UnmanagedType.LPStr)] public string loadPath;
public AugSettings(string _root, string _loadPath )
{
@ -19,7 +19,7 @@ namespace Sharp.Augeas.Test
root = "NIL";
loadPath = "NIL";
}
};
}
}

View File

@ -1,6 +1,5 @@
using System.Runtime.InteropServices;
using System.Text;
using Sharp.Augeas.Test;
using static Sharp.Augeas.AugeasExtern;
namespace Sharp.Augeas

View File

@ -2,13 +2,20 @@ using System.Numerics;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
using Sharp.Augeas.Test;
namespace Sharp.Augeas
{
[SuppressUnmanagedCodeSecurity]
public static unsafe class AugeasExtern
{
/// <summary>
/// Used by DllImport to load the native library
/// </summary>
///
private const string _libName = "clAugeas";
[DllImport(_libName)]
public static extern IntPtr init_aug(AugSettings settings, int flags);
@ -18,10 +25,6 @@ namespace Sharp.Augeas
[DllImport(_libName)]
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>
[DllImport(_libName)]

View File

@ -5,19 +5,29 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<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>
<ItemGroup>
<ContentWithTargetPath Include="root\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>root\%(RecursiveDir)\%(Filename)%(Extension)</TargetPath>
</ContentWithTargetPath>
<PackageReference Update="Nerdbank.GitVersioning">
<Version>3.5.109</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Content Include="./Platform/Linux/libclAugeas.so">
<None Include="libclAugeas.so">
<Pack>true</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</None>
</ItemGroup>
<ItemGroup>
<None Include="libclAugeas.dylib">
<Pack>true</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -3,7 +3,7 @@ namespace Sharp.Augeas;
public class Argument : Node
{
public string Value;
public string Value { get; set; }
public bool SetValue(string newValue)
{

View File

@ -4,14 +4,14 @@ namespace Sharp.Augeas;
public class Directive : Node
{
public string Value;
public List<Argument> Arguments;
public string Value { get; set; }
public List<Argument> Arguments { get; set; }
public bool HasArguments => Arguments.Count != 0;
/// <summary>
/// Sets a new value for the directive using string literals
/// The values are separated by spaces, the first value is the directive value,
/// the other values are values corresponding to the arguments.
/// Sets a new value for the directive.
/// The first word is the directive value,
/// the following words correspond to the arguments.
/// </summary>
/// <param name="newValue"></param>
public void Set(string newValue)
@ -31,8 +31,7 @@ public class Directive : Node
}
/// <summary>
/// Set the value of this directive.
/// Note: This doesn't write any changes to disk.
/// Set the value of this directivew without writing changes to the disk.
/// </summary>
/// <param name="newValue">New value.</param>
/// <returns></returns>

View File

@ -4,9 +4,9 @@ namespace Sharp.Augeas
{
public class SuperNode : Node
{
public List<Directive> Directives;
public List<Argument> Arguments;
public List<SuperNode> SuperNodes;
public List<Directive> Directives { get; set; }
public List<Argument> Arguments { get; set; }
public List<SuperNode> SuperNodes { get; set; }
public SuperNode(Augeas augeas, string path, string id) : base(augeas, path)
{

Binary file not shown.

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",
"version": "0.9",
"version": "1.3",
"semVer1NumericIdentifierPadding": 1,
"publicReleaseRefSpec": [
"^refs/heads/master$",