-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor the project cracker into a new file et al. (#618)
* Move some code from BuildCommand.fs to a new file. Do not report nonexistent substitution parameters (see changes in the param function of ProjectCracker.fs). * Fix and document the --parameters command line option. Seq.pairwise [1;2;3;4] returns [1,2; 2,3; 3,4], not [1,2; 3,4]. * Remove a try-with block around File.Exists (it doesn't throw). And use Process.Start with UseShellExecute on all platforms (it is implemented on .NET Core). * Use System.Text.Json to serialize the documentation search index. Remove duplicate code in a helper function in BuildCommand.fs. * Update packages. * Make some optimizations in the project cracker. The most important is the replacement of the tree-based FSharpMap with the hashtable-based readOnlyDict. * Exit without leaving a stacktrace if --parameters was incorrectly defined. * Do not catch and then print exceptions at the entry point; let them be thrown. It is not needed. They will already be reported to the console and AggregateExceptions are not correctly handled.
- Loading branch information
1 parent
60cb2cf
commit f523d4c
Showing
11 changed files
with
649 additions
and
937 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,11 @@ | ||
|
||
module FSharp.Formatting.CommandTool.Main | ||
|
||
open CommandLine | ||
|
||
let printAssemblies msg = | ||
printfn "%s. Loaded Assemblies:" msg | ||
System.AppDomain.CurrentDomain.GetAssemblies() | ||
|> Seq.choose (fun a -> try Some (a.GetName().FullName, a.Location) with _ -> None) | ||
|> Seq.iter (fun (n, l) -> printfn "\t- %s: %s" n l) | ||
|
||
|
||
[<EntryPoint>] | ||
let main argv = | ||
try | ||
CommandLine.Parser.Default.ParseArguments(argv, typeof<BuildCommand>, typeof<WatchCommand>) | ||
CommandLine.Parser.Default.ParseArguments<BuildCommand, WatchCommand>(argv) | ||
.MapResult( | ||
(fun (opts: BuildCommand) -> opts.Execute()), | ||
(fun (opts: WatchCommand) -> opts.Execute()), | ||
(fun errs -> 1)); | ||
with e -> | ||
let e = | ||
match e with | ||
| :? System.AggregateException as ex -> ex.InnerExceptions.[0] | ||
| _ -> e | ||
//printAssemblies "(DIAGNOSTICS) Documentation failed" | ||
printfn "fsdocs.exe failed: %O" e | ||
1 | ||
//reraise() | ||
(fun _ -> 1)) |
Oops, something went wrong.