Skip to content

Commit

Permalink
simplify framework matching (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
vilinski authored and TheAngryByrd committed Jul 2, 2017
1 parent 56f6b69 commit d22d66f
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions Content/build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Target "Clean" (fun _ ->

!! srcGlob
++ testsGlob
|> Seq.collect(fun p ->
["bin";"obj"]
|> Seq.collect(fun p ->
["bin";"obj"]
|> Seq.map(fun sp ->
IO.Path.GetDirectoryName p @@ sp)
)
Expand All @@ -34,7 +34,7 @@ Target "DotnetRestore" (fun _ ->
Project = proj
//This makes sure that Proj2 references the correct version of Proj1
AdditionalArgs = [sprintf "/p:PackageVersion=%s" release.NugetVersion]
})
})
))

Target "DotnetBuild" (fun _ ->
Expand All @@ -45,7 +45,7 @@ Target "DotnetBuild" (fun _ ->
Project = proj
//This makes sure that Proj2 references the correct version of Proj1
AdditionalArgs = [sprintf "/p:PackageVersion=%s" release.NugetVersion]
})
})
))

let invoke f = f ()
Expand All @@ -55,13 +55,13 @@ type TargetFramework =
| Full of string
| Core of string

let (|StartsWith|_|) prefix (s: string) =
if s.StartsWith prefix then Some () else None

let getTargetFramework tf =
match tf with
| "net45" | "net451" | "net452"
| "net46" | "net461" | "net462" ->
Full tf
| "netcoreapp1.0" | "netcoreapp1.1" ->
Core tf
| StartsWith "net4" -> Full tf
| StartsWith "netcoreapp" -> Core tf
| _ -> failwithf "Unknown TargetFramework %s" tf

let getTargetFrameworksFromProjectFile (projFile : string)=
Expand All @@ -72,13 +72,13 @@ let getTargetFrameworksFromProjectFile (projFile : string)=
|> Seq.toList

let selectRunnerForFramework tf =
let runMono = sprintf "mono -f %s --restore -c Release"
let runMono = sprintf "mono -f %s --restore -c Release"
let runCore = sprintf "run -f %s -c Release"
match tf with
| Full t when isMono-> runMono t
| Full t -> runCore t
| Core t -> runCore t


let runTests modifyArgs =
!! testsGlob
Expand All @@ -100,7 +100,7 @@ Target "DotnetTest" (fun _ ->
)
let execProcAndReturnMessages filename args =
let args' = args |> String.concat " "
ProcessHelper.ExecProcessAndReturnMessages
ProcessHelper.ExecProcessAndReturnMessages
(fun psi ->
psi.FileName <- filename
psi.Arguments <-args'
Expand Down Expand Up @@ -136,18 +136,18 @@ Target "DotnetPack" (fun _ ->
Project = proj
Configuration = "Release"
OutputPath = IO.Directory.GetCurrentDirectory() @@ "dist"
AdditionalArgs =
AdditionalArgs =
[
sprintf "/p:PackageVersion=%s" release.NugetVersion
sprintf "/p:PackageReleaseNotes=\"%s\"" (String.Join("\n",release.Notes))
]
})
})
)
)

Target "Publish" (fun _ ->
Paket.Push(fun c ->
{ c with
{ c with
PublishUrl = "https://www.nuget.org"
WorkingDir = "dist"
}
Expand Down Expand Up @@ -177,4 +177,4 @@ Target "Release" (fun _ ->
"DotnetRestore"
==> "WatchTests"

RunTargetOrDefault "DotnetPack"
RunTargetOrDefault "DotnetPack"

0 comments on commit d22d66f

Please sign in to comment.