Skip to content

Commit 1fb9eae

Browse files
committed
wip
1 parent 28455cd commit 1fb9eae

File tree

8 files changed

+46
-90
lines changed

8 files changed

+46
-90
lines changed

FSharp.Compiler.Service.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fsc", "samples\FscExe\Fsc.f
5757
EndProject
5858
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharp_Analysis", "tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj", "{887630A3-4B1D-40EA-B8B3-2D842E9C40DB}"
5959
EndProject
60-
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Service.ProjectCracker", "src\fsharp\FSharp.Compiler.Service.ProjectCracker\FSharp.Compiler.Service.ProjectCracker.fsproj", "{B1BDD96D-47E1-4E65-8107-FBAE23A06DB4}"
60+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Service.ProjectCracker.Exe", "src\fsharp\FSharp.Compiler.Service.ProjectCracker\FSharp.Compiler.Service.ProjectCracker.Exe.fsproj", "{B1BDD96D-47E1-4E65-8107-FBAE23A06DB4}"
6161
EndProject
62-
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Service.ProjectCrackerReader", "src\fsharp\FSharp.Compiler.Service.ProjectCrackerReader\FSharp.Compiler.Service.ProjectCrackerReader.fsproj", "{893C3CD9-5AF8-4027-A667-21E62FC2C703}"
62+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Service.ProjectCracker", "src\fsharp\FSharp.Compiler.Service.ProjectCrackerReader\FSharp.Compiler.Service.ProjectCracker.fsproj", "{893C3CD9-5AF8-4027-A667-21E62FC2C703}"
6363
EndProject
6464
Global
6565
GlobalSection(SolutionConfigurationPlatforms) = preSolution

src/fsharp/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj renamed to src/fsharp/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.Exe.fsproj

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1919
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
2020
<TargetFSharpCoreVersion>4.3.1.0</TargetFSharpCoreVersion>
21-
<Name>FSharp.Compiler.Service.ProjectCracker</Name>
21+
<Name>FSharp.Compiler.Service.ProjectCracker.Exe</Name>
2222
</PropertyGroup>
2323
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2424
<DebugSymbols>true</DebugSymbols>
@@ -43,6 +43,27 @@
4343
<DocumentationFile>bin\Release\FSharp.Compiler.Service.ProjectCracker.XML</DocumentationFile>
4444
<Prefer32Bit>true</Prefer32Bit>
4545
</PropertyGroup>
46+
<PropertyGroup>
47+
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
48+
</PropertyGroup>
49+
<Choose>
50+
<When Condition="'$(VisualStudioVersion)' == '11.0'">
51+
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
52+
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
53+
</PropertyGroup>
54+
</When>
55+
<Otherwise>
56+
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
57+
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
58+
</PropertyGroup>
59+
</Otherwise>
60+
</Choose>
61+
<Import Project="$(FSharpTargetsPath)" />
62+
<ItemGroup>
63+
<Compile Include="ProjectCrackerOptions.fs" />
64+
<Compile Include="Program.fs" />
65+
<None Include="App.config" />
66+
</ItemGroup>
4667
<ItemGroup>
4768
<Reference Include="Microsoft.Build.Framework" Condition=" '$(TargetFrameworkVersion)' == 'v4.0'" />
4869
<Reference Include="Microsoft.Build.Engine" Condition=" '$(TargetFrameworkVersion)' == 'v4.0'" />
@@ -75,31 +96,8 @@
7596
<Reference Include="System.Numerics" />
7697
<Reference Include="System.Runtime.Serialization" />
7798
<Reference Include="System.Xml" />
78-
</ItemGroup>
79-
<ItemGroup>
80-
<Compile Include="ProjectCrackerOptions.fs" />
8199
<Reference Include="System.Xml" />
82100
</ItemGroup>
83-
<ItemGroup>
84-
<Compile Include="Program.fs" />
85-
<None Include="App.config" />
86-
</ItemGroup>
87-
<PropertyGroup>
88-
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
89-
</PropertyGroup>
90-
<Choose>
91-
<When Condition="'$(VisualStudioVersion)' == '11.0'">
92-
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
93-
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
94-
</PropertyGroup>
95-
</When>
96-
<Otherwise>
97-
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
98-
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
99-
</PropertyGroup>
100-
</Otherwise>
101-
</Choose>
102-
<Import Project="$(FSharpTargetsPath)" />
103101
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
104102
Other similar extension points exist, see Microsoft.Common.targets.
105103
<Target Name="BeforeBuild">

src/fsharp/FSharp.Compiler.Service.ProjectCracker/Program.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace FSharp.Compiler.Service.ProjectCracker
1+
namespace FSharp.Compiler.Service.ProjectCracker.Exe
22

33
open Microsoft.Build.Framework
44
open Microsoft.Build.Utilities

src/fsharp/FSharp.Compiler.Service.ProjectCracker/ProjectCrackerOptions.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace FSharp.Compiler.Service.ProjectCracker
1+
namespace FSharp.Compiler.Service.ProjectCracker.Exe
22

33
type ProjectOptions =
44
{

src/fsharp/FSharp.Compiler.Service.ProjectCrackerReader/FSharp.Compiler.Service.ProjectCrackerReader.fsproj renamed to src/fsharp/FSharp.Compiler.Service.ProjectCrackerReader/FSharp.Compiler.Service.ProjectCracker.fsproj

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1414
<TargetFSharpCoreVersion>4.3.1.0</TargetFSharpCoreVersion>
15-
<Name>FSharp.Compiler.Service.ProjectCrackerReader</Name>
15+
<Name>FSharp.Compiler.Service.ProjectCracker</Name>
1616
</PropertyGroup>
1717
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1818
<DebugSymbols>true</DebugSymbols>
@@ -51,11 +51,16 @@
5151
<None Include="App.config" />
5252
</ItemGroup>
5353
<ItemGroup>
54-
<ProjectReference Include="..\FSharp.Compiler.Service.ProjectCracker\FSharp.Compiler.Service.ProjectCracker.fsproj">
55-
<Name>FSharp.Compiler.Service.ProjectCracker</Name>
54+
<ProjectReference Include="..\FSharp.Compiler.Service.ProjectCracker\FSharp.Compiler.Service.ProjectCracker.Exe.fsproj">
55+
<Name>FSharp.Compiler.Service.ProjectCracker.Exe</Name>
5656
<Project>{b1bdd96d-47e1-4e65-8107-fbae23a06db4}</Project>
5757
<Private>True</Private>
5858
</ProjectReference>
59+
<ProjectReference Include="..\FSharp.Compiler.Service\FSharp.Compiler.Service.fsproj">
60+
<Name>FSharp.Compiler.Service</Name>
61+
<Project>{2e4d67b4-522d-4cf7-97e4-ba940f0b18f3}</Project>
62+
<Private>True</Private>
63+
</ProjectReference>
5964
</ItemGroup>
6065
<PropertyGroup>
6166
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>

src/fsharp/FSharp.Compiler.Service.ProjectCrackerReader/Program.fs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ open System.Diagnostics
44
open System.Text
55
open System.IO
66
open System
7-
open System.Runtime.Serialization.Formatters.Binary
7+
open System.Runtime
88

9-
open FSharp.Compiler.Service.ProjectCracker
9+
open Microsoft.FSharp.Compiler.SourceCodeServices
1010

11-
type ProjectCrackerReader =
11+
type ProjectCracker =
1212

1313
static member GetProjectOptionsFromProjectFileLogged(projectFileName : string, ?properties : (string * string) list, ?loadedTimeStamp, ?enableLogging) =
1414
let loadedTimeStamp = defaultArg loadedTimeStamp DateTime.MaxValue // Not 'now', we don't want to force reloading
1515
let properties = defaultArg properties []
1616
let enableLogging = defaultArg enableLogging false
1717

18-
let rec convert (opts: FSharp.Compiler.Service.ProjectCracker.ProjectOptions) : FSharpProjectOptions =
18+
let rec convert (opts: FSharp.Compiler.Service.ProjectCracker.Exe.ProjectOptions) : FSharpProjectOptions =
1919
let referencedProjects = Array.map (fun (a, b) -> a, convert b) opts.ReferencedProjectOptions
2020
{ ProjectFileName = opts.ProjectFile
2121
ProjectFileNames = [| |]
@@ -34,18 +34,18 @@ type ProjectCrackerReader =
3434

3535
let p = new System.Diagnostics.Process()
3636
p.StartInfo.FileName <- Path.Combine(Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly().Location),
37-
"FSharp.Compiler.Service.ProjectCracker.exe")
37+
"FSharp.Compiler.Service.ProjectCracker.Exe.exe")
3838
p.StartInfo.Arguments <- arguments.ToString()
3939
p.StartInfo.UseShellExecute <- false
4040
p.StartInfo.CreateNoWindow <- true
4141
p.StartInfo.RedirectStandardOutput <- true
4242
ignore <| p.Start()
4343

44-
let ser = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof<FSharp.Compiler.Service.ProjectCracker.ProjectOptions>)
45-
let opts = ser.ReadObject(p.StandardOutput.BaseStream) :?> FSharp.Compiler.Service.ProjectCracker.ProjectOptions
44+
let fmt = new Serialization.Formatters.Binary.BinaryFormatter()
45+
let opts = fmt.Deserialize(p.StandardOutput.BaseStream) :?> FSharp.Compiler.Service.ProjectCracker.Exe.ProjectOptions
4646
p.WaitForExit()
4747

4848
convert opts, opts.LogOutput
4949

50-
let GetProjectOptionsFromProjectFile(projectFileName : string, ?properties : (string * string) list, ?loadedTimeStamp) =
51-
fst (ic.GetProjectOptionsFromProjectFileLogged(projectFileName, ?properties=properties, ?loadedTimeStamp=loadedTimeStamp))
50+
static member GetProjectOptionsFromProjectFile(projectFileName : string, ?properties : (string * string) list, ?loadedTimeStamp) =
51+
fst (ProjectCracker.GetProjectOptionsFromProjectFileLogged(projectFileName, ?properties=properties, ?loadedTimeStamp=loadedTimeStamp))

src/fsharp/vs/service.fs

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2802,45 +2802,8 @@ type FSharpChecker(projectCacheSize, keepAssemblyContents, keepAllBackgroundReso
28022802
#if SILVERLIGHT
28032803
#else
28042804
#if FX_ATLEAST_45
2805-
member ic.GetProjectOptionsFromProjectFileLogged(projectFileName : string, ?properties : (string * string) list, ?loadedTimeStamp, ?enableLogging) =
2806-
let loadedTimeStamp = defaultArg loadedTimeStamp DateTime.MaxValue // Not 'now', we don't want to force reloading
2807-
let properties = defaultArg properties []
2808-
let enableLogging = defaultArg enableLogging false
2809-
2810-
let rec convert (opts: FSharp.Compiler.Service.ProjectCracker.ProjectOptions) : FSharpProjectOptions =
2811-
let referencedProjects = Array.map (fun (a, b) -> a, convert b) opts.ReferencedProjectOptions
2812-
{ ProjectFileName = opts.ProjectFile
2813-
ProjectFileNames = [| |]
2814-
OtherOptions = opts.Options
2815-
ReferencedProjects = referencedProjects
2816-
IsIncompleteTypeCheckEnvironment = false
2817-
UseScriptResolutionRules = false
2818-
LoadTime = loadedTimeStamp
2819-
UnresolvedReferences = None }
2820-
2821-
let arguments = new StringBuilder()
2822-
arguments.Append(projectFileName) |> ignore
2823-
arguments.Append(' ').Append(enableLogging.ToString()) |> ignore
2824-
for k, v in properties do
2825-
arguments.Append(' ').Append(k).Append(' ').Append(v) |> ignore
2826-
2827-
let p = new System.Diagnostics.Process()
2828-
p.StartInfo.FileName <- Path.Combine(Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly().Location),
2829-
"FSharp.Compiler.Service.ProjectCracker.exe")
2830-
p.StartInfo.Arguments <- arguments.ToString()
2831-
p.StartInfo.UseShellExecute <- false
2832-
p.StartInfo.CreateNoWindow <- true
2833-
p.StartInfo.RedirectStandardOutput <- true
2834-
ignore <| p.Start()
2835-
2836-
let ser = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof<FSharp.Compiler.Service.ProjectCracker.ProjectOptions>)
2837-
let opts = ser.ReadObject(p.StandardOutput.BaseStream) :?> FSharp.Compiler.Service.ProjectCracker.ProjectOptions
2838-
p.WaitForExit()
2839-
2840-
convert opts, opts.LogOutput
2841-
2842-
member ic.GetProjectOptionsFromProjectFile(projectFileName : string, ?properties : (string * string) list, ?loadedTimeStamp) =
2843-
fst (ic.GetProjectOptionsFromProjectFileLogged(projectFileName, ?properties=properties, ?loadedTimeStamp=loadedTimeStamp))
2805+
member ic.GetProjectOptionsFromProjectFile(_ : string, ?_a : (string * string) list, ?_b : System.DateTime) : FSharpProjectOptions =
2806+
failwithf "This method has been removed."
28442807
#endif
28452808
#endif
28462809

src/fsharp/vs/service.fsi

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -542,17 +542,7 @@ type FSharpChecker =
542542
/// <param name="properties">The build properties such as Configuration=Debug etc.</param>
543543
/// <param name="loadedTimeStamp">Indicates when the project was loaded into the editing environment,
544544
/// so that an 'unload' and 'reload' action will cause the project to be considered as a new project.</param>
545-
/// <param name="enableLogging">Enable detailed log output from the MSBuild project analysis.</param>
546-
member GetProjectOptionsFromProjectFileLogged : projectFileName: string * ?properties : (string * string) list * ?loadedTimeStamp: DateTime * ?enableLogging: bool -> FSharpProjectOptions * string
547-
548-
/// <summary>
549-
/// <para>Get the project options implied by a standard F# project file in the xbuild/msbuild format.</para>
550-
/// </summary>
551-
///
552-
/// <param name="projectFileName">Used to differentiate between projects and for the base directory of the project.</param>
553-
/// <param name="properties">The build properties such as Configuration=Debug etc.</param>
554-
/// <param name="loadedTimeStamp">Indicates when the project was loaded into the editing environment,
555-
/// so that an 'unload' and 'reload' action will cause the project to be considered as a new project.</param>
545+
[<Obsolete("This functionality has been moved to the new NuGet package 'FSharp.Compiler.Service.ProjectCracker'", true)>]
556546
member GetProjectOptionsFromProjectFile : projectFileName: string * ?properties : (string * string) list * ?loadedTimeStamp: DateTime -> FSharpProjectOptions
557547
#endif
558548
#endif

0 commit comments

Comments
 (0)