lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject lucenenet git commit: build: Added Version.proj MSBuild file to supply VersionPrefix and VersionSuffix from the repository. This will allow control over all parts of the version except the build counter from the repository. Also scripted the versioning r
Date Wed, 19 Apr 2017 16:06:44 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/api-work a8ebf6b76 -> 9094afa64


build: Added Version.proj MSBuild file to supply VersionPrefix and VersionSuffix from the
repository. This will allow control over all parts of the version except the build counter
from the repository. Also scripted the versioning rules to synchronize the version number
with Lucene while still allowing for pre-releases (when Lucene versions are ported only) and
for patches.


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

Branch: refs/heads/api-work
Commit: 9094afa64aa583006193ca7b6b351d09757caad2
Parents: a8ebf6b
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Wed Apr 19 23:05:11 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Wed Apr 19 23:05:11 2017 +0700

----------------------------------------------------------------------
 Lucene.Net.Portable.sln |   1 +
 Lucene.Net.sln          |   1 +
 Version.proj            |  13 +++++
 build.bat               |   4 +-
 build/build.ps1         | 117 +++++++++++++++++++++++++++++--------------
 5 files changed, 96 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9094afa6/Lucene.Net.Portable.sln
----------------------------------------------------------------------
diff --git a/Lucene.Net.Portable.sln b/Lucene.Net.Portable.sln
index 7f4edad..374ff5a 100644
--- a/Lucene.Net.Portable.sln
+++ b/Lucene.Net.Portable.sln
@@ -77,6 +77,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{EFA10A77
 	ProjectSection(SolutionItems) = preProject
 		build.bat = build.bat
 		build\build.ps1 = build\build.ps1
+		Version.proj = Version.proj
 	EndProjectSection
 EndProject
 Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Lucene.Net.Icu", "src\Lucene.Net.Icu\Lucene.Net.Icu.xproj",
"{44A5341B-0F52-429D-977A-C35E10ECCADF}"

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9094afa6/Lucene.Net.sln
----------------------------------------------------------------------
diff --git a/Lucene.Net.sln b/Lucene.Net.sln
index 66e91a6..e6940c9 100644
--- a/Lucene.Net.sln
+++ b/Lucene.Net.sln
@@ -86,6 +86,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{9811D53E
 	ProjectSection(SolutionItems) = preProject
 		build.bat = build.bat
 		build\build.ps1 = build\build.ps1
+		Version.proj = Version.proj
 	EndProjectSection
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lucene.Net.Icu", "src\Lucene.Net.Icu\Lucene.Net.Icu.csproj",
"{349CB7C9-7534-4E1D-9B0A-5521441AF0AE}"

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9094afa6/Version.proj
----------------------------------------------------------------------
diff --git a/Version.proj b/Version.proj
new file mode 100644
index 0000000..4296667
--- /dev/null
+++ b/Version.proj
@@ -0,0 +1,13 @@
+<Project>
+
+  <PropertyGroup>
+    <!-- IMPORTANT: VersionPrefix should always be the same as the Lucene version this
is based on.
+      Never increment it for an individual build - only increment this when an entire version's
changes
+      are ported over from Lucene. This is what determines the version of all of the NuGet
packages and binaries. -->
+	  <VersionPrefix>4.8.0</VersionPrefix>
+    <!-- VersionSuffix is the pre-release tag. A zero-padded version number will automatically
be suffixed to this
+      by the build script. -->
+	  <VersionSuffix>beta</VersionSuffix>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9094afa6/build.bat
----------------------------------------------------------------------
diff --git a/build.bat b/build.bat
index 297314d..0911554 100644
--- a/build.bat
+++ b/build.bat
@@ -13,7 +13,7 @@ GOTO endcommentblock
 ::                  as PackageVersion (excluding any pre-release tag).
 ::
 ::   -PackageVersion:<PackageVersion>
-::   -pv:<PackageVersion> - Nuget package version. Default is 1.0.0.
+::   -pv:<PackageVersion> - Nuget package version. Default is 0.0.0, which instructs
the script to use the value in Version.proj.
 ::
 ::   -Configuration:<Configuration>
 ::   -config:<Configuration> - MSBuild configuration for the build.
@@ -38,7 +38,7 @@ IF "%version%" == "" (
 	set version=0.0.0
 )
 IF "%PackageVersion%" == "" (
-    set PackageVersion=1.0.0
+    set PackageVersion=0.0.0
 )
 set configuration=Release
 IF NOT "%config%" == "" (

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9094afa6/build/build.ps1
----------------------------------------------------------------------
diff --git a/build/build.ps1 b/build/build.ps1
index d956897..1dcd496 100644
--- a/build/build.ps1
+++ b/build/build.ps1
@@ -6,7 +6,7 @@
 	[string]$nuget_package_directory = "$release_directory\NuGetPackages"
 	[string]$test_results_directory = "$release_directory\TestResults"
 
-	[string]$packageVersion   = "4.8.0"
+	[string]$packageVersion   = "0.0.0"
 	[string]$version          = "0.0.0"
 	[string]$configuration    = "Release"
 	[bool]$backup_files        = $true
@@ -37,6 +37,56 @@ task Init -description "This task makes sure the build environment is correctly
 		Write-Error "Could not find dotnet CLI in PATH. Please install the .NET Core 1.1 SDK."
 	}
 
+	#If $packageVersion is not passed in, get it from Version.proj
+	if ([string]::IsNullOrEmpty($packageVersion) -or $packageVersion -eq "0.0.0") {
+		#Get the version info
+		$versionFile = "$base_directory\Version.proj"
+		$xml = [xml](Get-Content $versionFile)
+
+		$versionPrefix = $xml.Project.PropertyGroup.VersionPrefix
+		$versionSuffix = $xml.Project.PropertyGroup.VersionSuffix
+		Write-Host "VersionPrefix: $versionPrefix" -ForegroundColor Yellow
+		Write-Host "VersionSuffix: $versionSuffix" -ForegroundColor Yellow
+
+		#build counter from TeamCity
+		$buildCounter = "$env:build_counter"
+		Write-Host "TeamCity buildCounter : $buildCounter"
+		if ([string]::IsNullOrEmpty($buildCounter)) {
+			#attempt to get MyGet build counter
+			$buildCounter = "$env:BuildCounter"
+		}
+
+
+		if ([string]::IsNullOrWhiteSpace($versionSuffix)) {
+			# this is a production release - use 4 segment version number 0.0.0.0
+			if ([string]::IsNullOrEmpty($buildCounter)) {
+				$buildCounter = "0"
+			}
+
+			$packageVersion = "$versionPrefix.$buildCounter"
+		} else {
+			# this is a pre-release - use 3 segment version number with (optional) zero-padded pre-release
tag
+			if (![string]::IsNullOrEmpty($buildCounter)) {
+				$buildCounter = ([Int32]$buildCounter).ToString("00000")
+			}
+
+			$packageVersion = "$versionPrefix-$versionSuffix$buildCounter"
+		}
+	}
+
+	#Update TeamCity or MyGet with packageVersion
+	Write-Output "##teamcity[buildNumber '$packageVersion']"
+	Write-Output "##myget[buildNumber '$packageVersion']"
+
+	#If $version is not passed in, parse it from $packageVersion
+	if ([string]::IsNullOrEmpty($version) -or $version -eq "0.0.0") {
+		$version = $packageVersion
+		if ($version.Contains("-") -eq $true) {
+			$version = $version.SubString(0, $version.IndexOf("-"))
+		}
+		Write-Host "Updated version to: $version"
+	}
+
 	& dotnet.exe --version
 	Write-Host "Base Directory: $base_directory"
 	Write-Host "Release Directory: $release_directory"
@@ -47,15 +97,6 @@ task Init -description "This task makes sure the build environment is correctly
 	Write-Host "Package Version: $packageVersion"
 	Write-Host "Configuration: $configuration"
 
-	#If version is not passed in, parse it from $packageVersion
-	if ($version -eq "0.0.0" -or [string]::IsNullOrEmpty($version)) {
-		$version = $packageVersion
-		if ($version.Contains("-") -eq $true) {
-			$version = $version.SubString(0, $version.IndexOf("-"))
-		}
-		Write-Host "Updated version to: $version"
-	}
-
 	Ensure-Directory-Exists "$release_directory"
 
 	#ensure we have the latest version of NuGet
@@ -65,41 +106,41 @@ task Init -description "This task makes sure the build environment is
correctly
 }
 
 task Compile -depends Clean, Init -description "This task compiles the solution" {
-	try {
-		pushd $base_directory
-		$projects = Get-ChildItem -Path "project.json" -Recurse
-		popd
+	#try {
+	#	pushd $base_directory
+	#	$projects = Get-ChildItem -Path "project.json" -Recurse
+	#	popd
 
-		Backup-Files $projects
-		Prepare-For-Build $projects
-		& dotnet.exe restore $base_directory
+	#	Backup-Files $projects
+	#	Prepare-For-Build $projects
+	#	& dotnet.exe restore $base_directory
 
-		Build-Assemblies $projects
+	#	Build-Assemblies $projects
 
-		Start-Sleep 10
+	#	Start-Sleep 10
 
-		$success = $true
-	} finally {
-		if ($success -ne $true) {
-			Restore-Files $backedUpFiles
-		}
-	}
+	#	$success = $true
+	#} finally {
+	#	if ($success -ne $true) {
+	#		Restore-Files $backedUpFiles
+	#	}
+	#}
 }
 
 task Pack -depends Compile -description "This task creates the NuGet packages" {
-	try {
-		pushd $base_directory
-		$packages = Get-ChildItem -Path "project.json" -Recurse | ? { !$_.Directory.Name.Contains(".Test")
}
-		popd
-
-		Pack-Assemblies $packages
-
-		$success = $true
-	} finally {
-		#if ($success -ne $true) {
-			Restore-Files $backedUpFiles
-		#}
-	}
+	#try {
+	#	pushd $base_directory
+	#	$packages = Get-ChildItem -Path "project.json" -Recurse | ? { !$_.Directory.Name.Contains(".Test")
}
+	#	popd
+
+	#	Pack-Assemblies $packages
+
+	#	$success = $true
+	#} finally {
+	#	#if ($success -ne $true) {
+	#		Restore-Files $backedUpFiles
+	#	#}
+	#}
 }
 
 task Test -description "This task runs the tests" {


Mime
View raw message