Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/Newtonsoft.Json.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamesNK <james@newtonking.com>2011-04-10 10:39:15 +0400
committerJamesNK <james@newtonking.com>2011-04-10 10:39:15 +0400
commit1e75151dda175d78d5779b5d821f1f5b1d02d110 (patch)
treefa520448dd8488c54e332dd51d5c5eb1f9756cd4
parentb26d5c485014b99cae9622a5ab8454e4c78033c7 (diff)
-Updated build process to embed the build number as assembly version
-rw-r--r--Build/build.ps145
-rw-r--r--Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs6
-rw-r--r--Src/Newtonsoft.Json/Properties/AssemblyInfo.cs6
3 files changed, 49 insertions, 8 deletions
diff --git a/Build/build.ps1 b/Build/build.ps1
index 75e18f4..e95a9b2 100644
--- a/Build/build.ps1
+++ b/Build/build.ps1
@@ -1,6 +1,7 @@
properties {
-
$zipFileName = "Json40r2.zip"
+ $majorVersion = "4.2"
+ $version = GetVersion $majorVersion
$signAssemblies = $false
$signKeyPath = "D:\Development\Releases\newtonsoft.snk"
$buildDocumentation = $false
@@ -42,7 +43,10 @@ task Clean {
# Build each solution, optionally signed
task Build -depends Clean {
-
+ Write-Host -ForegroundColor Green "Updating assembly version"
+ Write-Host
+ Update-AssemblyInfoFiles $sourceDir ($majorVersion + '.0.0') $version
+
foreach ($build in $builds)
{
$name = $build.Name
@@ -168,4 +172,41 @@ function GetConstants($constants, $includeSigned)
$signed = switch($includeSigned) { $true { ";SIGNED" } default { "" } }
return "/p:DefineConstants=`"TRACE;$constants$signed`""
+}
+
+function GetVersion($majorVersion)
+{
+ $now = [DateTime]::Now
+
+ $year = $now.Year - 2000
+ $month = $now.Month
+ $totalMonthsSince2000 = ($year * 12) + $month
+ $day = $now.Day
+ $minor = "{0}{1:00}" -f $totalMonthsSince2000, $day
+
+ $hour = $now.Hour
+ $minute = $now.Minute
+ $revision = "{0:00}{1:00}" -f $hour, $minute
+
+ return $majorVersion + "." + $minor + "." + $revision
+}
+
+function Update-AssemblyInfoFiles ([string] $sourceDir, [string] $assemblyVersionNumber, [string] $fileVersionNumber)
+{
+ $assemblyVersionPattern = 'AssemblyVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)'
+ $fileVersionPattern = 'AssemblyFileVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)'
+ $assemblyVersion = 'AssemblyVersion("' + $assemblyVersionNumber + '")';
+ $fileVersion = 'AssemblyFileVersion("' + $fileVersionNumber + '")';
+
+ Get-ChildItem -Path $sourceDir -r -filter AssemblyInfo.cs | ForEach-Object {
+
+ $filename = $_.Directory.ToString() + '\' + $_.Name
+ Write-Host $filename
+ $filename + ' -> ' + $version
+
+ (Get-Content $filename) | ForEach-Object {
+ % {$_ -replace $assemblyVersionPattern, $assemblyVersion } |
+ % {$_ -replace $fileVersionPattern, $fileVersion }
+ } | Set-Content $filename
+ }
} \ No newline at end of file
diff --git a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs
index 902005c..95955c6 100644
--- a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs
+++ b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs
@@ -39,7 +39,7 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("3.5.0.0")]
+[assembly: AssemblyVersion("4.2.0.0")]
#if !PocketPC
-[assembly: AssemblyFileVersion("3.5.0.0")]
-#endif \ No newline at end of file
+[assembly: AssemblyFileVersion("4.2.13610.1823")]
+#endif
diff --git a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
index b5bc580..855dcfe 100644
--- a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
+++ b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
@@ -108,9 +108,9 @@ using System.Security;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("4.0.0.0")]
+[assembly: AssemblyVersion("4.2.0.0")]
#if !PocketPC
-[assembly: AssemblyFileVersion("4.0.0.0")]
+[assembly: AssemblyFileVersion("4.2.13610.1823")]
#endif
-[assembly: CLSCompliant(true)] \ No newline at end of file
+[assembly: CLSCompliant(true)]