未验证 提交 dd3dbcc6 编写于 作者: J Jose Perez Rodriguez 提交者: GitHub

Adding Package validation to the repo in order to catch breaking changes early (#1647)

* Adding Package validation to the repo in order to catch breaking changes early

* Address PR Feedback
上级 4c7e0d7c
此差异已折叠。
......@@ -5,7 +5,13 @@
<MinorVersion>6</MinorVersion>
<Description>This package provides a set of Device Bindings that use System.Device.Gpio package to communicate with a microcontroller.</Description>
<PackageTags>.NET Core GPIO Pins SPI I2C PWM BCM2835 BCM2837 RPi IoT Device Bindings</PackageTags>
<EnablePackageValidation>true</EnablePackageValidation>
<PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion>
</PropertyGroup>
<ItemGroup>
<PackageDownload Include="Iot.Device.Bindings" Version="[1.0.0]" />
</ItemGroup>
<Import Project="../../Directory.Build.props" />
</Project>
......@@ -4,6 +4,7 @@
<TargetFrameworks>netstandard2.0;net5.0;netcoreapp2.1</TargetFrameworks>
<LangVersion>9</LangVersion>
<Nullable>enable</Nullable>
<DefineConstants>$(DefineConstants);BUILDING_IOT_DEVICE_BINDINGS</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EnableDefaultItems>false</EnableDefaultItems>
<IsPackable>true</IsPackable>
......
<?xml version="1.0" encoding="utf-8"?>
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- All of these breaking changes are against 1.0.0 windows runtime asset which nobody compiles against so we are fine in taking them. -->
<Suppression>
<DiagnosticId>CP0007</DiagnosticId>
<Target>T:System.Device.Gpio.Drivers.HummingBoardDriver</Target>
<Left>runtimes/win/lib/netstandard2.0/System.Device.Gpio.dll</Left>
<Right>lib/netstandard2.0/System.Device.Gpio.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:System.Device.Gpio.Drivers.LibGpiodDriver.#ctor</Target>
<Left>runtimes/win/lib/netstandard2.0/System.Device.Gpio.dll</Left>
<Right>lib/netstandard2.0/System.Device.Gpio.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0007</DiagnosticId>
<Target>T:System.Device.Gpio.Drivers.RaspberryPi3Driver</Target>
<Left>runtimes/win/lib/netstandard2.0/System.Device.Gpio.dll</Left>
<Right>lib/netstandard2.0/System.Device.Gpio.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
\ No newline at end of file
......@@ -6,7 +6,13 @@
<Description>The System.Device.Gpio package supports general-purpose I/O (GPIO) pins, PWM, I2C, SPI and related interfaces for interacting with low level hardware pins to control hardware sensors, displays and input devices on single-board-computers; Raspberry Pi, BeagleBoard, HummingBoard, ODROID, and other single-board-computers that are supported by Linux and Windows 10 IoT Core OS can be used with .NET Core and System.Device.Gpio. On Windows 10 IoT Core OS, the library wraps the Windows.Devices.Gpio.dll assembly. On Linux, the library supports three driver modes: libgpiod for fast full-featured GPIO access on all Linux distros since version 4.8 of the Linux kernel; slower and limited-functionality GPIO access via the deprecated Sysfs interface (/sys/class/gpio) when running on older Linux distro versions with a Linux kernel older than version 4.8; and lastly board-specific Linux drivers that access GPIO addresses in /dev/mem for fasted performance at the trade-off of being able to run on very specific versions of single-board-computers. In the future, the board-specific Linux drivers may be removed in favor of only supporting libgpiod and sysfs Linux interfaces. In addition to System.Device.Gpio, the optional IoT.Device.Bindings NuGet package contains device bindings for many sensors, displays, and input devices that can be used with System.Device.Gpio.
</Description>
<PackageTags>.NET Core GPIO Pins SPI I2C PWM BCM2835 RPi IoT</PackageTags>
<PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion>
<EnablePackageValidation>true</EnablePackageValidation>
</PropertyGroup>
<ItemGroup>
<PackageDownload Include="System.Device.Gpio" Version="[1.0.0]" />
</ItemGroup>
<Import Project="..\..\Directory.Build.props" />
</Project>
......@@ -8,7 +8,6 @@
<ItemGroup>
<Compile Include="*.cs" />
<Compile Include="$(MSBuildThisFileDirectory)/../Common/System/Runtime/CompilerServices/IsExternalInit.cs" Condition="'$(TargetFramework)' == 'netcoreapp2.1'" />
<None Include="README.md" />
<ProjectReference Include="$(MainLibraryPath)System.Device.Gpio.csproj" />
<ProjectReference Include="..\Common\CommonHelpers.csproj" />
......
......@@ -22,6 +22,9 @@
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<Compile Include="FrameworkCompatibilityExtensions.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' Or '$(TargetFramework)' == 'netstandard2.0'">
<Compile Include="IsExternalInit.cs" />
</ItemGroup>
......
......@@ -9,7 +9,12 @@ namespace Iot.Device
/// <summary>
/// .NET Core compatibility helper functions (methods that do not exist in .NET Framework)
/// </summary>
public static class FrameworkCompatibilityExtensions
#if BUILDING_IOT_DEVICE_BINDINGS
internal
#else
public
#endif
static class FrameworkCompatibilityExtensions
{
public static bool StartsWith(this Span<char> span, string value)
{
......
......@@ -8,7 +8,12 @@ namespace System.Runtime.CompilerServices
/// This dummy class is required to compile records when targeting .NET Standard
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static class IsExternalInit
#if BUILDING_IOT_DEVICE_BINDINGS
internal
#else
public
#endif
static class IsExternalInit
{
}
}
......@@ -10,7 +10,12 @@ namespace Iot.Device
/// <summary>
/// Implementations of some functions missing in older .NET versions
/// </summary>
public static class MathExtensions
#if BUILDING_IOT_DEVICE_BINDINGS
internal
#else
public
#endif
static class MathExtensions
{
/// <summary>
/// Returns val, limited to the range min-max (inclusive)
......@@ -18,7 +23,7 @@ namespace Iot.Device
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double Clamp(double val, double min, double max)
{
#if NETSTANDARD2_0
#if !NET5_0_OR_GREATER
if (val < min)
{
return min;
......@@ -41,7 +46,7 @@ namespace Iot.Device
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Clamp(int val, int min, int max)
{
#if NETSTANDARD2_0
#if !NET5_0_OR_GREATER
if (val < min)
{
return min;
......@@ -64,7 +69,7 @@ namespace Iot.Device
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte Clamp(byte val, byte min, byte max)
{
#if NETSTANDARD2_0
#if !NET5_0_OR_GREATER
if (val < min)
{
return min;
......@@ -87,7 +92,7 @@ namespace Iot.Device
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static long Clamp(long val, long min, long max)
{
#if NETSTANDARD2_0
#if !NET5_0_OR_GREATER
if (val < min)
{
return min;
......@@ -110,7 +115,7 @@ namespace Iot.Device
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint Clamp(uint val, uint min, uint max)
{
#if NETSTANDARD2_0
#if !NET5_0_OR_GREATER
if (val < min)
{
return min;
......
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Runtime.CompilerServices
{
internal class IsExternalInit
{
}
}
......@@ -14,7 +14,7 @@
<ItemGroup>
<Compile Include="GrovePi.cs" />
<Compile Include="Models\*.cs" />
<Compile Include="Models\*.cs" />
<Compile Include="Sensors\*.cs" />
</ItemGroup>
......
......@@ -7,7 +7,6 @@
<ItemGroup>
<ProjectReference Include="$(MainLibraryPath)System.Device.Gpio.csproj" />
<Compile Include="$(MSBuildThisFileDirectory)/../Common/System/Runtime/CompilerServices/IsExternalInit.cs" Condition="'$(TargetFramework)' == 'netcoreapp2.1'" />
<Compile Include="*.cs" />
<None Include="README.md" />
</ItemGroup>
......
......@@ -8,7 +8,6 @@
<ItemGroup>
<ProjectReference Include="$(MainLibraryPath)System.Device.Gpio.csproj" />
<ProjectReference Include="..\Common\CommonHelpers.csproj" />
<Compile Include="$(MSBuildThisFileDirectory)/../Common/System/Runtime/CompilerServices/IsExternalInit.cs" Condition="'$(TargetFramework)' == 'netcoreapp2.1'" />
<Compile Include="*.cs" />
<Compile Remove="samples\**" />
<Compile Include="Models\*.cs" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册