Skip to content

Commit 1fc23fb

Browse files
authored
refonly validation (#14416)
1 parent 17fdbb1 commit 1fc23fb

File tree

22 files changed

+148
-79
lines changed

22 files changed

+148
-79
lines changed

src/Compiler/Driver/CompilerOptions.fs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ let SetDeterministicSwitch (tcConfigB: TcConfigBuilder) switch =
581581

582582
let SetReferenceAssemblyOnlySwitch (tcConfigB: TcConfigBuilder) switch =
583583
match tcConfigB.emitMetadataAssembly with
584-
| MetadataAssemblyGeneration.None ->
584+
| MetadataAssemblyGeneration.None when tcConfigB.standalone = false && tcConfigB.extraStaticLinkRoots.IsEmpty ->
585585
tcConfigB.emitMetadataAssembly <-
586586
if (switch = OptionSwitch.On) then
587587
MetadataAssemblyGeneration.ReferenceOnly
@@ -591,7 +591,7 @@ let SetReferenceAssemblyOnlySwitch (tcConfigB: TcConfigBuilder) switch =
591591

592592
let SetReferenceAssemblyOutSwitch (tcConfigB: TcConfigBuilder) outputPath =
593593
match tcConfigB.emitMetadataAssembly with
594-
| MetadataAssemblyGeneration.None ->
594+
| MetadataAssemblyGeneration.None when tcConfigB.standalone = false && tcConfigB.extraStaticLinkRoots.IsEmpty ->
595595
if FileSystem.IsInvalidPathShim outputPath then
596596
error (Error(FSComp.SR.optsInvalidRefOut (), rangeCmdArgs))
597597
else
@@ -1304,9 +1304,12 @@ let advancedFlagsFsc tcConfigB =
13041304
"standalone",
13051305
tagNone,
13061306
OptionUnit(fun _ ->
1307-
tcConfigB.openDebugInformationForLaterStaticLinking <- true
1308-
tcConfigB.standalone <- true
1309-
tcConfigB.implicitlyResolveAssemblies <- true),
1307+
match tcConfigB.emitMetadataAssembly with
1308+
| MetadataAssemblyGeneration.None ->
1309+
tcConfigB.openDebugInformationForLaterStaticLinking <- true
1310+
tcConfigB.standalone <- true
1311+
tcConfigB.implicitlyResolveAssemblies <- true
1312+
| _ -> error (Error(FSComp.SR.optsInvalidRefAssembly (), rangeCmdArgs))),
13101313
None,
13111314
Some(FSComp.SR.optsStandalone ())
13121315
)
@@ -1315,8 +1318,11 @@ let advancedFlagsFsc tcConfigB =
13151318
"staticlink",
13161319
tagFile,
13171320
OptionString(fun s ->
1318-
tcConfigB.extraStaticLinkRoots <- tcConfigB.extraStaticLinkRoots @ [ s ]
1319-
tcConfigB.implicitlyResolveAssemblies <- true),
1321+
match tcConfigB.emitMetadataAssembly with
1322+
| MetadataAssemblyGeneration.None ->
1323+
tcConfigB.extraStaticLinkRoots <- tcConfigB.extraStaticLinkRoots @ [ s ]
1324+
tcConfigB.implicitlyResolveAssemblies <- true
1325+
| _ -> error (Error(FSComp.SR.optsInvalidRefAssembly (), rangeCmdArgs))),
13201326
None,
13211327
Some(FSComp.SR.optsStaticlink ())
13221328
)

src/Compiler/Driver/StaticLinking.fs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,10 +514,6 @@ let StaticLink (ctok, tcConfig: TcConfig, tcImports: TcImports, ilGlobals: ILGlo
514514
id
515515
else
516516
(fun ilxMainModule ->
517-
match tcConfig.emitMetadataAssembly with
518-
| MetadataAssemblyGeneration.None -> ()
519-
| _ -> error (Error(FSComp.SR.optsInvalidRefAssembly (), rangeCmdArgs))
520-
521517
ReportTime tcConfig "Find assembly references"
522518

523519
let dependentILModules =

src/Compiler/FSComp.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ fscTooManyErrors,"Exiting - too many errors"
11651165
2025,fscAssemblyWildcardAndDeterminism,"An %s specified version '%s', but this value is a wildcard, and you have requested a deterministic build, these are in conflict."
11661166
2028,optsInvalidPathMapFormat,"Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath'"
11671167
2029,optsInvalidRefOut,"Invalid reference assembly path'"
1168-
2030,optsInvalidRefAssembly,"Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together."
1168+
2030,optsInvalidRefAssembly,"Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'."
11691169
3000,etIllegalCharactersInNamespaceName,"Character '%s' is not allowed in provided namespace name '%s'"
11701170
3001,etNullOrEmptyMemberName,"The provided type '%s' returned a member with a null or empty member name"
11711171
3002,etNullMember,"The provided type '%s' returned a null member"

src/Compiler/xlf/FSComp.txt.cs.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@
538538
<note />
539539
</trans-unit>
540540
<trans-unit id="optsInvalidRefAssembly">
541-
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
542-
<target state="translated">Neplatné použití generování referenčního sestavení, nepoužívejte --staticlink ani --refonly a --refout společně.</target>
541+
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
542+
<target state="needs-review-translation">Neplatné použití generování referenčního sestavení, nepoužívejte --staticlink ani --refonly a --refout společně.</target>
543543
<note />
544544
</trans-unit>
545545
<trans-unit id="optsInvalidRefOut">

src/Compiler/xlf/FSComp.txt.de.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@
538538
<note />
539539
</trans-unit>
540540
<trans-unit id="optsInvalidRefAssembly">
541-
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
542-
<target state="translated">Ungültige Verwendung der Ausgabe einer Referenzassembly. Verwenden Sie nicht "--staticlink" oder "--refonly" und "--refout" zusammen.</target>
541+
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
542+
<target state="needs-review-translation">Ungültige Verwendung der Ausgabe einer Referenzassembly. Verwenden Sie nicht "--staticlink" oder "--refonly" und "--refout" zusammen.</target>
543543
<note />
544544
</trans-unit>
545545
<trans-unit id="optsInvalidRefOut">

src/Compiler/xlf/FSComp.txt.es.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@
538538
<note />
539539
</trans-unit>
540540
<trans-unit id="optsInvalidRefAssembly">
541-
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
542-
<target state="translated">Uso no válido de emitir un ensamblado de referencia, no use "--staticlink', or '--refonly' and '--refout" de forma conjunta.</target>
541+
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
542+
<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>
543543
<note />
544544
</trans-unit>
545545
<trans-unit id="optsInvalidRefOut">

src/Compiler/xlf/FSComp.txt.fr.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@
538538
<note />
539539
</trans-unit>
540540
<trans-unit id="optsInvalidRefAssembly">
541-
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
542-
<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>
541+
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
542+
<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>
543543
<note />
544544
</trans-unit>
545545
<trans-unit id="optsInvalidRefOut">

src/Compiler/xlf/FSComp.txt.it.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@
538538
<note />
539539
</trans-unit>
540540
<trans-unit id="optsInvalidRefAssembly">
541-
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
542-
<target state="translated">Utilizzo non valido della creazione di un assembly di riferimento. Non usare insieme '--staticlink' o '--refonly' e '--refout'.</target>
541+
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
542+
<target state="needs-review-translation">Utilizzo non valido della creazione di un assembly di riferimento. Non usare insieme '--staticlink' o '--refonly' e '--refout'.</target>
543543
<note />
544544
</trans-unit>
545545
<trans-unit id="optsInvalidRefOut">

src/Compiler/xlf/FSComp.txt.ja.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@
538538
<note />
539539
</trans-unit>
540540
<trans-unit id="optsInvalidRefAssembly">
541-
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
542-
<target state="translated">参照アセンブリの生成の使用が無効です。'--staticlink'、または '--refonly' と '--refout' を同時に使用しないでください。</target>
541+
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
542+
<target state="needs-review-translation">参照アセンブリの生成の使用が無効です。'--staticlink'、または '--refonly' と '--refout' を同時に使用しないでください。</target>
543543
<note />
544544
</trans-unit>
545545
<trans-unit id="optsInvalidRefOut">

src/Compiler/xlf/FSComp.txt.ko.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@
538538
<note />
539539
</trans-unit>
540540
<trans-unit id="optsInvalidRefAssembly">
541-
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
542-
<target state="translated">참조 어셈블리 내보내기를 잘못 사용했습니다. '--staticlink' 또는 '--refonly' 및 '--refout'을 함께 사용하지 마세요.</target>
541+
<source>Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'.</source>
542+
<target state="needs-review-translation">참조 어셈블리 내보내기를 잘못 사용했습니다. '--staticlink' 또는 '--refonly' 및 '--refout'을 함께 사용하지 마세요.</target>
543543
<note />
544544
</trans-unit>
545545
<trans-unit id="optsInvalidRefOut">

0 commit comments

Comments
 (0)