Skip to content

fix: Support libraries using TargetFrameworks property #12

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

Merged
merged 13 commits into from
Apr 14, 2025

Conversation

roboz0r
Copy link
Contributor

@roboz0r roboz0r commented Apr 5, 2025

Copies the build directory to buildCrossTargeting when creating packages so the SDK will work as expected with libraries using TargetFrameworks dotnet/msbuild#1860

@MangelMaxime
Copy link
Member

Hello,

Thanks for the PR could you please add tests too to check that everything works as expected for TargetFrameworks too.

I don't think we need the full suit of test, the following should be enough I think:

  • Fail if we don't have the the required tag
  • Tags, files, etc. are added if all is configured correctly (can be done in a single test I think)

@roboz0r
Copy link
Contributor Author

roboz0r commented Apr 5, 2025

Creating a test project like the others in the repo will work but won't demonstrate the fix. Using explicit Import like the existing tests works fine without the changes I made.

The way I tested it manually was:

  • Create the Fable.Package.SDK package locally with an incremented version number e.g. 1.4.0
  • Create a test project library with <PackageReference Include="Fable.Package.SDK" Version="1.4.0">
  • Add nuget.config for a local package reference
<configuration>
  <packageSources>
    <!-- The <clear/> line below removes the global NuGet package sources. -->
    <clear />
    <add key="nuget" value="https://api.nuget.org/v3/index.json" />
    <add key="local" value="C:\Users\Robert\GitHub\sdk-test\packages" />
  </packageSources>
  <packageSourceMapping>
    <!-- key value for <packageSource> should match key values from <packageSources> element -->
    <packageSource key="nuget">
      <package pattern="*" />
    </packageSource>
    <packageSource key="local">
      <package pattern="Fable.Package.SDK" />
    </packageSource>
  </packageSourceMapping>
</configuration>
  • Run dotnet pack on sdk-test project to confirm errors without and success with required tags
  • Inspect the produced package and confirm the .fs files were bundled

I'm not sure if there's a good way to automate this for a test?

@MangelMaxime
Copy link
Member

Creating a test project like the others in the repo will work but won't demonstrate the fix. Using explicit Import like the existing tests works fine without the changes I made.

Even, by changing <TargetFramework>netstandard2.0</TargetFramework> to <TargetFrameworks>netstandard2.0</TargetFrameworks> ?

I'm not sure if there's a good way to automate this for a test?

We could automate all this setup, but this is probably more work for something which is not too worth. If the issue keep happening because we release regression then it could be worth considering in the future.

Thanks for the PR, I will review it a little later

@roboz0r
Copy link
Contributor Author

roboz0r commented Apr 7, 2025

Yes, I've published XParsec by using direct Import here and using <TargetFrameworks>net8.0;netstandard2.0</TargetFrameworks> which is confirmed working as expected.

https://github.com/roboz0r/XParsec/blob/fa8fcff6e37484fd16bee5105a9892faaeefbe01/src/XParsec/XParsec.fsproj#L41-L42

@roboz0r
Copy link
Contributor Author

roboz0r commented Apr 8, 2025

I've added some basic tests which should identify any regressions that would make the targets multi-tfm incompatible. I didn't go the whole way as I described in the manual testing.

@roboz0r roboz0r requested a review from MangelMaxime April 12, 2025 06:36
@MangelMaxime MangelMaxime merged commit d8b16c7 into fable-compiler:main Apr 14, 2025
1 check passed
@MangelMaxime
Copy link
Member

Thanks for the PR, it has been released in 1.3.1

@roboz0r
Copy link
Contributor Author

roboz0r commented Apr 15, 2025

Looks like you went to the effort of the full test simulation. Nice work!

@MangelMaxime
Copy link
Member

Looks like you went to the effort of the full test simulation. Nice work!

Yes, I needed to do that because otherwise the test was succeeding even without your fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SDK does not run on projects targeting multiple TFMs
2 participants