Skip to content

Commit

Permalink
#1082 fix loading key container file
Browse files Browse the repository at this point in the history
  • Loading branch information
Jand42 committed Dec 7, 2019
1 parent ebb8f47 commit b039f8b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/compiler/WebSharper.CSharp/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ let Compile config =

TimedStage "Erasing assembly content for Proxy project"

assem.Write config.KeyFile config.AssemblyFile
assem.Write (config.KeyFile |> Option.map File.ReadAllBytes) config.AssemblyFile

TimedStage "Writing resources into assembly"
js, currentMeta, sources, extraBundles
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/WebSharper.Compiler/CommandTools.fs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ let RunInterfaceGenerator (aR: AssemblyResolver) snk config =
EmbeddedResources = config.Resources |> Seq.map fst
ProjectDir = config.ProjectDir
ReferencePaths = config.References
StrongNameKey = snk
StrongNameKeyPath = snk
}

let cmp = InterfaceGenerator.Compiler.Create()
Expand Down
10 changes: 5 additions & 5 deletions src/compiler/WebSharper.Compiler/WIGCompile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ type CompilerOptions =
OutputPath : option<string>
ProjectDir : string
ReferencePaths : seq<string>
StrongNameKey : option<string>
StrongNameKeyPath : option<string>
}

static member Default(name) =
Expand All @@ -717,7 +717,7 @@ type CompilerOptions =
OutputPath = None
ProjectDir = "."
ReferencePaths = Seq.empty
StrongNameKey = None
StrongNameKeyPath = None
}

static member Parse args =
Expand All @@ -731,7 +731,7 @@ type CompilerOptions =
| S "-v:" ver ->
{ opts with AssemblyVersion = Version.Parse ver }
| S "-snk:" path ->
{ opts with StrongNameKey = Some path }
{ opts with StrongNameKeyPath = Some path }
| S "-embed:" path ->
{ opts with EmbeddedResources = Seq.append opts.EmbeddedResources [path] }
| S "-o:" out ->
Expand Down Expand Up @@ -1258,10 +1258,10 @@ type XmlDocGenerator(assembly: AssemblyDefinition, comments: Comments) =
type CompiledAssembly(def: AssemblyDefinition, doc: XmlDocGenerator, options: CompilerOptions, tB: TypeBuilder) =

let writerParams =
match options.StrongNameKey with
match options.StrongNameKeyPath with
| None -> WriterParameters()
| Some p ->
WriterParameters(StrongNameKeyContainer = p)
WriterParameters(StrongNameKeyBlob = File.ReadAllBytes p)

member a.GetBytes() =
use out = new MemoryStream()
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/WebSharper.Compiler/WIGCompile.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type CompilerOptions =
OutputPath : option<string>
ProjectDir : string
ReferencePaths : seq<string>
StrongNameKey : option<string>
StrongNameKeyPath : option<string>
}

static member Default : assemblyName: string -> CompilerOptions
Expand Down
6 changes: 3 additions & 3 deletions src/compiler/WebSharper.Compiler/api/Assembly.fs
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,18 @@ type Assembly =
member this.OutputParameters(keyPair) =
let par = Mono.Cecil.WriterParameters()
match keyPair with
| Some kp -> par.StrongNameKeyContainer <- kp
| Some kp -> par.StrongNameKeyBlob <- kp
| None -> ()
par

member this.RawBytes(kP: option<string>) =
member this.RawBytes(kP: option<byte[]>) =
use s = new System.IO.MemoryStream(16 * 1024)
this.Definition.Write(s, this.OutputParameters kP)
s.ToArray()

member this.Symbols = this.Debug

member this.Write(kP: option<string>)(path: string) =
member this.Write(kP: option<byte[]>)(path: string) =
let par = this.OutputParameters kP
match this.Debug with
| Some (Mdb _) ->
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/WebSharper.Compiler/api/Assembly.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ type Assembly =
member GetScripts : unit -> seq<EmbeddedFile>

/// Returns the raw assembly data.
member RawBytes : option<string> -> byte []
member RawBytes : option<byte[]> -> byte[]

/// Writes the assembly to the given path.
member Write : option<string> -> path: string -> unit
member Write : option<byte[]> -> path: string -> unit

/// Reads the embedded JavaScript.
member CompressedJavaScript : option<string>
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/WebSharper.FSharp/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ let Compile (config : WsConfig) (warnSettings: WarnSettings) =

TimedStage "Erasing assembly content for Proxy project"

assem.Write config.KeyFile config.AssemblyFile
assem.Write (config.KeyFile |> Option.map File.ReadAllBytes) config.AssemblyFile

TimedStage "Writing resources into assembly"
js, currentMeta, sources, extraBundles
Expand Down

0 comments on commit b039f8b

Please sign in to comment.