Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate nuget package for System.Device.Gpio #28

Merged
merged 3 commits into from Nov 8, 2018
Merged

Generate nuget package for System.Device.Gpio #28

merged 3 commits into from Nov 8, 2018

Conversation

joperezr
Copy link
Member

@joperezr joperezr commented Nov 7, 2018

cc: @ericstj @safern

These changes will add the required targets in order to produce a package for System.Device.Gpio. For now, it will have the following layout:

ref/
  netstandard2.0/
    System.Device.Gpio.dll
runtimes/
  linux-x64/
    lib/
      netstandard2.0/
        System.Device.Gpio.dll
  win/
    lib/
      netstandard2.0/
        System.Device.Gpio.dll

We will also need to eventually add one more asset lib/netstandard2.0/SYstem.Device.Gpio.dll to be a turd assembly so that we do in fact support netstandard2.0

@raffaeler
Copy link
Contributor

I love taking advantage of the reference assemblies to provide multiple implementations.
It would be even better if the nuget system allowed to take in input an additional discriminator to differentiate the physical device.

Imagine there are two devices (such as OrangePi or RasperryPi) supporting a different pull-up resistor configuration. Both can run Ubuntu, so I can't differentiate the GPIO library by RIDs.
Instead I would like to have a new discriminator, possibly a user-defined string specified in the csproj, that can be used by nuget to match the required library.
Probably it would be better to have the ability to specify multiple alternate discriminators that would trigger a "first-match" logic.

I would post this in the nuget repo, but it would be hard to explain as this example perfectly match on hardware libraries (but I have other non-hw scenarios in mind).

@joperezr
Copy link
Member Author

joperezr commented Nov 7, 2018

For physical devices, like RaspberryPi or Hummingboards, what we are doing is that the Linux implementation contains those different drivers that are tied to different boards. We also have some default constructors that depending on the board you are running on, it will get you the driver that best applies, but this can only be done at runtime, so it can't be a NuGet feature.

@raffaeler
Copy link
Contributor

@joperezr I get your point, but I still see a value in taking a different implementation depending on a value specified in the referencing project. This could avoid a lot of pre-processor directives in the final app.
Beyond the GPIO, where I agree you can level the differences at runtime, there are other hw peripherals that may be missing and would require a different strategy that would be a useless weight on other devices.

src/System.Device.Gpio/System.Device.Gpio.csproj Outdated Show resolved Hide resolved
build.proj Outdated Show resolved Hide resolved
Directory.Build.props Outdated Show resolved Hide resolved
Directory.Build.targets Outdated Show resolved Hide resolved
<PackageTags>.NET Core GPIO Pins BCM2835 Raspberry Pi IoT</PackageTags>
</PropertyGroup>

<Import Project="..\..\Directory.Build.props" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We typically import this one at the beginning to respect the sdk convention in hierarchy

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that that one will import the arcade sdk, which will set the Version of the package, so I want to set Major and Minor version first.

<Project>
<!-- Packaging related properties -->
<PropertyGroup>
<MajorVersion>0</MajorVersion>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you planning on sharing a version across packages?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to set the package version. It will also set the Assembly version for now but that is fine because I also want that to be 0.1.0.0. Once we ship a different version of assembly this will change.

<!-- Only produce reference assembly in one of our inner builds -->
<ProduceReferenceAssembly Condition="'$(TargetsWindows)' == 'true'">true</ProduceReferenceAssembly>
<TargetRefPath>$(OutputPath)$(TargetFramework)\$(MSBuildProjectName).dll</TargetRefPath>
<IsPackable>true</IsPackable>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought you had to set a IncludeBuildOutput property and set it to false so that it doesn't include it in the package.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is set in the Directory.Build.props of this project. I wanted to move all the packaging related things over there, except for this property so that when we look at the project we know that this project will generate a package.

@joperezr joperezr merged commit e4e9ba0 into dotnet:master Nov 8, 2018
@joperezr joperezr deleted the Packaging branch November 8, 2018 17:31
@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants