diff --git a/Directory.Packages.props b/Directory.Packages.props index 3179fbd..9c85d11 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -57,4 +57,4 @@ - \ No newline at end of file + diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000..6ce9759 --- /dev/null +++ b/nuget.config @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index bf9b43a..41c4972 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,4 +1,4 @@ - + true true @@ -13,5 +13,15 @@ MIT MSBuild evaluation, fsproj file loading, and project system for F# tooling true + README.md - \ No newline at end of file + + + + + + + + + + diff --git a/src/Ionide.ProjInfo.FCS/Ionide.ProjInfo.FCS.fsproj b/src/Ionide.ProjInfo.FCS/Ionide.ProjInfo.FCS.fsproj index 82e091e..6dd31fd 100644 --- a/src/Ionide.ProjInfo.FCS/Ionide.ProjInfo.FCS.fsproj +++ b/src/Ionide.ProjInfo.FCS/Ionide.ProjInfo.FCS.fsproj @@ -12,9 +12,8 @@ + - - diff --git a/src/Ionide.ProjInfo.FCS/README.md b/src/Ionide.ProjInfo.FCS/README.md new file mode 100644 index 0000000..abc97e0 --- /dev/null +++ b/src/Ionide.ProjInfo.FCS/README.md @@ -0,0 +1,11 @@ +# Ionide.ProjInfo.FCS + +This is a helper library that provides APIs to map Ionide.ProjInfo.Types.ProjectOptions instances to FSharp.Compiler.CodeAnalysis.FSharpProjectOptions instances. + +Assuming you've already done the steps in Ionide.ProjInfo to get the ProjectOptions instances, you can use the following code to get the FSharpProjectOptions for those instances efficiently + +```fsharp +open Ionide.ProjInfo + +let fcsProjectOptions = FCS.mapManyOptions projectOptions +``` diff --git a/src/Ionide.ProjInfo.ProjectSystem/README.md b/src/Ionide.ProjInfo.ProjectSystem/README.md new file mode 100644 index 0000000..4fa5b72 --- /dev/null +++ b/src/Ionide.ProjInfo.ProjectSystem/README.md @@ -0,0 +1,12 @@ +# Ionide.ProjInfo.ProjectSystem + +This library provides helpers for operating an entire project system based on the data structures returned by the Ionide.ProjInfo library. + +The main entrypoint is the `ProjectController` API in the Ionide.ProjInfo.ProjectSystem workspace: + +```fsharp +type ProjectController(toolsPath: ToolsPath, workspaceLoaderFactory: ToolsPath -> IWorkspaceLoader) = + ... +``` + +From there you can load specific projects, get their dependencies, and more. diff --git a/src/Ionide.ProjInfo.Sln/Ionide.ProjInfo.Sln.csproj b/src/Ionide.ProjInfo.Sln/Ionide.ProjInfo.Sln.csproj index a9cae61..44c668a 100644 --- a/src/Ionide.ProjInfo.Sln/Ionide.ProjInfo.Sln.csproj +++ b/src/Ionide.ProjInfo.Sln/Ionide.ProjInfo.Sln.csproj @@ -7,12 +7,4 @@ FULL_SLN_PARSER;STANDALONEBUILD;$(DefineConstants) true - - - - - - - - - \ No newline at end of file + diff --git a/src/Ionide.ProjInfo.Tool/Ionide.ProjInfo.Tool.fsproj b/src/Ionide.ProjInfo.Tool/Ionide.ProjInfo.Tool.fsproj index 3d4efb5..ffa4aa0 100644 --- a/src/Ionide.ProjInfo.Tool/Ionide.ProjInfo.Tool.fsproj +++ b/src/Ionide.ProjInfo.Tool/Ionide.ProjInfo.Tool.fsproj @@ -19,10 +19,8 @@ - - - - + + diff --git a/src/Ionide.ProjInfo.Tool/README.md b/src/Ionide.ProjInfo.Tool/README.md new file mode 100644 index 0000000..d453b1a --- /dev/null +++ b/src/Ionide.ProjInfo.Tool/README.md @@ -0,0 +1,21 @@ +# Ionide.ProjInfo.Tool + +A .NET SDK tool that allows for quick parsing of projects and solutions. + +Broadly, the tool has three kinds of arguments: + + +### Loading args + +``` +--project the path to a project file to load +--solution the path to a solution file to load +``` + +### How to load a project + +By default you will use the standard MSBuild loader, but specifying `--graph` will use the MSBuild graph loader. + +### What to parse the results into + +By default you will get a structured text version of the Ionide project options for the project(s). If you want, you can get the FCS ProjectOptions versions by adding the `--fcs` flag. Finally, you can get project JSON with `--serialize` as well. diff --git a/src/Ionide.ProjInfo/Ionide.ProjInfo.fsproj b/src/Ionide.ProjInfo/Ionide.ProjInfo.fsproj index b5e8c22..ab31344 100644 --- a/src/Ionide.ProjInfo/Ionide.ProjInfo.fsproj +++ b/src/Ionide.ProjInfo/Ionide.ProjInfo.fsproj @@ -17,11 +17,9 @@ - - - - + + diff --git a/src/Ionide.ProjInfo/Library.fs b/src/Ionide.ProjInfo/Library.fs index b006579..92a1a75 100644 --- a/src/Ionide.ProjInfo/Library.fs +++ b/src/Ionide.ProjInfo/Library.fs @@ -102,7 +102,7 @@ module SdkDiscovery = Path: DirectoryInfo } - /// Given the DOTNET_sROOT, that is the directory where the `dotnet` binary is present and the sdk/runtimes/etc are, + /// Given the DOTNET_ROOT, that is the directory where the `dotnet` binary is present and the sdk/runtimes/etc are, /// enumerates the available SDKs in descending version order let sdks (dotnetBinaryPath: FileInfo) : DotnetSdkInfo[] = execDotnet true dotnetBinaryPath.Directory dotnetBinaryPath [ "--list-sdks" ] diff --git a/src/Ionide.ProjInfo/README.md b/src/Ionide.ProjInfo/README.md new file mode 100644 index 0000000..0c9c7ab --- /dev/null +++ b/src/Ionide.ProjInfo/README.md @@ -0,0 +1,38 @@ +# Ionide.Proj-Info + +This project loads some MSBuild specific assemblies at runtime so that you can use an existing MSBuild installation instead of (incorrectly) bundling it yourself. Somewhat similar to how [MSBuildLocator](https://github.com/microsoft/MSBuildLocator) loads the correct assemblies. +Because of this you need to add a direct dependency on `Microsoft.Build.Framework` and `NuGet.Frameworks` but keep excluded them at runtime. + +``` + + + +``` + +Next, you first need to initialize the MsBuild integration. + +```fsharp +open Ionide.ProjInfo + +let projectDirectory: DirectoryInfo = yourProjectOrSolutionFolder +let toolsPath = Init.init projectDirectory None +``` + +With the `toolsPath` you can create a `loader` + +```fsharp +let defaultLoader: IWorkspaceLoader = WorkspaceLoader.Create(toolsPath, []) +// or +let graphLoader: IWorkspaceLoader = WorkspaceLoaderViaProjectGraph.Create(toolsPath, []) +``` + +Using the `IWorkspaceLoader` you can load projects or solutions. +Events are being emitted while projects/solutions are loaded. +You typically want to subscribe to this before you load anything. + +```fsharp +let subscription: System.IDisposable = defaultLoader.Notifications.Subscribe(fun msg -> printfn "%A" msg) +let projectOptions = loader.LoadProjects([ yourFsProjPath ]) |> Seq.toArray +``` + +From here consider using Ionide.ProjInfo.FCS to map the `projectOptions` to F# Compiler `ProjectOptions`, or use the `projectOptions` directly to get information about the project. diff --git a/test/Ionide.ProjInfo.Tests/Ionide.ProjInfo.Tests.fsproj b/test/Ionide.ProjInfo.Tests/Ionide.ProjInfo.Tests.fsproj index 985baaf..bc70fe3 100644 --- a/test/Ionide.ProjInfo.Tests/Ionide.ProjInfo.Tests.fsproj +++ b/test/Ionide.ProjInfo.Tests/Ionide.ProjInfo.Tests.fsproj @@ -39,9 +39,9 @@ - - - - + + + +