Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc76b29e

Browse files
authored
cherry pick two PRs from FCS (#3687)
* fix assembly reference* remove line endings from all *.nuspec files* ProjectCracker returns *.fsi files in FSharpProjectOptions.SourceFiles array (in addition to *.fs files, in right order)* ProjectCracker raises exception if ProjectCrackerTool returns non null ProjectCrackerOptions.Error (new field)* fix build on linux* fix a test* slashes* revert slashes* Update FSharp.Compiler.Service.ProjectCracker.nuspec
1 parent9893e72 commitc76b29e

File tree

10 files changed

+111
-31
lines changed

10 files changed

+111
-31
lines changed

‎fcs/FSharp.Compiler.Service.ProjectCracker/ProjectCracker.fs‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@ type ProjectCracker =
1616
letenableLogging= defaultArg enableLoggingtrue
1717
letlogMap= ref Map.empty
1818

19-
let recconvert(opts:Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool.ProjectOptions):FSharpProjectOptions=
19+
let recconvert(opts:ProjectCrackerTool.ProjectOptions):FSharpProjectOptions=
20+
ifnot(isNull opts.Error)then failwith opts.Error
21+
2022
letreferencedProjects= Array.map(fun(a,b)-> a, convert b) opts.ReferencedProjectOptions
2123

2224
letsourceFiles,otherOptions=
23-
opts.Options|> Array.partition(fun x-> x.IndexOfAny(Path.GetInvalidPathChars())=-1&& Path.GetExtension(x).ToLower()=".fs")
25+
opts.Options
26+
|> Array.partition(fun x->
27+
letextension= Path.GetExtension(x).ToLower()
28+
x.IndexOfAny(Path.GetInvalidPathChars())=-1
29+
&&(extension=".fs"|| extension=".fsi"))
2430

2531
letsepChar= Path.DirectorySeparatorChar
2632

@@ -73,8 +79,8 @@ type ProjectCracker =
7379
p.StartInfo.RedirectStandardOutput<-true
7480
ignore<| p.Start()
7581

76-
letser=newSystem.Runtime.Serialization.Json.DataContractJsonSerializer(typeof<Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool.ProjectOptions>)
77-
letopts= ser.ReadObject(p.StandardOutput.BaseStream):?>Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool.ProjectOptions
82+
letser=new DataContractJsonSerializer(typeof<ProjectCrackerTool.ProjectOptions>)
83+
letopts= ser.ReadObject(p.StandardOutput.BaseStream):?> ProjectCrackerTool.ProjectOptions
7884
#endif
7985

8086
convert opts,!logMap

‎fcs/FSharp.Compiler.Service.ProjectCrackerTool/ProjectCrackerOptions.fs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ type ProjectOptions =
77
Options:string[]
88
ReferencedProjectOptions:(string* ProjectOptions)[]
99
LogOutput:string
10+
Error:string
1011
}

‎fcs/FSharp.Compiler.Service.ProjectCrackerTool/ProjectCrackerTool.fs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,8 @@ module internal ProjectCrackerTool =
420420
letoptions={ ProjectFile= file
421421
Options= Array.ofSeq(parsedProject.Options@ referencedProjectOutputs)
422422
ReferencedProjectOptions= referencedProjectOptions
423-
LogOutput= parsedProject.LogOutput}
423+
LogOutput= parsedProject.LogOutput
424+
Error=null}
424425

425426
parsedProject.OutputFile, options
426427

@@ -465,9 +466,11 @@ module internal ProjectCrackerTool =
465466
2,{ ProjectFile= projectFile;
466467
Options=[||];
467468
ReferencedProjectOptions=[||];
468-
LogOutput= e.ToString()}
469+
LogOutput= e.ToString()
470+
Error= e.Message}
469471
else
470472
1,{ ProjectFile="";
471473
Options=[||];
472474
ReferencedProjectOptions=[||];
473-
LogOutput="At least two arguments required."}
475+
LogOutput="At least two arguments required."
476+
Error=null}

‎fcs/FSharp.Compiler.Service.sln‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 15
3-
VisualStudioVersion =15.0.26730.8
3+
VisualStudioVersion =15.0.26730.16
44
MinimumVisualStudioVersion =10.0.40219.1
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") ="project","project","{B6B68AE6-E7A4-4D43-9B34-FFA74BFE192B}"
66
ProjectSection(SolutionItems) =preProject
77
build.cmd=build.cmd
88
build.fsx=build.fsx
99
build.sh=build.sh
10+
nuget\FSharp.Compiler.Service.MSBuild.v12.nuspec=nuget\FSharp.Compiler.Service.MSBuild.v12.nuspec
1011
nuget\FSharp.Compiler.Service.nuspec=nuget\FSharp.Compiler.Service.nuspec
12+
nuget\FSharp.Compiler.Service.ProjectCracker.nuspec=nuget\FSharp.Compiler.Service.ProjectCracker.nuspec
1113
paket.dependencies=paket.dependencies
1214
README.md=README.md
1315
RELEASE_NOTES.md=RELEASE_NOTES.md

‎fcs/build.fsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ Target "Test.NetFx" (fun _ ->
9999
// --------------------------------------------------------------------------------------
100100
// Build a NuGet package
101101
Target"NuGet.NetFx"(fun _->
102-
runCmdIn__SOURCE_DIRECTORY__@"..\.nuget\NuGet.exe"@"pack nuget\FSharp.Compiler.Service.nuspec -OutputDirectory %s" releaseDir
103-
runCmdIn__SOURCE_DIRECTORY__@"..\.nuget\NuGet.exe"@"pack nuget\FSharp.Compiler.Service.MSBuild.v12.nuspec -OutputDirectory %s" releaseDir
104-
runCmdIn__SOURCE_DIRECTORY__@"..\.nuget\NuGet.exe"@"pack nuget\FSharp.Compiler.Service.ProjectCracker.nuspec -OutputDirectory %s" releaseDir
102+
runCmdIn__SOURCE_DIRECTORY__"../.nuget/NuGet.exe"@"pack nuget/FSharp.Compiler.Service.nuspec -OutputDirectory %s" releaseDir
103+
runCmdIn__SOURCE_DIRECTORY__"../.nuget/NuGet.exe"@"pack nuget/FSharp.Compiler.Service.MSBuild.v12.nuspec -OutputDirectory %s" releaseDir
104+
runCmdIn__SOURCE_DIRECTORY__"../.nuget/NuGet.exe"@"pack nuget/FSharp.Compiler.Service.ProjectCracker.nuspec -OutputDirectory %s" releaseDir
105105
)
106106

107107

‎fcs/nuget/FSharp.Compiler.Service.MSBuild.v12.nuspec‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
<packagexmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
33
<metadata>
44
<id>FSharp.Compiler.Service.MSBuild.v12</id>
5-
<description>
6-
Adds legacy MSBuild 12.0 support to the F# compiler services package for
7-
resolving references such as #r "System, Version=4.1.0.0,..."
8-
</description>
5+
<description>Adds legacy MSBuild 12.0 support to the F# compiler services package for resolving references such as #r "System, Version=4.1.0.0,..."</description>
96
<language>en-US</language>
107
<requireLicenseAcceptance>false</requireLicenseAcceptance>
118
<version>16.0.1</version>

‎fcs/nuget/FSharp.Compiler.Service.ProjectCracker.nuspec‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
<packagexmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
33
<metadata>
44
<id>FSharp.Compiler.Service.ProjectCracker</id>
5-
<description>
6-
The F# compiler services package contains a custom build of the F# compiler that
7-
exposes additional functionality for implementing F# language bindings, additional
8-
tools based on the compiler or refactoring tools. The package also includes F#
9-
interactive service that can be used for embedding F# scripting into your applications.
10-
</description>
5+
<description>The F# compiler services package contains a custom build of the F# compiler that exposes additional functionality for implementing F# language bindings, additional tools based on the compiler or refactoring tools. The package also includes F# interactive service that can be used for embedding F# scripting into your applications.</description>
116
<language>en-US</language>
127
<requireLicenseAcceptance>false</requireLicenseAcceptance>
138
<version>16.0.1</version>

‎fcs/nuget/FSharp.Compiler.Service.nuspec‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
<packagexmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
33
<metadata>
44
<id>FSharp.Compiler.Service</id>
5-
<description>
6-
The F# compiler services package contains a custom build of the F# compiler that
7-
exposes additional functionality for implementing F# language bindings, additional
8-
tools based on the compiler or refactoring tools. The package also includes F#
9-
interactive service that can be used for embedding F# scripting into your applications.
10-
</description>
5+
<description>The F# compiler services package contains a custom build of the F# compiler that exposes additional functionality for implementing F# language bindings, additional tools based on the compiler or refactoring tools. The package also includes F# interactive service that can be used for embedding F# scripting into your applications.</description>
116
<language>en-US</language>
127
<requireLicenseAcceptance>false</requireLicenseAcceptance>
138
<version>16.0.1</version>

‎tests/service/ProjectOptionsTests.fs‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,19 @@ let ``Project file parsing -- compile files 2``() =
137137
[<Test>]
138138
let``Project file parsing--bad project file``()=
139139
letf= normalizePath(__SOURCE_DIRECTORY__+@"/data/Malformed.fsproj")
140-
letlog= snd(ProjectCracker.GetProjectOptionsFromProjectFileLogged(f))
141-
log.[f]|> should contain"Microsoft.Build.Exceptions.InvalidProjectFileException"
140+
try
141+
ProjectCracker.GetProjectOptionsFromProjectFileLogged(f)|> ignore
142+
failwith"Expected exception"
143+
with e->
144+
Assert.That(e.Message, Contains.Substring"The project file could not be loaded.")
142145

143146
[<Test>]
144147
let``Project file parsing--non-existent project file``()=
145148
letf= normalizePath(__SOURCE_DIRECTORY__+@"/data/DoesNotExist.fsproj")
146-
letlog= snd(ProjectCracker.GetProjectOptionsFromProjectFileLogged(f, enableLogging=true))
147-
log.[f]|> should contain"System.IO.FileNotFoundException"
149+
try
150+
ProjectCracker.GetProjectOptionsFromProjectFileLogged(f, enableLogging=true)|> ignore
151+
with e->
152+
Assert.That(e.Message, Contains.Substring"Could not find file")
148153

149154
[<Test>]
150155
let``Project file parsing--output file``()=
@@ -217,6 +222,19 @@ let ``Project file parsing -- Logging``() =
217222
else
218223
Assert.That(log, Is.StringContaining("""Using "ResolveAssemblyReference" task from assembly "Microsoft.Build.Tasks.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"."""))
219224

225+
[<Test>]
226+
let``Project file parsing--FSharpProjectOptions.SourceFiles contains both fs and fsi files``()=
227+
letprojectFileName= normalizePath(__SOURCE_DIRECTORY__+@"/data/FsAndFsiFiles.fsproj")
228+
letoptions,log= ProjectCracker.GetProjectOptionsFromProjectFileLogged(projectFileName, enableLogging=true)
229+
printfn"%A" log
230+
letexpectedSourceFiles=
231+
[|"Test1File2.fsi"
232+
"Test1File2.fs"
233+
"Test1File1.fs"
234+
"Test1File0.fsi"
235+
"Test1File0.fs"|]
236+
Assert.That(options.SourceFiles|> Array.map Path.GetFileName, Is.EqualTo expectedSourceFiles,"source files")
237+
220238
[<Test>]
221239
let``Project file parsing--Full path``()=
222240
letf= normalizePath(__SOURCE_DIRECTORY__+@"/data/ToolsVersion12.fsproj")
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ProjectToolsVersion="4.0"DefaultTargets="Build"xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<ConfigurationCondition=" '$(Configuration)' == ''">Debug</Configuration>
5+
<PlatformCondition=" '$(Platform)' == ''">x86</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{116cc2f9-f987-4b3d-915a-34cac04a73da}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<RootNamespace>Test1</RootNamespace>
11+
<AssemblyName>Test1</AssemblyName>
12+
<OutputPath>bin\$(Configuration)\</OutputPath>
13+
<UsePartialTypes>False</UsePartialTypes>
14+
<MinimumVisualStudioVersionCondition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
15+
</PropertyGroup>
16+
<PropertyGroupCondition=" '$(Configuration)|$(Platform)' == 'Debug|x86'">
17+
<DebugSymbols>True</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>False</Optimize>
20+
<Tailcalls>False</Tailcalls>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<WarningLevel>3</WarningLevel>
23+
<PlatformTarget>x86</PlatformTarget>
24+
<DocumentationFile>bin\Debug\Test1.xml</DocumentationFile>
25+
</PropertyGroup>
26+
<PropertyGroupCondition=" '$(Configuration)|$(Platform)' == 'Release|x86'">
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>True</Optimize>
29+
<Tailcalls>True</Tailcalls>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<WarningLevel>3</WarningLevel>
32+
<PlatformTarget>x86</PlatformTarget>
33+
<DocumentationFile>bin\Release\Test1.xml</DocumentationFile>
34+
<DebugSymbols>False</DebugSymbols>
35+
</PropertyGroup>
36+
<ItemGroup>
37+
<ReferenceInclude="FSharp.Core">
38+
<HintPath>..\..\..\packages\Microsoft.Portable.FSharp.Core.4.1.20\lib\profiles\net40\FSharp.Core.dll</HintPath>
39+
</Reference>
40+
<ReferenceInclude="mscorlib" />
41+
<ReferenceInclude="System" />
42+
<ReferenceInclude="System.Core" />
43+
</ItemGroup>
44+
<ItemGroup>
45+
<CompileInclude="Test1File2.fsi" />
46+
<CompileInclude="Test1File2.fs" />
47+
<CompileInclude="Test1File1.fs" />
48+
<CompileInclude="Test1File0.fsi" />
49+
<CompileInclude="Test1File0.fs" />
50+
</ItemGroup>
51+
<ImportProject="..\..\..\packages\FSharp.Compiler.Tools.4.1.23\tools\Microsoft.FSharp.Targets" />
52+
<Choose>
53+
<WhenCondition="($(TargetFrameworkIdentifier) == '.NETStandard' And $(TargetFrameworkVersion) == 'v1.6') Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And $(TargetFrameworkVersion) == 'v1.0') Or ($(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.5')">
54+
<ItemGroup>
55+
<ReferenceInclude="nunit.framework">
56+
<HintPath>..\..\..\packages\NUnit\lib\nunit.framework.dll</HintPath>
57+
<Private>True</Private>
58+
<Paket>True</Paket>
59+
</Reference>
60+
</ItemGroup>
61+
</When>
62+
</Choose>
63+
</Project>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp