Skip to content

Commit cd09ee2

Browse files
KevinRansomT-Gro
andauthored
remove multi-emit - internal restriction (#14478)
* remove internal restriction * fantomas * Oops * Update src/Compiler/Interactive/fsi.fs Co-authored-by: Tomas Grosup <[email protected]> * Update src/Compiler/Interactive/fsi.fs Co-authored-by: Tomas Grosup <[email protected]> * make desktop fsi default to multi-emit * fix some issues * ushort * commented out code * Correct size for maxvalue * tweak * No longer a compile error under fsi with multiemit * Cambridge Co-authored-by: Tomas Grosup <[email protected]>
1 parent a9c194a commit cd09ee2

29 files changed

+162
-316
lines changed

a

272 Bytes
Binary file not shown.

src/Compiler/AbstractIL/ilsign.fs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,10 @@ type ILStrongNameSigner =
349349
| KeyPair of keyPair
350350
| KeyContainer of keyContainerName
351351

352-
static member OpenPublicKeyOptions s p =
353-
PublicKeyOptionsSigner((signerOpenPublicKeyFile s), p)
352+
static member OpenPublicKeyOptions kp p = PublicKeyOptionsSigner(kp, p)
354353

355-
static member OpenPublicKey pubkey = PublicKeySigner pubkey
356-
static member OpenKeyPairFile s = KeyPair(signerOpenKeyPairFile s)
354+
static member OpenPublicKey bytes = PublicKeySigner bytes
355+
static member OpenKeyPairFile bytes = KeyPair(bytes)
357356
static member OpenKeyContainer s = KeyContainer s
358357

359358
member s.IsFullySigned =

src/Compiler/AbstractIL/ilsign.fsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ open System.IO
1616
[<Sealed>]
1717
type ILStrongNameSigner =
1818
member PublicKey: byte[]
19-
static member OpenPublicKeyOptions: string -> bool -> ILStrongNameSigner
19+
static member OpenPublicKeyOptions: byte array -> bool -> ILStrongNameSigner
2020
static member OpenPublicKey: byte[] -> ILStrongNameSigner
21-
static member OpenKeyPairFile: string -> ILStrongNameSigner
21+
static member OpenKeyPairFile: byte[] -> ILStrongNameSigner
2222
static member OpenKeyContainer: string -> ILStrongNameSigner
2323
member IsFullySigned: bool
2424
member PublicKey: byte[]

src/Compiler/Driver/CreateILModule.fs

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ module AttributeHelpers =
6565
//----------------------------------------------------------------------------
6666

6767
/// Represents the configuration settings used to perform strong-name signing
68-
type StrongNameSigningInfo = StrongNameSigningInfo of delaysign: bool * publicsign: bool * signer: string option * container: string option
68+
type StrongNameSigningInfo =
69+
| StrongNameSigningInfo of delaysign: bool * publicsign: bool * signer: byte array option * container: string option
70+
71+
let GetStrongNameSigningInfo (delaysign, publicsign, signer, container) =
72+
StrongNameSigningInfo(delaysign, publicsign, signer, container)
6973

7074
/// Validate the attributes and configuration settings used to perform strong-name signing
7175
let ValidateKeySigningAttributes (tcConfig: TcConfig, tcGlobals, topAttrs) =
@@ -91,14 +95,24 @@ let ValidateKeySigningAttributes (tcConfig: TcConfig, tcGlobals, topAttrs) =
9195

9296
// if signer is set via an attribute, validate that it wasn't set via an option
9397
let signer =
94-
match signerAttrib with
95-
| Some signer ->
96-
if tcConfig.signer.IsSome && tcConfig.signer <> Some signer then
97-
warning (Error(FSComp.SR.fscKeyFileWarning (), rangeCmdArgs))
98-
tcConfig.signer
99-
else
100-
Some signer
101-
| None -> tcConfig.signer
98+
let signerFile =
99+
match signerAttrib with
100+
| Some signer ->
101+
if tcConfig.signer.IsSome && tcConfig.signer <> Some signer then
102+
warning (Error(FSComp.SR.fscKeyFileWarning (), rangeCmdArgs))
103+
tcConfig.signer
104+
else
105+
Some signer
106+
| None -> tcConfig.signer
107+
108+
match signerFile with
109+
| Some signerPath ->
110+
try
111+
Some(FileSystem.OpenFileForReadShim(signerPath).ReadAllBytes())
112+
with _ ->
113+
// Note :: don't use errorR here since we really want to fail and not produce a binary
114+
error (Error(FSComp.SR.fscKeyFileCouldNotBeOpened signerPath, rangeCmdArgs))
115+
| None -> None
102116

103117
// if container is set via an attribute, validate that it wasn't set via an option, and that they keyfile wasn't set
104118
// if keyfile was set, use that instead (silently)
@@ -127,15 +141,11 @@ let GetStrongNameSigner signingInfo =
127141
| None ->
128142
match signer with
129143
| None -> None
130-
| Some s ->
131-
try
132-
if publicsign || delaysign then
133-
Some(ILStrongNameSigner.OpenPublicKeyOptions s publicsign)
134-
else
135-
Some(ILStrongNameSigner.OpenKeyPairFile s)
136-
with _ ->
137-
// Note :: don't use errorR here since we really want to fail and not produce a binary
138-
error (Error(FSComp.SR.fscKeyFileCouldNotBeOpened s, rangeCmdArgs))
144+
| Some bytes ->
145+
if publicsign || delaysign then
146+
Some(ILStrongNameSigner.OpenPublicKeyOptions bytes publicsign)
147+
else
148+
Some(ILStrongNameSigner.OpenKeyPairFile bytes)
139149

140150
//----------------------------------------------------------------------------
141151
// Building the contents of the finalized IL module

src/Compiler/Driver/CreateILModule.fsi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ open FSharp.Compiler.TypedTree
1515
/// Represents the configuration settings used to perform strong-name signing
1616
type StrongNameSigningInfo
1717

18+
/// Get the SigningInfo for specific values(delaysign, tcConfig.publicsign, signer, container)
19+
val GetStrongNameSigningInfo:
20+
delaysign: bool * publicsign: bool * signer: byte array option * container: string option -> StrongNameSigningInfo
21+
1822
/// Validate the attributes and configuration settings used to perform strong-name signing
1923
val ValidateKeySigningAttributes: tcConfig: TcConfig * tcGlobals: TcGlobals * TopAttribs -> StrongNameSigningInfo
2024

src/Compiler/Interactive/FSIstrings.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,4 @@ shadowCopyReferences,"Prevents references from being locked by the F# Interactiv
5656
fsiOperationCouldNotBeCompleted,"Operation could not be completed due to earlier error"
5757
fsiOperationFailed,"Operation failed. The error text has been printed in the error stream. To return the corresponding FSharpDiagnostic use the EvalInteractionNonThrowing, EvalScriptNonThrowing or EvalExpressionNonThrowing"
5858
fsiMultiAssemblyEmitOption,"Emit multiple assemblies (on by default)"
59-
fsiMultiAssemblyEmitOptionOffByDefault,"Emit multiple assemblies (off by default for .NET Framework)"
60-
2303,fsiInternalAccess,"Accessing the internal type, method or field '%s' from a previous evaluation in F# Interactive is deprecated and may cause subsequent access errors. To enable the legacy generation of a single dynamic assembly that can access internals, use the '--multiemit-' option."
6159
2304,fsiEntryPointWontBeInvoked,"Functions with [<EntryPoint>] are not invoked in FSI. '%s' was not invoked. Execute '%s <args>' in order to invoke '%s' with the appropriate string array of command line arguments."

0 commit comments

Comments
 (0)