Repository: lucenenet
Updated Branches:
  refs/heads/master 1495bff05 -> 5e7ec8a6a


build\build.ps1: Added options for generating a "released" build.bat file and 
to turn off the prepare-for-build functionality that updates the files with 
version information, etc. so the release will build without specifying any 
command line options.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/5e7ec8a6
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/5e7ec8a6
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/5e7ec8a6

Branch: refs/heads/master
Commit: 5e7ec8a6af3bda47812ada26546f07e46518c2c5
Parents: 1495bff
Author: Shad Storhaug <[email protected]>
Authored: Tue Apr 25 21:13:38 2017 +0700
Committer: Shad Storhaug <[email protected]>
Committed: Tue Apr 25 21:13:38 2017 +0700

----------------------------------------------------------------------
 build/build.ps1 | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5e7ec8a6/build/build.ps1
----------------------------------------------------------------------
diff --git a/build/build.ps1 b/build/build.ps1
index 4574d59..7f60e92 100644
--- a/build/build.ps1
+++ b/build/build.ps1
@@ -13,8 +13,11 @@ properties {
        [string]$version          = Get-Version
        [string]$configuration    = "Release"
        [bool]$backup_files       = $true
+       [bool]$prepareForBuild    = $true
+       [bool]$generateBuildBat   = $false
 
        [string]$common_assembly_info = 
"$base_directory\src\CommonAssemblyInfo.cs"
+       [string]$build_bat = "$base_directory\build.bat"
        [string]$copyright_year = [DateTime]::Today.Year.ToString() #Get the 
current year from the system
        [string]$copyright = "Copyright " + $([char]0x00A9) + " 2006 - 
$copyright_year The Apache Software Foundation"
        [string]$company_name = "The Apache Software Foundation"
@@ -68,7 +71,9 @@ task Compile -depends Clean, Init -description "This task 
compiles the solution"
                popd
 
                Backup-Files $projects
-               Prepare-For-Build $projects
+               if ($prepareForBuild -eq $true) {
+                       Prepare-For-Build $projects
+               }
 
                Exec {
                        & dotnet.exe restore $base_directory
@@ -232,6 +237,11 @@ function Prepare-For-Build([string[]]$projects) {
                }
                $json | ConvertTo-Json -depth 100 | Out-File $project -encoding 
UTF8 -Force
        }
+
+       if ($generateBuildBat -eq $true) {
+               Backup-File $build_bat
+               Generate-Build-Bat $build_bat
+       }
 }
 
 function Update-Constants-Version([string]$version) {
@@ -276,6 +286,20 @@ using System.Reflection;
        Out-File -filePath $file -encoding UTF8 -inputObject $asmInfo
 }
 
+function Generate-Build-Bat {
+param(
+       [string]$file = $(throw "file is a required parameter.")
+)
+  $buildBat = "
+powershell -ExecutionPolicy Bypass -Command ""& { Import-Module 
.\build\psake.psm1; Invoke-Psake .\build\build.ps1 -properties 
@{prepareForBuild='false';backup_files='false'} }""
+"
+       $dir = [System.IO.Path]::GetDirectoryName($file)
+       Ensure-Directory-Exists $dir
+
+       Write-Host "Generating build.bat file: $file"
+       Out-File -filePath $file -encoding UTF8 -inputObject $buildBat -Force
+}
+
 function Build-Assemblies([string[]]$projects) {
        foreach ($project in $projects) {
                Exec {

Reply via email to