Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSBuildHelper: Add BuildWebsite(s)Config. #1230

Merged
merged 1 commit into from
May 11, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions src/app/FakeLib/MSBuildHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -429,37 +429,52 @@ let MSBuildReleaseExt outputPath properties targets projects =
let properties = ("Configuration", "Release") :: properties
MSBuild outputPath targets properties projects

/// Builds the given web project file in debug mode and copies it to the given websiteDir.
/// Builds the given web project file in the specified configuration and copies it to the given outputPath.
/// ## Parameters
/// - `outputPath` - The output path.
/// - `configuration` - MSBuild configuration.
/// - `projectFile` - The project file path.
let BuildWebsite outputPath projectFile =
let BuildWebsiteConfig outputPath configuration projectFile =
traceStartTask "BuildWebsite" projectFile
let projectName = (fileInfo projectFile).Name.Replace(".csproj", "").Replace(".fsproj", "").Replace(".vbproj", "")
let slashes (dir : string) =

let slashes (dir : string) =
dir.Replace("\\", "/").TrimEnd('/')
|> Seq.filter ((=) '/')
|> Seq.length

let currentDir = (directoryInfo ".").FullName
let projectDir = (fileInfo projectFile).Directory.FullName

let diff = slashes projectDir - slashes currentDir
let prefix = if Path.IsPathRooted outputPath
then ""
else (String.replicate diff "../")

MSBuildDebug "" "Rebuild" [ projectFile ] |> ignore
MSBuild "" "_CopyWebApplication;_BuiltWebOutputGroupOutput"
[ "OutDir", prefix + outputPath
MSBuild null "Build" [ "Configuration", configuration ] [ projectFile ] |> ignore
MSBuild null "_CopyWebApplication;_BuiltWebOutputGroupOutput"
[ "Configuration", configuration
"OutDir", prefix + outputPath
"WebProjectOutputDir", prefix + outputPath + "/" + projectName ] [ projectFile ]
|> ignore
!!(projectDir + "/bin/*.*") |> Copy(outputPath + "/" + projectName + "/bin/")
traceEndTask "BuildWebsite" projectFile

/// Builds the given web project files in debug mode and copies them to the given websiteDir.
/// Builds the given web project file with debug configuration and copies it to the given outputPath.
/// ## Parameters
/// - `outputPath` - The output path.
/// - `projectFile` - The project file path.
let BuildWebsite outputPath projectFile = BuildWebsiteConfig outputPath "Debug" projectFile

/// Builds the given web project files in specified configuration and copies them to the given outputPath.
/// ## Parameters
/// - `outputPath` - The output path.
/// - `configuration` - MSBuild configuration.
/// - `projectFiles` - The project file paths.
let BuildWebsitesConfig outputPath configuration projectFiles = Seq.iter (BuildWebsiteConfig outputPath configuration) projectFiles

/// Builds the given web project files with debug configuration and copies them to the given websiteDir.
/// ## Parameters
/// - `outputPath` - The output path.
/// - `projectFiles` - The project file paths.
let BuildWebsites websiteDir projectFiles = Seq.iter (BuildWebsite websiteDir) projectFiles
let BuildWebsites outputPath projectFiles = BuildWebsitesConfig outputPath "Debug" projectFiles