Skip to content

Commit

Permalink
merge devel-apilist
Browse files Browse the repository at this point in the history
  • Loading branch information
smdn committed Dec 30, 2021
2 parents 1a4076e + 153c30e commit 833d4f1
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Smdn.Net.MuninNode.dll (Smdn.Net.MuninNode-1.0beta3 (net5.0))
// Name: Smdn.Net.MuninNode
// AssemblyVersion: 1.0.0.0
// InformationalVersion: 1.0beta3 (net5.0)
// TargetFramework: .NETCoreApp,Version=v5.0
// Configuration: Release

using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using Smdn.Net.MuninPlugin;

namespace Smdn.Net.MuninNode {
public class LocalNode : IDisposable {
public LocalNode(IReadOnlyList<Plugin> plugins, string hostName, TimeSpan timeout, int portNumber, Version nodeVersion = null, IServiceProvider serviceProvider = null) {}

public string HostName { get; }
public IPEndPoint LocalEndPoint { get; }
public IReadOnlyList<Plugin> Plugins { get; }
public TimeSpan Timeout { get; }

[AsyncStateMachine]
public Task AcceptClientAsync() {}
public void Close() {}
public void Start() {}
void IDisposable.Dispose() {}
}
}

namespace Smdn.Net.MuninPlugin {
public class Plugin {
public Plugin(string name, PluginGraphConfiguration graphConfiguration, PluginFieldConfiguration fieldConfiguration) {}

public PluginFieldConfiguration FieldConfiguration { get; }
public PluginGraphConfiguration GraphConfiguration { get; }
public string Name { get; }
}

public abstract class PluginFieldConfiguration {
protected PluginFieldConfiguration(string defaultGraphStyle, Range? warningValueRange = null, Range? criticalValueRange = null) {}

public Range? CriticalValueRange { get; }
public string DefaultGraphStyle { get; }
public Range? WarningValueRange { get; }

public abstract IEnumerable<PluginField> FetchFields();
}

public class PluginGraphConfiguration {
public PluginGraphConfiguration(string title, string category, string verticalLabel, bool scale, string arguments, TimeSpan updateRate, int? width = null, int? height = null) {}

public string Arguments { get; }
public string Category { get; }
public int? Height { get; }
public bool Scale { get; }
public string Title { get; }
public TimeSpan UpdateRate { get; }
public string VerticalLabel { get; }
public int? Width { get; }
}

public readonly struct PluginField {
public PluginField(string label, double @value, string graphStyle = null) {}
public PluginField(string name, string label, double @value, string graphStyle = null) {}

public string GraphStyle { get; }
public string Label { get; }
public string Name { get; }
public double? Value { get; }

public static PluginField CreateUnknownValueField(string label, string graphStyle = null) {}
public static PluginField CreateUnknownValueField(string name, string label, string graphStyle = null) {}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Smdn.Net.MuninNode.dll (Smdn.Net.MuninNode-1.0beta3 (netstandard2.1))
// Name: Smdn.Net.MuninNode
// AssemblyVersion: 1.0.0.0
// InformationalVersion: 1.0beta3 (netstandard2.1)
// TargetFramework: .NETStandard,Version=v2.1
// Configuration: Release

using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using Smdn.Net.MuninPlugin;

namespace Smdn.Net.MuninNode {
public class LocalNode : IDisposable {
public LocalNode(IReadOnlyList<Plugin> plugins, string hostName, TimeSpan timeout, int portNumber, Version nodeVersion = null, IServiceProvider serviceProvider = null) {}

public string HostName { get; }
public IPEndPoint LocalEndPoint { get; }
public IReadOnlyList<Plugin> Plugins { get; }
public TimeSpan Timeout { get; }

[AsyncStateMachine]
public Task AcceptClientAsync() {}
public void Close() {}
public void Start() {}
void IDisposable.Dispose() {}
}
}

namespace Smdn.Net.MuninPlugin {
public class Plugin {
public Plugin(string name, PluginGraphConfiguration graphConfiguration, PluginFieldConfiguration fieldConfiguration) {}

public PluginFieldConfiguration FieldConfiguration { get; }
public PluginGraphConfiguration GraphConfiguration { get; }
public string Name { get; }
}

public abstract class PluginFieldConfiguration {
protected PluginFieldConfiguration(string defaultGraphStyle, Range? warningValueRange = null, Range? criticalValueRange = null) {}

public Range? CriticalValueRange { get; }
public string DefaultGraphStyle { get; }
public Range? WarningValueRange { get; }

public abstract IEnumerable<PluginField> FetchFields();
}

public class PluginGraphConfiguration {
public PluginGraphConfiguration(string title, string category, string verticalLabel, bool scale, string arguments, TimeSpan updateRate, int? width = null, int? height = null) {}

public string Arguments { get; }
public string Category { get; }
public int? Height { get; }
public bool Scale { get; }
public string Title { get; }
public TimeSpan UpdateRate { get; }
public string VerticalLabel { get; }
public int? Width { get; }
}

public readonly struct PluginField {
public PluginField(string label, double @value, string graphStyle = null) {}
public PluginField(string name, string label, double @value, string graphStyle = null) {}

public string GraphStyle { get; }
public string Label { get; }
public string Name { get; }
public double? Value { get; }

public static PluginField CreateUnknownValueField(string label, string graphStyle = null) {}
public static PluginField CreateUnknownValueField(string name, string label, string graphStyle = null) {}
}
}

11 changes: 11 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ SPDX-License-Identifier: MIT
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)\StyleCop.Analyzers.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

<ItemGroup Label="API list generator">
<PackageReference Include="Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks" Version="1.0.2" Condition=" '$(Configuration)' == 'Release' ">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<PropertyGroup Label="API list generator">
<APIListOutputBaseDirectory>$(MSBuildThisFileDirectory)..\doc\api-list\</APIListOutputBaseDirectory>
</PropertyGroup>

<PropertyGroup Label="metadata">
<Authors>smdn</Authors>
<CopyrightYear>2021</CopyrightYear>
Expand Down
17 changes: 17 additions & 0 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,21 @@ SPDX-License-Identifier: MIT
<Target Name="WarnNupkgConfiguration" AfterTargets="Pack" Condition=" '$(Configuration)' != 'Release' ">
<Warning Text="generated nupkg with configuration '$(Configuration)'" />
</Target>

<Import Project="$(NuGetPackageRoot)\smdn.reflection.reversegenerating.listapi.msbuild.tasks\1.0.2\tasks\net6.0\GenerateApiList.task" Condition=" '$(Configuration)' == 'Release' " />

<Target Name="GenerateAPIListOfPackage" AfterTargets="Pack" Condition=" '$(Configuration)' == 'Release' " Label="API list generator">
<ItemGroup>
<GenerateApiListTargets Include="%(NuGetPackInput.Identity)" Condition="
'%(NuGetPackInput.MSBuildSourceProjectFile)' == '$(MSBuildProjectFullPath)' and
'' != '%(NuGetPackInput.TargetFramework)' and
$([System.String]::new('%(NuGetPackInput.TargetPath)').EndsWith('.dll'))
">
<OutputFilePath>$(APIListOutputBaseDirectory)\$(AssemblyName)\$(AssemblyName)-%(NuGetPackInput.TargetFramework).apilist.cs</OutputFilePath>
<LoadIntoReflectionOnlyContext>$(APIListLoadIntoReflectionOnlyContext)</LoadIntoReflectionOnlyContext>
</GenerateApiListTargets>
</ItemGroup>

<GenerateApiList Assemblies="@(GenerateApiListTargets)" />
</Target>
</Project>
4 changes: 4 additions & 0 deletions src/Smdn.Net.MuninNode/Smdn.Net.MuninNode.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ SPDX-License-Identifier: MIT
<VersionSuffix>beta3</VersionSuffix>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' " Label="Required properties to generate API list">
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

<PropertyGroup Label="metadata">
<Description>
<![CDATA[Smdn.Net.MuninNode is a .NET implementation of Munin-Node and Munin-Plugin.
Expand Down

0 comments on commit 833d4f1

Please sign in to comment.