Skip to content

Commit

Permalink
Fix #1002: Add [min]jsoutput cli arg and WebSharper[Min]JsOutput proj…
Browse files Browse the repository at this point in the history
…ect prop
  • Loading branch information
Tarmil committed Aug 7, 2018
1 parent b3a4c47 commit 73983ad
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions msbuild/WebSharper.CSharp.targets
Expand Up @@ -57,6 +57,8 @@
WebSharperDeadCodeElimination="$(WebSharperDeadCodeElimination)"
WebSharperDownloadResources="$(WebSharperDownloadResources)"
WebSharperAnalyzeClosures="$(WebSharperAnalyzeClosures)"
WebSharperJsOutput="$(WebSharperJsOutput)"
WebSharperMinJsOutput="$(WebSharperMinJsOutput)"
ZafirToolPath="$(ZafirToolPath)"
TargetType="$(OutputType)"
NoConfig="true"
Expand Down
2 changes: 2 additions & 0 deletions msbuild/WebSharper.FSharp.targets
Expand Up @@ -33,6 +33,8 @@
<OtherFlags Condition=" '$(WebSharperDeadCodeElimination)' == 'False' ">$(OtherFlags) --dce-</OtherFlags>
<OtherFlags Condition=" '$(WebSharperDownloadResources)' == 'True' ">$(OtherFlags) --dlres</OtherFlags>
<OtherFlags Condition=" '$(WebSharperAnalyzeClosures)' != '' ">$(OtherFlags) --closures:$(WebSharperAnalyzeClosures)</OtherFlags>
<OtherFlags Condition=" '$(WebSharperJsOutput)' != '' ">$(OtherFlags) --jsoutput:$(WebSharperJsOutput)</OtherFlags>
<OtherFlags Condition=" '$(WebSharperMinJsOutput)' != '' ">$(OtherFlags) --jsoutput:$(WebSharperMinJsOutput)</OtherFlags>
<_WebSharperUseNetFxCompiler>$(WebSharperUseNetFxCompiler)</_WebSharperUseNetFxCompiler>
<_WebSharperUseNetFxCompiler Condition="'$(_WebSharperUseNetFxCompiler)' == '' AND ( $(TargetFramework.StartsWith('net4')) OR $(TargetFrameworkVersion.StartsWith('v4')) )">True</_WebSharperUseNetFxCompiler>
</PropertyGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/compiler/WebSharper.Compiler/CommandTools.fs
Expand Up @@ -425,6 +425,8 @@ let HandleDefaultArgsAndCommands argv isFSharp =
default: false
--wsoutput:<dir> Specify output directory for WebSharper-generated files
available for --ws:html,bundle,bundleOnly
--jsoutput:<path> Specify output file for compiled JavaScript
--minjsoutput:<path> Specify output file for compiled & minified JavaScript
--project:<path> Location of project file
--closures[+|-] Enable JS closure analysis
default: false
Expand Down Expand Up @@ -463,6 +465,10 @@ let RecognizeWebSharperArg a wsArgs =
Some { wsArgs with OutputDir = Some o }
| StartsWith "--project:" p ->
Some { wsArgs with ProjectFile = Path.Combine(Directory.GetCurrentDirectory(), p) }
| StartsWith "--jsoutput:" f ->
Some { wsArgs with JSOutputPath = Some f }
| StartsWith "--minjsoutput:" f ->
Some { wsArgs with MinJSOutputPath = Some f }
| Flag "--closures" v ->
Some { wsArgs with AnalyzeClosures = Some v }
| StartsWith "--closures:" c ->
Expand Down
5 changes: 5 additions & 0 deletions src/compiler/WebSharper.MSBuild.CSharp/WebSharperTask.cs
Expand Up @@ -29,6 +29,8 @@ public sealed class WebSharperTask : ToolTask
public string WebSharperDeadCodeElimination { get; set; } = "";
public string WebSharperDownloadResources { get; set; } = "";
public string WebSharperAnalyzeClosures { get; set; }
public string WebSharperJsOutput { get; set; }
public string WebSharperMinJsOutput { get; set; }
public string DocumentationFile { get; set; } = "";
public string ZafirToolPath { get; set; } = "ZafirCs.exe";
public string DefineConstants { get; set; } = "";
Expand Down Expand Up @@ -88,6 +90,9 @@ private void WriteAtFileName(string filename)

WriteIfSet(w, "--closures:", WebSharperAnalyzeClosures);

WriteIfSet(w, "--jsoutput:", WebSharperJsOutput);
WriteIfSet(w, "--minjsoutput:", WebSharperMinJsOutput);

if (TryParseBool(WebSharperSourceMap))
w.WriteLine("--jsmap");

Expand Down

0 comments on commit 73983ad

Please sign in to comment.