Permalink
Browse files

Added NuGet files

- System.Text.Json.Mobile pushed into NuGet
- Added serializer implementation for XLabs.Serialization package on XLabs project : XLabs/Xamarin-Forms-Labs@b450af8
  • Loading branch information...
1 parent 35c9d4a commit 910b2e31b1d553e1bb7bf3b53ff7af6dfd7132e6 @sami1971 sami1971 committed May 1, 2015
View
@@ -0,0 +1,75 @@
+[CmdletBinding()]
+param(
+ [Parameter(Mandatory = $False)]
+ [string] $version = $null,
+ [Parameter(Mandatory = $False)]
+ [string] $preRelease = $null
+)
+
+
+function OutputCommandLineUsageHelp()
+{
+ Write-Host "Build all NuGet packages."
+ Write-Host "============================"
+ Write-Host ">E.g.: Build All.ps1"
+ Write-Host ">E.g.: Build All.ps1 -PreRelease pre1"
+ Write-Host ">E.g.: Build All.ps1 -Version 1.3.0"
+ Write-Host ">E.g.: Build All.ps1 -Version 1.3.0 -PreRelease pre1"
+}
+
+function Pause ($Message="Press any key to continue...")
+{
+ Write-Host -NoNewLine $Message
+ $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
+ Write-Host ""
+}
+
+try
+{
+ ## Initialise
+ ## ----------
+ $originalBackground = $host.UI.RawUI.BackgroundColor
+ $originalForeground = $host.UI.RawUI.ForegroundColor
+ $originalLocation = Get-Location
+ $packages = (Get-Item "$originalLocation\Definition\*.NuSpec" | % { $_.BaseName })
+
+ $host.UI.RawUI.BackgroundColor = [System.ConsoleColor]::Black
+ $host.UI.RawUI.ForegroundColor = [System.ConsoleColor]::White
+
+ Write-Host "Build All NuGet packages" -ForegroundColor White
+ Write-Host "==================================" -ForegroundColor White
+
+ Write-Host "Creating Packages folder" -ForegroundColor Yellow
+ if (-Not (Test-Path .\Packages)) {
+ mkdir Packages
+ }
+
+ ## NB - Cleanup destination package folder
+ ## ---------------------------------------
+ Write-Host "Clean destination folders..." -ForegroundColor Yellow
+ Remove-Item ".\Packages\*.nupkg" -Recurse -Force -ErrorAction SilentlyContinue
+
+ ## Spawn off individual build processes...
+ ## ---------------------------------------
+ Set-Location "$originalLocation\Definition" ## Adjust current working directory since scripts are using relative paths
+ $packages | ForEach { & ".\Build.ps1" -package $_ -version $version -preRelease $preRelease }
+ Write-Host "Build All - Done." -ForegroundColor Green
+}
+catch
+{
+ $baseException = $_.Exception.GetBaseException()
+ if ($_.Exception -ne $baseException)
+ {
+ Write-Host $baseException.Message -ForegroundColor Magenta
+ }
+ Write-Host $_.Exception.Message -ForegroundColor Magenta
+ Pause
+}
+finally
+{
+ ## Restore original values
+ $host.UI.RawUI.BackgroundColor = $originalBackground
+ $host.UI.RawUI.ForegroundColor = $originalForeground
+ Set-Location $originalLocation
+}
+Pause # For debugging purpose
View
@@ -0,0 +1,56 @@
+##
+## Clean out all output folders
+## ============================
+##
+
+function Pause ($Message="Press any key to continue...")
+{
+ Write-Host -NoNewLine $Message
+ $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
+ Write-Host ""
+}
+
+try
+{
+ ## Initialise
+ ## ----------
+ $originalBackground = $host.UI.RawUI.BackgroundColor
+ $originalForeground = $host.UI.RawUI.ForegroundColor
+ $originalLocation = Get-Location
+ $packages = (Get-Item "$originalLocation\Definition\*.NuSpec" | % { $_.BaseName })
+
+ $host.UI.RawUI.BackgroundColor = [System.ConsoleColor]::Black
+ $host.UI.RawUI.ForegroundColor = [System.ConsoleColor]::White
+
+ Write-Host "Clean all NuGet build outputs" -ForegroundColor White
+ Write-Host "=======================================" -ForegroundColor White
+
+ ## NB - Cleanup destination package folder
+ ## ---------------------------------------
+ Write-Host "Clean destination folders..." -ForegroundColor Yellow
+ Remove-Item ".\Packages\*.nupkg" -Recurse -Force -ErrorAction SilentlyContinue
+
+ ## Spawn off individual create processes...
+ ## ---------------------------------------
+ Set-Location "$originalLocation\Definition" ## Adjust current working directory since scripts are using relative paths
+ $packages | ForEach { & ".\Clean.ps1" $_ }
+ Write-Host "Clean all done." -ForegroundColor Green
+}
+catch
+{
+ $baseException = $_.Exception.GetBaseException()
+ if ($_.Exception -ne $baseException)
+ {
+ Write-Host $baseException.Message -ForegroundColor Magenta
+ }
+ Write-Host $_.Exception.Message -ForegroundColor Magenta
+ Pause
+}
+finally
+{
+ ## Restore original values
+ $host.UI.RawUI.BackgroundColor = $originalBackground
+ $host.UI.RawUI.ForegroundColor = $originalForeground
+ Set-Location $originalLocation
+}
+Pause # For debugging purposes
@@ -0,0 +1,175 @@
+[CmdletBinding()]
+param(
+ [Parameter(Mandatory = $True, ValueFromPipeline = $True)]
+ [string] $package,
+ [Parameter(Mandatory = $False)]
+ [string] $version = $null,
+ [Parameter(Mandatory = $False)]
+ [string] $preRelease = $null
+)
+
+function OutputCommandLineUsageHelp()
+{
+ Write-Host "Create a NuGet build output."
+ Write-Host "============================"
+ Write-Host "Usage: Build.ps1 ""<NuGet Package Name>"" [-PreRelease <PreReleaseVersion>] [-Version <VersionNumber>]"
+}
+
+function Pause( $Message="Press any key to continue..." )
+{
+ Write-Host -NoNewLine $Message
+ $null = $Host.UI.RawUI.ReadKey( "NoEcho,IncludeKeyDown" )
+ Write-Host ""
+}
+
+function ChangeNuSpecVersion( [string] $nuSpecFilePath, [string] $version="0.0.0.0", [string] $nuSpecFilePathTmp = $null )
+{
+ Write-Host "Dynamically setting NuSpec version: $Version" -ForegroundColor Yellow
+
+ # Get full path or save operation fails when launched in standalone powershell
+ $nuSpecFile = Get-Item $nuSpecFilePath | Select-Object -First 1
+
+ # Bring the XML Linq namespace in
+ [Reflection.Assembly]::LoadWithPartialName( “System.Xml.Linq” ) | Out-Null
+
+ # Update the XML document with the new version
+ $xDoc = [System.Xml.Linq.XDocument]::Load( $nuSpecFile.FullName )
+ $versionNode = $xDoc.Descendants( "version" ) | Select-Object -First 1
+ if ($versionNode -ne $null)
+ {
+ $versionNode.SetValue($version)
+ }
+
+ # Update the XML document dependencies with the new version
+ $dependencies = $xDoc.Descendants( "dependency" )
+ foreach( $dependency in $dependencies )
+ {
+ $idAttribute = $dependency.Attributes( "id" ) | Select-Object -First 1
+ if ( $idAttribute -ne $null )
+ {
+ if ( $idAttribute.Value -like "System.Text.Json.*" )
+ {
+ $dependency.SetAttributeValue( "version", "[$version]" )
+ }
+ }
+ }
+
+ # Save file
+ if ($nuSpecFilePathTmp -ne $null)
+ {
+ Write-Host "Creating a temporary NuSpec file with the new version"
+ $xDoc.Save( $nuSpecFilePathTmp )
+ } else {
+ $xDoc.Save( $nuSpecFile.FullName )
+ }
+}
+
+function CopyMaintainingSubDirectories( $basePath, $includes, $targetBasePath )
+{
+ $basePathLength = [System.IO.Path]::GetFullPath( $basePath ).Length - 1
+ $filesToCopy = Get-ChildItem "$basePath\" -Include $includes -Recurse
+ #$filesToCopy | Write-Host -ForegroundColor DarkGray # Debug.Print
+ foreach( $file in $filesToCopy )
+ {
+ $targetDirectory = Join-Path $targetBasePath $file.Directory.FullName.Substring( $basePathLength )
+ if ( (Test-Path $targetDirectory) -ne $true)
+ {
+ [System.IO.Directory]::CreateDirectory( $targetDirectory ) | Out-Null
+ }
+ Copy-Item $file -Destination $targetDirectory
+ }
+}
+
+## Validate input parameters
+## -------------------------
+if ( $package -eq $null )
+{
+ OutputCommandLineUsageHelp
+ return
+}
+
+try
+{
+ ## Initialise
+ ## ----------
+ $basePath = Get-Location
+ $pathToNuGetPackager = [System.IO.Path]::GetFullPath( "$basePath\..\NuGet.exe" )
+ $pathToNuGetPackageOutput = [System.IO.Path]::GetFullPath( "$basePath\..\Packages" )
+ $originalBackground = $host.UI.RawUI.BackgroundColor
+ $originalForeground = $host.UI.RawUI.ForegroundColor
+
+ $host.UI.RawUI.BackgroundColor = [System.ConsoleColor]::Black
+ $host.UI.RawUI.ForegroundColor = [System.ConsoleColor]::White
+
+ Write-Host "Build NuGet packages for: " -ForegroundColor White -NoNewLine
+ Write-Host $package -ForegroundColor Cyan
+ Write-Host "=========================" -ForegroundColor White
+
+ # Do we have a version or do we need to dynamically load it?
+ if ( [System.String]::IsNullOrEmpty( $version ) -ne $true )
+ {
+ Write-Host "Option: /Version:$version" -ForegroundColor Yellow
+
+ $productVersion = $version
+ } else {
+ ## Update Package Version
+ ## ----------------------
+ ## Before building NuGet package, extract CSLA Version number and update .NuSpec to automate versioning of .NuSpec document
+ ## - JH: Not sure if I should get direct from source code file or from file version of compiled library instead.
+ ## - JH: Going with product version in assembly for now
+ $pathToBin = [System.IO.Path]::GetFullPath( "$basePath\..\..\JsonTest\bin\Release" )
+ $pathToAssembly = "$pathToBin\System.Text.Json.Droid.dll"
+ $cslaAssembly = (Get-ChildItem $pathToAssembly -ErrorAction SilentlyContinue | Select-Object -First 1)
+ if ($cslaAssembly -eq $null) {
+ Write-Host "Failed to load version information from $pathToAssembly" -ForegroundColor Red
+ exit
+ }
+
+ ## - JH: If $preRelease is specified, then append it with a dash following the 3rd component of the quad-dotted-version number
+ ## Refer: http://docs.nuget.org/docs/Reference/Versioning
+ $productVersion = [System.String]::Format( "{0}.{1}.{2}", $cslaAssembly.VersionInfo.ProductMajorPart, $cslaAssembly.VersionInfo.ProductMinorPart, $cslaAssembly.VersionInfo.ProductBuildPart )
+ }
+
+ # Is this a prelease?
+ if ( [System.String]::IsNullOrEmpty( $preRelease ) -ne $true )
+ {
+ Write-Host "Option: /PreRelease:$preRelease" -ForegroundColor Yellow
+ $productVersion = [System.String]::Format( "{0}-{1}", $productVersion, $preRelease )
+ }
+
+ ChangeNuSpecVersion "$basePath\$package.NuSpec" $productVersion "$basePath\$package.tmp.NuSpec"
+
+ ## Launch NuGet.exe to build package
+ Write-Host "Build NuGet package: $package..." -ForegroundColor Yellow
+ & $pathToNuGetPackager pack "$basePath\$package.tmp.NuSpec" -Symbols
+
+ Remove-Item "$basePath\$package.tmp.NuSpec"
+
+ ## Publish package to Gallery using API Key
+ ## JH - TODO
+
+ ## Move NuGet package to Package Release folder"
+ Write-Host "Move package to ..\Packages folder..." -ForegroundColor Yellow
+ Move-Item "*.nupkg" -Destination $pathToNuGetPackageOutput -Force
+
+ ## Cleanup after ourselves
+ ## JH - TODO
+
+ Write-Host "Done." -ForegroundColor Green
+}
+catch
+{
+ $baseException = $_.Exception.GetBaseException()
+ if ( $_.Exception -ne $baseException )
+ {
+ Write-Host $baseException.Message -ForegroundColor Magenta
+ }
+ Write-Host $_.Exception.Message -ForegroundColor Magenta
+ Pause
+}
+finally
+{
+ $host.UI.RawUI.BackgroundColor = $originalBackground
+ $host.UI.RawUI.ForegroundColor = $originalForeground
+}
+#Pause # For debugging purposes
@@ -0,0 +1,52 @@
+param($package)
+
+if ($package -eq $null)
+{
+ Write-Host "Clean a NuGet build output."
+ Write-Host "============================"
+ Write-Host "Usage: Clean.ps1 ""<NuGet Name>"""
+ Write-Host ">E.g.: Clean.ps1 ""Core"""
+ return
+}
+
+try
+{
+ ## Initialise
+ ## ----------
+ $configuration = "Release"
+ $basePath = Get-Location
+ $pathToNuGetLib = [System.IO.Path]::GetFullPath( "$basePath\$package" )
+
+ $originalBackground = $host.UI.RawUI.BackgroundColor
+ $originalForeground = $host.UI.RawUI.ForegroundColor
+
+ $host.UI.RawUI.BackgroundColor = [System.ConsoleColor]::Black
+ $host.UI.RawUI.ForegroundColor = [System.ConsoleColor]::White
+
+ Write-Host "Clean NuGet build outputs for: $package" -ForegroundColor White
+ Write-Host "==============================" -ForegroundColor White
+
+ ## NB - Cleanup destination folders
+ ## --------------------------------
+ Write-Host "Clean destination folders..." -ForegroundColor Yellow
+ ##Remove-Item "$pathToNuGetLib\*" -Exclude *.NuSpec -Recurse -Force -ErrorAction SilentlyContinue
+ Remove-Item "$basePath\*.NuPkg" -Recurse -Force -ErrorAction SilentlyContinue
+
+ Write-Host "Clean operation done." -ForegroundColor Green
+}
+catch
+{
+ $baseException = $_.Exception.GetBaseException()
+ if ($_.Exception -ne $baseException)
+ {
+ Write-Host $baseException.Message -ForegroundColor Magenta
+ }
+ Write-Host $_.Exception.Message -ForegroundColor Magenta
+ Pause
+}
+finally
+{
+ $host.UI.RawUI.BackgroundColor = $originalBackground
+ $host.UI.RawUI.ForegroundColor = $originalForeground
+}
+#Pause # For debugging purposes
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<package>
+ <metadata>
+ <id>System.Text.Json.Mobile</id>
+ <title>System.Text.Json.Mobile</title>
+ <tags>Fast JSON parser deserializer POCO Xamarin Mobile Android WP</tags>
+ <version>2.0.0.6</version>
+ <authors>Cyril Jandia, Sami Kallio</authors>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <description>
+ A minimalistic and fast JSON parser/deserializer. Mobile versions for Android and WP8.
+ </description>
+ <summary>
+ </summary>
+ <language>en-US</language>
+ <frameworkAssemblies>
+ <frameworkAssembly assemblyName="Mono.Android.Export" targetFramework="MonoAndroid" />
+ </frameworkAssemblies>
+ </metadata>
+ <files>
+ <file src="..\..\JsonTest\System.Text.Json\bin\Release\**\System.Text.Json.Droid.dll" target="lib\MonoAndroid" />
+ <file src="..\..\JsonTest\System.Text.Json\bin\Release\**\System.Text.Json.WP8.dll" target="lib\wp8" />
+ <!-- Source Files for Symbol Server -->
+ <file src="..\..\JsonTest\System.Text.Json\**\*.cs" target="src" />
+ </files>
+</package>
Oops, something went wrong.

0 comments on commit 910b2e3

Please sign in to comment.