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

enable deserialization of cached project file data and fix legacy project tests #139

Merged
merged 4 commits into from
Apr 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: dotnet tool restore
- name: Install latest F# from mono (.net 4.x)
if: runner.os == 'Linux'
run: ./install_mono_from_microsoft_deb_packages.sh
run: ./install_mono_from_microsoft_deb_packages.sh && which msbuild
- name: Run build
run: dotnet fake build -t Pack
- name: Upload NuGet packages
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ x86/
bld/
[Bb]in/
[Oo]bj/
*.binlog

# Visual Studio 2015 cache/options directory
.vs/
Expand Down
3 changes: 2 additions & 1 deletion src/Ionide.ProjInfo.ProjectSystem/Project.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ open FSharp.Compiler.CodeAnalysis
open Newtonsoft.Json
open Ionide.ProjInfo

type internal ProjectCrackerCache =
// need to expose this so that json.net can serialize it
type ProjectCrackerCache =
{ Options: FSharpProjectOptions
OutFile: string option
References: string list
Expand Down
6 changes: 5 additions & 1 deletion src/Ionide.ProjInfo.ProjectSystem/Workspace.fs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ let internal loadInBackground onLoaded (loader: IWorkspaceLoader) (projects: Pro

for project in resProjects do
match project.Response with
| Some res -> onLoaded (ProjectSystemState.Loaded(res.Options, res.ExtraInfo, res.Items, false))
| Some res ->
// if we have project data already then that means it was cached.
// fire a loading/loaded event pair so that outside observers get the correct loading experience
onLoaded (ProjectSystemState.Loading project.FileName )
onLoaded (ProjectSystemState.Loaded(res.Options, res.ExtraInfo, res.Items, true))
| None -> () //Shouldn't happen

otherProjects |> List.map (fun n -> n.FileName) |> getProjectOptions loader onLoaded binaryLogs
15 changes: 7 additions & 8 deletions src/Ionide.ProjInfo/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,11 @@ module LegacyFrameworkDiscovery =
// example: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
let msbuildExe =
SdkDiscovery.execDotnet vsWhereDir vsWhereExe [ "-find"; "MSBuild\**\Bin\MSBuild.exe" ]
|> Seq.last
|> FileInfo
if msbuildExe.Exists then
msbuildExe |> Some
else
None
|> Seq.tryHead
|> Option.map FileInfo
match msbuildExe with
| Some exe when exe.Exists -> Some exe
| _ -> None

let internal msbuildLibPath(msbuildDir: DirectoryInfo) =
if isLinux then
Expand Down Expand Up @@ -219,7 +218,7 @@ module Init =
let internal setupForLegacyFramework (msbuildPathDir: DirectoryInfo) =
let msbuildLibPath = LegacyFrameworkDiscovery.msbuildLibPath msbuildPathDir

// gotta set some env variables so msbuild interop works
// gotta set some env variables so msbuild interop works
if LegacyFrameworkDiscovery.isUnix then
Environment.SetEnvironmentVariable("MSBuildBinPath", "/usr/lib/mono/msbuild/Current/bin")
Environment.SetEnvironmentVariable("FrameworkPathOverride", "/usr/lib/mono/4.5")
Expand Down Expand Up @@ -369,7 +368,7 @@ module ProjectLoader =
"_ComputeNonExistentFileProperty"
"CoreCompile" |]
else
[|
[|
"ResolveAssemblyReferencesDesignTime"
"ResolveProjectReferencesDesignTime"
"ResolvePackageDependenciesDesignTime"
Expand Down
2 changes: 1 addition & 1 deletion test/Ionide.ProjInfo.Tests/Ionide.ProjInfo.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
<ProjectReference Include="..\..\src\Ionide.ProjInfo.ProjectSystem\Ionide.ProjInfo.ProjectSystem.fsproj" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>
</Project>
Loading