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

📝 Guidance for what an Sdk looks like #1439

Open
rainersigwald opened this issue Dec 5, 2016 · 13 comments
Open

📝 Guidance for what an Sdk looks like #1439

rainersigwald opened this issue Dec 5, 2016 · 13 comments
Labels
needs-design Requires discussion with the dev team before attempting a fix. triaged
Milestone

Comments

@rainersigwald
Copy link
Member

rainersigwald commented Dec 5, 2016

What makes a good Sdk? What functionality must it provide? Should it always include Common.targets? Should we define a new minimum target surface?

What do dependencies look like?

Must every Sdk have both props and targets? Should an Sdk define a version-number that can be used in other Sdks for error checking?

We should pull heavily from the experience of the existing Web and NET Sdks, but temper that with understanding that they were originally defined for something else.

Later edits:

@rainersigwald rainersigwald added the needs-design Requires discussion with the dev team before attempting a fix. label Dec 5, 2016
@rainersigwald rainersigwald added this to the Feature: Sdks milestone Dec 5, 2016
@gulshan
Copy link

gulshan commented Dec 7, 2016

MSBuild SDKs are very similar to plugins in Gradle. So, we can have a look on their description of plugins-
https://docs.gradle.org/current/userguide/plugins.html

@cdmihai
Copy link
Contributor

cdmihai commented Dec 7, 2016

A point to consider: what is the difference between SDKs and "normal" PackageReference packages that bring build logic? Both of them lead to extra top and bottom imports, but via different mechanism (sdks have msbuild awareness whereas build augmentor PackageReferences use the common props / targets extensions).

When should users use one against the other?

@borgdylan
Copy link

I have a related use case: bringing in a compiler with targets inside a package that depends on the Sdks installed by the dotnet CLI tooling. How will that work?

@cdmihai
Copy link
Contributor

cdmihai commented Dec 20, 2016

@borgdylan

With the current implementation, I don't think there's a way to have a node in the PackageReference closure depend on a node in the SDK closure. With the way the current design is going, you'd have to make a third party SDK with the compiler logic, and have it depend on some other SDK (though the following are not yet supported: third party SDKs, inter-SDK dependencies, SDK closure, and on the fly SDK acquisition).

This is because PackateReference is an item, and items are only evaluated in msbuild after imports and properties. Since the SDK closure is computed in an earlier step of the evaluation, you can't have a thing from the future influence a thing from the past (the SDK version constraint of a PackageReference node affecting the dependency resolution in the SDK graph).

@borgdylan
Copy link

borgdylan commented Dec 20, 2016

I do not wish to write an Sdk myself. I'd rather import targets (that I will write) from a path based on the package root property that is already available by filling in a property in the Sdk that comes with the CLI. The .NET Sdk happens to require a property that points to the targets for a compiler i.e. the Sdk already lets third party languages participate.. I just wanted to know if there will be an official story or if I could just hack my way to something that works.

@dsplaisted
Copy link
Member

@borgdylan Take a look at dotnet/sdk#539. I think if we do that, you will be able to have a compiler in a NuGet package by setting the LanguageTargets property to a .targets file in your NuGet package in the auto-imported Build\<PackageName>.props file.

@borgdylan
Copy link

borgdylan commented Dec 21, 2016

So far language targets has worked for me when setting a hard coded path(I'm still authoring the targets). Once the bug regarding netxy targeting is fixed on non windows I'll try the nuget route as well.

@enricosada
Copy link

@borgdylan see FSharp.NET.Sdk package, works really well to add F# support using LanguageTargets (thx to @dsplaisted ).

About sdk, ihmo can be useful to customize some behaviours, mostly related to restore i think:

  • override or customize restore target to use another nuget client (like Paket /cc @forki)
  • include of <PackageReference dinamically
  • languages
  • evaluation of project pre-restore

@borgdylan
Copy link

If LanguageTargets works OK now, I won't need to write an Sdk but only targets files. I don't use Paket with my custom language but normal NuGet.

@enricosada
Copy link

@borgdylan paket doesnt matter, was an example of configuration of sdk.

For language yes, afaik, you can just use a PackageReference (who contains a props file with the LanguageTarget property set).

I used an sdk for F# because like that i can enable dotnet pack with multiple <TargetFrameworks> too.

@borgdylan
Copy link

Shouldn't that work automatically without writing an Sdk? Why does the language specific support have to drive multi-targeting builds?

@bbowman
Copy link

bbowman commented Mar 16, 2017

@borgdylan @enricosada I'm a little confused following this discussion. How is the LanguageTarget property coming into play here? My team https://github.com/Microsoft/WinObjC is currently just using a nuget package for our compiler + sdk and I want to understand the implications here.

@Nirmal4G
Copy link
Contributor

Nirmal4G commented Apr 18, 2018

I have been developing experimental SDKs for my projects.
Here's the MSBuild-Sdks repo that I currently hold these SDKs.

They are experimental, bit of mixed from existing projects, props, targets and some my own to get my projects going. some might not build properly.

But I hope these will provide some insight on what I was hoping to achieve! and possibly give a standard for SDKs design! Also #1686 (comment)

@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-design Requires discussion with the dev team before attempting a fix. triaged
Projects
None yet
Development

No branches or pull requests

9 participants