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
20 changes: 13 additions & 7 deletions src/Compiler/Driver/CompilerOptions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ let SetDeterministicSwitch (tcConfigB: TcConfigBuilder) switch =

let SetReferenceAssemblyOnlySwitch (tcConfigB: TcConfigBuilder) switch =
match tcConfigB.emitMetadataAssembly with
| MetadataAssemblyGeneration.None ->
| MetadataAssemblyGeneration.None when tcConfigB.standalone = false && tcConfigB.extraStaticLinkRoots.IsEmpty ->
tcConfigB.emitMetadataAssembly <-
if (switch = OptionSwitch.On) then
MetadataAssemblyGeneration.ReferenceOnly
Expand All @@ -591,7 +591,7 @@ let SetReferenceAssemblyOnlySwitch (tcConfigB: TcConfigBuilder) switch =

let SetReferenceAssemblyOutSwitch (tcConfigB: TcConfigBuilder) outputPath =
match tcConfigB.emitMetadataAssembly with
| MetadataAssemblyGeneration.None ->
| MetadataAssemblyGeneration.None when tcConfigB.standalone = false && tcConfigB.extraStaticLinkRoots.IsEmpty ->
if FileSystem.IsInvalidPathShim outputPath then
error (Error(FSComp.SR.optsInvalidRefOut (), rangeCmdArgs))
else
Expand Down Expand Up @@ -1304,9 +1304,12 @@ let advancedFlagsFsc tcConfigB =
"standalone",
tagNone,
OptionUnit(fun _ ->
tcConfigB.openDebugInformationForLaterStaticLinking <- true
tcConfigB.standalone <- true
tcConfigB.implicitlyResolveAssemblies <- true),
match tcConfigB.emitMetadataAssembly with
| MetadataAssemblyGeneration.None ->
tcConfigB.openDebugInformationForLaterStaticLinking <- true
tcConfigB.standalone <- true
tcConfigB.implicitlyResolveAssemblies <- true
| _ -> error (Error(FSComp.SR.optsInvalidRefAssembly (), rangeCmdArgs))),
None,
Some(FSComp.SR.optsStandalone ())
)
Expand All @@ -1315,8 +1318,11 @@ let advancedFlagsFsc tcConfigB =
"staticlink",
tagFile,
OptionString(fun s ->
tcConfigB.extraStaticLinkRoots <- tcConfigB.extraStaticLinkRoots @ [ s ]
tcConfigB.implicitlyResolveAssemblies <- true),
match tcConfigB.emitMetadataAssembly with
| MetadataAssemblyGeneration.None ->
tcConfigB.extraStaticLinkRoots <- tcConfigB.extraStaticLinkRoots @ [ s ]
tcConfigB.implicitlyResolveAssemblies <- true
| _ -> error (Error(FSComp.SR.optsInvalidRefAssembly (), rangeCmdArgs))),
None,
Some(FSComp.SR.optsStaticlink ())
)
Expand Down
4 changes: 0 additions & 4 deletions src/Compiler/Driver/StaticLinking.fs
Original file line number Diff line number Diff line change
Expand Up @@ -514,10 +514,6 @@ let StaticLink (ctok, tcConfig: TcConfig, tcImports: TcImports, ilGlobals: ILGlo
id
else
(fun ilxMainModule ->
match tcConfig.emitMetadataAssembly with
| MetadataAssemblyGeneration.None -> ()
| _ -> error (Error(FSComp.SR.optsInvalidRefAssembly (), rangeCmdArgs))

ReportTime tcConfig "Find assembly references"

let dependentILModules =
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ fscTooManyErrors,"Exiting - too many errors"
2025,fscAssemblyWildcardAndDeterminism,"An %s specified version '%s', but this value is a wildcard, and you have requested a deterministic build, these are in conflict."
2028,optsInvalidPathMapFormat,"Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath'"
2029,optsInvalidRefOut,"Invalid reference assembly path'"
2030,optsInvalidRefAssembly,"Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together."
2030,optsInvalidRefAssembly,"Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'."
3000,etIllegalCharactersInNamespaceName,"Character '%s' is not allowed in provided namespace name '%s'"
3001,etNullOrEmptyMemberName,"The provided type '%s' returned a member with a null or empty member name"
3002,etNullMember,"The provided type '%s' returned a null member"
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSComp.txt.cs.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@
<note />
</trans-unit>
<trans-unit id="optsInvalidRefAssembly">
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
<target state="translated">Neplatné použití generování referenčního sestavení, nepoužívejte --staticlink ani --refonly a --refout společně.</target>
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
<target state="needs-review-translation">Neplatné použití generování referenčního sestavení, nepoužívejte --staticlink ani --refonly a --refout společně.</target>
<note />
</trans-unit>
<trans-unit id="optsInvalidRefOut">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSComp.txt.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@
<note />
</trans-unit>
<trans-unit id="optsInvalidRefAssembly">
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
<target state="translated">Ungültige Verwendung der Ausgabe einer Referenzassembly. Verwenden Sie nicht "--staticlink" oder "--refonly" und "--refout" zusammen.</target>
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
<target state="needs-review-translation">Ungültige Verwendung der Ausgabe einer Referenzassembly. Verwenden Sie nicht "--staticlink" oder "--refonly" und "--refout" zusammen.</target>
<note />
</trans-unit>
<trans-unit id="optsInvalidRefOut">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSComp.txt.es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@
<note />
</trans-unit>
<trans-unit id="optsInvalidRefAssembly">
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
<target state="translated">Uso no válido de emitir un ensamblado de referencia, no use "--staticlink', or '--refonly' and '--refout" de forma conjunta.</target>
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
<target state="needs-review-translation">Uso no válido de emitir un ensamblado de referencia, no use "--staticlink', or '--refonly' and '--refout" de forma conjunta.</target>
<note />
</trans-unit>
<trans-unit id="optsInvalidRefOut">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSComp.txt.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@
<note />
</trans-unit>
<trans-unit id="optsInvalidRefAssembly">
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
<target state="translated">Utilisation non valide de l’émission d’un assembly de référence. N’utilisez pas '--staticlink' ni '--refonly' et '--refout' ensemble.</target>
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
<target state="needs-review-translation">Utilisation non valide de l’émission d’un assembly de référence. N’utilisez pas '--staticlink' ni '--refonly' et '--refout' ensemble.</target>
<note />
</trans-unit>
<trans-unit id="optsInvalidRefOut">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSComp.txt.it.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@
<note />
</trans-unit>
<trans-unit id="optsInvalidRefAssembly">
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
<target state="translated">Utilizzo non valido della creazione di un assembly di riferimento. Non usare insieme '--staticlink' o '--refonly' e '--refout'.</target>
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
<target state="needs-review-translation">Utilizzo non valido della creazione di un assembly di riferimento. Non usare insieme '--staticlink' o '--refonly' e '--refout'.</target>
<note />
</trans-unit>
<trans-unit id="optsInvalidRefOut">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSComp.txt.ja.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@
<note />
</trans-unit>
<trans-unit id="optsInvalidRefAssembly">
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
<target state="translated">参照アセンブリの生成の使用が無効です。'--staticlink'、または '--refonly' と '--refout' を同時に使用しないでください。</target>
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
<target state="needs-review-translation">参照アセンブリの生成の使用が無効です。'--staticlink'、または '--refonly' と '--refout' を同時に使用しないでください。</target>
<note />
</trans-unit>
<trans-unit id="optsInvalidRefOut">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSComp.txt.ko.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@
<note />
</trans-unit>
<trans-unit id="optsInvalidRefAssembly">
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
<target state="translated">참조 어셈블리 내보내기를 잘못 사용했습니다. '--staticlink' 또는 '--refonly' 및 '--refout'을 함께 사용하지 마세요.</target>
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
<target state="needs-review-translation">참조 어셈블리 내보내기를 잘못 사용했습니다. '--staticlink' 또는 '--refonly' 및 '--refout'을 함께 사용하지 마세요.</target>
<note />
</trans-unit>
<trans-unit id="optsInvalidRefOut">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSComp.txt.pl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@
<note />
</trans-unit>
<trans-unit id="optsInvalidRefAssembly">
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
<target state="translated">Nieprawidłowe użycie emitowania zestawu odwołania, nie używaj razem elementów „--staticlink” ani „--refonly” i „--refout”.</target>
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
<target state="needs-review-translation">Nieprawidłowe użycie emitowania zestawu odwołania, nie używaj razem elementów „--staticlink” ani „--refonly” i „--refout”.</target>
<note />
</trans-unit>
<trans-unit id="optsInvalidRefOut">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSComp.txt.pt-BR.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@
<note />
</trans-unit>
<trans-unit id="optsInvalidRefAssembly">
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
<target state="translated">Uso inválido de emitir um assembly de referência, não use '--staticlink' ou '--reutilly' e '--refout' juntos.</target>
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
<target state="needs-review-translation">Uso inválido de emitir um assembly de referência, não use '--staticlink' ou '--reutilly' e '--refout' juntos.</target>
<note />
</trans-unit>
<trans-unit id="optsInvalidRefOut">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSComp.txt.ru.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@
<note />
</trans-unit>
<trans-unit id="optsInvalidRefAssembly">
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
<target state="translated">Недопустимое использование при создании базовой сборки. Не используйте "--staticlink" или "--refonly" и "--refout" вместе.</target>
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
<target state="needs-review-translation">Недопустимое использование при создании базовой сборки. Не используйте "--staticlink" или "--refonly" и "--refout" вместе.</target>
<note />
</trans-unit>
<trans-unit id="optsInvalidRefOut">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSComp.txt.tr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@
<note />
</trans-unit>
<trans-unit id="optsInvalidRefAssembly">
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
<target state="translated">Başvuru bütünleştirilmiş kodunun oluşturulması için geçersiz kullanım: '--staticlink' veya '--refonly' ile '--refout' birlikte kullanılmaz.</target>
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
<target state="needs-review-translation">Başvuru bütünleştirilmiş kodunun oluşturulması için geçersiz kullanım: '--staticlink' veya '--refonly' ile '--refout' birlikte kullanılmaz.</target>
<note />
</trans-unit>
<trans-unit id="optsInvalidRefOut">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSComp.txt.zh-Hans.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@
<note />
</trans-unit>
<trans-unit id="optsInvalidRefAssembly">
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
<target state="translated">发出引用程序集的使用无效,请勿同时使用“--staticlink”或“--refonly”和“--refout”。</target>
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
<target state="needs-review-translation">发出引用程序集的使用无效,请勿同时使用“--staticlink”或“--refonly”和“--refout”。</target>
<note />
</trans-unit>
<trans-unit id="optsInvalidRefOut">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSComp.txt.zh-Hant.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@
<note />
</trans-unit>
<trans-unit id="optsInvalidRefAssembly">
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
<target state="translated">發出參考組件的使用無效,請勿同時使用 '--staticlink' 或 '--refonly' 和 '--refout'。</target>
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
<target state="needs-review-translation">發出參考組件的使用無效,請勿同時使用 '--staticlink' 或 '--refonly' 和 '--refout'。</target>
<note />
</trans-unit>
<trans-unit id="optsInvalidRefOut">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<DefineConstants>NO_GENERATIVE</DefineConstants>
<DefineConstants>IS_DESIGNTIME</DefineConstants>
<FSharpCoreImplicitPackageVersion>$(FSharpCoreShippedPackageVersionValue)</FSharpCoreImplicitPackageVersion>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<IsPackable>false</IsPackable>
<DefineConstants>NO_GENERATIVE</DefineConstants>
<FSharpCoreImplicitPackageVersion>$(FSharpCoreShippedPackageVersionValue)</FSharpCoreImplicitPackageVersion>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<FSharpCoreImplicitPackageVersion>$(FSharpCoreShippedPackageVersionValue)</FSharpCoreImplicitPackageVersion>
<PackagePath>typeproviders</PackagePath>
<NoWarn>$(NoWarn);NU5100;NU5118</NoWarn>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.

namespace FSharp.Compiler.ComponentTests.CompilerOptions

open Xunit
open FSharp.Test
open FSharp.Test.Compiler

module RefOnlyRefOut =

// Test refout/refonly alongside standalone
[<Fact>]
let ``fsc --refonly --standalone``() =
FSharp """
"""
|> asExe
|> withOptions ["--refonly"; "--standalone"]
|> compile
|> shouldFail
|> withDiagnostics [
(Error 2030, Line 0, Col 1, Line 0, Col 1, "Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.")
]

[<Fact>]
let ``fsc --standalone --refonly ``() =
FSharp """
"""
|> asExe
|> withOptions ["--standalone"; "--refonly"]
|> compile
|> shouldFail
|> withDiagnostics [
(Error 2030, Line 0, Col 1, Line 0, Col 1, "Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.")
]

[<Fact>]
let ``fsc --refout:. --standalone``() =
FSharp """
"""
|> asExe
|> withOptions ["--refout:."; "--standalone"]
|> compile
|> shouldFail
|> withDiagnostics [
(Error 2030, Line 0, Col 1, Line 0, Col 1, "Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.")
]

[<Fact>]
let ``fsc --standalone --refout:.``() =
FSharp """
"""
|> asExe
|> withOptions ["--standalone"; "--refout:."]
|> compile
|> shouldFail
|> withDiagnostics [
(Error 2030, Line 0, Col 1, Line 0, Col 1, "Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.")
]

// Test refout/refonly alongside staticlink
[<Fact>]
let ``fsc --refonly --staticlink:.``() =
FSharp """
"""
|> asExe
|> withOptions ["--refonly"; "--staticlink:."]
|> compile
|> shouldFail
|> withDiagnostics [
(Error 2030, Line 0, Col 1, Line 0, Col 1, "Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.")
]

[<Fact>]
let ``fsc --staticlink:. --refonly ``() =
FSharp """
"""
|> asExe
|> withOptions ["--staticlink:."; "--refonly"]
|> compile
|> shouldFail
|> withDiagnostics [
(Error 2030, Line 0, Col 1, Line 0, Col 1, "Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.")
]

[<Fact>]
let ``fsc --refout:. --staticlink:.``() =
FSharp """
"""
|> asExe
|> withOptions ["--refout:."; "--staticlink:."]
|> compile
|> shouldFail
|> withDiagnostics [
(Error 2030, Line 0, Col 1, Line 0, Col 1, "Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.")
]

[<Fact>]
let ``fsc --staticlink:. --refout:.``() =
FSharp """
"""
|> asExe
|> withOptions ["--staticlink:."; "--refout:."]
|> compile
|> shouldFail
|> withDiagnostics [
(Error 2030, Line 0, Col 1, Line 0, Col 1, "Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.")
]
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
<Compile Include="CompilerOptions\fsc\warnon\warnon.fs" />
<Compile Include="CompilerOptions\fsc\reference.fs" />
<Compile Include="CompilerOptions\fsc\reflectionfree.fs" />
<Compile Include="CompilerOptions\fsc\refonlyrefout.fs" />
<Compile Include="Debugger\PortablePdbs.fs" />
<Compile Include="Diagnostics\async.fs" />
<Compile Include="Diagnostics\General.fs" />
Expand Down
Loading