提交 4c19c429 编写于 作者: S Steffen Forkmann 提交者: Kevin Ransom (msft)

Make FCS build work on Jenkins (#3788)

上级 d55aa3b8
......@@ -121,3 +121,6 @@ tests/fsharpqa/testenv/bin/System.ValueTuple.dll
*/.fake
/fcs/packages/
*/paket-files/
/fcs/TestResult.xml
/tests/fcs/
/fcs/.paket/Paket.Restore.targets
......@@ -538,10 +538,16 @@ set _ngenexe="%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ngen.exe"
if not exist %_ngenexe% echo Error: Could not find ngen.exe. && goto :failure
echo ---------------- Done with prepare, starting package restore ----------------
set _nugetexe="%~dp0.nuget\NuGet.exe"
set _nugetconfig="%~dp0.nuget\NuGet.Config"
if "%RestorePackages%" == "true" (
cd fcs
.paket\paket.exe restore
cd..
@if ERRORLEVEL 1 echo Error: Paket restore failed && goto :failure
%_ngenexe% install %_nugetexe% /nologo
%_nugetexe% restore packages.config -PackagesDirectory packages -ConfigFile %_nugetconfig%
......
......@@ -412,6 +412,14 @@ _nugetconfig=".nuget/NuGet.Config"
# Restore packages (default to restoring packages if otherwise unspecified).
if [ "${RestorePackages:-true}" = 'true' ]; then
cd fcs
mono .paket/paket.exe restore
cd ..
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
fi
eval "$_nugetexe restore packages.config -PackagesDirectory packages -ConfigFile $_nugetconfig"
if [ $? -ne 0 ]; then
failwith "Nuget restore failed"
......
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Prevent dotnet template engine to parse this file -->
<!--/-:cnd:noEmit-->
<PropertyGroup>
<!-- make MSBuild track this file for incremental builds. -->
<!-- ref https://blogs.msdn.microsoft.com/msbuild/2005/09/26/how-to-ensure-changes-to-a-custom-target-file-prompt-a-rebuild/ -->
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<!-- Mark that this target file has been loaded. -->
<IsPaketRestoreTargetsFileLoaded>true</IsPaketRestoreTargetsFileLoaded>
<PaketToolsPath>$(MSBuildThisFileDirectory)</PaketToolsPath>
<PaketRootPath>$(MSBuildThisFileDirectory)..\</PaketRootPath>
<PaketRestoreCacheFile>$(PaketRootPath)paket-files\paket.restore.cached</PaketRestoreCacheFile>
<PaketLockFilePath>$(PaketRootPath)paket.lock</PaketLockFilePath>
<MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
<MonoPath Condition="'$(MonoPath)' == ''">mono</MonoPath>
<!-- Paket command -->
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket.exe')">$(PaketRootPath)paket.exe</PaketExePath>
<PaketExePath Condition=" '$(PaketExePath)' == '' ">$(PaketToolsPath)paket.exe</PaketExePath>
<PaketCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketExePath)"</PaketCommand>
<PaketCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' AND Exists('$(PaketRootPath)paket.bootstrapper.exe')">$(PaketRootPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
<!-- Disable automagic references for F# dotnet sdk -->
<!-- This will not do anything for other project types -->
<!-- see https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1032-fsharp-in-dotnet-sdk.md -->
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
</PropertyGroup>
<Target Name="PaketRestore" BeforeTargets="_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" >
<!-- Step 1 Check if lockfile is properly restored -->
<PropertyGroup>
<PaketRestoreRequired>true</PaketRestoreRequired>
<NoWarn>$(NoWarn);NU1603</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="Exists('$(PaketRestoreCacheFile)') ">
<PaketRestoreCachedHash>$([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))</PaketRestoreCachedHash>
<PaketRestoreLockFileHash>$([System.IO.File]::ReadAllText('$(PaketLockFilePath)'))</PaketRestoreLockFileHash>
<PaketRestoreRequired>true</PaketRestoreRequired>
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '$(PaketRestoreCachedHash)' ">false</PaketRestoreRequired>
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '' ">true</PaketRestoreRequired>
</PropertyGroup>
<!-- Do a global restore if required -->
<Exec Command='$(PaketBootStrapperCommand)' Condition="Exists('$(PaketBootStrapperExePath)') AND !(Exists('$(PaketExePath)'))" ContinueOnError="false" />
<Exec Command='$(PaketCommand) restore' Condition=" '$(PaketRestoreRequired)' == 'true' " ContinueOnError="false" />
<!-- Step 2 Detect project specific changes -->
<PropertyGroup>
<PaketReferencesCachedFilePath>$(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).paket.references.cached</PaketReferencesCachedFilePath>
<!-- MyProject.fsproj.paket.references has the highest precedence -->
<PaketOriginalReferencesFilePath>$(MSBuildProjectFullPath).paket.references</PaketOriginalReferencesFilePath>
<!-- MyProject.paket.references -->
<PaketOriginalReferencesFilePath Condition=" !Exists('$(PaketOriginalReferencesFilePath)')">$(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references</PaketOriginalReferencesFilePath>
<!-- paket.references -->
<PaketOriginalReferencesFilePath Condition=" !Exists('$(PaketOriginalReferencesFilePath)')">$(MSBuildProjectDirectory)\paket.references</PaketOriginalReferencesFilePath>
<PaketResolvedFilePath>$(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).$(TargetFramework).paket.resolved</PaketResolvedFilePath>
<PaketRestoreRequired>true</PaketRestoreRequired>
<PaketRestoreRequiredReason>references-file-or-cache-not-found</PaketRestoreRequiredReason>
</PropertyGroup>
<!-- Step 2 a Detect changes in references file -->
<PropertyGroup Condition="Exists('$(PaketOriginalReferencesFilePath)') AND Exists('$(PaketReferencesCachedFilePath)') ">
<PaketRestoreCachedHash>$([System.IO.File]::ReadAllText('$(PaketReferencesCachedFilePath)'))</PaketRestoreCachedHash>
<PaketRestoreReferencesFileHash>$([System.IO.File]::ReadAllText('$(PaketOriginalReferencesFilePath)'))</PaketRestoreReferencesFileHash>
<PaketRestoreRequiredReason>references-file</PaketRestoreRequiredReason>
<PaketRestoreRequired Condition=" '$(PaketRestoreReferencesFileHash)' == '$(PaketRestoreCachedHash)' ">false</PaketRestoreRequired>
</PropertyGroup>
<PropertyGroup Condition="!Exists('$(PaketOriginalReferencesFilePath)') AND !Exists('$(PaketReferencesCachedFilePath)') ">
<!-- If both don't exist there is nothing to do. -->
<PaketRestoreRequired>false</PaketRestoreRequired>
</PropertyGroup>
<!-- Step 2 b detect relevant changes in project file (new targetframework) -->
<PropertyGroup Condition=" !Exists('$(PaketResolvedFilePath)') AND '$(TargetFramework)' != '' ">
<PaketRestoreRequired>true</PaketRestoreRequired>
<PaketRestoreRequiredReason>target-framework '$(TargetFramework)'</PaketRestoreRequiredReason>
</PropertyGroup>
<!-- Step 3 Restore project specific stuff if required -->
<Message Condition=" '$(PaketRestoreRequired)' == 'true' " Importance="low" Text="Detected a change ('$(PaketRestoreRequiredReason)') in the project file '$(MSBuildProjectFullPath)', calling paket restore" />
<Exec Command='$(PaketCommand) restore --project "$(MSBuildProjectFullPath)"' Condition=" '$(PaketRestoreRequired)' == 'true' " ContinueOnError="false" />
<!-- This shouldn't actually happen, but just to be sure. -->
<Error Condition=" !Exists('$(PaketResolvedFilePath)') AND '$(TargetFramework)' != '' " Text="A paket file for the framework '$(TargetFramework)' is missing. Please delete 'paket-files/paket.restore.cached' and call 'paket restore'." />
<!-- Step 4 forward all msbuild properties (PackageReference, DotNetCliToolReference) to msbuild -->
<ReadLinesFromFile Condition="Exists('$(PaketResolvedFilePath)')" File="$(PaketResolvedFilePath)" >
<Output TaskParameter="Lines" ItemName="PaketReferencesFileLines"/>
</ReadLinesFromFile>
<ItemGroup Condition=" Exists('$(PaketResolvedFilePath)') AND '@(PaketReferencesFileLines)' != '' " >
<PaketReferencesFileLinesInfo Include="@(PaketReferencesFileLines)" >
<PackageName>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName>
<PackageVersion>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion>
</PaketReferencesFileLinesInfo>
<PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)">
<Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup>
<RestoreConfigFile>$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).NuGet.Config</RestoreConfigFile>
</PropertyGroup>
</Target>
<Target Name="PaketDisableDirectPack" AfterTargets="_IntermediatePack" BeforeTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references')" >
<PropertyGroup>
<ContinuePackingAfterGeneratingNuspec>false</ContinuePackingAfterGeneratingNuspec>
</PropertyGroup>
</Target>
<Target Name="PaketOverrideNuspec" AfterTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references')" >
<PropertyGroup>
<PaketProjectFile>$(MSBuildProjectDirectory)/$(MSBuildProjectFile)</PaketProjectFile>
<ContinuePackingAfterGeneratingNuspec>true</ContinuePackingAfterGeneratingNuspec>
<UseNewPack>false</UseNewPack>
<UseNewPack Condition=" '$(NuGetToolVersion)' != '4.0.0' ">true</UseNewPack>
</PropertyGroup>
<ItemGroup>
<_NuspecFiles Include="$(BaseIntermediateOutputPath)*.nuspec"/>
</ItemGroup>
<Exec Command='$(PaketCommand) fix-nuspecs files "@(_NuspecFiles)" project-file "$(PaketProjectFile)" ' Condition="@(_NuspecFiles) != ''" />
<ConvertToAbsolutePath Condition="@(_NuspecFiles) != ''" Paths="@(_NuspecFiles)">
<Output TaskParameter="AbsolutePaths" PropertyName="NuspecFileAbsolutePath" />
</ConvertToAbsolutePath>
<!-- Call Pack -->
<PackTask Condition="$(UseNewPack)"
PackItem="$(PackProjectInputFile)"
PackageFiles="@(_PackageFiles)"
PackageFilesToExclude="@(_PackageFilesToExclude)"
PackageVersion="$(PackageVersion)"
PackageId="$(PackageId)"
Title="$(Title)"
Authors="$(Authors)"
Description="$(Description)"
Copyright="$(Copyright)"
RequireLicenseAcceptance="$(PackageRequireLicenseAcceptance)"
LicenseUrl="$(PackageLicenseUrl)"
ProjectUrl="$(PackageProjectUrl)"
IconUrl="$(PackageIconUrl)"
ReleaseNotes="$(PackageReleaseNotes)"
Tags="$(PackageTags)"
DevelopmentDependency="$(DevelopmentDependency)"
BuildOutputInPackage="@(_BuildOutputInPackage)"
TargetPathsToSymbols="@(_TargetPathsToSymbols)"
TargetFrameworks="@(_TargetFrameworks)"
AssemblyName="$(AssemblyName)"
PackageOutputPath="$(PackageOutputAbsolutePath)"
IncludeSymbols="$(IncludeSymbols)"
IncludeSource="$(IncludeSource)"
PackageTypes="$(PackageType)"
IsTool="$(IsTool)"
RepositoryUrl="$(RepositoryUrl)"
RepositoryType="$(RepositoryType)"
SourceFiles="@(_SourceFiles->Distinct())"
NoPackageAnalysis="$(NoPackageAnalysis)"
MinClientVersion="$(MinClientVersion)"
Serviceable="$(Serviceable)"
FrameworkAssemblyReferences="@(_FrameworkAssemblyReferences)"
ContinuePackingAfterGeneratingNuspec="$(ContinuePackingAfterGeneratingNuspec)"
NuspecOutputPath="$(BaseIntermediateOutputPath)"
IncludeBuildOutput="$(IncludeBuildOutput)"
BuildOutputFolder="$(BuildOutputTargetFolder)"
ContentTargetFolders="$(ContentTargetFolders)"
RestoreOutputPath="$(RestoreOutputAbsolutePath)"
NuspecFile="$(NuspecFileAbsolutePath)"
NuspecBasePath="$(NuspecBasePath)"
NuspecProperties="$(NuspecProperties)"/>
<PackTask Condition="! $(UseNewPack)"
PackItem="$(PackProjectInputFile)"
PackageFiles="@(_PackageFiles)"
PackageFilesToExclude="@(_PackageFilesToExclude)"
PackageVersion="$(PackageVersion)"
PackageId="$(PackageId)"
Title="$(Title)"
Authors="$(Authors)"
Description="$(Description)"
Copyright="$(Copyright)"
RequireLicenseAcceptance="$(PackageRequireLicenseAcceptance)"
LicenseUrl="$(PackageLicenseUrl)"
ProjectUrl="$(PackageProjectUrl)"
IconUrl="$(PackageIconUrl)"
ReleaseNotes="$(PackageReleaseNotes)"
Tags="$(PackageTags)"
TargetPathsToAssemblies="@(_TargetPathsToAssemblies->'%(FinalOutputPath)')"
TargetPathsToSymbols="@(_TargetPathsToSymbols)"
TargetFrameworks="@(_TargetFrameworks)"
AssemblyName="$(AssemblyName)"
PackageOutputPath="$(PackageOutputAbsolutePath)"
IncludeSymbols="$(IncludeSymbols)"
IncludeSource="$(IncludeSource)"
PackageTypes="$(PackageType)"
IsTool="$(IsTool)"
RepositoryUrl="$(RepositoryUrl)"
RepositoryType="$(RepositoryType)"
SourceFiles="@(_SourceFiles->Distinct())"
NoPackageAnalysis="$(NoPackageAnalysis)"
MinClientVersion="$(MinClientVersion)"
Serviceable="$(Serviceable)"
AssemblyReferences="@(_References)"
ContinuePackingAfterGeneratingNuspec="$(ContinuePackingAfterGeneratingNuspec)"
NuspecOutputPath="$(BaseIntermediateOutputPath)"
IncludeBuildOutput="$(IncludeBuildOutput)"
BuildOutputFolder="$(BuildOutputTargetFolder)"
ContentTargetFolders="$(ContentTargetFolders)"
RestoreOutputPath="$(RestoreOutputAbsolutePath)"
NuspecFile="$(NuspecFileAbsolutePath)"
NuspecBasePath="$(NuspecBasePath)"
NuspecProperties="$(NuspecProperties)"/>
</Target>
<!--/+:cnd:noEmit-->
</Project>
......@@ -89,4 +89,4 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(FSharpSourcesRoot)\..\packages\FSharp.Compiler.Tools.4.1.27\tools\Microsoft.FSharp.Targets" />
</Project>
\ No newline at end of file
</Project>
......@@ -8,18 +8,17 @@ open System.Diagnostics
open System.Text
open System.IO
open System
open System.Xml
type ProjectCracker =
static member GetProjectOptionsFromProjectFileLogged(projectFileName : string, ?properties : (string * string) list, ?loadedTimeStamp, ?enableLogging) =
let loadedTimeStamp = defaultArg loadedTimeStamp DateTime.MaxValue // Not 'now', we don't want to force reloading
let properties = defaultArg properties []
let enableLogging = defaultArg enableLogging true
module Utils =
let Convert loadedTimeStamp (originalOpts: ProjectCrackerTool.ProjectOptions) =
let logMap = ref Map.empty
let rec convert (opts: ProjectCrackerTool.ProjectOptions) : FSharpProjectOptions =
let rec convertProject (opts: ProjectCrackerTool.ProjectOptions) =
if not (isNull opts.Error) then failwith opts.Error
let referencedProjects = Array.map (fun (a, b) -> a, convert b) opts.ReferencedProjectOptions
let referencedProjects() = Array.map (fun (a, b) -> a,convertProject b) opts.ReferencedProjectOptions
let sourceFiles, otherOptions =
opts.Options
......@@ -41,7 +40,7 @@ type ProjectCracker =
{ ProjectFileName = opts.ProjectFile
SourceFiles = sourceFiles
OtherOptions = otherOptions
ReferencedProjects = referencedProjects
ReferencedProjects = referencedProjects()
IsIncompleteTypeCheckEnvironment = false
UseScriptResolutionRules = false
LoadTime = loadedTimeStamp
......@@ -50,6 +49,16 @@ type ProjectCracker =
ExtraProjectInfo = None
Stamp = None }
convertProject originalOpts, !logMap
type ProjectCracker =
static member GetProjectOptionsFromProjectFileLogged(projectFileName : string, ?properties : (string * string) list, ?loadedTimeStamp, ?enableLogging) =
let loadedTimeStamp = defaultArg loadedTimeStamp DateTime.MaxValue // Not 'now', we don't want to force reloading
let properties = defaultArg properties []
let enableLogging = defaultArg enableLogging true
#if NETSTANDARD1_6
let arguments = [|
yield projectFileName
......@@ -70,20 +79,47 @@ type ProjectCracker =
let codebase = Path.GetDirectoryName(Uri(typeof<ProjectCracker>.Assembly.CodeBase).LocalPath)
let crackerFilename = Path.Combine(codebase,"FSharp.Compiler.Service.ProjectCrackerTool.exe")
if not (File.Exists crackerFilename) then failwithf "ProjectCracker exe not found at: %s it must be next to the ProjectCracker dll." crackerFilename
if not (File.Exists crackerFilename) then
failwithf "ProjectCracker exe not found at: %s it must be next to the ProjectCracker dll." crackerFilename
let p = new System.Diagnostics.Process()
p.StartInfo.FileName <- crackerFilename
p.StartInfo.Arguments <- arguments.ToString()
p.StartInfo.UseShellExecute <- false
p.StartInfo.CreateNoWindow <- true
p.StartInfo.RedirectStandardOutput <- true
p.StartInfo.RedirectStandardError <- true
let sbOut = StringBuilder()
let sbErr = StringBuilder()
p.ErrorDataReceived.AddHandler(fun _ a -> sbErr.AppendLine a.Data |> ignore)
p.OutputDataReceived.AddHandler(fun _ a -> sbOut.AppendLine a.Data |> ignore)
ignore <| p.Start()
let ser = new DataContractJsonSerializer(typeof<ProjectCrackerTool.ProjectOptions>)
let opts = ser.ReadObject(p.StandardOutput.BaseStream) :?> ProjectCrackerTool.ProjectOptions
p.EnableRaisingEvents <- true
p.BeginOutputReadLine()
p.BeginErrorReadLine()
p.WaitForExit()
let crackerOut = sbOut.ToString()
let crackerErr = sbErr.ToString()
let opts =
try
let ser = new DataContractJsonSerializer(typeof<ProjectCrackerTool.ProjectOptions>)
let stringBytes = Encoding.Unicode.GetBytes crackerOut
use ms = new MemoryStream(stringBytes)
ser.ReadObject(ms) :?> ProjectCrackerTool.ProjectOptions
with
exn ->
raise (Exception(sprintf "error parsing ProjectCrackerTool output, stdoutput was:\n%s\n\nstderr was:\n%s" crackerOut crackerErr, exn))
#endif
convert opts, !logMap
Utils.Convert loadedTimeStamp opts
static member GetProjectOptionsFromProjectFile(projectFileName : string, ?properties : (string * string) list, ?loadedTimeStamp) =
fst (ProjectCracker.GetProjectOptionsFromProjectFileLogged(
......
......@@ -46,24 +46,9 @@
<Compile Include="Program.fs" />
<None Include="App.config" />
<None Include="FSharp.Compiler.Service.ProjectCracker.targets" />
<None Include="paket.references" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Build.Framework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>$(FSharpSourcesRoot)/../fcs/dependencies/MSBuild.v14.0/Microsoft.Build.Framework.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.Build.Engine, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>$(FSharpSourcesRoot)/../fcs/dependencies/MSBuild.v14.0/Microsoft.Build.Engine.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>$(FSharpSourcesRoot)/../fcs/dependencies/MSBuild.v14.0/Microsoft.Build.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.Build.Utilities.v12.0">
<HintPath>$(FSharpSourcesRoot)/../fcs/dependencies/MSBuild.v12.0/Microsoft.Build.Utilities.v12.0.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
......@@ -71,13 +56,75 @@
<Reference Include="System.Numerics" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" />
<!-- we build the nuget against FSHarp.Core 4.4.0.0 instead of our latest to allow use in wider range of F# tools -->
<Reference Include="FSharp.Core">
<HintPath>$(FSharpSourcesRoot)\..\packages\Microsoft.Portable.FSharp.Core.4.1.20\lib\profiles\net40\FSharp.Core.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
<Import Project="$(FSharpSourcesRoot)\..\packages\FSharp.Compiler.Tools.4.1.27\tools\Microsoft.FSharp.Targets" />
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.6')">
<ItemGroup>
<Reference Include="Microsoft.Build">
<HintPath>..\packages\Microsoft.Build\lib\net45\Microsoft.Build.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.6')">
<ItemGroup>
<Reference Include="Microsoft.Build.Engine">
<HintPath>..\packages\Microsoft.Build.Engine\lib\net45\Microsoft.Build.Engine.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.6')">
<ItemGroup>
<Reference Include="Microsoft.Build.Framework">
<HintPath>..\packages\Microsoft.Build.Framework\lib\net45\Microsoft.Build.Framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.6')">
<ItemGroup>
<Reference Include="Microsoft.Build.Utilities.Core">
<HintPath>..\packages\Microsoft.Build.Utilities.Core\lib\net45\Microsoft.Build.Utilities.Core.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.6'">
<ItemGroup>
<Reference Include="System.ComponentModel.Composition">
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.6')">
<ItemGroup>
<Reference Include="System.Threading.Tasks.Dataflow">
<HintPath>..\packages\System.Threading.Tasks.Dataflow\lib\portable-net45+win8+wpa81\System.Threading.Tasks.Dataflow.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
</Project>
\ No newline at end of file
namespace Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool
open System
open System.IO
open System.Reflection
open System.Runtime.Serialization.Json
module Program =
[<EntryPoint>]
let main argv =
let text = Array.exists (fun (s: string) -> s = "--text") argv
let argv = Array.filter (fun (s: string) -> s <> "--text") argv
#if !DOTNETCORE
let addMSBuildv14BackupResolution () =
let onResolveEvent = new ResolveEventHandler(fun sender evArgs ->
let requestedAssembly = AssemblyName(evArgs.Name)
if requestedAssembly.Name.StartsWith("Microsoft.Build") &&
not (requestedAssembly.Name.EndsWith(".resources")) &&
not (requestedAssembly.Version.ToString().Contains("12.0.0.0"))
then
// If the version of MSBuild that we're using wasn't present on the machine, then
// just revert back to 12.0.0.0 since that's normally installed as part of the .NET
// Framework.
requestedAssembly.Version <- Version("12.0.0.0")
Assembly.Load requestedAssembly
else
null)
AppDomain.CurrentDomain.add_AssemblyResolve(onResolveEvent)
#endif
let crackAndSendOutput asText argv =
let ret, opts = ProjectCrackerTool.crackOpen argv
if text then
if asText then
printfn "%A" opts
else
let ser = new DataContractJsonSerializer(typeof<ProjectOptions>)
ser.WriteObject(Console.OpenStandardOutput(), opts)
ret
[<EntryPoint>][<STAThread>]
let main argv =
let asText = Array.exists (fun (s: string) -> s = "--text") argv
let argv = Array.filter (fun (s: string) -> s <> "--text") argv
#if !DOTNETCORE
addMSBuildv14BackupResolution ()
#endif
crackAndSendOutput asText argv
Microsoft.Build.Utilities.Core
Microsoft.Build.Engine
Microsoft.Build
System.Threading.Tasks.Dataflow
\ No newline at end of file
......@@ -80,8 +80,8 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="App.config" />
<None Include="paket.references" />
</ItemGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System" />
......@@ -97,7 +97,6 @@
<Reference Include="WindowsBase" />
<Reference Include="UIAutomationTypes" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Collections.Immutable">
<HintPath>$(FSharpSourcesRoot)\..\packages\System.Collections.Immutable.$(SystemCollectionsImmutableVersion)\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
......@@ -112,7 +111,6 @@
<HintPath>$(FSharpSourcesRoot)\..\packages\FSharp.Compiler.Tools.4.1.27\tools\FSharp.Core.dll</HintPath>
<Private>true</Private>
</Reference>
<ProjectReference Include="$(FSharpSourcesRoot)\..\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj">
<Name>CSharp_Analysis</Name>
<Project>{887630A3-4B1D-40EA-B8B3-2D842E9C40DB}</Project>
......@@ -130,4 +128,66 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(FSharpSourcesRoot)\..\packages\FSharp.Compiler.Tools.4.1.27\tools\Microsoft.FSharp.Targets" />
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.6')">
<ItemGroup>
<Reference Include="Microsoft.Build">
<HintPath>..\packages\Microsoft.Build\lib\net45\Microsoft.Build.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.6')">
<ItemGroup>
<Reference Include="Microsoft.Build.Engine">
<HintPath>..\packages\Microsoft.Build.Engine\lib\net45\Microsoft.Build.Engine.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.6')">
<ItemGroup>
<Reference Include="Microsoft.Build.Framework">
<HintPath>..\packages\Microsoft.Build.Framework\lib\net45\Microsoft.Build.Framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.6')">
<ItemGroup>
<Reference Include="Microsoft.Build.Utilities.Core">
<HintPath>..\packages\Microsoft.Build.Utilities.Core\lib\net45\Microsoft.Build.Utilities.Core.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.6'">
<ItemGroup>
<Reference Include="System.Core">
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.6'">
<ItemGroup>
<Reference Include="System.ComponentModel.Composition">
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
</Project>
\ No newline at end of file
Microsoft.Build.Utilities.Core
Microsoft.Build.Engine
Microsoft.Build
\ No newline at end of file
@echo off
dotnet --version
.nuget\NuGet.exe restore -PackagesDirectory packages
setlocal
cd fcs
dotnet restore tools.fsproj
if errorlevel 1 (
endlocal
exit /b %errorlevel%
......
......@@ -13,8 +13,22 @@ open Fake.ReleaseNotesHelper
#if MONO
// prevent incorrect output encoding (e.g. https://github.com/fsharp/FAKE/issues/1196)
System.Console.OutputEncoding <- System.Text.Encoding.UTF8
CleanDir (__SOURCE_DIRECTORY__ + "/../tests/TestResults")
File.WriteAllText(__SOURCE_DIRECTORY__ + "/../tests/TestResults/notestsyet.txt","No tests yet")
#endif
let dotnetExePath = DotNetCli.InstallDotNetSDK "2.0.2"
let runDotnet workingDir args =
let result =
ExecProcess (fun info ->
info.FileName <- dotnetExePath
info.WorkingDirectory <- workingDir
info.Arguments <- args) TimeSpan.MaxValue
if result <> 0 then failwithf "dotnet %s failed" args
// --------------------------------------------------------------------------------------
// Utilities
// --------------------------------------------------------------------------------------
......@@ -69,6 +83,22 @@ let buildVersion =
else if isAppVeyorBuild then sprintf "%s-b%s" assemblyVersion AppVeyorEnvironment.BuildNumber
else assemblyVersion
Target "Clean" (fun _ ->
CleanDir releaseDir
)
Target "Restore" (fun _ ->
for p in (!! "./../**/packages.config") do
let result =
ExecProcess (fun info ->
info.FileName <- FullName @"./../.nuget/NuGet.exe"
info.WorkingDirectory <- FullName @"./.."
info.Arguments <- sprintf "restore %s -PackagesDirectory \"%s\" -ConfigFile \"%s\"" (FullName p) (FullName "./../packages") (FullName "./../.nuget/NuGet.Config")) TimeSpan.MaxValue
if result <> 0 then failwithf "nuget restore %s failed" p
runDotnet __SOURCE_DIRECTORY__ "restore tools.fsproj"
)
Target "BuildVersion" (fun _ ->
Shell.Exec("appveyor", sprintf "UpdateBuild -Version \"%s\"" buildVersion) |> ignore
)
......@@ -88,11 +118,24 @@ Target "Build.NetFx" (fun _ ->
// Run the unit tests using test runner
Target "Test.NetFx" (fun _ ->
!! (releaseDir + "/fcs/net45/FSharp.Compiler.Service.Tests.dll")
let testDir = __SOURCE_DIRECTORY__ + "/../tests/fcs"
CleanDir testDir
let outDir = releaseDir + "/fcs"
!! (outDir + "/**/*.*")
|> CopyFiles testDir
let toolPath = __SOURCE_DIRECTORY__ + "/../packages/NUnit.Console.3.0.0/tools"
!! (toolPath + "/*.*")
|> CopyFiles testDir
!! (testDir + "/**/FSharp.Compiler.Service.Tests.dll")
|> Fake.Testing.NUnit3.NUnit3 (fun p ->
{ p with
ToolPath = @"..\packages\NUnit.Console.3.0.0\tools\nunit3-console.exe"
ToolPath = testDir + "/nunit3-console.exe"
ShadowCopy = false
WorkingDir = FullName testDir
TimeOut = TimeSpan.FromMinutes 20. })
)
......@@ -109,26 +152,14 @@ Target "NuGet.NetFx" (fun _ ->
// --------------------------------------------------------------------------------------
// .NET Core and .NET Core SDK
let isDotnetSDKInstalled =
match Fake.EnvironmentHelper.environVarOrNone "FCS_DNC" with
| Some flag ->
match bool.TryParse flag with
| true, result -> result
| _ -> false
| None ->
try
Shell.Exec("dotnet", "--info") = 0
with
_ -> false
Target "Build.NetStd" (fun _ ->
runCmdIn __SOURCE_DIRECTORY__ "dotnet" "pack %s -v n -c Release" "FSharp.Compiler.Service.netstandard.sln"
runDotnet __SOURCE_DIRECTORY__ (sprintf "pack %s -v n -c Release" "FSharp.Compiler.Service.netstandard.sln")
)
Target "Test.NetStd" (fun _ ->
runCmdIn __SOURCE_DIRECTORY__ "dotnet" "run -p FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj -c Release -- --result:TestResults.NetStd.xml;format=nunit3"
runDotnet __SOURCE_DIRECTORY__ (sprintf "run -p FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj -c Release -- --result:TestResults.NetStd.xml;format=nunit3")
)
......@@ -136,7 +167,7 @@ Target "Test.NetStd" (fun _ ->
Target "Nuget.AddNetStd" (fun _ ->
let nupkg = sprintf "%s/FSharp.Compiler.Service.%s.nupkg" releaseDir release.AssemblyVersion
let netcoreNupkg = sprintf "FSharp.Compiler.Service.netstandard/bin/Release/FSharp.Compiler.Service.%s.nupkg" release.AssemblyVersion
runCmdIn __SOURCE_DIRECTORY__ "dotnet" "mergenupkg --source %s --other %s --framework netstandard1.6" nupkg netcoreNupkg
runDotnet __SOURCE_DIRECTORY__ (sprintf "mergenupkg --source %s --other %s --framework netstandard1.6" nupkg netcoreNupkg)
)
......@@ -168,7 +199,6 @@ Target "PublishNuGet" (fun _ ->
// --------------------------------------------------------------------------------------
// Run all targets by default. Invoke 'build <Target>' to override
Target "Clean" DoNothing
Target "Release" DoNothing
Target "NuGet" DoNothing
Target "Build" DoNothing
......@@ -177,10 +207,12 @@ Target "TestAndNuGet" DoNothing
"Clean"
=?> ("BuildVersion", isAppVeyorBuild)
==> "Restore"
==> "Build.NetStd"
"Clean"
=?> ("BuildVersion", isAppVeyorBuild)
==> "Restore"
==> "Build.NetFx"
"Build.NetFx"
......@@ -190,15 +222,15 @@ Target "TestAndNuGet" DoNothing
==> "Test.NetStd"
"Build.NetFx"
=?> ("Build.NetStd", isDotnetSDKInstalled)
==> "Build.NetStd"
==> "Build"
"Build.NetStd"
=?> ("Nuget.AddNetStd", isDotnetSDKInstalled)
==> "Nuget.AddNetStd"
"Build.NetFx"
==> "NuGet.NetFx"
=?> ("Nuget.AddNetStd", isDotnetSDKInstalled)
==> "Nuget.AddNetStd"
==> "NuGet"
"Test.NetFx"
......@@ -206,9 +238,7 @@ Target "TestAndNuGet" DoNothing
"NuGet"
==> "TestAndNuGet"
//"Test.NetStd"
// ==> "TestAndNuGet"
"Build"
==> "NuGet"
......
......@@ -4,10 +4,6 @@ then
# use .Net
cmd fcs/build.cmd $@
else
dotnet --version
mono .nuget/NuGet.exe restore -PackagesDirectory packages
cd fcs
# use mono
......@@ -15,8 +11,6 @@ else
mozroots --import --sync --quiet
fi
dotnet restore tools.fsproj
mono .paket/paket.exe restore
exit_code=$?
if [ $exit_code -ne 0 ]; then
......@@ -24,4 +18,4 @@ else
fi
mono packages/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
fi
\ No newline at end of file
fi
framework: net45
framework: net45, net46
source https://www.nuget.org/api/v2/
nuget FAKE
nuget FSharp.Formatting
nuget Microsoft.Build.Utilities.Core 14.3.0
nuget Microsoft.Build.Framework 14.3.0
nuget Microsoft.Build.Engine 14.3.0
nuget Microsoft.Build 14.3.0
nuget System.Threading.Tasks.Dataflow 4.5.24.0
\ No newline at end of file
RESTRICTION: == net45
RESTRICTION: || (== net45) (== net46)
NUGET
remote: https://www.nuget.org/api/v2
FAKE (4.63.2)
......@@ -8,3 +8,17 @@ NUGET
FSharpVSPowerTools.Core (>= 2.3 < 2.4)
FSharpVSPowerTools.Core (2.3)
FSharp.Compiler.Service (>= 2.0.0.3)
Microsoft.Build (14.3)
Microsoft.Build.Framework (14.3)
Microsoft.Build.Engine (14.3)
Microsoft.Build.Framework (14.3)
Microsoft.Build.Framework (14.3)
System.Collections (>= 4.0.11) - restriction: || (&& (== net45) (>= netstandard1.3)) (== net46)
System.Runtime (>= 4.1) - restriction: || (&& (== net45) (>= netstandard1.3)) (== net46)
System.Runtime.InteropServices (>= 4.1) - restriction: || (&& (== net45) (>= netstandard1.3)) (== net46)
Microsoft.Build.Utilities.Core (14.3)
Microsoft.Build.Framework (14.3)
System.Collections (4.3) - restriction: || (&& (== net45) (>= netstandard1.3)) (== net46)
System.Runtime (4.3) - restriction: || (&& (== net45) (>= netstandard1.3)) (== net46)
System.Runtime.InteropServices (4.3) - restriction: || (&& (== net45) (>= netstandard1.3)) (== net46)
System.Threading.Tasks.Dataflow (4.5.24)
......@@ -20,6 +20,10 @@ open FSharp.Compiler.Service.Tests.Common
#if !NO_PROJECTCRACKER
let hasMSBuild14 =
use engine = new Microsoft.Build.Evaluation.ProjectCollection()
engine.Toolsets |> Seq.exists (fun x -> x.ToolsPath.Contains "v14.0")
let normalizePath s = (new Uri(s)).LocalPath
let checkOption (opts:string[]) s =
......@@ -90,7 +94,7 @@ let ``Project file parsing example 1 Default configuration relative path`` () =
[<Test>]
let ``Project file parsing VS2013_FSharp_Portable_Library_net45``() =
if not runningOnMono then // Disabled on Mono due to lack of installed PCL reference libraries - the modern way is to reference the FSHarp.Core nuget package so this is ok
if (not hasMSBuild14) || runningOnMono then () else // Disabled on Mono due to lack of installed PCL reference libraries - the modern way is to reference the FSHarp.Core nuget package so this is ok
let projectFile = __SOURCE_DIRECTORY__ + @"/../projects/Sample_VS2013_FSharp_Portable_Library_net45/Sample_VS2013_FSharp_Portable_Library_net45.fsproj"
let options = ProjectCracker.GetProjectOptionsFromProjectFile(projectFile, [])
......@@ -106,7 +110,7 @@ let ``Project file parsing VS2013_FSharp_Portable_Library_net45``() =
[<Test>]
let ``Project file parsing Sample_VS2013_FSharp_Portable_Library_net451_adjusted_to_profile78``() =
if not runningOnMono then // Disabled on Mono due to lack of installed PCL reference libraries - the modern way is to reference the FSHarp.Core nuget package so this is ok
if (not hasMSBuild14) || runningOnMono then () else // Disabled on Mono due to lack of installed PCL reference libraries - the modern way is to reference the FSHarp.Core nuget package so this is ok
let projectFile = __SOURCE_DIRECTORY__ + @"/../projects/Sample_VS2013_FSharp_Portable_Library_net451_adjusted_to_profile78/Sample_VS2013_FSharp_Portable_Library_net451.fsproj"
Directory.SetCurrentDirectory(__SOURCE_DIRECTORY__ + @"/../projects/Sample_VS2013_FSharp_Portable_Library_net451_adjusted_to_profile78/")
......@@ -141,7 +145,8 @@ let ``Project file parsing -- bad project file``() =
ProjectCracker.GetProjectOptionsFromProjectFileLogged(f) |> ignore
failwith "Expected exception"
with e ->
Assert.That(e.Message, Contains.Substring "The project file could not be loaded.")
Assert.That(e.Message, Contains.Substring "Could not load project")
Assert.That(e.Message, Contains.Substring "Malformed.fsproj")
[<Test>]
let ``Project file parsing -- non-existent project file``() =
......@@ -149,7 +154,7 @@ let ``Project file parsing -- non-existent project file``() =
try
ProjectCracker.GetProjectOptionsFromProjectFileLogged(f, enableLogging=true) |> ignore
with e ->
Assert.That(e.Message, Contains.Substring "Could not find file")
Assert.That(e.Message, Contains.Substring "DoesNotExist.fsproj")
[<Test>]
let ``Project file parsing -- output file``() =
......@@ -175,9 +180,20 @@ let ``Project file parsing -- references``() =
references |> should haveLength 4
p.ReferencedProjects |> should be Empty
[<Test>]
let ``Project file parsing -- no project references``() =
let p = ProjectCracker.GetProjectOptionsFromProjectFile(__SOURCE_DIRECTORY__ + @"/data/Test3.fsproj")
let references = getReferencedFilenames p.OtherOptions
checkOption references "FSharp.Core.dll"
checkOption references "mscorlib.dll"
checkOption references "System.Core.dll"
checkOption references "System.dll"
p.ReferencedProjects |> should haveLength 0
[<Test>]
let ``Project file parsing -- 2nd level references``() =
let p = ProjectCracker.GetProjectOptionsFromProjectFile(__SOURCE_DIRECTORY__ + @"/data/Test2.fsproj")
let p,_ = ProjectCracker.GetProjectOptionsFromProjectFileLogged(__SOURCE_DIRECTORY__ + @"/data/Test2.fsproj", enableLogging=true)
let references = getReferencedFilenames p.OtherOptions
checkOption references "FSharp.Core.dll"
......@@ -190,6 +206,7 @@ let ``Project file parsing -- 2nd level references``() =
p.ReferencedProjects |> should haveLength 1
(snd p.ReferencedProjects.[0]).ProjectFileName |> should contain (normalizePath (__SOURCE_DIRECTORY__ + @"/data/Test1.fsproj"))
[<Test>]
let ``Project file parsing -- reference project output file``() =
let p = ProjectCracker.GetProjectOptionsFromProjectFile(__SOURCE_DIRECTORY__ + @"/data/DifferingOutputDir/Dir2/Test2.fsproj")
......@@ -207,20 +224,23 @@ let ``Project file parsing -- reference project output file``() =
[<Test>]
let ``Project file parsing -- Tools Version 12``() =
if not hasMSBuild14 then () else
let opts = ProjectCracker.GetProjectOptionsFromProjectFile(__SOURCE_DIRECTORY__ + @"/data/ToolsVersion12.fsproj")
checkOption (getReferencedFilenames opts.OtherOptions) "System.Core.dll"
[<Test>]
let ``Project file parsing -- Logging``() =
if not hasMSBuild14 then () else
let projectFileName = normalizePath (__SOURCE_DIRECTORY__ + @"/data/ToolsVersion12.fsproj")
let _, logMap = ProjectCracker.GetProjectOptionsFromProjectFileLogged(projectFileName, enableLogging=true)
let log = logMap.[projectFileName]
Assert.That(log, Is.StringContaining("ResolveAssemblyReference"))
if runningOnMono then
Assert.That(log, Is.StringContaining("Reference System.Core resolved"))
Assert.That(log, Is.StringContaining("Using task ResolveAssemblyReference from Microsoft.Build.Tasks.ResolveAssemblyReference"))
else
Assert.That(log, Is.StringContaining("""Using "ResolveAssemblyReference" task from assembly "Microsoft.Build.Tasks.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"."""))
Assert.That(log, Is.StringContaining("System.Core"))
Assert.That(log, Is.StringContaining("Microsoft.Build.Tasks.ResolveAssemblyReference"))
else
Assert.That(log, Is.StringContaining("Microsoft.Build.Tasks.Core"))
[<Test>]
let ``Project file parsing -- FSharpProjectOptions.SourceFiles contains both fs and fsi files``() =
......@@ -237,6 +257,7 @@ let ``Project file parsing -- FSharpProjectOptions.SourceFiles contains both fs
[<Test>]
let ``Project file parsing -- Full path``() =
if not hasMSBuild14 then () else
let f = normalizePath (__SOURCE_DIRECTORY__ + @"/data/ToolsVersion12.fsproj")
let p = ProjectCracker.GetProjectOptionsFromProjectFile(f)
p.ProjectFileName |> should equal f
......@@ -253,6 +274,7 @@ let ``Project file parsing -- project references``() =
[<Test>]
let ``Project file parsing -- multi language project``() =
if not hasMSBuild14 then () else
let f = normalizePath (__SOURCE_DIRECTORY__ + @"/data/MultiLanguageProject/ConsoleApplication1.fsproj")
let options = ProjectCracker.GetProjectOptionsFromProjectFile(f)
......@@ -265,8 +287,7 @@ let ``Project file parsing -- multi language project``() =
[<Test>]
let ``Project file parsing -- PCL profile7 project``() =
if not runningOnMono then // Disabled on Mono due to lack of installed PCL reference libraries - the modern way is to reference the FSHarp.Core nuget package so this is ok
if (not hasMSBuild14) || runningOnMono then () else // Disabled on Mono due to lack of installed PCL reference libraries - the modern way is to reference the FSHarp.Core nuget package so this is ok
let f = normalizePath (__SOURCE_DIRECTORY__ + @"/../projects/Sample_VS2013_FSharp_Portable_Library_net45/Sample_VS2013_FSharp_Portable_Library_net45.fsproj")
......@@ -315,8 +336,7 @@ let ``Project file parsing -- PCL profile7 project``() =
[<Test>]
let ``Project file parsing -- PCL profile78 project``() =
if not runningOnMono then // Disabled on Mono due to lack of installed PCL reference libraries - the modern way is to reference the FSHarp.Core nuget package so this is ok
if (not hasMSBuild14) || runningOnMono then () else // Disabled on Mono due to lack of installed PCL reference libraries - the modern way is to reference the FSHarp.Core nuget package so this is ok
let f = normalizePath (__SOURCE_DIRECTORY__ + @"/../projects/Sample_VS2013_FSharp_Portable_Library_net451_adjusted_to_profile78/Sample_VS2013_FSharp_Portable_Library_net451.fsproj")
......@@ -356,7 +376,7 @@ let ``Project file parsing -- PCL profile78 project``() =
[<Test>]
let ``Project file parsing -- PCL profile259 project``() =
if not runningOnMono then // Disabled on Mono due to lack of installed PCL reference libraries - the modern way is to reference the FSHarp.Core nuget package so this is ok
if (not hasMSBuild14) || runningOnMono then () else // Disabled on Mono due to lack of installed PCL reference libraries - the modern way is to reference the FSHarp.Core nuget package so this is ok
let f = normalizePath (__SOURCE_DIRECTORY__ + @"/../projects/Sample_VS2013_FSharp_Portable_Library_net451_adjusted_to_profile259/Sample_VS2013_FSharp_Portable_Library_net451.fsproj")
let options = ProjectCracker.GetProjectOptionsFromProjectFile(f)
......@@ -468,9 +488,11 @@ let ``Test OtherOptions order for GetProjectOptionsFromScript`` () =
projOpts.OtherOptions
|> Array.map (fun s -> if s.StartsWith "--" then s else Path.GetFileNameWithoutExtension s)
|> Array.sort
|> shouldEqual (Array.sort expected2)
let otherArgs = [|"--noframework"; "--warn:3"; "System.Numerics"; "mscorlib"; "FSharp.Core"; "System"; "System.Xml"; "System.Runtime.Remoting"; "System.Runtime.Serialization.Formatters.Soap"; "System.Data"; "System.Drawing"; "System.Core"; "System.Runtime"; "System.Linq"; "System.Reflection"; "System.Linq.Expressions"; "System.Threading.Tasks"; "System.IO"; "System.Net.Requests"; "System.Collections"; "System.Runtime.Numerics"; "System.Threading"; "System.Web"; "System.Web.Services"; "System.Windows.Forms"; "FSharp.Compiler.Interactive.Settings"|]
|> Array.forall (fun s -> Set.contains s expected2)
|> shouldEqual true
let otherArgs = [|"--noframework"; "--warn:3"; "System.Numerics"; "mscorlib"; "FSharp.Core"; "System"; "System.Xml"; "System.Runtime.Remoting"; "System.Runtime.Serialization.Formatters.Soap"; "System.Data"; "System.Drawing"; "System.Core"; "System.Runtime"; "System.Linq"; "System.Reflection"; "System.Linq.Expressions"; "System.Threading.Tasks"; "System.IO"; "System.Net.Requests"; "System.Collections"; "System.Runtime.Numerics"; "System.Threading"; "System.Web"; "System.Web.Services"; "System.Windows.Forms"; "FSharp.Compiler.Interactive.Settings"|] |> Set.ofArray
test "Main1" otherArgs
test "Main2" otherArgs
test "Main3" otherArgs
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{116cc2f9-f987-4b3d-915a-34cac04a73db}</ProjectGuid>
<OutputPath>..\..\..\$(Configuration)\net40\bin</OutputPath>
<OutputType>Exe</OutputType>
<RootNamespace>Test2</RootNamespace>
<AssemblyName>Test2</AssemblyName>
<Name>Test2</Name>
<UsePartialTypes>False</UsePartialTypes>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<Tailcalls>False</Tailcalls>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<DocumentationFile>bin\Debug\Test2.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>True</Optimize>
<Tailcalls>True</Tailcalls>
<DefineConstants>TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<DocumentationFile>bin\Release\Test2.xml</DocumentationFile>
<DebugSymbols>False</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="FSharp.Core">
<HintPath>..\..\..\packages\Microsoft.Portable.FSharp.Core.4.1.20\lib\profiles\net40\FSharp.Core.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="Test2File2.fs" />
<Compile Include="Test2File1.fs" />
</ItemGroup>
<Import Project="..\..\..\packages\FSharp.Compiler.Tools.4.1.27\tools\Microsoft.FSharp.Targets" />
<Choose>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And $(TargetFrameworkVersion) == 'v1.6') Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And $(TargetFrameworkVersion) == 'v1.0') Or ($(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.5')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\..\packages\NUnit\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
</Project>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册