Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/FSharpSource.Profiles.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup Condition="'$(TargetDotnetProfile)'=='net40'">
<DefineConstants>$(DefineConstants);PREFERRED_UI_LANG</DefineConstants>
<DefineConstants>$(DefineConstants);ENABLE_MONO_SUPPORT</DefineConstants>
<DefineConstants>$(DefineConstants);BE_SECURITY_TRANSPARENT</DefineConstants>
<DefineConstants>$(DefineConstants);FX_LCIDFROMCODEPAGE</DefineConstants>
Expand All @@ -15,7 +14,6 @@
<PropertyGroup Condition="'$(TargetDotnetProfile)'=='coreclr'">
<DefineConstants>$(DefineConstants);FX_PORTABLE_OR_NETSTANDARD</DefineConstants>
<DefineConstants>$(DefineConstants);NETSTANDARD1_6</DefineConstants>
<DefineConstants>$(DefineConstants);PREFERRED_UI_LANG</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_APP_DOMAINS</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_ARRAY_LONG_LENGTH</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_BEGINEND_READWRITE</DefineConstants>
Expand Down
6 changes: 0 additions & 6 deletions src/fsharp/CompileOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2283,9 +2283,7 @@ type TcConfigBuilder =
mutable optSettings : Optimizer.OptimizationSettings
mutable emitTailcalls : bool
mutable deterministic : bool
#if PREFERRED_UI_LANG
mutable preferredUiLang: string option
#endif
mutable lcid : int option
mutable productNameForBannerText : string
/// show the MS (c) notice, e.g. with help or fsi?
Expand Down Expand Up @@ -2444,9 +2442,7 @@ type TcConfigBuilder =
optSettings = Optimizer.OptimizationSettings.Defaults
emitTailcalls = true
deterministic = false
#if PREFERRED_UI_LANG
preferredUiLang = None
#endif
lcid = None
// See bug 6071 for product banner spec
productNameForBannerText = FSComp.SR.buildProductName(FSharpEnvironment.FSharpBannerVersion)
Expand Down Expand Up @@ -2910,9 +2906,7 @@ type TcConfig private (data : TcConfigBuilder, validate:bool) =
member x.optSettings = data.optSettings
member x.emitTailcalls = data.emitTailcalls
member x.deterministic = data.deterministic
#if PREFERRED_UI_LANG
member x.preferredUiLang = data.preferredUiLang
#endif
member x.lcid = data.lcid
member x.optsOn = data.optsOn
member x.productNameForBannerText = data.productNameForBannerText
Expand Down
6 changes: 0 additions & 6 deletions src/fsharp/CompileOps.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,7 @@ type TcConfigBuilder =
mutable optSettings : Optimizer.OptimizationSettings
mutable emitTailcalls: bool
mutable deterministic: bool
#if PREFERRED_UI_LANG
mutable preferredUiLang: string option
#endif
mutable lcid : int option
mutable productNameForBannerText: string
mutable showBanner : bool
Expand Down Expand Up @@ -481,11 +479,7 @@ type TcConfig =
member optSettings : Optimizer.OptimizationSettings
member emitTailcalls: bool
member deterministic: bool
#if PREFERRED_UI_LANG
member preferredUiLang: string option
#else
member lcid : int option
#endif
member optsOn : bool
member productNameForBannerText: string
member showBanner : bool
Expand Down
8 changes: 0 additions & 8 deletions src/fsharp/CompileOptions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -739,10 +739,8 @@ let codePageFlag (tcConfigB : TcConfigBuilder) =
tcConfigB.inputCodePage <- Some(n)), None,
Some (FSComp.SR.optsCodepage()))

#if PREFERRED_UI_LANG
let preferredUiLang (tcConfigB: TcConfigBuilder) =
CompilerOption("preferreduilang", tagString, OptionString (fun s -> tcConfigB.preferredUiLang <- Some(s)), None, Some(FSComp.SR.optsPreferredUiLang()))
#endif

let utf8OutputFlag (tcConfigB: TcConfigBuilder) =
CompilerOption("utf8output", tagNone, OptionUnit (fun () -> tcConfigB.utf8output <- true), None,
Expand Down Expand Up @@ -771,9 +769,7 @@ let advancedFlagsBoth tcConfigB =
[
yield codePageFlag tcConfigB
yield utf8OutputFlag tcConfigB
#if PREFERRED_UI_LANG
yield preferredUiLang tcConfigB
#endif
yield fullPathsFlag tcConfigB
yield libFlag tcConfigB
yield CompilerOption("simpleresolution",
Expand Down Expand Up @@ -849,11 +845,7 @@ let testFlag tcConfigB =
let vsSpecificFlags (tcConfigB: TcConfigBuilder) =
[ CompilerOption("vserrors", tagNone, OptionUnit (fun () -> tcConfigB.errorStyle <- ErrorStyle.VSErrors), None, None)
CompilerOption("validate-type-providers", tagNone, OptionUnit (id), None, None) // preserved for compatibility's sake, no longer has any effect
#if PREFERRED_UI_LANG
CompilerOption("LCID", tagInt, OptionInt (fun _n -> ()), None, None)
#else
CompilerOption("LCID", tagInt, OptionInt (fun n -> tcConfigB.lcid <- Some(n)), None, None)
#endif
CompilerOption("flaterrors", tagNone, OptionUnit (fun () -> tcConfigB.flatErrors <- true), None, None)
CompilerOption("sqmsessionguid", tagNone, OptionString (fun s -> tcConfigB.sqmSessionGuid <- try System.Guid(s) |> Some with e -> None), None, None)
CompilerOption("gccerrors", tagNone, OptionUnit (fun () -> tcConfigB.errorStyle <- ErrorStyle.GccErrors), None, None)
Expand Down
6 changes: 0 additions & 6 deletions src/fsharp/fsc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1635,19 +1635,13 @@ let main0(ctok, argv, legacyReferenceResolver, bannerAlreadyPrinted, openBinarie
let directoryBuildingFrom = Directory.GetCurrentDirectory()
let setProcessThreadLocals tcConfigB =
tcConfigB.openBinariesInMemory <- openBinariesInMemory
#if PREFERRED_UI_LANG
match tcConfigB.preferredUiLang with
#if FX_RESHAPED_GLOBALIZATION
| Some s -> System.Globalization.CultureInfo.CurrentUICulture <- new System.Globalization.CultureInfo(s)
#else
| Some s -> Thread.CurrentThread.CurrentUICulture <- new System.Globalization.CultureInfo(s)
#endif
| None -> ()
#else
match tcConfigB.lcid with
| Some n -> Thread.CurrentThread.CurrentUICulture <- new CultureInfo(n)
| None -> ()
#endif
if tcConfigB.utf8output then
Console.OutputEncoding <- Encoding.UTF8

Expand Down
30 changes: 6 additions & 24 deletions src/fsharp/fsi/fsi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2419,19 +2419,6 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i
// We later switch to doing interaction-by-interaction processing on the "event loop" thread.
let ctokStartup = AssumeCompilationThreadWithoutEvidence ()

#if FX_LCIDFROMCODEPAGE

// See Bug 735819
let lcidFromCodePage =
if (Console.OutputEncoding.CodePage <> 65001) &&
(Console.OutputEncoding.CodePage <> Thread.CurrentThread.CurrentUICulture.TextInfo.OEMCodePage) &&
(Console.OutputEncoding.CodePage <> Thread.CurrentThread.CurrentUICulture.TextInfo.ANSICodePage) then
Thread.CurrentThread.CurrentUICulture <- new CultureInfo("en-US")
Some 1033
else
None
#endif

let timeReporter = FsiTimeReporter(outWriter)

#if !FX_RESHAPED_CONSOLE
Expand Down Expand Up @@ -2494,19 +2481,14 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i
let fsiOptions = FsiCommandLineOptions(fsi, argv, tcConfigB, fsiConsoleOutput)
let fsiConsolePrompt = FsiConsolePrompt(fsiOptions, fsiConsoleOutput)

// Check if we have a codepage from the console
#if FX_LCIDFROMCODEPAGE
do
match fsiOptions.FsiLCID with
| Some _ -> ()
| None -> tcConfigB.lcid <- lcidFromCodePage

// Set the ui culture
do
match fsiOptions.FsiLCID with
| Some(n) -> Thread.CurrentThread.CurrentUICulture <- new CultureInfo(n)
| None -> ()
match tcConfigB.preferredUiLang with
#if FX_RESHAPED_GLOBALIZATION
| Some s -> System.Globalization.CultureInfo.CurrentUICulture <- new System.Globalization.CultureInfo(s)
#else
| Some s -> Thread.CurrentThread.CurrentUICulture <- new System.Globalization.CultureInfo(s)
#endif
| None -> ()

#if !FX_NO_SERVERCODEPAGES
do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3277,16 +3277,9 @@ internal virtual BuildSubmission DoMSBuildSubmission(BuildKind buildKind, string

projectInstance.SetProperty("UTFOutput", "true");

#if FX_PREFERRED_UI_LANG
// The CoreCLR build of FSC will use the CultureName since lcid doesn't apply very well
// so that the errors reported by fsc.exe are in the right locale
projectInstance.SetProperty("PREFERREDUILANG", System.Threading.Thread.CurrentThread.CurrentUICulture.Name);
#else
// When building, we need to set the flags for the fsc.exe that we spawned
// so that the errors reported by fsc.exe are in the right locale
projectInstance.SetProperty("LCID", System.Threading.Thread.CurrentThread.CurrentUICulture.LCID.ToString());
#endif

this.BuildProject.ProjectCollection.HostServices.SetNodeAffinity(projectInstance.FullPath, NodeAffinity.InProc);
BuildRequestData requestData = new BuildRequestData(projectInstance, targetsToBuild, this.BuildProject.ProjectCollection.HostServices, BuildRequestDataFlags.ReplaceExistingProjectInstance);
submission = BuildManager.DefaultBuildManager.PendBuildRequest(requestData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<DefineConstants>$(DefineConstants);CODE_ANALYSIS</DefineConstants>
<AsmmetaDependsOnMSBuildInVS>true</AsmmetaDependsOnMSBuildInVS>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<DefineConstants>$(DefineConstants);FX_PREFERRED_UI_LANG</DefineConstants>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
Expand Down