From 20fecbcd639819b8318b427cb9747e0f59d67db3 Mon Sep 17 00:00:00 2001 From: Omar Tawfik Date: Wed, 20 Jan 2016 14:39:35 -0800 Subject: [PATCH 1/9] Add nocopyfsharpcore option to fsc.exe --- src/fsharp/CompileOps.fs | 6 ++++++ src/fsharp/CompileOps.fsi | 2 ++ src/fsharp/CompileOptions.fs | 3 +++ src/fsharp/FSComp.txt | 1 + 4 files changed, 12 insertions(+) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 9da02263f55..786f7187779 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -1996,6 +1996,10 @@ type TcConfigBuilder = mutable emitDebugInfoInQuotations : bool mutable exename : string option + + // If trye - the compiler will copy FSharp.Core.dll along the produced binaries + mutable copyFSharpCore : bool + /// When false FSI will lock referenced assemblies requiring process restart, false = disable Shadow Copy false (*default*) mutable shadowCopyReferences : bool } @@ -2134,6 +2138,7 @@ type TcConfigBuilder = sqmSessionStartedTime = System.DateTime.Now.Ticks emitDebugInfoInQuotations = false exename = None + copyFSharpCore = true shadowCopyReferences = false } @@ -2584,6 +2589,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) = member x.sqmSessionGuid = data.sqmSessionGuid member x.sqmNumOfSourceFiles = data.sqmNumOfSourceFiles member x.sqmSessionStartedTime = data.sqmSessionStartedTime + member x.copyFSharpCore = data.copyFSharpCore member x.shadowCopyReferences = data.shadowCopyReferences static member Create(builder,validate) = diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 9b0f8faf96e..daa8a9f385a 100644 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -316,6 +316,7 @@ type TcConfigBuilder = sqmSessionStartedTime : int64 mutable emitDebugInfoInQuotations : bool mutable exename : string option + mutable copyFSharpCore : bool mutable shadowCopyReferences : bool } @@ -473,6 +474,7 @@ type TcConfig = member sqmSessionGuid : System.Guid option member sqmNumOfSourceFiles : int member sqmSessionStartedTime : int64 + member copyFSharpCore : bool member shadowCopyReferences : bool static member Create : TcConfigBuilder * validate: bool -> TcConfig diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index 1e2fe37a9f7..5a1888a0f0b 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -513,6 +513,7 @@ let PrintOptionInfo (tcConfigB:TcConfigBuilder) = printfn " debuginfo . . . . . . : %+A" tcConfigB.debuginfo printfn " resolutionEnvironment : %+A" tcConfigB.resolutionEnvironment printfn " product . . . . . . . : %+A" tcConfigB.productNameForBannerText + printfn " copyFSharpCore . . . . : %+A" tcConfigB.copyFSharpCore tcConfigB.includes |> List.sort |> List.iter (printfn " include . . . . . . . : %A") @@ -611,6 +612,8 @@ let outputFileFlagsFsc (tcConfigB : TcConfigBuilder) = CompilerOption("sig", tagFile, OptionString (setSignatureFile tcConfigB), None, Some (FSComp.SR.optsSig())); + + CompilerOption("nocopyfsharpcore", tagNone, OptionUnit (fun () -> tcConfigB.copyFSharpCore <- false), None, Some (FSComp.SR.optsNoCopyFsharpCore())); ] diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 8e15d8dc4e5..510b6db8610 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -877,6 +877,7 @@ optsUseHighEntropyVA,"Enable high-entropy ASLR" optsSubSystemVersion,"Specify subsystem version of this assembly" optsTargetProfile,"Specify target framework profile of this assembly. Valid values are mscorlib or netcore. Default - mscorlib" optsEmitDebugInfoInQuotations,"Emit debug information in quotations" +optsNoCopyFsharpCore,"Don't copy FSharp.Core.dll along the produced binaries" 1051,optsInvalidSubSystemVersion,"Invalid version '%s' for '--subsystemversion'. The version must be 4.00 or greater." 1052,optsInvalidTargetProfile,"Invalid value '%s' for '--targetprofile', valid values are 'mscorlib' or 'netcore'." typeInfoFullName,"Full name" From 91a532392670adf3f0952502636a3e40f0b94e78 Mon Sep 17 00:00:00 2001 From: Omar Tawfik Date: Wed, 20 Jan 2016 19:37:16 -0800 Subject: [PATCH 2/9] Added copying Fsharp.Core to the compiler --- src/fsharp/FSComp.txt | 1 + src/fsharp/fsc.fs | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 510b6db8610..ab16418c8b9 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1270,3 +1270,4 @@ estApplyStaticArgumentsForMethodNotImplemented,"A type provider implemented GetS 3193,optsInvalidResponseFile,"Invalid response file '%s' ( '%s' )" 3194,optsResponseFileNotFound,"Response file '%s' not found in '%s'" 3195,optsResponseFileNameInvalid,"Response file name '%s' is empty, contains invalid characters, has a drive specification without an absolute path, or is too long" +3196,fsharpCoreNotFoundToBeCopied,"Cannot find FSharp.Core.dll in compiler's directory" diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 939f1d0185a..67c2c78b7bf 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -1779,7 +1779,22 @@ let ValidateKeySigningAttributes (tcConfig : TcConfig, tcGlobals, topAttrs) = | None -> tcConfig.container SigningInfo (delaysign,signer,container) - + +let copyFSharpCore(outFile) = + let outDir = Path.GetDirectoryName(outFile) + let fsharpCoreAssemblyName = "FSharp.Core.dll" + let fsharpCoreDestinationPath = Path.Combine(outDir, fsharpCoreAssemblyName) + + if not (File.Exists(fsharpCoreDestinationPath)) then + match FSharpEnvironment.BinFolderOfDefaultFSharpCompiler with + | None -> errorR(Error(FSComp.SR.fsharpCoreNotFoundToBeCopied(), rangeCmdArgs)) + | Some compilerPath -> + let fsharpCoreSourcePath = Path.Combine(compilerPath, fsharpCoreAssemblyName) + if File.Exists(fsharpCoreSourcePath) then + File.Copy(fsharpCoreSourcePath, fsharpCoreDestinationPath) + else + errorR(Error(FSComp.SR.fsharpCoreNotFoundToBeCopied(), rangeCmdArgs)) + //---------------------------------------------------------------------------- // main - split up to make sure that we can GC the // dead data at the end of each phase. We explicitly communicate arguments @@ -1999,10 +2014,14 @@ let main4 (Args (tcConfig, errorLogger: ErrorLogger, ilGlobals, ilxMainModule, o FileWriter.EmitIL (tcConfig, ilGlobals, errorLogger, outfile, pdbfile, ilxMainModule, signingInfo, exiter) AbortOnError(errorLogger, tcConfig, exiter) + if tcConfig.showLoadedAssemblies then for a in System.AppDomain.CurrentDomain.GetAssemblies() do dprintfn "%s" a.FullName + if tcConfig.copyFSharpCore then + copyFSharpCore(outfile) + SqmLoggerWithConfig tcConfig errorLogger.ErrorNumbers errorLogger.WarningNumbers ReportTime tcConfig "Exiting" From 29f1952515915ec9be1b2a909f3ad60a50aca54f Mon Sep 17 00:00:00 2001 From: Omar Tawfik Date: Thu, 21 Jan 2016 15:15:20 -0800 Subject: [PATCH 3/9] Switch resolution order to search compilers directory first before current directory --- src/fsharp/ReferenceResolution.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsharp/ReferenceResolution.fs b/src/fsharp/ReferenceResolution.fs index e8c76b94644..9f8c62c492a 100644 --- a/src/fsharp/ReferenceResolution.fs +++ b/src/fsharp/ReferenceResolution.fs @@ -277,8 +277,8 @@ module internal MSBuildResolver = // These are search paths for runtime-like or scripting resolution. GAC searching is present. yield! rawFileNamePath // Quick-resolve straight to filename first yield! explicitIncludeDirs // From -I, #I - yield implicitIncludeDir // Usually the project directory yield fsharpCoreExplicitDirOrFSharpBinariesDir // Location of explicit reference to FSharp.Core, otherwise location of fsc.exe + yield implicitIncludeDir // Usually the project directory yield "{TargetFrameworkDirectory}" yield registry yield "{AssemblyFolders}" @@ -290,8 +290,8 @@ module internal MSBuildResolver = yield "{TargetFrameworkDirectory}" yield! rawFileNamePath // Quick-resolve straight to filename first yield! explicitIncludeDirs // From -I, #I - yield implicitIncludeDir // Usually the project directory yield fsharpCoreExplicitDirOrFSharpBinariesDir // Location of explicit reference to FSharp.Core, otherwise location of fsc.exe + yield implicitIncludeDir // Usually the project directory yield registry yield "{AssemblyFolders}" yield outputDirectory From b584ee720423897cdfb8f8d00017b06e84245d85 Mon Sep 17 00:00:00 2001 From: Omar Tawfik Date: Thu, 21 Jan 2016 19:36:08 -0800 Subject: [PATCH 4/9] Remove compiler code accessing GACUtil --- DEVGUIDE.md | 2 +- TESTGUIDE.md | 2 +- src/assemblyinfo/assemblyinfo.FSharp.Core.dll.fs | 2 +- .../assemblyinfo.FSharp.Data.TypeProviders.dll.fs | 2 +- src/update.cmd | 6 +----- src/update.fs | 9 +-------- tests/RunTests.cmd | 2 -- tests/config.bat | 4 ---- vsintegration/update-vsintegration.cmd | 4 ---- 9 files changed, 6 insertions(+), 27 deletions(-) diff --git a/DEVGUIDE.md b/DEVGUIDE.md index f8130884a4c..dfac29a146e 100644 --- a/DEVGUIDE.md +++ b/DEVGUIDE.md @@ -131,7 +131,7 @@ Restart Visual Studio, it should now be running your freshly-built Visual F# IDE ### Notes on the build -1. The `update.cmd` script adds the built `FSharp.Core` to the GAC, adds required strong name validation skips, and NGens the compiler and libraries. This requires admin privileges. +1. The `update.cmd` script adds required strong name validation skips, and NGens the compiler and libraries. This requires admin privileges. 1. The compiler binaries produced are "private" and strong-named signed with a test key. 1. Some additional tools are required to build the compiler, notably `fslex.exe`, `fsyacc.exe`, `FSharp.PowerPack.Build.Tasks.dll`, `FsSrGen.exe`, `FSharp.SRGen.Build.Tasks.dll`, and the other tools found in the `lkg` directory. 1. The overall bootstrapping process executes as follows diff --git a/TESTGUIDE.md b/TESTGUIDE.md index a95c48258ef..316f8cb75ce 100644 --- a/TESTGUIDE.md +++ b/TESTGUIDE.md @@ -23,7 +23,7 @@ In order to run all of the tests, you will need to install * [Perl](http://www.perl.org/get.html) (ActiveState Perl 5.16.3 is known to work fine) -Perl must be included in the `%PATH%` for the below steps to work. It is also recommended that you run tests from an elevated command prompt, as there are a couple of test cases which modify the GAC, and this requires administrative privileges. +Perl must be included in the `%PATH%` for the below steps to work. It is also recommended that you run tests from an elevated command prompt, as there are a couple of test cases which require administrative privileges. Before running tests, make sure you have successfully built all required projects as specified in the 'Prepare For Tests' section of the [DEVGUIDE](DEVGUIDE.md). diff --git a/src/assemblyinfo/assemblyinfo.FSharp.Core.dll.fs b/src/assemblyinfo/assemblyinfo.FSharp.Core.dll.fs index c88d9d117b5..c3ccc753f63 100644 --- a/src/assemblyinfo/assemblyinfo.FSharp.Core.dll.fs +++ b/src/assemblyinfo/assemblyinfo.FSharp.Core.dll.fs @@ -15,7 +15,7 @@ open System.Runtime.InteropServices #if PORTABLE [] -[] // ensure we replace any 4.0.30319.* or 4.0.31105.* versions in the GAC. These are the FileVersions for RTM VS2010 and SP1 VS2010 +[] #endif do() diff --git a/src/assemblyinfo/assemblyinfo.FSharp.Data.TypeProviders.dll.fs b/src/assemblyinfo/assemblyinfo.FSharp.Data.TypeProviders.dll.fs index f5a4f3d1ab1..2dab428ec29 100644 --- a/src/assemblyinfo/assemblyinfo.FSharp.Data.TypeProviders.dll.fs +++ b/src/assemblyinfo/assemblyinfo.FSharp.Data.TypeProviders.dll.fs @@ -17,7 +17,7 @@ do() [] [] #else -[] // ensure we replace any 4.0.30319.* or 4.0.31105.* versions in the GAC. These are the FileVersions for RTM VS2010 and SP1 VS2010 +[] [] [] #endif diff --git a/src/update.cmd b/src/update.cmd index 088073d6c7b..e67434cd713 100644 --- a/src/update.cmd +++ b/src/update.cmd @@ -11,7 +11,7 @@ if /i "%1" == "release" goto :ok if /i "%1" == "vsdebug" goto :ok if /i "%1" == "vsrelease" goto :ok -echo GACs built binaries, adds required strong name verification skipping, and optionally NGens built binaries +echo adding required strong name verification skipping, and NGening built binaries echo Usage: echo update.cmd debug [-ngen] echo update.cmd release [-ngen] @@ -35,7 +35,6 @@ if "%WINSDKNETFXTOOLS%"=="" FOR /F "tokens=2* delims= " %%A IN ('%REGEXE32BIT% if "%WINSDKNETFXTOOLS%"=="" FOR /F "tokens=2* delims= " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDK-NetFx40Tools" /v InstallationFolder') DO SET WINSDKNETFXTOOLS=%%B if "%WINSDKNETFXTOOLS%"=="" FOR /F "tokens=2* delims= " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx40Tools" /v InstallationFolder') DO SET WINSDKNETFXTOOLS=%%B -set GACUTIL="%WINSDKNETFXTOOLS%gacutil.exe" set SN32="%WINSDKNETFXTOOLS%sn.exe" set SN64="%WINSDKNETFXTOOLS%x64\sn.exe" set NGEN32=%windir%\Microsoft.NET\Framework\v4.0.30319\ngen.exe @@ -80,9 +79,6 @@ if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( %SN64% -Vr Salsa,b03f5f7f11d50a3a ) -rem Only GACing FSharp.Core for now -%GACUTIL% /if %BINDIR%\FSharp.Core.dll - rem NGen fsc, fsi, fsiAnyCpu, and FSharp.Build.dll if /i not "%2"=="-ngen" goto :donengen diff --git a/src/update.fs b/src/update.fs index 9ba090f5bc9..bcf3d3cb2af 100644 --- a/src/update.fs +++ b/src/update.fs @@ -36,7 +36,7 @@ let updateCmd envVars args = processor { // if /i "%1" == "release" goto :ok ignore "already validated input" - // echo GACs built binaries, adds required strong name verification skipping, and optionally NGens built binaries + // echo adding required strong name verification skipping, and NGening built binaries // echo Usage: // echo update.cmd debug [-ngen] // echo update.cmd release [-ngen] @@ -82,8 +82,6 @@ let updateCmd envVars args = processor { let WINSDKNETFXTOOLS = match allWINSDKNETFXTOOLS |> Seq.tryPick id with Some sdk -> sdk | None -> "" - // set GACUTIL="%WINSDKNETFXTOOLS%gacutil.exe" - let GACUTIL = WINSDKNETFXTOOLS/"gacutil.exe" // set SN32="%WINSDKNETFXTOOLS%sn.exe" let SN32 = WINSDKNETFXTOOLS/"sn.exe" // set SN64="%WINSDKNETFXTOOLS%x64\sn.exe" @@ -95,7 +93,6 @@ let updateCmd envVars args = processor { let checkResult = function CmdResult.ErrorLevel err -> Failure (sprintf "ERRORLEVEL %d" err) | CmdResult.Success -> Success () - let gacutil flags = Commands.gacutil exec GACUTIL flags >> checkResult let ngen32 = Commands.ngen exec NGEN32 >> checkResult let ngen64 = Commands.ngen exec NGEN64 >> checkResult let sn32 = exec SN32 >> checkResult @@ -160,10 +157,6 @@ let updateCmd envVars args = processor { (fun () -> Success ()) //) - // rem Only GACing FSharp.Core for now - // %GACUTIL% /if %BINDIR%\FSharp.Core.dll - do! gacutil "/if" (binDir/"FSharp.Core.dll") - // rem NGen fsc, fsi, fsiAnyCpu, and FSharp.Build.dll // if /i not "%2"=="-ngen" goto :donengen diff --git a/tests/RunTests.cmd b/tests/RunTests.cmd index e39bc9a4770..43835bc11a9 100644 --- a/tests/RunTests.cmd +++ b/tests/RunTests.cmd @@ -182,8 +182,6 @@ set PATH=%PATH%;%WINSDKNETFXTOOLS% IF NOT DEFINED SNEXE32 IF EXIST "%WINSDKNETFXTOOLS%sn.exe" set SNEXE32=%WINSDKNETFXTOOLS%sn.exe IF NOT DEFINED SNEXE64 IF EXIST "%WINSDKNETFXTOOLS%x64\sn.exe" set SNEXE64=%WINSDKNETFXTOOLS%x64\sn.exe -IF NOT DEFINED GACUTILEXE32 IF EXIST "%WINSDKNETFXTOOLS%gacutil.exe" set GACUTILEXE32=%WINSDKNETFXTOOLS%gacutil.exe -IF NOT DEFINED GACUTILEXE64 IF EXIST "%WINSDKNETFXTOOLS%x64\gacutil.exe" set GACUTILEXE64=%WINSDKNETFXTOOLS%x64\gacutil.exe set FSC=%FSCBINPATH%\fsc.exe set PATH=%FSCBINPATH%;%PATH% diff --git a/tests/config.bat b/tests/config.bat index 8d047c19f1c..0868e704b25 100644 --- a/tests/config.bat +++ b/tests/config.bat @@ -40,7 +40,6 @@ if not defined CSC set CSC=csc.exe %csc_flags% REM SDK Dependencires. if not defined ILDASM set ILDASM=ildasm.exe -if not defined GACUTIL set GACUTIL=gacutil.exe if not defined PEVERIFY set PEVERIFY=peverify.exe if not defined RESGEN set RESGEN=resgen.exe @@ -75,7 +74,6 @@ set fsc_flags=%fsc_flags% set CLR_SUPPORTS_GENERICS=true set ILDASM=%ILDASM% -set GACUTIL=%GACUTIL% set CLR_SUPPORTS_WINFORMS=true set CLR_SUPPORTS_SYSTEM_WEB=true @@ -148,7 +146,6 @@ REM == The logic here is: pick the latest msbuild REM == If we are testing against NDP4.0, then don't try msbuild 3.5 REM == IF NOT "%CORSDK%"=="" IF EXIST "%CORSDK%\ildasm.exe" SET ILDASM=%CORSDK%\ildasm.exe -IF NOT "%CORSDK%"=="" IF EXIST "%CORSDK%\gacutil.exe" SET GACUTIL=%CORSDK%\gacutil.exe IF NOT "%CORSDK%"=="" IF EXIST "%CORSDK%\peverify.exe" SET PEVERIFY=%CORSDK%\peverify.exe IF NOT "%CORSDK%"=="" IF EXIST "%CORSDK%\resgen.exe" SET RESGEN=%CORSDK%\resgen.exe IF NOT "%CORSDK%"=="" IF NOT EXIST "%RESGEN%" IF EXIST "%CORSDK%\..\resgen.exe" SET RESGEN=%CORSDK%\..\resgen.exe @@ -218,7 +215,6 @@ echo FSDATATPPATH =%FSDATATPPATH% echo FSDIFF =%FSDIFF% echo FSI =%FSI% echo fsi_flags =%fsi_flags% -echo GACUTIL =%GACUTIL% echo ILDASM =%ILDASM% echo INSTALL_SKU =%INSTALL_SKU% echo MSBUILDTOOLSPATH =%MSBuildToolsPath% diff --git a/vsintegration/update-vsintegration.cmd b/vsintegration/update-vsintegration.cmd index 9d5708e06c4..38e1651bf9c 100644 --- a/vsintegration/update-vsintegration.cmd +++ b/vsintegration/update-vsintegration.cmd @@ -31,7 +31,6 @@ if "%WINSDKNETFXTOOLS%"=="" FOR /F "tokens=2* delims= " %%A IN ('%REGEXE32BIT% if "%WINSDKNETFXTOOLS%"=="" FOR /F "tokens=2* delims= " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDK-NetFx40Tools" /v InstallationFolder') DO SET WINSDKNETFXTOOLS=%%B if "%WINSDKNETFXTOOLS%"=="" FOR /F "tokens=2* delims= " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx40Tools" /v InstallationFolder') DO SET WINSDKNETFXTOOLS=%%B -set GACUTIL="%WINSDKNETFXTOOLS%gacutil.exe" set SN32="%WINSDKNETFXTOOLS%sn.exe" set SN64="%WINSDKNETFXTOOLS%x64\sn.exe" set NGEN32=%windir%\Microsoft.NET\Framework\v4.0.30319\ngen.exe @@ -136,9 +135,6 @@ if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( %SN64% -Vr Salsa,b03f5f7f11d50a3a ) -%GACUTIL% /if %BINDIR%\FSharp.Compiler.Interactive.Settings.dll -%GACUTIL% /if %BINDIR%\FSharp.Compiler.Server.Shared.dll - rem NGen fsc, fsi, fsiAnyCpu, and FSharp.Build.dll "%NGEN32%" install "%COMPILERSDKPATH%\fsc.exe" /queue:1 From 0148c07c58d32ec60052be1e0b84ef3514d37bb4 Mon Sep 17 00:00:00 2001 From: Omar Tawfik Date: Fri, 22 Jan 2016 16:57:21 -0800 Subject: [PATCH 5/9] Fix fsc.exe to copy FSharp.Core.dll from references if existed --- src/fsharp/fsc.fs | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index f59f769aa99..95b78080fb8 100755 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -1782,20 +1782,27 @@ let ValidateKeySigningAttributes (tcConfig : TcConfig, tcGlobals, topAttrs) = SigningInfo (delaysign,signer,container) -let copyFSharpCore(outFile) = +// If the --nocopyfsharpcore switch is not specified, this will: +// 1) Look into the referenced assemblies, if FSharp.Core.dll is specified, it will copy it to output directory. +// 2) If not, but FSharp.Core.dll exists beside the compiler binaries, it will copy it to output directory. +// 3) If not, it will produce an error. +let copyFSharpCore(outFile: string, referencedDlls: AssemblyReference list) = let outDir = Path.GetDirectoryName(outFile) - let fsharpCoreAssemblyName = "FSharp.Core.dll" + let fsharpCoreAssemblyName = GetFSharpCoreLibraryName() + ".dll" let fsharpCoreDestinationPath = Path.Combine(outDir, fsharpCoreAssemblyName) - + if not (File.Exists(fsharpCoreDestinationPath)) then - match FSharpEnvironment.BinFolderOfDefaultFSharpCompiler with - | None -> errorR(Error(FSComp.SR.fsharpCoreNotFoundToBeCopied(), rangeCmdArgs)) - | Some compilerPath -> - let fsharpCoreSourcePath = Path.Combine(compilerPath, fsharpCoreAssemblyName) - if File.Exists(fsharpCoreSourcePath) then - File.Copy(fsharpCoreSourcePath, fsharpCoreDestinationPath) - else - errorR(Error(FSComp.SR.fsharpCoreNotFoundToBeCopied(), rangeCmdArgs)) + match referencedDlls |> Seq.tryFind (fun dll -> String.Equals(Path.GetFileName(dll.Text), fsharpCoreAssemblyName, StringComparison.CurrentCultureIgnoreCase)) with + | Some referencedFsharpCoreDll -> File.Copy(referencedFsharpCoreDll.Text, fsharpCoreDestinationPath) + | None -> + match FSharpEnvironment.BinFolderOfDefaultFSharpCompiler with + | None -> errorR(Error(FSComp.SR.fsharpCoreNotFoundToBeCopied(), rangeCmdArgs)) + | Some compilerPath -> + let fsharpCoreSourcePath = Path.Combine(compilerPath, fsharpCoreAssemblyName) + if File.Exists(fsharpCoreSourcePath) then + File.Copy(fsharpCoreSourcePath, fsharpCoreDestinationPath) + else + errorR(Error(FSComp.SR.fsharpCoreNotFoundToBeCopied(), rangeCmdArgs)) //---------------------------------------------------------------------------- // main - split up to make sure that we can GC the @@ -2022,7 +2029,7 @@ let main4 (Args (tcConfig, errorLogger: ErrorLogger, ilGlobals, ilxMainModule, o dprintfn "%s" a.FullName if tcConfig.copyFSharpCore then - copyFSharpCore(outfile) + copyFSharpCore(outfile, tcConfig.referencedDLLs) SqmLoggerWithConfig tcConfig errorLogger.ErrorNumbers errorLogger.WarningNumbers From 2f3d3f7b86506ab963a6969a05fbe8e4f9073cd4 Mon Sep 17 00:00:00 2001 From: Omar Tawfik Date: Fri, 22 Jan 2016 17:49:34 -0800 Subject: [PATCH 6/9] Fix update-vsintegration to copy GAC'ed files into VS PrivateAssemblies folder --- vsintegration/update-vsintegration.cmd | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vsintegration/update-vsintegration.cmd b/vsintegration/update-vsintegration.cmd index 4be0172a9d5..dca5f63a13c 100644 --- a/vsintegration/update-vsintegration.cmd +++ b/vsintegration/update-vsintegration.cmd @@ -139,6 +139,15 @@ if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( %SN64% -Vr Salsa,b03f5f7f11d50a3a ) +if exist "%ProgramFiles(x86)%\Microsoft Visual Studio %VisualStudioVersion%\Common7\IDE\PrivateAssemblies" ( + copy /y %BINDIR%\FSharp.Compiler.Server.Shared.dll "%ProgramFiles(x86)%\Microsoft Visual Studio %VisualStudioVersion%\Common7\IDE\PrivateAssemblies\FSharp.Compiler.Server.Shared.dll" + copy /y %BINDIR%\FSharp.Compiler.Interactive.Settings.dll "%ProgramFiles(x86)%\Microsoft Visual Studio %VisualStudioVersion%\Common7\IDE\PrivateAssemblies\FSharp.Compiler.Interactive.Settings.dll" +) +if exist "%ProgramFiles%\Microsoft Visual Studio %VisualStudioVersion%\Common7\IDE\PrivateAssemblies" ( + copy /y %BINDIR%\FSharp.Compiler.Server.Shared.dll "%ProgramFiles%\Microsoft Visual Studio %VisualStudioVersion%\Common7\IDE\PrivateAssemblies\FSharp.Compiler.Server.Shared.dll" + copy /y %BINDIR%\FSharp.Compiler.Interactive.Settings.dll "%ProgramFiles%\Microsoft Visual Studio %VisualStudioVersion%\Common7\IDE\PrivateAssemblies\FSharp.Compiler.Interactive.Settings.dll" +) + rem NGen fsc, fsi, fsiAnyCpu, and FSharp.Build.dll "%NGEN32%" install "%COMPILERSDKPATH%\fsc.exe" /queue:1 From 55f983379d806bbeebf4fc5788ac51a57048a101 Mon Sep 17 00:00:00 2001 From: Omar Tawfik Date: Fri, 22 Jan 2016 18:53:39 -0800 Subject: [PATCH 7/9] Fsc.exe now searchs its own directory for FSharp.Core.dll instead of the Program Files directory --- src/fsharp/fsc.fs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 95b78080fb8..c302315f055 100755 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -1795,14 +1795,12 @@ let copyFSharpCore(outFile: string, referencedDlls: AssemblyReference list) = match referencedDlls |> Seq.tryFind (fun dll -> String.Equals(Path.GetFileName(dll.Text), fsharpCoreAssemblyName, StringComparison.CurrentCultureIgnoreCase)) with | Some referencedFsharpCoreDll -> File.Copy(referencedFsharpCoreDll.Text, fsharpCoreDestinationPath) | None -> - match FSharpEnvironment.BinFolderOfDefaultFSharpCompiler with - | None -> errorR(Error(FSComp.SR.fsharpCoreNotFoundToBeCopied(), rangeCmdArgs)) - | Some compilerPath -> - let fsharpCoreSourcePath = Path.Combine(compilerPath, fsharpCoreAssemblyName) - if File.Exists(fsharpCoreSourcePath) then - File.Copy(fsharpCoreSourcePath, fsharpCoreDestinationPath) - else - errorR(Error(FSComp.SR.fsharpCoreNotFoundToBeCopied(), rangeCmdArgs)) + let compilerLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + let compilerFsharpCoreDllPath = Path.Combine(compilerLocation, fsharpCoreAssemblyName) + if File.Exists(compilerFsharpCoreDllPath) then + File.Copy(compilerFsharpCoreDllPath, fsharpCoreDestinationPath) + else + errorR(Error(FSComp.SR.fsharpCoreNotFoundToBeCopied(), rangeCmdArgs)) //---------------------------------------------------------------------------- // main - split up to make sure that we can GC the From 62723aad7cdc0174eaad85c8f4f188dde38b5f9f Mon Sep 17 00:00:00 2001 From: Omar Tawfik Date: Sun, 24 Jan 2016 01:18:20 -0800 Subject: [PATCH 8/9] Fixing failed tests --- .gitignore | 4 ++++ tests/fsharp/typecheck/sigs/neg46.bsl | 2 +- .../Source/CompilerOptions/fsc/help/help40.437.1033.bsl | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 89a796baf2d..98da687d682 100644 --- a/.gitignore +++ b/.gitignore @@ -73,6 +73,8 @@ src/fsharp/FSharp.LanguageService.Compiler/pplex.fs src/fsharp/FSharp.LanguageService.Compiler/pppars.fs src/fsharp/FSharp.LanguageService.Compiler/pppars.fsi vsintegration/src/unittests/Unittests.fsi +tests/*FSharp_Failures.env +tests/*FSharp_Failures.lst tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Module01.dll tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Module01.pdb tests/XFSharpQA_Failures.log.* @@ -80,6 +82,8 @@ vsintegration/src/vs/FsPkgs/FSharp.Project/FS/FSharp.ProjectSystem.FSharp.fsi vsintegration/src/vs/FsPkgs/FSharp.Project/FS/ctofiles/ tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Utils.dll tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExprLibrary.dll +tests/fsharpqa/Source/*FSharpQA_Failures.env +tests/fsharpqa/Source/*FSharpQA_Failures.lst *.csproj.user *.sln.DotSettings.user *.ide diff --git a/tests/fsharp/typecheck/sigs/neg46.bsl b/tests/fsharp/typecheck/sigs/neg46.bsl index ca1733f5642..1bdf9fbc95b 100644 --- a/tests/fsharp/typecheck/sigs/neg46.bsl +++ b/tests/fsharp/typecheck/sigs/neg46.bsl @@ -23,7 +23,7 @@ neg46.fs(48,8,48,34): typecheck error FS0912: This declaration element is not pe neg46.fs(52,8,52,39): typecheck error FS0912: This declaration element is not permitted in an augmentation -neg46.fs(56,8,56,11): typecheck error FS3191: Constructors are not permitted as extension members - they must be defined as part of the original definition of the type +neg46.fs(56,8,56,11): typecheck error FS3192: Constructors are not permitted as extension members - they must be defined as part of the original definition of the type neg46.fs(56,8,56,11): typecheck error FS0871: Constructors cannot be defined for this type diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl index d33d914dcca..7ed059b54bc 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl @@ -26,6 +26,8 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. containing F#-specific metadata --sig: Print the inferred interface of the assembly to a file +--nocopyfsharpcore Don't copy FSharp.Core.dll along the produced + binaries - INPUT FILES - From 318e6796f5ab41ef603da6a94c93cd10b2f15534 Mon Sep 17 00:00:00 2001 From: Omar Tawfik Date: Mon, 25 Jan 2016 17:03:26 -0800 Subject: [PATCH 9/9] PR comments --- src/assemblyinfo/assemblyinfo.FSharp.Data.TypeProviders.dll.fs | 2 +- src/fsharp/CompileOps.fs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assemblyinfo/assemblyinfo.FSharp.Data.TypeProviders.dll.fs b/src/assemblyinfo/assemblyinfo.FSharp.Data.TypeProviders.dll.fs index 2dab428ec29..6cb03e6d375 100644 --- a/src/assemblyinfo/assemblyinfo.FSharp.Data.TypeProviders.dll.fs +++ b/src/assemblyinfo/assemblyinfo.FSharp.Data.TypeProviders.dll.fs @@ -17,7 +17,7 @@ do() [] [] #else -[] +[] [] [] #endif diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index e3d55ab0081..cc67345ed5c 100755 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2034,7 +2034,7 @@ type TcConfigBuilder = mutable exename : string option - // If trye - the compiler will copy FSharp.Core.dll along the produced binaries + // If true - the compiler will copy FSharp.Core.dll along the produced binaries mutable copyFSharpCore : bool /// When false FSI will lock referenced assemblies requiring process restart, false = disable Shadow Copy false (*default*)