Skip to content

Commit 42c041e

Browse files
committed
CSHARP-1707: Modified build script to add net45 and netstandard1.6 subdirectories to zip file.
1 parent 25eb3b1 commit 42c041e

File tree

1 file changed

+78
-72
lines changed

1 file changed

+78
-72
lines changed

build/build.fsx

Lines changed: 78 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ let binDirNetStandard16 = binDir @@ "netstandard16"
4444
let testResultsDir = artifactsDir @@ "test_results"
4545
let tempDir = artifactsDir @@ "tmp"
4646

47-
let slnFile =
48-
match isMono with
49-
| true -> baseDir @@ "CSharpDriver-Mono.sln"
50-
| false -> baseDir @@ "CSharpDriver.sln"
47+
let slnFile = baseDir @@ "CSharpDriver.sln"
5148

5249
let asmFile = srcDir @@ "MongoDB.Shared" @@ "GlobalAssemblyInfo.cs"
5350
let apiDocsFile = baseDir @@ "Docs" @@ "Api" @@ "CSharpDriverDocs.shfbproj"
@@ -98,8 +95,6 @@ let zipArtifactFile = artifactsDir @@ "CSharpDriver-" + semVersion + ".zip"
9895

9996
MSBuildDefaults <- { MSBuildDefaults with Verbosity = Some(MSBuildVerbosity.Minimal) }
10097

101-
monoArguments <- "--runtime=v4.0.30319"
102-
10398
// Targets
10499
Target "Clean" (fun _ ->
105100
CleanDir artifactsDir
@@ -137,11 +132,10 @@ Target "BuildNet45" (fun _ ->
137132
|> Seq.iter (RestorePackage (fun x -> { x with OutputPath = baseDir @@ "packages" }))
138133

139134

140-
let mutable properties = ["Configuration", config
141-
"TargetFrameworkVersion", "v4.5"]
142-
143-
if isMono then
144-
properties <- properties @ ["DefineConstants", "MONO"]
135+
let properties = [
136+
("Configuration", config);
137+
("TargetFrameworkVersion", "v4.5")
138+
]
145139

146140
[slnFile]
147141
|> MSBuild binDirNet45 "Build" properties
@@ -166,9 +160,7 @@ Target "TestNet45" (fun _ ->
166160
if not <| directoryExists binDirNet45 then new Exception(sprintf "Directory %s does not exist." binDirNet45) |> raise
167161
ensureDirectory testResultsDir
168162

169-
let mutable testDlls = !! (binDirNet45 @@ "*Tests.dll")
170-
if isMono then
171-
testDlls <- testDlls -- (binDirNet45 @@ "*VB.Tests.dll")
163+
let testDlls = !! (binDirNet45 @@ "*Tests.dll")
172164

173165
let resultsOutputPath = testResultsDir @@ (getBuildParamOrDefault "testResults" "test-results.xml")
174166
let includeTraits =
@@ -257,28 +249,53 @@ Target "Zip" (fun _ ->
257249
checkFileExists licenseFile
258250
checkFileExists releaseNotesFile
259251

260-
let files =
261-
[ binDirNet45 @@ "MongoDB.Bson.dll"
262-
binDirNet45 @@ "MongoDB.Bson.pdb"
263-
binDirNet45 @@ "MongoDB.Bson.xml"
264-
binDirNet45 @@ "MongoDB.Driver.Core.dll"
265-
binDirNet45 @@ "MongoDB.Driver.Core.pdb"
266-
binDirNet45 @@ "MongoDB.Driver.Core.xml"
267-
binDirNet45 @@ "MongoDB.Driver.dll"
268-
binDirNet45 @@ "MongoDB.Driver.pdb"
269-
binDirNet45 @@ "MongoDB.Driver.xml"
270-
binDirNet45 @@ "MongoDB.Driver.GridFS.dll"
271-
binDirNet45 @@ "MongoDB.Driver.GridFS.pdb"
272-
binDirNet45 @@ "MongoDB.Driver.GridFS.xml"
273-
binDirNet45 @@ "MongoDB.Driver.Legacy.dll"
274-
binDirNet45 @@ "MongoDB.Driver.Legacy.pdb"
275-
binDirNet45 @@ "MongoDB.Driver.Legacy.xml"
276-
licenseFile
277-
releaseNotesFile
278-
apiDocsArtifactFile ]
279-
280-
files
281-
|> CreateZip artifactsDir zipArtifactFile "" DefaultZipLevel true
252+
let zipStagingDirectory = artifactsDir @@ "zip-staging"
253+
CleanDir zipStagingDirectory
254+
DeleteDir zipStagingDirectory
255+
256+
let sharedFiles = [
257+
licenseFile
258+
releaseNotesFile
259+
apiDocsArtifactFile
260+
]
261+
262+
let net45Files = [
263+
binDirNet45 @@ "MongoDB.Bson.dll"
264+
binDirNet45 @@ "MongoDB.Bson.pdb"
265+
binDirNet45 @@ "MongoDB.Bson.xml"
266+
binDirNet45 @@ "MongoDB.Driver.Core.dll"
267+
binDirNet45 @@ "MongoDB.Driver.Core.pdb"
268+
binDirNet45 @@ "MongoDB.Driver.Core.xml"
269+
binDirNet45 @@ "MongoDB.Driver.dll"
270+
binDirNet45 @@ "MongoDB.Driver.pdb"
271+
binDirNet45 @@ "MongoDB.Driver.xml"
272+
binDirNet45 @@ "MongoDB.Driver.GridFS.dll"
273+
binDirNet45 @@ "MongoDB.Driver.GridFS.pdb"
274+
binDirNet45 @@ "MongoDB.Driver.GridFS.xml"
275+
binDirNet45 @@ "MongoDB.Driver.Legacy.dll"
276+
binDirNet45 @@ "MongoDB.Driver.Legacy.pdb"
277+
binDirNet45 @@ "MongoDB.Driver.Legacy.xml"
278+
]
279+
280+
let netStandard16Files = [
281+
srcDir @@ "MongoDB.Bson.Dotnet" @@ "bin" @@ "Release" @@ "netstandard1.6" @@ "MongoDB.Bson.dll"
282+
srcDir @@ "MongoDB.Bson.Dotnet" @@ "bin" @@ "Release" @@ "netstandard1.6" @@ "MongoDB.Bson.pdb"
283+
srcDir @@ "MongoDB.Driver.Core.Dotnet" @@ "bin" @@ "Release" @@ "netstandard1.6" @@ "MongoDB.Driver.Core.dll"
284+
srcDir @@ "MongoDB.Driver.Core.Dotnet" @@ "bin" @@ "Release" @@ "netstandard1.6" @@ "MongoDB.Driver.Core.pdb"
285+
srcDir @@ "MongoDB.Driver.Dotnet" @@ "bin" @@ "Release" @@ "netstandard1.6" @@ "MongoDB.Driver.dll"
286+
srcDir @@ "MongoDB.Driver.Dotnet" @@ "bin" @@ "Release" @@ "netstandard1.6" @@ "MongoDB.Driver.pdb"
287+
srcDir @@ "MongoDB.Driver.Legacy.Dotnet" @@ "bin" @@ "Release" @@ "netstandard1.6" @@ "MongoDB.Driver.Legacy.dll"
288+
srcDir @@ "MongoDB.Driver.Legacy.Dotnet" @@ "bin" @@ "Release" @@ "netstandard1.6" @@ "MongoDB.Driver.Legacy.pdb"
289+
srcDir @@ "MongoDB.Driver.GridFS.Dotnet" @@ "bin" @@ "Release" @@ "netstandard1.6" @@ "MongoDB.Driver.GridFS.dll"
290+
srcDir @@ "MongoDB.Driver.GridFS.Dotnet" @@ "bin" @@ "Release" @@ "netstandard1.6" @@ "MongoDB.Driver.GridFS.pdb"
291+
]
292+
293+
CopyFiles zipStagingDirectory sharedFiles
294+
CopyFiles (zipStagingDirectory @@ "net45") net45Files
295+
CopyFiles (zipStagingDirectory @@ "netstandard1.6") netStandard16Files
296+
297+
!! (zipStagingDirectory @@ "**/*.*")
298+
|> CreateZip zipStagingDirectory zipArtifactFile "" DefaultZipLevel false
282299
)
283300

284301
let createNuGetPackage file deps symbols =
@@ -329,45 +346,34 @@ FinalTarget "Teardown" (fun _ ->
329346
)
330347

331348

332-
Target "NoOp" DoNothing
333349
Target "Docs" DoNothing
334350
Target "Package" DoNothing
335351
Target "Publish" DoNothing
336352
Target "Build" DoNothing
337353
Target "Test" DoNothing
338354

339-
"Clean"
340-
==> "AssemblyInfo"
341-
342-
"AssemblyInfo"
343-
==> "BuildNet45"
344-
345-
"AssemblyInfo"
346-
==> "InstallDotnet"
347-
==> "BuildNetStandard16"
348-
349-
"BuildNet45"
350-
==> "Build"
351-
352-
"BuildNetStandard16"
353-
==> "Build"
354-
355-
"TestNet45"
356-
==> "Test"
357-
358-
"TestNetStandard16"
359-
==> "Test"
360-
361-
"RefDocs"
362-
==> "ApiDocs"
363-
==> "Docs"
364-
365-
"Docs"
366-
==> "Zip"
367-
==> "NuGetPack"
368-
==> "Package"
369-
370-
"NuGetPush"
371-
==> "Publish"
372-
373-
RunTargetOrDefault "Build"
355+
// Build dependencies
356+
"AssemblyInfo" ==> "BuildNet45"
357+
"AssemblyInfo" ==> "BuildNetStandard16"
358+
"BuildNet45" ==> "Build"
359+
"BuildNetStandard16" ==> "Build"
360+
"Clean" ==> "AssemblyInfo"
361+
"InstallDotnet" ==> "BuildNetStandard16"
362+
363+
// Test dependencies (assumes Build has already been run)
364+
"InstallDotnet" ==> "TestNetStandard16"
365+
"TestNet45" ==> "Test"
366+
"TestNetStandard16" ==> "Test"
367+
368+
// Package dependencies (assumes Build has already been run)
369+
"ApiDocs" ==> "Docs"
370+
"ApiDocs" ==> "Zip"
371+
"Docs" ==> "Package"
372+
"NuGetPack" ==> "Package"
373+
"RefDocs" ==> "Docs"
374+
"Zip" ==> "Package"
375+
376+
// Publish dependencies (assumes Package has already been run)
377+
"NuGetPush" ==> "Publish"
378+
379+
RunTargetOrDefault "Build"

0 commit comments

Comments
 (0)