Skip to content

Commit 4663659

Browse files
committed
Ability to diff assemblies from files, directories, nuget and github (#3027)
This commit adds a build target, diff, that can create a diff output of assemblies from 1. files 2. directories 3. nuget packages 4. github commits It uses Progress/Telerik's JustAssembly command line tool to generate an XML file of the public diffs between two assemblies, with functions implemented to transform XML to markdown and asciidoc. Since JustAssembly installation cannot be easily automated, an exception is thrown when diff is run if the tool is not installed, prompting the user with a link to download. When specifying directories or nuget packages, the assemblies within the first path will be paired up with assemblies with the same name in the second path, and a diff will be generated for each pair. The diff can output XML, Markdown and Asciidoc, with the latter two implemented as functions that convert the XML to a document structure. Add skipdocs argument to be able to skip generating documentation. (cherry picked from commit e0a42a5)
1 parent 2f285b2 commit 4663659

File tree

6 files changed

+475
-5
lines changed

6 files changed

+475
-5
lines changed

build/scripts/Commandline.fsx

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Targets:
2929
* canary [apikey] [feed]
3030
- create a canary nuget package based on the current version if [feed] and [apikey] are provided
3131
also pushes to upstream (myget)
32+
* diff <github|nuget|directories|assemblies> <version|path 1> <version|path 2> [format]
3233
3334
NOTE: both the `test` and `integrate` targets can be suffixed with `-all` to force the tests against all suported TFM's
3435
"""
@@ -38,7 +39,8 @@ module Commandline =
3839

3940
let private args = getBuildParamOrDefault "cmdline" "build" |> split ' '
4041
let skipTests = args |> List.exists (fun x -> x = "skiptests")
41-
let private filteredArgs = args |> List.filter (fun x -> x <> "skiptests")
42+
let skipDocs = args |> List.exists (fun x -> x = "skipdocs") || isMono
43+
let private filteredArgs = args |> List.filter (fun x -> x <> "skiptests" && x <> "skipdocs")
4244

4345
let multiTarget =
4446
match (filteredArgs |> List.tryHead) with
@@ -57,7 +59,7 @@ module Commandline =
5759
| ("test", _)
5860
| ("integrate", _) -> false
5961
| _ -> true
60-
62+
6163
let arguments =
6264
match filteredArgs with
6365
| _ :: tail -> target :: tail
@@ -68,6 +70,24 @@ module Commandline =
6870
| true, _ -> Some candidate
6971
| _ -> None
7072

73+
let private (|IsDiff|_|) (candidate:string) =
74+
let c = candidate |> toLower
75+
match c with
76+
| "github" | "nuget" | "directories" | "assemblies" -> Some c
77+
| _ -> failwith (sprintf "Unknown diff type: %s" candidate)
78+
79+
let private (|IsProject|_|) (candidate:string) =
80+
let c = candidate |> toLower
81+
match c with
82+
| "nest" | "elasticsearch.net" -> Some c
83+
| _ -> None
84+
85+
let private (|IsFormat|_|) (candidate:string) =
86+
let c = candidate |> toLower
87+
match c with
88+
| "xml" | "markdown" | "asciidoc" -> Some c
89+
| _ -> None
90+
7191
let parse () =
7292
setEnvironVar "FAKEBUILD" "1"
7393
match arguments with
@@ -131,6 +151,28 @@ module Commandline =
131151
setBuildParam "clusterfilter" "ConnectionReuse"
132152
setBuildParam "numberOfConnections" numberOfConnections
133153

154+
| ["diff"; IsDiff diffType; IsProject project; firstVersionOrPath; secondVersionOrPath; IsFormat format] ->
155+
setBuildParam "diffType" diffType
156+
setBuildParam "project" project
157+
setBuildParam "first" firstVersionOrPath
158+
setBuildParam "second" secondVersionOrPath
159+
setBuildParam "format" format
160+
| ["diff"; IsDiff diffType; IsProject project; firstVersionOrPath; secondVersionOrPath] ->
161+
setBuildParam "diffType" diffType
162+
setBuildParam "project" project
163+
setBuildParam "first" firstVersionOrPath
164+
setBuildParam "second" secondVersionOrPath
165+
| ["diff"; IsDiff diffType; firstVersionOrPath; secondVersionOrPath; IsFormat format] ->
166+
setBuildParam "diffType" diffType
167+
setBuildParam "first" firstVersionOrPath
168+
setBuildParam "second" secondVersionOrPath
169+
setBuildParam "format" format
170+
| ["diff"; IsDiff diffType; firstVersionOrPath; secondVersionOrPath] ->
171+
setBuildParam "diffType" diffType
172+
setBuildParam "first" firstVersionOrPath
173+
setBuildParam "second" secondVersionOrPath
174+
175+
| ["temp"; ] -> ignore()
134176
| ["canary"; ] -> ignore()
135177
| ["canary"; apiKey ] ->
136178
setBuildParam "apiKey" apiKey

0 commit comments

Comments
 (0)