Skip to content

Commit 4975b66

Browse files
committed
fix project references
1 parent b5a4736 commit 4975b66

File tree

10 files changed

+47
-25
lines changed

10 files changed

+47
-25
lines changed

FSharp.Compiler.Service.sln

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio 2013
3-
VisualStudioVersion = 12.0.30501.0
42
# Visual Studio 14
53
VisualStudioVersion = 14.0.23107.0
64
MinimumVisualStudioVersion = 10.0.40219.1
@@ -59,7 +57,7 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fsc", "samples\FscExe\Fsc.f
5957
EndProject
6058
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharp_Analysis", "tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj", "{887630A3-4B1D-40EA-B8B3-2D842E9C40DB}"
6159
EndProject
62-
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Service.ProjectCracker.Exe", "src\fsharp\FSharp.Compiler.Service.ProjectCracker.Exe\FSharp.Compiler.Service.ProjectCracker.Exe.fsproj", "{B1BDD96D-47E1-4E65-8107-FBAE23A06DB4}"
60+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Service.ProjectCracker.Tool", "src\fsharp\FSharp.Compiler.Service.ProjectCracker.Tool\FSharp.Compiler.Service.ProjectCracker.Tool.fsproj", "{B1BDD96D-47E1-4E65-8107-FBAE23A06DB4}"
6361
EndProject
6462
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Service.ProjectCracker", "src\fsharp\FSharp.Compiler.Service.ProjectCracker\FSharp.Compiler.Service.ProjectCracker.fsproj", "{893C3CD9-5AF8-4027-A667-21E62FC2C703}"
6563
EndProject

src/fsharp/FSharp.Compiler.Service.ProjectCracker.Exe/App.config renamed to src/fsharp/FSharp.Compiler.Service.ProjectCracker.Tool/App.config

File renamed without changes.

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
<SchemaVersion>2.0</SchemaVersion>
88
<ProjectGuid>b1bdd96d-47e1-4e65-8107-fbae23a06db4</ProjectGuid>
99
<OutputType>Exe</OutputType>
10-
<RootNamespace>FSharp.Compiler.Service.ProjectCracker.Exe</RootNamespace>
11-
<AssemblyName>FSharp.Compiler.Service.ProjectCracker.Exe</AssemblyName>
10+
<RootNamespace>FSharp.Compiler.Service.ProjectCracker.Tool</RootNamespace>
11+
<AssemblyName>FSharp.Compiler.Service.ProjectCracker.Tool</AssemblyName>
1212
<TargetFrameworkVersion Condition=" '$(TargetFrameworkVersion)' == '' ">v4.5</TargetFrameworkVersion>
1313
<TargetFSharpCoreVersion>4.3.0.0</TargetFSharpCoreVersion>
1414
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir>
15-
<Name>FSharp.Compiler.Service.ProjectCracker.Exe</Name>
15+
<Name>FSharp.Compiler.Service.ProjectCracker.Tool</Name>
1616
<OtherFlags>$(OtherFlags) --staticlink:FSharp.Core</OtherFlags>
1717
<NoWarn>$(NoWarn);40</NoWarn>
1818
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
19-
<Name>FSharp.Compiler.Service.ProjectCracker.Exe</Name>
19+
<Name>FSharp.Compiler.Service.ProjectCracker.Tool</Name>
2020
<OutputPath>..\..\..\bin\$(TargetFrameworkVersion)</OutputPath>
21-
<DocumentationFile>..\..\..\bin\$(TargetFrameworkVersion)\FSharp.Compiler.Service.ProjectCracker.Exe.XML</DocumentationFile>
21+
<DocumentationFile>..\..\..\bin\$(TargetFrameworkVersion)\FSharp.Compiler.Service.ProjectCracker.Tool.XML</DocumentationFile>
2222
</PropertyGroup>
2323
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2424
<DebugSymbols>true</DebugSymbols>

src/fsharp/FSharp.Compiler.Service.ProjectCracker.Exe/Program.fs renamed to src/fsharp/FSharp.Compiler.Service.ProjectCracker.Tool/Program.fs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCracker.Exe
1+
namespace Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCracker.Tool
22

33
open Microsoft.Build.Framework
44
open Microsoft.Build.Utilities
@@ -37,7 +37,7 @@ module Program =
3737
member x.Log = sb.ToString()
3838

3939
type internal HostCompile() =
40-
member th.Compile(_, _, _) = 0
40+
member th.Compile(_:obj, _:obj, _:obj) = 0
4141
interface ITaskHost
4242

4343
//----------------------------------------------------------------------------
@@ -127,17 +127,19 @@ module Program =
127127
let host = new HostCompile()
128128
engine.HostServices.RegisterHostObject(fsprojFullPath, "CoreCompile", "Fsc", host)
129129

130+
131+
engine.SetGlobalProperty("BuildingInsideVisualStudio", "true") |> ignore
132+
engine.SetGlobalProperty("VisualStudioVersion", "12.0") |> ignore
133+
engine.SetGlobalProperty("ShouldUnsetParentConfigurationAndPlatform", "false") |> ignore
134+
for (prop, value) in properties do
135+
engine.SetGlobalProperty(prop, value) |> ignore
136+
130137
let projectInstanceFromFullPath (fsprojFullPath: string) =
131138
use stream = new IO.StreamReader(fsprojFullPath)
132139
use xmlReader = System.Xml.XmlReader.Create(stream)
133140

134141
let project = engine.LoadProject(xmlReader, FullPath=fsprojFullPath)
135-
136-
project.SetGlobalProperty("BuildingInsideVisualStudio", "true") |> ignore
137-
project.SetGlobalProperty("VisualStudioVersion", "12.0") |> ignore
138-
for (prop, value) in properties do
139-
project.SetProperty(prop, value) |> ignore
140-
142+
141143
project.CreateProjectInstance()
142144

143145
let project = projectInstanceFromFullPath fsprojFullPath

src/fsharp/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
<Compile Include="ProjectCracker.fs" />
4949
</ItemGroup>
5050
<ItemGroup>
51-
<ProjectReference Include="..\FSharp.Compiler.Service.ProjectCracker.Exe\FSharp.Compiler.Service.ProjectCracker.Exe.fsproj">
52-
<Name>FSharp.Compiler.Service.ProjectCracker.Exe</Name>
51+
<ProjectReference Include="..\FSharp.Compiler.Service.ProjectCracker.Exe\FSharp.Compiler.Service.ProjectCracker.Tool.fsproj">
52+
<Name>FSharp.Compiler.Service.ProjectCracker.Tool</Name>
5353
<Project>{b1bdd96d-47e1-4e65-8107-fbae23a06db4}</Project>
5454
<Private>True</Private>
5555
</ProjectReference>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type ProjectCracker =
1414
let enableLogging = defaultArg enableLogging true
1515
let logMap = ref Map.empty
1616

17-
let rec convert (opts: Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCracker.Exe.ProjectOptions) : FSharpProjectOptions =
17+
let rec convert (opts: Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCracker.Tool.ProjectOptions) : FSharpProjectOptions =
1818
let referencedProjects = Array.map (fun (a, b) -> a, convert b) opts.ReferencedProjectOptions
1919
logMap := Map.add opts.ProjectFile opts.LogOutput !logMap
2020
{ ProjectFileName = opts.ProjectFile
@@ -34,15 +34,15 @@ type ProjectCracker =
3434
let codebase = Path.GetDirectoryName(Uri(typeof<ProjectCracker>.Assembly.CodeBase).LocalPath)
3535

3636
let p = new System.Diagnostics.Process()
37-
p.StartInfo.FileName <- Path.Combine(codebase,"FSharp.Compiler.Service.ProjectCracker.Exe.exe")
37+
p.StartInfo.FileName <- Path.Combine(codebase,"FSharp.Compiler.Service.ProjectCracker.Tool.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

4444
let fmt = new Serialization.Formatters.Binary.BinaryFormatter()
45-
let opts = fmt.Deserialize(p.StandardOutput.BaseStream) :?> Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCracker.Exe.ProjectOptions
45+
let opts = fmt.Deserialize(p.StandardOutput.BaseStream) :?> Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCracker.Tool.ProjectOptions
4646
p.WaitForExit()
4747

4848
convert opts, !logMap

tests/service/ExprTests.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#if INTERACTIVE
33
#r "../../bin/v4.5/FSharp.Compiler.Service.dll"
44
#r "../../bin/v4.5/FSharp.Compiler.Service.ProjectCracker.dll"
5-
#r "../../bin/v4.5/FSharp.Compiler.Service.ProjectCracker.Exe.exe"
5+
#r "../../bin/v4.5/FSharp.Compiler.Service.ProjectCracker.Tool.exe"
66
#r "../../packages/NUnit/lib/nunit.framework.dll"
77
#load "FsUnit.fs"
88
#load "Common.fs"

tests/service/FSharp.Compiler.Service.Tests.fsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@
8686
<Reference Include="Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition=" '$(TargetFrameworkVersion)' == 'v4.5'" />
8787
</ItemGroup>
8888
<ItemGroup>
89-
<ProjectReference Include="..\..\src\fsharp\FSharp.Compiler.Service.ProjectCracker.Exe\FSharp.Compiler.Service.ProjectCracker.Exe.fsproj">
90-
<Name>FSharp.Compiler.Service.ProjectCracker.Exe</Name>
89+
<ProjectReference Include="..\..\src\fsharp\FSharp.Compiler.Service.ProjectCracker.Exe\FSharp.Compiler.Service.ProjectCracker.Tool.fsproj">
90+
<Name>FSharp.Compiler.Service.ProjectCracker.Tool</Name>
9191
<Project>{b1bdd96d-47e1-4e65-8107-fbae23a06db4}</Project>
9292
<Private>True</Private>
9393
</ProjectReference>

tests/service/ProjectOptionsTests.fs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#if INTERACTIVE
22
#r "../../bin/v4.5/FSharp.Compiler.Service.dll"
33
#r "../../bin/v4.5/FSharp.Compiler.Service.ProjectCracker.dll"
4+
#r "../../bin/v4.5/FSharp.Compiler.Service.ProjectCracker.Tool.exe"
45
#r "../../packages/NUnit/lib/nunit.framework.dll"
56
#load "FsUnit.fs"
67
#load "Common.fs"
@@ -34,6 +35,7 @@ let checkOptionNotPresent (opts:string[]) s =
3435
|> shouldEqual notFound
3536

3637
let getReferencedFilenames = Array.choose (fun (o:string) -> if o.StartsWith("-r:") then o.[3..] |> (Path.GetFileName >> Some) else None)
38+
let getReferencedFilenamesAndContainingFolders = Array.choose (fun (o:string) -> if o.StartsWith("-r:") then o.[3..] |> (fun r -> ((r |> Path.GetFileName), (r |> Path.GetDirectoryName |> Path.GetFileName)) |> Some) else None)
3739
let getOutputFile = Array.pick (fun (o:string) -> if o.StartsWith("--out:") then o.[6..] |> Some else None)
3840
let getCompiledFilenames = Array.choose (fun (o:string) -> if o.EndsWith(".fs") then o |> (Path.GetFileName >> Some) else None)
3941

@@ -377,5 +379,25 @@ let ``Project file parsing -- Exe with a PCL reference``() =
377379
references |> should contain "mscorlib.dll"
378380
references |> should contain "System.Reflection.dll"
379381
references |> should contain "System.Reflection.Emit.Lightweight.dll"
382+
383+
384+
[<Test>]
385+
let ``Project file parsing -- project reference in release mode``() =
386+
387+
let f = normalizePath(__SOURCE_DIRECTORY__ + @"/data/TestProject/TestProject.fsproj")
388+
let p = ProjectCracker.GetProjectOptionsFromProjectFile(f,[("Configuration","Release")])
389+
let references = getReferencedFilenamesAndContainingFolders p.OtherOptions |> set
390+
references |> should contain ("FSharp.Core.dll", "4.3.0.0")
391+
references |> should contain ("TestTP.dll", "Release")
392+
393+
[<Test>]
394+
let ``Project file parsing -- project reference in debug mode``() =
395+
396+
let f = normalizePath(__SOURCE_DIRECTORY__ + @"/data/TestProject/TestProject.fsproj")
397+
let p = ProjectCracker.GetProjectOptionsFromProjectFile(f,[("Configuration","Debug")])
398+
let references = getReferencedFilenamesAndContainingFolders p.OtherOptions |> set
399+
references |> should contain ("FSharp.Core.dll", "4.3.0.0")
400+
references |> should contain ("TestTP.dll", "Debug")
401+
380402
#endif
381403

tests/service/data/TestProject/TestProject.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

0 commit comments

Comments
 (0)