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

Initial FSharp.Analyzers.Build setup. #139

Merged
merged 9 commits into from
Nov 14, 2023
Merged

Conversation

nojaf
Copy link
Contributor

@nojaf nojaf commented Oct 31, 2023

Trying out the pointer of @baronfel in #135 (comment)

I'm a little lost on how to start on the buildMultitargeting bit.

@nojaf
Copy link
Contributor Author

nojaf commented Oct 31, 2023

@baronfel, ok this almost works.

I'm currently doing in repositories Directory.Build.props:

<PropertyGroup>
    <FSharpAnalyzersOtherFlags>--analyzers-path $(PkgG-Research_FSharp_Analyzers)/analyzers/dotnet/fs --verbose --report $(MSBuildProjectName)-$(TargetFramework).sarif</FSharpAnalyzersOtherFlags>
</PropertyGroup>
<ItemGroup>
  <PackageReference Include="FSharp.Analyzers.Build" PrivateAssets="all" />
  <PackageReference Include="G-Research.FSharp.Analyzers">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>build</IncludeAssets>
  </PackageReference>
</ItemGroup>

The only real thing missing would be making PkgG-Research_FSharp_Analyzers to work.

<FSharpAnalyzersOtherFlags>--analyzers-path $(PkgG-Research_FSharp_Analyzers)/analyzers/dotnet/fs --verbose --report $(MSBuildProjectName)-$(TargetFramework).sarif</FSharpAnalyzersOtherFlags>

I'm assuming the moment the g.props file is loaded, the $(TargetFramework) isn't set yet.
So

  <PropertyGroup Condition=" '$(TargetFramework)' == 'net7.0' AND '$(ExcludeRestorePackageImports)' != 'true' ">
    <PkgIonide_KeepAChangelog_Tasks Condition=" '$(PkgIonide_KeepAChangelog_Tasks)' == '' ">C:\Users\nojaf\.nuget\packages\ionide.keepachangelog.tasks\0.1.8</PkgIonide_KeepAChangelog_Tasks>
    <PkgG-Research_FSharp_Analyzers Condition=" '$(PkgG-Research_FSharp_Analyzers)' == '' ">C:\Users\nojaf\.nuget\packages\g-research.fsharp.analyzers\0.1.6</PkgG-Research_FSharp_Analyzers>
    <PkgFSharp_Core Condition=" '$(PkgFSharp_Core)' == '' ">C:\Users\nojaf\.nuget\packages\fsharp.core\8.0.100-beta.23519.2</PkgFSharp_Core>
    <PkgFSharp_Compiler_Service Condition=" '$(PkgFSharp_Compiler_Service)' == '' ">C:\Users\nojaf\.nuget\packages\fsharp.compiler.service\43.8.100-preview.23519.2</PkgFSharp_Compiler_Service>
    <PkgFSharp_Analyzers_Build Condition=" '$(PkgFSharp_Analyzers_Build)' == '' ">C:\Users\nojaf\.nuget\packages\fsharp.analyzers.build\0.18.3</PkgFSharp_Analyzers_Build>
    <PkgFantomas_Core Condition=" '$(PkgFantomas_Core)' == '' ">C:\Users\nojaf\.nuget\packages\fantomas.core\6.2.0</PkgFantomas_Core>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(TargetFramework)' == 'net8.0' AND '$(ExcludeRestorePackageImports)' != 'true' ">
    <PkgIonide_KeepAChangelog_Tasks Condition=" '$(PkgIonide_KeepAChangelog_Tasks)' == '' ">C:\Users\nojaf\.nuget\packages\ionide.keepachangelog.tasks\0.1.8</PkgIonide_KeepAChangelog_Tasks>
    <PkgG-Research_FSharp_Analyzers Condition=" '$(PkgG-Research_FSharp_Analyzers)' == '' ">C:\Users\nojaf\.nuget\packages\g-research.fsharp.analyzers\0.1.6</PkgG-Research_FSharp_Analyzers>
    <PkgFSharp_Core Condition=" '$(PkgFSharp_Core)' == '' ">C:\Users\nojaf\.nuget\packages\fsharp.core\8.0.100-beta.23519.2</PkgFSharp_Core>
    <PkgFSharp_Compiler_Service Condition=" '$(PkgFSharp_Compiler_Service)' == '' ">C:\Users\nojaf\.nuget\packages\fsharp.compiler.service\43.8.100-preview.23519.2</PkgFSharp_Compiler_Service>
    <PkgFSharp_Analyzers_Build Condition=" '$(PkgFSharp_Analyzers_Build)' == '' ">C:\Users\nojaf\.nuget\packages\fsharp.analyzers.build\0.18.3</PkgFSharp_Analyzers_Build>
    <PkgFantomas_Core Condition=" '$(PkgFantomas_Core)' == '' ">C:\Users\nojaf\.nuget\packages\fantomas.core\6.2.0</PkgFantomas_Core>
  </PropertyGroup>

doesn't work yet.

@nojaf nojaf marked this pull request as ready for review November 13, 2023 17:21
@nojaf
Copy link
Contributor Author

nojaf commented Nov 13, 2023

@dawedawe please review, I managed to make things even slightly simpler.
I think this is really a good improvement.

I moved the .fsx to .md, if there is no F# code involved it shouldn't be a script.

Copy link
Contributor

@dawedawe dawedawe left a comment

Choose a reason for hiding this comment

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

"Any sufficiently advanced technology is indistinguishable from magic."

docs/content/Getting Started Using.md Outdated Show resolved Hide resolved
docs/content/Getting Started Using.md Outdated Show resolved Hide resolved
docs/content/Getting Started Using.md Outdated Show resolved Hide resolved
@nojaf nojaf merged commit 6ee40d2 into ionide:master Nov 14, 2023
2 checks passed
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.

2 participants