Skip to content

Commit

Permalink
Merge pull request #1600 from pchinery/detect-all-build-servers-for-m…
Browse files Browse the repository at this point in the history
…sbuild

Disable NodeReuse by default (FAKE 4)
  • Loading branch information
matthid committed Jul 27, 2017
2 parents a816d2d + 5a3f662 commit d0d5b2b
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/app/FakeLib/MSBuildHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ exception BuildException of string*list<string>
with
override x.ToString() = x.Data0.ToString() + "\r\n" + (separated "\r\n" x.Data1)


type MsBuildEntry = {
Version: string;
Paths: string list;
Expand Down Expand Up @@ -52,7 +51,7 @@ let monoVersionToUseMSBuildOn = System.Version("5.0")
/// Tries to detect the right version of MSBuild.
/// - On all OS's, we check a `MSBuild` environment variable which is either
/// * a direct path to a file to use, or
/// * a directory that contains a file called
/// * a directory that contains a file called
/// * `msbuild` on non-Windows systems with mono >= 5.0.0.0, or
/// * `xbuild` on non-Windows systems with mono < 5.0.0.0,
/// * `MSBuild.exe` on Windows systems, or
Expand All @@ -79,24 +78,24 @@ let msBuildExe =

let foundExe =
match isUnix, EnvironmentHelper.monoVersion with
| true, Some(_, Some(version)) when version >= monoVersionToUseMSBuildOn ->
| true, Some(_, Some(version)) when version >= monoVersionToUseMSBuildOn ->
let sources = [
msbuildEnvironVar |> Option.map (exactPathOrBinaryOnPath "msbuild")
msbuildEnvironVar |> Option.bind which
which "msbuild"
which "xbuild"
]
defaultArg (sources |> List.choose id |> List.tryHead) "msbuild"
| true, _ ->
| true, _ ->
let sources = [
msbuildEnvironVar |> Option.map (exactPathOrBinaryOnPath "xbuild")
msbuildEnvironVar |> Option.bind which
which "xbuild"
which "msbuild"
]
defaultArg (sources |> List.choose id |> List.tryHead) "xbuild"
| false, _ ->
| false, _ ->

let configIgnoreMSBuild =
if "true".Equals(ConfigurationManager.AppSettings.["IgnoreMSBuild"], StringComparison.OrdinalIgnoreCase)
then Some ""
Expand All @@ -106,17 +105,17 @@ let msBuildExe =
let vsVersionPaths =
defaultArg (EnvironmentHelper.environVarOrNone "VisualStudioVersion" |> Option.bind dict.TryFind) getAllKnownPaths
|> List.map ((@@) ProgramFilesX86)

ProcessHelper.tryFindFileInDirsThenPath vsVersionPaths "MSBuild.exe"

let sources = [
msbuildEnvironVar |> Option.map (exactPathOrBinaryOnPath "MSBuild.exe")
msbuildEnvironVar |> Option.bind which
configIgnoreMSBuild
findOnVSPathsThenSystemPath
]
defaultArg (sources |> List.choose id |> List.tryHead) "MSBuild.exe"

if foundExe.Contains @"\BuildTools\" then
traceFAKE "If you encounter msbuild errors make sure you have copied the required SDKs, see https://github.com/Microsoft/msbuild/issues/1697"
elif foundExe.Contains @"\2017\" then
Expand Down Expand Up @@ -236,7 +235,7 @@ let mutable MSBuildDefaults =
Properties = []
MaxCpuCount = Some None
NoLogo = false
NodeReuse = not (buildServer = TeamCity || buildServer = TeamFoundation || buildServer = Jenkins)
NodeReuse = false
ToolsVersion = None
Verbosity = None
NoConsoleLogger = false
Expand Down Expand Up @@ -268,8 +267,6 @@ let serializeMSBuildParams (p : MSBuildParams) =
| Detailed -> "d"
| Diagnostic -> "diag"



let targets =
match p.Targets with
| [] -> None
Expand Down Expand Up @@ -471,7 +468,7 @@ let MSBuildWithProjectProperties outputPath (targets : string) (properties : (st
|> Set.unionMany

let setBuildParam project projectParams =
{ projectParams with
{ projectParams with
Targets = targets |> split ';' |> List.filter ((<>) "")
Properties = projectParams.Properties @ properties project }

Expand Down

0 comments on commit d0d5b2b

Please sign in to comment.