diff --git a/build.cmd b/build.cmd index 2440d345648..3303f56f9c8 100644 --- a/build.cmd +++ b/build.cmd @@ -64,6 +64,8 @@ for %%i in (%BUILD_FSC_DEFAULT%) do ( call :SET_CONFIG %%i ) setlocal disableDelayedExpansion echo. +rem disable setup build by setting FSC_BUILD_SETUP=0 +if /i '%FSC_BUILD_SETUP%' == '' (set FSC_BUILD_SETUP=1) goto :MAIN :SET_CONFIG @@ -96,7 +98,7 @@ if /i '%ARG%' == 'all' ( set BUILD_CORECLR=1 set BUILD_PORTABLE=1 set BUILD_VS=1 - set BUILD_SETUP=1 + set BUILD_SETUP=%FSC_BUILD_SETUP% set TEST_COMPILERUNIT=1 set TEST_NET40_COREUNIT=1 @@ -120,7 +122,7 @@ if /i '%ARG%' == 'microbuild' ( set BUILD_CORECLR=0 set BUILD_PORTABLE=1 set BUILD_VS=1 - set BUILD_SETUP=1 + set BUILD_SETUP=%FSC_BUILD_SETUP% set TEST_COMPILERUNIT=1 set TEST_NET40_COREUNIT=1 @@ -143,7 +145,7 @@ if /i '%ARG%' == 'ci' ( set BUILD_CORECLR=1 set BUILD_PORTABLE=1 set BUILD_VS=1 - set BUILD_SETUP=1 + set BUILD_SETUP=%FSC_BUILD_SETUP% set TEST_COMPILERUNIT=1 set TEST_NET40_COREUNIT=1 @@ -164,7 +166,7 @@ if /i '%ARG%' == 'ci_part1' ( set BUILD_CORECLR=0 set BUILD_PORTABLE=1 set BUILD_VS=1 - set BUILD_SETUP=1 + set BUILD_SETUP=%FSC_BUILD_SETUP% set TEST_COMPILERUNIT=1 set TEST_NET40_COREUNIT=0 diff --git a/src/FSharpSource.Settings.targets b/src/FSharpSource.Settings.targets index f9f6c3b8657..bc0a2aa84a8 100644 --- a/src/FSharpSource.Settings.targets +++ b/src/FSharpSource.Settings.targets @@ -26,10 +26,11 @@ full - portable + embedded false prompt - $(OtherFlags) --no-jit-optimize + $(OtherFlags) --no-jit-optimize + $(OtherFlags) --no-jit-optimize --embed DEBUG;TRACE;CODE_ANALYSIS;$(DefineConstants) DEBUG=True,TRACE=True,CODE_ANALYSIS=True,$(DefineConstants) false diff --git a/src/absil/il.fs b/src/absil/il.fs old mode 100755 new mode 100644 diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index 22ea8eb0501..9ca851d3ed9 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -3536,7 +3536,7 @@ let writeDirectory os dict = let writeBytes (os: BinaryWriter) (chunk:byte[]) = os.Write(chunk,0,chunk.Length) -let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: ILStrongNameSigner option, portablePDB, embeddedPDB, +let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: ILStrongNameSigner option, portablePDB, embeddedPDB, embedAllSource, embedSourceList, fixupOverlappingSequencePoints, emitTailcalls, showTimes, dumpDebugInfo) modul noDebugData = // Store the public key from the signer into the manifest. This means it will be written // to the binary and also acts as an indicator to leave space for delay sign @@ -3690,7 +3690,7 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: let pdbOpt = match portablePDB with | true -> - let struct (uncompressedLength, contentId, stream) as pdbStream = generatePortablePdb fixupOverlappingSequencePoints showTimes pdbData + let struct (uncompressedLength, contentId, stream) as pdbStream = generatePortablePdb fixupOverlappingSequencePoints embedAllSource embedSourceList showTimes pdbData if embeddedPDB then Some (compressPortablePdbStream uncompressedLength contentId stream) else Some (pdbStream) | _ -> None @@ -4260,6 +4260,8 @@ type options = pdbfile: string option portablePDB: bool embeddedPDB: bool + embedAllSource: bool + embedSourceList: string list signer: ILStrongNameSigner option fixupOverlappingSequencePoints: bool emitTailcalls : bool @@ -4267,6 +4269,6 @@ type options = dumpDebugInfo:bool } let WriteILBinary (outfile, (args: options), modul, noDebugData) = - ignore (writeBinaryAndReportMappings (outfile, args.ilg, args.pdbfile, args.signer, args.portablePDB, args.embeddedPDB, - args.fixupOverlappingSequencePoints, args.emitTailcalls, args.showTimes, - args.dumpDebugInfo) modul noDebugData) + ignore (writeBinaryAndReportMappings (outfile, args.ilg, args.pdbfile, args.signer, args.portablePDB, args.embeddedPDB, + args.embedAllSource, args.embedSourceList, args.fixupOverlappingSequencePoints, + args.emitTailcalls, args.showTimes, args.dumpDebugInfo) modul noDebugData) diff --git a/src/absil/ilwrite.fsi b/src/absil/ilwrite.fsi index 51d1842b208..f1b43e6ae21 100644 --- a/src/absil/ilwrite.fsi +++ b/src/absil/ilwrite.fsi @@ -20,6 +20,8 @@ type options = pdbfile: string option portablePDB: bool embeddedPDB: bool + embedAllSource: bool + embedSourceList: string list signer : ILStrongNameSigner option fixupOverlappingSequencePoints : bool emitTailcalls: bool diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index 87bf4fafb0f..a393fa1c87b 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -19,6 +19,31 @@ open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Range + +type BlobBuildingStream () = + inherit Stream() + + static let chunkSize = 32 * 1024 + let builder = new BlobBuilder(chunkSize) + + override this.CanWrite with get() = true + override this.CanRead with get() = false + override this.CanSeek with get() = false + override this.Length with get() = int64(builder.Count) + + override this.Write(buffer:byte array, offset:int, count:int) = builder.WriteBytes(buffer, offset, count) + override this.WriteByte(value:byte) = builder.WriteByte(value) + member this.WriteInt32(value:int) = builder.WriteInt32(value) + member this.ToImmutableArray() = builder.ToImmutableArray() + member this.TryWriteBytes(stream:Stream, length:int) = builder.TryWriteBytes(stream, length) + + override this.Flush() = () + override this.Dispose(_disposing:bool) = () + override this.Seek(_offset:int64, _origin:SeekOrigin) = raise (new NotSupportedException()) + override this.Read(_buffer:byte array, _offset:int, _count:int) = raise (new NotSupportedException()) + override this.SetLength(_value:int64) = raise (new NotSupportedException()) + override val Position = 0L with get, set + // -------------------------------------------------------------------- // PDB types // -------------------------------------------------------------------- @@ -227,7 +252,7 @@ let fixupOverlappingSequencePoints fixupSPs showTimes methods = Array.sortInPlaceBy fst allSps spCounts, allSps -let generatePortablePdb fixupSPs showTimes (info:PdbData) = +let generatePortablePdb fixupSPs (embedAllSource:bool) (embedSourceList:string list) showTimes (info:PdbData) = sortMethods showTimes info let _spCounts, _allSps = fixupOverlappingSequencePoints fixupSPs showTimes info.Methods let externalRowCounts = getRowCounts info.TableRowCounts @@ -253,23 +278,71 @@ let generatePortablePdb fixupSPs showTimes (info:PdbData) = metadata.GetOrAddBlob(writer) let corSymLanguageTypeFSharp = System.Guid(0xAB4F38C9u, 0xB6E6us, 0x43baus, 0xBEuy, 0x3Buy, 0x58uy, 0x08uy, 0x0Buy, 0x2Cuy, 0xCCuy, 0xE3uy) + let embeddedSource = System.Guid(0x0e8a571bu, 0x6926us, 0x466eus, 0xb4uy, 0xaduy, 0x8auy, 0xb0uy, 0x46uy, 0x11uy, 0xf5uy, 0xfeuy) + + /// + /// The maximum number of bytes in to write out uncompressed. + /// + /// This prevents wasting resources on compressing tiny files with little to negative gain + /// in PDB file size. + /// + /// Chosen as the point at which we start to see > 10% blob size reduction using all + /// current source files in corefx and roslyn as sample data. + /// + let sourceCompressionThreshold = 200 + let documentIndex = + let includeSource file = + let isInList = + if embedSourceList |> List.length = 0 then false + else + match embedSourceList |> List.tryFind(fun f -> String.Compare(file, f, StringComparison.OrdinalIgnoreCase ) = 0) with + | Some _ -> true + | None -> false + + if not embedAllSource && not isInList || not (File.Exists(file)) then + None + else + let stream = File.OpenRead(file) + let length64 = stream.Length + if length64 > int64(Int32.MaxValue) then raise (new IOException("File is too long")) + + let builder = new BlobBuildingStream() + let length = int(length64) + if length < sourceCompressionThreshold then + builder.WriteInt32(0) + builder.TryWriteBytes(stream, length) |> ignore + else + builder.WriteInt32(length) |>ignore + use deflater = new DeflateStream(builder, CompressionMode.Compress, true) + stream.CopyTo(deflater) |> ignore + Some (builder.ToImmutableArray()) + let mutable index = new Dictionary(docs.Length) metadata.SetCapacity(TableIndex.Document, docs.Length) for doc in docs do let handle = match checkSum doc.File with | Some (hashAlg, checkSum) -> - serializeDocumentName doc.File, - metadata.GetOrAddGuid(hashAlg), - metadata.GetOrAddBlob(checkSum.ToImmutableArray()), - metadata.GetOrAddGuid(corSymLanguageTypeFSharp) + let h = + (serializeDocumentName doc.File, + metadata.GetOrAddGuid(hashAlg), + metadata.GetOrAddBlob(checkSum.ToImmutableArray()), + metadata.GetOrAddGuid(corSymLanguageTypeFSharp)) |> metadata.AddDocument + match includeSource doc.File with + | None -> () + | Some blob -> + metadata.AddCustomDebugInformation(DocumentHandle.op_Implicit(h), + metadata.GetOrAddGuid(embeddedSource), + metadata.GetOrAddBlob(blob)) |> ignore + h | None -> - serializeDocumentName doc.File, - metadata.GetOrAddGuid(System.Guid.Empty), - metadata.GetOrAddBlob(ImmutableArray.Empty), - metadata.GetOrAddGuid(corSymLanguageTypeFSharp) - |> metadata.AddDocument + let h = + (serializeDocumentName doc.File, + metadata.GetOrAddGuid(System.Guid.Empty), + metadata.GetOrAddBlob(ImmutableArray.Empty), + metadata.GetOrAddGuid(corSymLanguageTypeFSharp)) |> metadata.AddDocument + h index.Add(doc.File, handle) index @@ -291,7 +364,7 @@ let generatePortablePdb fixupSPs showTimes (info:PdbData) = else match documentIndex.TryGetValue(docs.[d].File) with | false, _ -> Unchecked.defaultof - | true, f -> f + | true, h -> h if sps.Length = 0 then Unchecked.defaultof, Unchecked.defaultof @@ -306,7 +379,6 @@ let generatePortablePdb fixupSPs showTimes (info:PdbData) = singleDocumentIndex let builder = new BlobBuilder() - builder.WriteCompressedInteger(minfo.LocalSignatureToken) // Initial document: When sp's spread over more than one document we put the initial document here. diff --git a/src/absil/ilwritepdb.fsi b/src/absil/ilwritepdb.fsi index 1baf1d4b98c..81f5272a188 100644 --- a/src/absil/ilwritepdb.fsi +++ b/src/absil/ilwritepdb.fsi @@ -82,7 +82,7 @@ type idd = iddData: byte[]; iddChunk: BinaryChunk } -val generatePortablePdb : fixupSPs:bool -> showTimes:bool -> info:PdbData -> struct (int64 * BlobContentId * MemoryStream) +val generatePortablePdb : fixupSPs:bool -> embedAllSource:bool -> embedSourceList:string list -> showTimes:bool -> info:PdbData -> struct (int64 * BlobContentId * MemoryStream) val compressPortablePdbStream : uncompressedLength:int64 -> contentId:BlobContentId -> stream:MemoryStream -> struct (int64 * BlobContentId * MemoryStream) val embedPortablePdbInfo : uncompressedLength:int64 -> contentId:BlobContentId -> stream:MemoryStream -> showTimes:bool -> fpdb:string -> cvChunk:BinaryChunk -> pdbChunk:BinaryChunk -> idd[] val writePortablePdbInfo : contentId:BlobContentId -> stream:MemoryStream -> showTimes:bool -> fpdb:string -> cvChunk:BinaryChunk -> idd[] diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 7ada6090e9e..a651b05f986 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2073,6 +2073,9 @@ type TcConfigBuilder = mutable jitTracking : bool mutable portablePDB : bool mutable embeddedPDB : bool + mutable embedAllSource : bool + mutable embedSourceList : string list + mutable ignoreSymbolStoreSequencePoints : bool mutable internConstantStrings : bool mutable extraOptimizationIterations : int @@ -2242,7 +2245,9 @@ type TcConfigBuilder = useSignatureDataFile = false jitTracking = true portablePDB = true - embeddedPDB = true + embeddedPDB = false + embedAllSource = false + embedSourceList = [] ignoreSymbolStoreSequencePoints = false internConstantStrings = true extraOptimizationIterations = 0 @@ -2371,7 +2376,7 @@ type TcConfigBuilder = | None -> false if ok && not (List.contains absolutePath tcConfigB.includes) then tcConfigB.includes <- tcConfigB.includes ++ absolutePath - + member tcConfigB.AddLoadedSource(m,path,pathLoadedFrom) = if FileSystem.IsInvalidPathShim(path) then warning(Error(FSComp.SR.buildInvalidFilename(path),m)) @@ -2384,7 +2389,9 @@ type TcConfigBuilder = ComputeMakePathAbsolute pathLoadedFrom path if not (List.contains path (List.map snd tcConfigB.loadedSources)) then tcConfigB.loadedSources <- tcConfigB.loadedSources ++ (m,path) - + + member tcConfigB.AddEmbeddedSourceFile (file) = + tcConfigB.embedSourceList <- tcConfigB.embedSourceList ++ file member tcConfigB.AddEmbeddedResource filename = tcConfigB.embedResources <- tcConfigB.embedResources ++ filename @@ -2732,6 +2739,8 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) = member x.jitTracking = data.jitTracking member x.portablePDB = data.portablePDB member x.embeddedPDB = data.embeddedPDB + member x.embedAllSource = data.embedAllSource + member x.embedSourceList = data.embedSourceList member x.ignoreSymbolStoreSequencePoints = data.ignoreSymbolStoreSequencePoints member x.internConstantStrings = data.internConstantStrings member x.extraOptimizationIterations = data.extraOptimizationIterations diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 34a4f8bf763..fc77fec23a9 100755 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -307,6 +307,8 @@ type TcConfigBuilder = mutable jitTracking : bool mutable portablePDB : bool mutable embeddedPDB : bool + mutable embedAllSource : bool + mutable embedSourceList : string list mutable ignoreSymbolStoreSequencePoints : bool mutable internConstantStrings : bool mutable extraOptimizationIterations : int @@ -377,6 +379,7 @@ type TcConfigBuilder = member AddIncludePath : range * string * string -> unit member AddReferencedAssemblyByPath : range * string -> unit member RemoveReferencedAssemblyByPath : range * string -> unit + member AddEmbeddedSourceFile : string -> unit member AddEmbeddedResource : string -> unit static member SplitCommandLineResourceInfo : string -> string * string * ILResourceAccess @@ -461,6 +464,8 @@ type TcConfig = member jitTracking : bool member portablePDB : bool member embeddedPDB : bool + member embedAllSource : bool + member embedSourceList : string list member ignoreSymbolStoreSequencePoints : bool member internConstantStrings : bool member extraOptimizationIterations : int diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index fb4ac15bcd8..9a18ce46308 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -422,7 +422,7 @@ let SetOptimizeOn(tcConfigB : TcConfigBuilder) = let SetOptimizeSwitch (tcConfigB : TcConfigBuilder) switch = if (switch = OptionSwitch.On) then SetOptimizeOn(tcConfigB) else SetOptimizeOff(tcConfigB) - + let SetTailcallSwitch (tcConfigB : TcConfigBuilder) switch = tcConfigB.emitTailcalls <- (switch = OptionSwitch.On) @@ -479,6 +479,9 @@ let SetDebugSwitch (tcConfigB : TcConfigBuilder) (dtype : string option) (s : Op | None -> tcConfigB.portablePDB <- false; tcConfigB.embeddedPDB <- false; tcConfigB.jitTracking <- s = OptionSwitch.On; tcConfigB.debuginfo <- s = OptionSwitch.On +let SetEmbedAllSourceSwitch (tcConfigB : TcConfigBuilder) switch = + if (switch = OptionSwitch.On) then tcConfigB.embedAllSource <- true else tcConfigB.embedAllSource <- false + let setOutFileName tcConfigB s = tcConfigB.outputFile <- Some s @@ -504,7 +507,6 @@ let tagAddress = "
" let tagInt = "" let tagNone = "" - // PrintOptionInfo //---------------- @@ -521,6 +523,8 @@ let PrintOptionInfo (tcConfigB:TcConfigBuilder) = printfn " jitTracking . . . . . : %+A" tcConfigB.jitTracking printfn " portablePDB. . . . . . : %+A" tcConfigB.portablePDB printfn " embeddedPDB. . . . . . : %+A" tcConfigB.embeddedPDB + printfn " embedAllSource . . . . : %+A" tcConfigB.embedAllSource + printfn " embedSourceList. . . . : %+A" tcConfigB.embedSourceList printfn " debuginfo . . . . . . : %+A" tcConfigB.debuginfo printfn " resolutionEnvironment : %+A" tcConfigB.resolutionEnvironment printfn " product . . . . . . . : %+A" tcConfigB.productNameForBannerText @@ -569,7 +573,7 @@ let errorsAndWarningsFlags (tcConfigB : TcConfigBuilder) = CompilerOption("nowarn", tagWarnList, OptionStringList (fun n -> tcConfigB.TurnWarningOff(rangeCmdArgs,n)), None, Some (FSComp.SR.optsNowarn())); - + CompilerOption("warnon", tagWarnList, OptionStringList (fun n -> tcConfigB.TurnWarningOn(rangeCmdArgs,n)), None, Some(FSComp.SR.optsWarnOn())); @@ -657,24 +661,28 @@ let resourcesFlagsFsc (tcConfigB : TcConfigBuilder) = //----------------------------- let codeGenerationFlags isFsi (tcConfigB : TcConfigBuilder) = - [ - CompilerOption("debug", tagNone, OptionSwitch (SetDebugSwitch tcConfigB None), None, - Some (FSComp.SR.optsDebugPM())) - - CompilerOption("debug", tagFullPDBOnlyPortable, OptionString (fun s -> SetDebugSwitch tcConfigB (Some(s)) OptionSwitch.On), None, - Some (FSComp.SR.optsDebug(if isFsi then "pdbonly" else "full"))) - - CompilerOption("optimize", tagNone, OptionSwitch (SetOptimizeSwitch tcConfigB) , None, - Some (FSComp.SR.optsOptimize())) - - CompilerOption("tailcalls", tagNone, OptionSwitch (SetTailcallSwitch tcConfigB), None, - Some (FSComp.SR.optsTailcalls())) - - CompilerOption("crossoptimize", tagNone, OptionSwitch (crossOptimizeSwitch tcConfigB), None, - Some (FSComp.SR.optsCrossoptimize())) - - ] - + let debug = + [CompilerOption("debug", tagNone, OptionSwitch (SetDebugSwitch tcConfigB None), None, + Some (FSComp.SR.optsDebugPM())) + CompilerOption("debug", tagFullPDBOnlyPortable, OptionString (fun s -> SetDebugSwitch tcConfigB (Some(s)) OptionSwitch.On), None, + Some (FSComp.SR.optsDebug(if isFsi then "pdbonly" else "full"))) + ] + let embed = + [CompilerOption("embed", tagNone, OptionSwitch (SetEmbedAllSourceSwitch tcConfigB) , None, + Some (FSComp.SR.optsEmbedAllSource())) + CompilerOption("embed", tagFileList, OptionStringList (fun f -> tcConfigB.AddEmbeddedSourceFile f), None, + Some ( FSComp.SR.optsEmbedSource())); + ] + let codegen = + [CompilerOption("optimize", tagNone, OptionSwitch (SetOptimizeSwitch tcConfigB) , None, + Some (FSComp.SR.optsOptimize())) + CompilerOption("tailcalls", tagNone, OptionSwitch (SetTailcallSwitch tcConfigB), None, + Some (FSComp.SR.optsTailcalls())) + CompilerOption("crossoptimize", tagNone, OptionSwitch (crossOptimizeSwitch tcConfigB), None, + Some (FSComp.SR.optsCrossoptimize())) + ] + if isFsi then debug @ codegen + else debug @ embed @ codegen // OptionBlock: Language //---------------------- @@ -824,7 +832,6 @@ let vsSpecificFlags (tcConfigB: TcConfigBuilder) = CompilerOption("exename", tagNone, OptionString (fun s -> tcConfigB.exename <- Some(s)), None, None) CompilerOption("maxerrors", tagInt, OptionInt (fun n -> tcConfigB.maxErrors <- n), None, None) ] - let internalFlags (tcConfigB:TcConfigBuilder) = [ CompilerOption("stamps", tagNone, OptionUnit (fun () -> ()), Some(InternalCommandLineOption("--stamps", rangeCmdArgs)), None) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 8f14f835865..9c5975d50aa 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -836,6 +836,9 @@ optsReference,"Reference an assembly (Short form: -r)" optsWin32res,"Specify a Win32 resource file (.res)" optsWin32manifest,"Specify a Win32 manifest file" optsNowin32manifest,"Do not include the default Win32 manifest" +optsEmbedAllSource,"Embed all source files in the portable PDB file" +optsEmbedSource,"Embed specific source files in the portable PDB file" +1501,optsEmbeddedSourceRequirePortablePDBs,"--embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded)" optsResource,"Embed the specified managed resource" optsLinkresource,"Link the specified resource to this assembly where the resinfo format is [,[,public|private]]" optsDebugPM,"Emit debug information (Short form: -g)" diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 592bf86621a..46333d48d60 100755 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -268,9 +268,12 @@ let ProcessCommandLineFlags (tcConfigB: TcConfigBuilder,setProcessThreadLocals,a else inputFilesRef := name :: !inputFilesRef let abbrevArgs = GetAbbrevFlagSet tcConfigB true - + // This is where flags are interpreted by the command line fsc.exe. ParseCompilerOptions (collect, GetCoreFscCompilerOptions tcConfigB, List.tail (PostProcessCompilerArgs abbrevArgs argv)) + if (tcConfigB.embedAllSource || tcConfigB.embedSourceList |> List.length <> 0) && (not (tcConfigB.portablePDB || tcConfigB.embeddedPDB)) then + error(Error(FSComp.SR.optsEmbeddedSourceRequirePortablePDBs(),rangeCmdArgs)) + let inputFiles = List.rev !inputFilesRef #if FX_LCIDFROMCODEPAGE @@ -334,12 +337,12 @@ let GetTcImportsFromCommandLine // Rather than start processing, just collect names, then process them. try let sourceFiles = - let files = ProcessCommandLineFlags (tcConfigB, setProcessThreadLocals, + let files = ProcessCommandLineFlags (tcConfigB, setProcessThreadLocals, #if FX_LCIDFROMCODEPAGE lcidFromCodePage, #endif argv) - AdjustForScriptCompile(tcConfigB,files,lexResourceManager) + AdjustForScriptCompile(tcConfigB,files,lexResourceManager) sourceFiles with e -> @@ -1743,6 +1746,8 @@ module FileWriter = showTimes = tcConfig.showTimes portablePDB = tcConfig.portablePDB embeddedPDB = tcConfig.embeddedPDB + embedAllSource = tcConfig.embedAllSource + embedSourceList = tcConfig.embedSourceList signer = GetSigner signingInfo fixupOverlappingSequencePoints = false dumpDebugInfo = tcConfig.dumpDebugInfo }, 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 1d028d6669d..57209f1d262 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl @@ -56,6 +56,9 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. cross-platform format, 'embedded' is a cross-platform format embedded into the output file). +--embed[+|-] Embed all source files in the portable PDB file +--embed: Embed specific source files in the portable PDB + file --optimize[+|-] Enable optimizations (Short form: -O) --tailcalls[+|-] Enable or disable tailcalls --crossoptimize[+|-] Enable or disable cross-module optimizations diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/pdb/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsc/pdb/env.lst index 32dc7495aee..938bd76d2e7 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/pdb/env.lst +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/pdb/env.lst @@ -4,21 +4,30 @@ NOMONO SOURCE=E_pdb_and_debug.fs SCFLAGS="--pdb:pdb01.pdb" PRECMD="IF EXIST pdb01.pdb DEL pdb01.pdb" POSTCMD="IF EXIST pdb01.pdb EXIT 1" # same file w/o -g NOMONO SOURCE=pdb01.fs SCFLAGS="-g --pdb:pdb01.pdb" PRECMD="IF EXIST pdb01.pdb DEL pdb01.pdb" POSTCMD="IF NOT EXIST pdb01.pdb EXIT 1" # same file w/ -g -NOMONO SOURCE=E_pdb_and_debug.fs SCFLAGS="--pdb:pdb01x.pdb" PRECMD="IF EXIST pdb01x.pdb DEL pdb01x.pdb" POSTCMD="IF EXIST pdb01x.pdb EXIT 1" # different file w/o -g -NOMONO SOURCE=pdb01.fs SCFLAGS="-g --pdb:pdb01x.pdb" PRECMD="IF EXIST pdb01x.pdb DEL pdb01x.pdb" POSTCMD="IF NOT EXIST pdb01x.pdb EXIT 1" # different file w/ -g -NOMONO SOURCE=E_pdb_and_debug.fs SCFLAGS="--pdb:pdb01x.pdb" PRECMD="IF EXIST pdb01.pdb DEL pdb01.pdb" POSTCMD="IF EXIST pdb01.pdb EXIT 1" # different file w/o -g (no pdb01.pdb) -NOMONO SOURCE=pdb01.fs SCFLAGS="-g --pdb:pdb01x.pdb" PRECMD="IF EXIST pdb01.pdb DEL pdb01.pdb" POSTCMD="IF EXIST pdb01.pdb EXIT 1" # different file w/ -g (no pdb01.pdb) +NOMONO SOURCE=E_pdb_and_debug.fs SCFLAGS="--pdb:pdb01x.pdb" PRECMD="IF EXIST pdb01x.pdb DEL pdb01x.pdb" POSTCMD="IF EXIST pdb01x.pdb EXIT 1" # different file w/o -g +NOMONO SOURCE=pdb01.fs SCFLAGS="-g --pdb:pdb01x.pdb" PRECMD="IF EXIST pdb01x.pdb DEL pdb01x.pdb" POSTCMD="IF NOT EXIST pdb01x.pdb EXIT 1" # different file w/ -g +NOMONO SOURCE=E_pdb_and_debug.fs SCFLAGS="--pdb:pdb01x.pdb" PRECMD="IF EXIST pdb01.pdb DEL pdb01.pdb" POSTCMD="IF EXIST pdb01.pdb EXIT 1" # different file w/o -g (no pdb01.pdb) +NOMONO SOURCE=pdb01.fs SCFLAGS="-g --pdb:pdb01x.pdb" PRECMD="IF EXIST pdb01.pdb DEL pdb01.pdb" POSTCMD="IF EXIST pdb01.pdb EXIT 1" # different file w/ -g (no pdb01.pdb) NOMONO SOURCE=pdb01.fs SCFLAGS="--debug --pdb:d\\pdb01.pdb" PRECMD="setup.cmd" POSTCMD="IF NOT EXIST d\\pdb01.pdb EXIT 1" # different file w/ -g (in a directory) NOMONO SOURCE=pdb01.fs SCFLAGS="--debug --pdb:.\\pdb01.pdb" PRECMD="IF EXIST pdb01.pdb DEL pdb01.pdb" POSTCMD="IF NOT EXIST pdb01.pdb EXIT 1" # different file w/ -g (in current dir) -NOMONO SOURCE=pdb01.fs SCFLAGS="-g --debug:embedded --pdb:.\\pdbembedded.pdb" PRECMD="IF EXIST pdbembedded.pdb DEL pdbembedded.pdb" POSTCMD="IF EXIST pdbembedded.pdb dir pdbembedded.pdb&EXIT 1" # If pdb file exists then it didn't embed so fail. +NOMONO SOURCE=pdb01.fs SCFLAGS="-g --debug:embedded --pdb:.\\pdbembedded.pdb" PRECMD="IF EXIST pdbembedded.pdb DEL pdbembedded.pdb" POSTCMD="IF EXIST pdbembedded.pdb dir pdbembedded.pdb&EXIT 1" # If pdb file exists then it didn't embed so fail. + +NOMONO SOURCE=pdb01.fs SCFLAGS="-g --debug:portable --embed:pdb01.fs --pdb:.\\pdbportable.pdb" PRECMD="IF EXIST pdbportable.pdb DEL pdbportable.pdb" POSTCMD="IF not EXIST pdbportable.pdb dir pdbportable.pdb&EXIT 1" # If pdb file doesn't exist then it failed to generate portable pdb with embeded source. +NOMONO SOURCE=pdb01.fs SCFLAGS="-g --out:pdbembedded.exe --debug:embedded --embed:pdb01.fs PRECMD="IF EXIST pdbembedded.exe DEL pdbembedded.exe" POSTCMD="IF NOT EXIST pdbembedded.exe dir pdbembedded.exe &EXIT 1" # If pdb file doesn't exist then it failed to embedded a pdb with embedded source. + +NOMONO SOURCE=pdb05.fs SCFLAGS="-g --debug:full --embed" # --embed with --debug:full is build error +NOMONO SOURCE=pdb05.fs SCFLAGS="-g --debug:pdbonly --embed" # --embed with --debug:pdbonly is build error + +NOMONO SOURCE=pdb05.fs SCFLAGS="-g --out:pdbportable.exe --debug:full --embed:pdb05.fs # --embed:filelist with --debug:full is build error +NOMONO SOURCE=pdb05.fs SCFLAGS="-g --out:pdbportable.exe --debug:pdbonly --embed:pdb05.fs" # --embed:filelist with --debug:pdbonly is build error # Case sensitive - SOURCE=pdb02.fs SCFLAGS="--PDB -g" POSTCMD="IF EXIST pdb02.pdb EXIT 1" # --PDB + SOURCE=pdb02.fs SCFLAGS="--PDB -g" POSTCMD="IF EXIST pdb02.pdb EXIT 1" # --PDB # Not in FSI SOURCE=pdb03.fsx SCFLAGS="--pdb:pdb03x.pdb -g" COMPILE_ONLY=1 FSIMODE=PIPE POSTCMD="IF EXIST pdb03x.pdb EXIT 1" # fsi # Test against creating debug info when file is not accessible -NOMONO SOURCE=pdb04.fs SCFLAGS="-g --pdb:pdb04.exe" # pdb04.fs +NOMONO SOURCE=pdb04.fs SCFLAGS="-g --pdb:pdb04.exe" # pdb04.fs diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/pdb/pdb05.fs b/tests/fsharpqa/Source/CompilerOptions/fsc/pdb/pdb05.fs new file mode 100644 index 00000000000..10e8390769d --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/pdb/pdb05.fs @@ -0,0 +1,4 @@ +// #Regression #NoMT #CompilerOptions #NoMono +//.+embed switch only supported when emitting a Portable PDB .+ + +exit 1 diff --git a/tests/fsharpqa/Source/Conformance/DeclarationElements/LetBindings/Basic/ManyLetBindings.fs b/tests/fsharpqa/Source/Conformance/DeclarationElements/LetBindings/Basic/ManyLetBindings.fs index f5ca30545c0..c4d01c11fbd 100644 --- a/tests/fsharpqa/Source/Conformance/DeclarationElements/LetBindings/Basic/ManyLetBindings.fs +++ b/tests/fsharpqa/Source/Conformance/DeclarationElements/LetBindings/Basic/ManyLetBindings.fs @@ -513,3 +513,191 @@ let x508 = "508" let x509 = "509" let x510 = "510" let x511 = "511" +let x512 = "512" +let x513 = "513" +let x514 = "514" +let x515 = "515" +let x516 = "516" +let x517 = "517" +let x518 = "518" +let x519 = "519" +let x520 = "520" +let x521 = "521" +let x522 = "522" +let x523 = "523" +let x524 = "524" +let x525 = "525" +let x526 = "526" +let x527 = "527" +let x528 = "528" +let x529 = "529" +let x530 = "530" +let x531 = "531" +let x532 = "532" +let x533 = "533" +let x534 = "534" +let x535 = "535" +let x536 = "536" +let x537 = "537" +let x538 = "538" +let x539 = "539" +let x540 = "540" +let x541 = "541" +let x542 = "542" +let x543 = "543" +let x544 = "544" +let x545 = "545" +let x546 = "546" +let x547 = "547" +let x548 = "548" +let x549 = "549" +let x550 = "550" +let x551 = "551" +let x552 = "552" +let x553 = "553" +let x554 = "554" +let x555 = "555" +let x556 = "556" +let x557 = "557" +let x558 = "558" +let x559 = "559" +let x560 = "560" +let x561 = "561" +let x562 = "562" +let x563 = "563" +let x564 = "564" +let x565 = "565" +let x566 = "566" +let x567 = "567" +let x568 = "568" +let x569 = "569" +let x570 = "570" +let x571 = "571" +let x572 = "572" +let x573 = "573" +let x574 = "574" +let x575 = "575" +let x576 = "576" +let x577 = "577" +let x578 = "578" +let x579 = "579" +let x580 = "580" +let x581 = "581" +let x582 = "582" +let x583 = "583" +let x584 = "584" +let x585 = "585" +let x586 = "586" +let x587 = "587" +let x588 = "588" +let x589 = "589" +let x590 = "590" +let x591 = "591" +let x592 = "592" +let x593 = "593" +let x594 = "594" +let x595 = "595" +let x596 = "596" +let x597 = "597" +let x598 = "598" +let x599 = "599" +let x600 = "600" +let x601 = "601" +let x602 = "602" +let x603 = "603" +let x604 = "604" +let x605 = "605" +let x606 = "606" +let x607 = "607" +let x608 = "608" +let x609 = "609" +let x610 = "610" +let x611 = "611" +let x612 = "612" +let x613 = "613" +let x614 = "614" +let x615 = "615" +let x616 = "616" +let x617 = "617" +let x618 = "618" +let x619 = "619" +let x620 = "620" +let x621 = "621" +let x622 = "622" +let x623 = "623" +let x624 = "624" +let x625 = "625" +let x626 = "626" +let x627 = "627" +let x628 = "628" +let x629 = "629" +let x630 = "630" +let x631 = "631" +let x632 = "632" +let x633 = "633" +let x634 = "634" +let x635 = "635" +let x636 = "636" +let x637 = "637" +let x638 = "638" +let x639 = "639" +let x640 = "640" +let x641 = "641" +let x642 = "642" +let x643 = "643" +let x644 = "644" +let x645 = "645" +let x646 = "646" +let x647 = "647" +let x648 = "648" +let x649 = "649" +let x650 = "650" +let x651 = "651" +let x652 = "652" +let x653 = "653" +let x654 = "654" +let x655 = "655" +let x656 = "656" +let x657 = "657" +let x658 = "658" +let x659 = "659" +let x660 = "660" +let x661 = "661" +let x662 = "662" +let x663 = "663" +let x664 = "664" +let x665 = "665" +let x666 = "666" +let x667 = "667" +let x668 = "668" +let x669 = "669" +let x670 = "670" +let x671 = "671" +let x672 = "672" +let x673 = "673" +let x674 = "674" +let x675 = "675" +let x676 = "676" +let x677 = "677" +let x678 = "678" +let x679 = "679" +let x680 = "680" +let x681 = "681" +let x682 = "682" +let x683 = "683" +let x684 = "684" +let x685 = "685" +let x686 = "686" +let x687 = "687" +let x688 = "688" +let x689 = "689" +let x690 = "690" +let x691 = "691" +let x692 = "692" +let x693 = "693" +let x694 = "694" +let x695 = "695" +let x696 = "696" +let x697 = "697" +let x698 = "698" +let x699 = "699" diff --git a/tests/fsharpqa/Source/Conformance/DeclarationElements/LetBindings/Basic/env.lst b/tests/fsharpqa/Source/Conformance/DeclarationElements/LetBindings/Basic/env.lst index 1b523e68034..7685eb450c1 100644 --- a/tests/fsharpqa/Source/Conformance/DeclarationElements/LetBindings/Basic/env.lst +++ b/tests/fsharpqa/Source/Conformance/DeclarationElements/LetBindings/Basic/env.lst @@ -4,8 +4,9 @@ SOURCE=Pathological04.fs SCFLAGS=-a # Pathological04.fs SOURCE=E_Pathological05.fs SCFLAGS=--test:ErrorRanges # E_Pathological05.fs SOURCE=E_Pathological06.fs SCFLAGS=--test:ErrorRanges # E_Pathological06.fs - - SOURCE=ManyLetBindings.fs SCFLAGS="--debug:full --optimize-" # ManyLetBindings.fs + + SOURCE=ManyLetBindings.fs SCFLAGS="--debug:full --optimize-" # Full ManyLetBindings.fs + SOURCE=ManyLetBindings.fs SCFLAGS="--debug:portable --optimize-" # Portable ManyLetBindings.fs SOURCE=SanityCheck.fs # SanityCheck.fs SOURCE=nestedLetBindings.fs # nestedLetBindings.fs diff --git a/tests/fsharpqa/Source/test.lst b/tests/fsharpqa/Source/test.lst index 1eb2476c1a7..0c33bdb3dc9 100644 --- a/tests/fsharpqa/Source/test.lst +++ b/tests/fsharpqa/Source/test.lst @@ -46,7 +46,7 @@ CompilerOptions01,NoMT CompilerOptions\fsc\noframework CompilerOptions01,NoMT CompilerOptions\fsc\nologo CompilerOptions01,NoMT CompilerOptions\fsc\optimize CompilerOptions01,NoMT CompilerOptions\fsc\out -CompilerOptions01,NoMT CompilerOptions\fsc\pdb +CompilerOptions01,NoMT,pdbs CompilerOptions\fsc\pdb CompilerOptions01,NoMT CompilerOptions\fsc\platform CompilerOptions01,NoMT CompilerOptions\fsc\reference CompilerOptions01,NoMT CompilerOptions\fsc\Removed