-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicTasks.fs
More file actions
65 lines (57 loc) · 2.54 KB
/
BasicTasks.fs
File metadata and controls
65 lines (57 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
module BasicTasks
open BlackFox.Fake
open Fake.IO
open Fake.DotNet
open Fake.IO.Globbing.Operators
open ProjectInfo
let clean = BuildTask.create "Clean" [] {
!! "src/**/bin"
++ "src/**/obj"
++ "tests/**/bin"
++ "tests/**/obj"
++ "pkg"
|> Shell.cleanDirs
}
// Regenerate the C# type model in BioFSharp.FileFormats.INSDC from the committed XSDs in schemas/.
// On-demand only — generated code is committed and the default build does NOT depend on this target.
// Run after touching schemas/ (or after pinning a new dotnet-xscgen version in .config/dotnet-tools.json).
//
// Flag choices:
// --separateFiles : one .cs per generated class (cleaner diffs than a single 15k-line file)
// -n <ns> : map the default XML namespace to the package's C# namespace
// -0 (--nullable) : nullable adapter properties for optional elements w/o defaults (needed for roundtrips)
// -i l : map xs:integer to System.Int64
// --tnsf <file> : substitute generated type names per schemas/typename-substitutions.txt
// (strips the Type infix from top-level + child types; cleans Type* enum prefixes)
let regenerateInsdcTypes = BuildTask.create "regenerateInsdcTypes" [] {
let schemasDir = "src/BioFSharp.FileFormats.INSDC/schemas"
let generatedDir = "src/BioFSharp.FileFormats.INSDC/Generated"
let substitutionFile = schemasDir + "/typename-substitutions.txt"
Shell.cleanDir generatedDir
let schemaArgs =
!! (schemasDir + "/*.xsd")
|> Seq.map (fun p -> sprintf "\"%s\"" p)
|> String.concat " "
let args =
sprintf "--separateFiles -n BioFSharp.FileFormats.INSDC -0 -i l --tnsf \"%s\" -o \"%s\" %s"
substitutionFile generatedDir schemaArgs
let result = DotNet.exec id "xscgen" args
if not result.OK then
failwithf "dotnet xscgen failed (exit %d): %A" result.ExitCode result.Errors
}
let setPrereleaseTag = BuildTask.create "SetPrereleaseTag" [] {
printfn "Please enter pre-release package suffix"
let suffix = System.Console.ReadLine()
prereleaseSuffix <- suffix
prereleaseTag <- (sprintf "%s-%s" release.NugetVersion suffix)
isPrerelease <- true
}
/// builds the solution file (dotnet build solution.sln)
let buildSolution =
BuildTask.create "BuildSolution" [ clean ] {
solutionFile
|> DotNet.build (fun p ->
{ p with MSBuildParams = { p.MSBuildParams with DisableInternalBinLog = true }}
|> DotNet.Options.withCustomParams (Some "-tl")
)
}