diff --git a/GitReleaseManager.yaml b/GitReleaseManager.yaml new file mode 100644 index 0000000..4259743 --- /dev/null +++ b/GitReleaseManager.yaml @@ -0,0 +1,21 @@ +create: + include-footer: true + footer-heading: Where to get it + footer-content: You can download this release from [nuget.org](https://www.nuget.org/packages/Realm.Json.Extensions/) + footer-includes-milestone: true + milestone-replace-text: '{milestone}' +export: + include-created-date-in-title: false + created-date-string-format: + perform-regex-removal: false + regex-text: + multiline-regex: false +issue-labels-include: +- Bug +- Feature +- Improvement +- Enhancement +issue-labels-exclude: +- Internal Refactoring +- Internal + diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000..70ce7e8 --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,4 @@ +mode: ContinuousDeployment +branches: {} +ignore: + sha: [] diff --git a/README.md b/README.md index f1d3ca0..8d3456b 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,23 @@ -![RealmJson.Extensions](media/SushiHangover.RealmJson.png) + -#SushiHangover.RealmJson.Extensions +##SushiHangover.RealmJson.Extensions -####Extension Methods for adding JSON APIs to a Realm Instance +**Extension Methods for adding JSON APIs to a Realm Instance** ##Current project status: -| Git Branch | Xamarin.Android | Xamarin.iOS | Xamarin.Forms[(1)](#1xamarinforms-usage) -| :------ | :------: | :------: | :------: | -| **master** | ![](media/passing.png) | ![](media/passing.png) | ![](media/passing.png) | +[![Build status](https://ci.appveyor.com/api/projects/status/ronof3ruyjpl1c4v/branch/master?svg=true)](https://ci.appveyor.com/project/sushihangover/realm-json-extensions/branch/master) - -##[Realm](https://realm.io/docs/xamarin/latest/) Versions: - - -###Xamarin Realm v0.80.0 - -* Package Version `1.1.0` - - * Due to the changes in `Manage`, it is now faster to create/update `RealmObject`s when dealing with under 1k records then using `AutoMapper`, see [Perf.md](https://github.com/sushihangover/Realm.Json.Extensions/blob/master/Perf.md) for details. - * Replaced `AutoMapper` w/ `Manage` except for: - * Added `CreateAllFromJsonViaAutoMapper` - -###Xamarin Realm v0.78.1 - -* Package Version `1.0.1` - - * Uses `AutoMapper` to auto-assign the Json derived object properies to the RealmObject - * Initial Public Release ##Nuget: -`PM> Install-Package RealmJson.Extensions` +
+

+ +PM> Install-Package RealmJson.Extensions + +

+
Ref: [https://www.nuget.org/packages/RealmJson.Extensions](https://www.nuget.org/packages/RealmJson.Extensions) @@ -44,6 +29,9 @@ Ref: [https://www.nuget.org/packages/RealmJson.Extensions](https://www.nuget.org Post on [StackOverflow](http://stackoverflow.com/questions/tagged/xamarin+realm) with the tags: **`[XAMARIN]`** **`[REALM]`** **`[JSON]`** +##API Reference: + +TODO, place doc link here ##Extension API: @@ -108,6 +96,16 @@ Note: Once Xamarin has full support for `.NET Standard` and AutoMapper releases (3) https://github.com/AutoMapper/AutoMapper/issues/1532 +##Build Documention: + +API Reference documention is built via the great +doxygen + + +
+doxygen Doxygen/realmthread.config +
+ ##Building: ###`xbuild` or `msbuild` based: @@ -151,3 +149,40 @@ See [Perf.md](https://github.com/sushihangover/Realm.Json.Extensions/blob/master ##License Consult [LICENSE](https://github.com/sushihangover/Realm.Json.Extensions/blob/master/LICENSE) + + + + diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..a838476 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,13 @@ +version: 1.0.{build} +environment: + NUGET_SOURCE: https://www.nuget.org/api/v2/package + GITHUB_USERNAME: sushihangover + GITHUB_TOKEN: + secure: mMrrEYoa3W9aMdthNtjHA9+FfEoYc3rcg7QW2lqvjZQ= + NUGET_APIKEY: + secure: ilgXixdHFR4fmcNjBiIB3686iIKTDToC1q7mAEsgyqM/Umuq9P20BiHSKRcY3J1R +build_script: +- ps: ./build.ps1 -Verbosity Diagnostic +test: off +artifacts: +- path: artifacts/* diff --git a/build.cake b/build.cake new file mode 100644 index 0000000..38d829a --- /dev/null +++ b/build.cake @@ -0,0 +1,430 @@ +using System.Threading; +////////////////////////////////////////////////////////////////////// +// ADDINS +////////////////////////////////////////////////////////////////////// + +#addin "Cake.FileHelpers" +#addin "Cake.AppleSimulator.SushiHangover" + +////////////////////////////////////////////////////////////////////// +// TOOLS +////////////////////////////////////////////////////////////////////// + +#tool "nuget:?package=Cake.AppleSimulator.SushiHangover" +#tool "nuget:?package=SushiHangover.RealmThread" +#tool "nuget:?package=xunit.runner.console" +#tool "nuget:?package=GitVersion.CommandLine" +#tool "GitReleaseManager" +#tool "GitLink" + +////////////////////////////////////////////////////////////////////// +// ARGUMENTS +////////////////////////////////////////////////////////////////////// + +var target = Argument("target", "Default"); +if (string.IsNullOrWhiteSpace(target)) +{ + target = "Default"; +} + +////////////////////////////////////////////////////////////////////// +// PREPARATION +////////////////////////////////////////////////////////////////////// + +// Should MSBuild & GitLink treat any errors as warnings? +var treatWarningsAsErrors = false; + +// Build configuration +var local = BuildSystem.IsLocalBuild; +var isRunningOnMacOS = IsRunningOnUnix(); //(Context.Environment.Platform.Family == PlatformFamily.OSX); // Still broken +var isRunningOnUnix = IsRunningOnUnix(); +var isRunningOnWindows = IsRunningOnWindows(); + +var githubOwner = "sushihangover"; +var githubRepository = "Realm.Json.Extensions"; +var githubUrl = string.Format("https://github.com/{0}/{1}", githubOwner, githubRepository); + +var isRunningOnAppVeyor = AppVeyor.IsRunningOnAppVeyor; +var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest; +var isRepository = StringComparer.OrdinalIgnoreCase.Equals("sushihangover/Realm.Json.Extensions", AppVeyor.Environment.Repository.Name); + +var isReleaseBranch = StringComparer.OrdinalIgnoreCase.Equals("master", AppVeyor.Environment.Repository.Branch); +var isTagged = AppVeyor.Environment.Repository.Tag.IsTag; + +// Version +var gitVersion = GitVersion(); +var majorMinorPatch = gitVersion.MajorMinorPatch; +var semVersion = gitVersion.SemVer; +var informationalVersion = gitVersion.InformationalVersion; +var nugetVersion = gitVersion.NuGetVersion; +var buildVersion = gitVersion.FullBuildMetaData; + +// Artifacts +var artifactDirectory = "./artifacts/"; +var packageWhitelist = new[] { "RealmJson.Extensions" }; + +// Macros +Action Abort = () => { throw new Exception("A non-recoverable fatal error occurred."); }; +Action TestFailuresAbort = () => { throw new Exception("Testing revealed failed unit tests"); }; +Action NonMacOSAbort = () => { throw new Exception("Running on platforms other macOS is not supported."); }; + +Action RestorePackages = (solution) => +{ + NuGetRestore(solution); +}; + +Action Package = (nuspec, basePath) => +{ + CreateDirectory(artifactDirectory); + + Information("Packaging {0} using {1} as the BasePath.", nuspec, basePath); + + NuGetPack(nuspec, new NuGetPackSettings { + Authors = new [] { "SushiHangover/RobertN" }, + Owners = new [] { "sushihangover" }, + + ProjectUrl = new Uri(githubUrl), + IconUrl = new Uri("https://raw.githubusercontent.com/sushihangover/Realm.Json.Extensions/master/media/icon.png"), + LicenseUrl = new Uri("https://opensource.org/licenses/MIT"), + Copyright = "Copyright (c) SushiHangover/RobertN", + RequireLicenseAcceptance = false, + + Version = nugetVersion, + Tags = new [] { "Json", "Realm", "Xamarin", "Netwonsoft", "SushiHangover" }, + ReleaseNotes = new [] { string.Format("{0}/releases", githubUrl) }, + + Symbols = true, + Verbosity = NuGetVerbosity.Detailed, + OutputDirectory = artifactDirectory, + BasePath = basePath, + }); +}; + +Action SourceLink = (solutionFileName) => +{ + GitLink("./", new GitLinkSettings() { + RepositoryUrl = githubUrl, + SolutionFileName = solutionFileName, + ErrorsAsWarnings = false, + }); +}; + +Action buildThisApp = (p,c,t) => +{ + Information("{0}:{1}:{2}", t,c,p); + if (isRunningOnMacOS) + { + var settings = new XBuildSettings() + .WithProperty("SolutionDir", new string[] { @"./" }) + .WithProperty("OutputPath", new string[] { @"../../artifacts/" }) + .SetConfiguration(c) + .SetVerbosity(Verbosity.Quiet) + .WithTarget(t); + XBuild(p, settings); + }; +}; + +Action unitTestApp = (bundleId, appPath) => +{ + Information("Shutdown"); + ShutdownAllAppleSimulators(); + + var setting = new SimCtlSettings() { ToolPath = FindXCodeTool("simctl") }; + var simulators = ListAppleSimulators(setting); + var device = simulators.First(x => x.Name == "xUnit Runner" & x.Runtime == "iOS 10.1"); + // Information(string.Format($"Name={device.Name}, UDID={device.UDID}, Runtime={device.Runtime}, Availability={device.Availability}")); + + Information("LaunchAppleSimulator"); + LaunchAppleSimulator(device.UDID); + Thread.Sleep(60 * 1000); + + Information("UninstalliOSApplication"); + UninstalliOSApplication( + device.UDID, + bundleId, + setting); + Thread.Sleep(5 * 1000); + + Information("InstalliOSApplication"); + InstalliOSApplication( + device.UDID, + appPath, + setting); + // Delay to allow simctl install to finish, otherwise you can receive the following error: + // The request was denied by service delegate (SBMainWorkspace) for reason: + // Busy ("Application "cake.applesimulator.test-xunit" is installing or uninstalling, and cannot be launched"). + Thread.Sleep(5 * 1000); + + Information("TestiOSApplication"); + var testResults = TestiOSApplication( + device.UDID, + bundleId, + setting); + Information("Test Results:"); + // Information(string.Format($"Tests Run:{testResults.Run} Passed:{testResults.Passed} Failed:{testResults.Failed} Skipped:{testResults.Skipped} Inconclusive:{testResults.Inconclusive}")); + + Information("UninstalliOSApplication"); + UninstalliOSApplication( + device.UDID, + bundleId, + setting); + + Information("Shutdown"); + ShutdownAllAppleSimulators(); + + if (testResults.Run > 0 && testResults.Failed > 0) + { + // Information(string.Format($"Tests Run:{testResults.Run} Passed:{testResults.Passed} Failed:{testResults.Failed} Skipped:{testResults.Skipped} Inconclusive:{testResults.Inconclusive}")); + TestFailuresAbort(); + } +}; + +///////////////////////////////////////////////////////////////////////////// +// SETUP / TEARDOWN +///////////////////////////////////////////////////////////////////////////// +Setup((context) => +{ + Information("Building version {0} of SushiHangover.RealmJson.Extensions. (isTagged: {1})", informationalVersion, isTagged); +}); + +Teardown((context) => +{ + // Executed AFTER the last task. +}); + +////////////////////////////////////////////////////////////////////// +// TASKS +////////////////////////////////////////////////////////////////////// + +Task("Build") + .IsDependentOn("RestorePackages") + .IsDependentOn("UpdateAssemblyInfo") + .Does (() => +{ + Action build = (filename) => + { + var solution = System.IO.Path.Combine("./src/", filename); + + Information("Building {0}", solution); + + if (isRunningOnMacOS) + { + var settings = new XBuildSettings() + .SetConfiguration("Release") + .SetVerbosity(Verbosity.Quiet) + .WithTarget("Clean"); + XBuild(solution, settings); + settings = new XBuildSettings() + .SetConfiguration("Release") + .SetVerbosity(Verbosity.Quiet) + .WithTarget("Build"); + XBuild(solution, settings); + } + if (isRunningOnWindows) + { + MSBuild(solution, new MSBuildSettings() + .SetConfiguration("Release") + .SetVerbosity(Verbosity.Minimal) + .SetNodeReuse(false)); + } + }; + + build("RealmJsonExtensions.sln"); +}); + +Task("UpdateAppVeyorBuildNumber") + .WithCriteria(() => isRunningOnAppVeyor) + .Does(() => +{ + Information("{0}", buildVersion); + AppVeyor.UpdateBuildVersion(buildVersion); +}); + +Task("UpdateAssemblyInfo") + .IsDependentOn("UpdateAppVeyorBuildNumber") + .Does (() => +{ + var file = "./src/CommonAssemblyInfo.cs"; + + CreateAssemblyInfo(file, new AssemblyInfoSettings { + Product = "SushiHangover.RealmJson.Extensions", + Version = majorMinorPatch, + FileVersion = majorMinorPatch, + InformationalVersion = informationalVersion, + Copyright = "Copyright (c) SushiHangover/RobertN" + }); +}); + +Task("RestorePackages").Does (() => +{ + RestorePackages("./src/RealmJsonExtensions.sln"); +}); + +Task("RunUnitTests") + .IsDependentOn("Build") + .Does(() => +{ + //XUnit2("./src/RealmThread.Tests/bin/x64/Release/RealmThread.Tests.dll", new XUnit2Settings { + // OutputDirectory = artifactDirectory, + // XmlReportV1 = false, + // NoAppDomain = false // RealmThread.Tests requires AppDomain otherwise it does not resolve System.Reactive.* + //}); +}); + +Task("Package") + .IsDependentOn("RunUnitTests") + .Does (() => +{ + Package("./src/RealmJson.Extensions.nuspec", "./src"); +}); + +Task("PublishPackages") + .IsDependentOn("Package") + .WithCriteria(() => !local) + .WithCriteria(() => !isPullRequest) + .WithCriteria(() => isReleaseBranch) + .WithCriteria(() => isRepository) + .WithCriteria(() => isTagged) + .Does (() => +{ + if (isReleaseBranch && !isTagged) + { + Information("Packages will not be published as this release has not been tagged."); + return; + } + + // Resolve the API key. + var apiKey = EnvironmentVariable("NUGET_APIKEY"); + if (string.IsNullOrEmpty(apiKey)) + { + throw new Exception("The NUGET_APIKEY environment variable is not defined."); + } + + var source = EnvironmentVariable("NUGET_SOURCE"); + if (string.IsNullOrEmpty(source)) + { + throw new Exception("The NUGET_SOURCE environment variable is not defined."); + } + + // only push whitelisted packages. + foreach(var package in packageWhitelist) + { + // only push the package which was created during this build run. + var packagePath = artifactDirectory + File(string.Concat(package, ".", nugetVersion, ".nupkg")); + + // Push the package. + NuGetPush(packagePath, new NuGetPushSettings { + Source = source, + ApiKey = apiKey + }); + } +}); + +Task("CreateRelease") + .IsDependentOn("Package") + .WithCriteria(() => !local) + .WithCriteria(() => !isPullRequest) + .WithCriteria(() => isRepository) + .WithCriteria(() => isReleaseBranch) + .WithCriteria(() => isTagged) + .Does (() => +{ + var username = EnvironmentVariable("GITHUB_USERNAME"); + if (string.IsNullOrEmpty(username)) + { + throw new Exception("The GITHUB_USERNAME environment variable is not defined."); + } + + var token = EnvironmentVariable("GITHUB_TOKEN"); + if (string.IsNullOrEmpty(token)) + { + throw new Exception("The GITHUB_TOKEN environment variable is not defined."); + } + + GitReleaseManagerCreate(username, token, githubOwner, githubRepository, new GitReleaseManagerCreateSettings { + Milestone = majorMinorPatch, + Name = majorMinorPatch, + Prerelease = true, + TargetCommitish = "master" + }); +}); + +Task("PublishRelease") + .IsDependentOn("RunUnitTests") + .IsDependentOn("Package") + .WithCriteria(() => !local) + .WithCriteria(() => !isPullRequest) + .WithCriteria(() => isRepository) + .WithCriteria(() => isReleaseBranch) + .WithCriteria(() => isTagged) + .Does (() => +{ + var username = EnvironmentVariable("GITHUB_USERNAME"); + if (string.IsNullOrEmpty(username)) + { + throw new Exception("The GITHUB_USERNAME environment variable is not defined."); + } + + var token = EnvironmentVariable("GITHUB_TOKEN"); + if (string.IsNullOrEmpty(token)) + { + throw new Exception("The GITHUB_TOKEN environment variable is not defined."); + } + + // only push whitelisted packages. + foreach(var package in packageWhitelist) + { + // only push the package which was created during this build run. + var packagePath = artifactDirectory + File(string.Concat(package, ".", nugetVersion, ".nupkg")); + + GitReleaseManagerAddAssets(username, token, githubOwner, githubRepository, majorMinorPatch, packagePath); + } + + GitReleaseManagerClose(username, token, githubOwner, githubRepository, majorMinorPatch); +}); + +Task("Documentation") + .WithCriteria(() => local) + .Does (() => +{ + Information("Documentation"); + using(var process = StartAndReturnProcess("doxygen", new ProcessSettings{ Arguments = "Doxygen/realmthread.config" })) + { + process.WaitForExit(); + Information("Exit code: {0}", process.GetExitCode()); + } +}); + +Task("UnitTestiOSApp") + .WithCriteria(() => isRunningOnMacOS) + .IsDependentOn("RestorePackages") + .Does (() => +{ + buildThisApp( + "./src/RealmJson.Test.iOS/RealmJson.Test.iOS.csproj", + "UnitTesting", + "Rebuild" + ); + unitTestApp( + "com.sushihangover.realmjson-test-ios", + "./artifacts/RealmJson.Test.iOS.app" + ); +}); + +////////////////////////////////////////////////////////////////////// +// TASK TARGETS +////////////////////////////////////////////////////////////////////// + +Task("Default") + .IsDependentOn("CreateRelease") + .IsDependentOn("PublishPackages") + .IsDependentOn("PublishRelease") + .Does (() => +{ +}); + +////////////////////////////////////////////////////////////////////// +// EXECUTION +////////////////////////////////////////////////////////////////////// + +RunTarget(target); diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..44de579 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,189 @@ +########################################################################## +# This is the Cake bootstrapper script for PowerShell. +# This file was downloaded from https://github.com/cake-build/resources +# Feel free to change this file to fit your needs. +########################################################################## + +<# + +.SYNOPSIS +This is a Powershell script to bootstrap a Cake build. + +.DESCRIPTION +This Powershell script will download NuGet if missing, restore NuGet tools (including Cake) +and execute your Cake build script with the parameters you provide. + +.PARAMETER Script +The build script to execute. +.PARAMETER Target +The build script target to run. +.PARAMETER Configuration +The build configuration to use. +.PARAMETER Verbosity +Specifies the amount of information to be displayed. +.PARAMETER Experimental +Tells Cake to use the latest Roslyn release. +.PARAMETER WhatIf +Performs a dry run of the build script. +No tasks will be executed. +.PARAMETER Mono +Tells Cake to use the Mono scripting engine. +.PARAMETER SkipToolPackageRestore +Skips restoring of packages. +.PARAMETER ScriptArgs +Remaining arguments are added here. + +.LINK +http://cakebuild.net + +#> + +[CmdletBinding()] +Param( + [string]$Script = "build.cake", + [string]$Target = "Default", + [ValidateSet("Release", "Debug")] + [string]$Configuration = "Release", + [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] + [string]$Verbosity = "Verbose", + [switch]$Experimental, + [Alias("DryRun","Noop")] + [switch]$WhatIf, + [switch]$Mono, + [switch]$SkipToolPackageRestore, + [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] + [string[]]$ScriptArgs +) + +[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null +function MD5HashFile([string] $filePath) +{ + if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf)) + { + return $null + } + + [System.IO.Stream] $file = $null; + [System.Security.Cryptography.MD5] $md5 = $null; + try + { + $md5 = [System.Security.Cryptography.MD5]::Create() + $file = [System.IO.File]::OpenRead($filePath) + return [System.BitConverter]::ToString($md5.ComputeHash($file)) + } + finally + { + if ($file -ne $null) + { + $file.Dispose() + } + } +} + +Write-Host "Preparing to run build script..." + +if(!$PSScriptRoot){ + $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent +} + +$TOOLS_DIR = Join-Path $PSScriptRoot "tools" +$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" +$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" +$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" +$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" +$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum" + +# Should we use mono? +$UseMono = ""; +if($Mono.IsPresent) { + Write-Verbose -Message "Using the Mono based scripting engine." + $UseMono = "-mono" +} + +# Should we use the new Roslyn? +$UseExperimental = ""; +if($Experimental.IsPresent -and !($Mono.IsPresent)) { + Write-Verbose -Message "Using experimental version of Roslyn." + $UseExperimental = "-experimental" +} + +# Is this a dry run? +$UseDryRun = ""; +if($WhatIf.IsPresent) { + $UseDryRun = "-dryrun" +} + +# Make sure tools folder exists +if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { + Write-Verbose -Message "Creating tools directory..." + New-Item -Path $TOOLS_DIR -Type directory | out-null +} + +# Make sure that packages.config exist. +if (!(Test-Path $PACKAGES_CONFIG)) { + Write-Verbose -Message "Downloading packages.config..." + try { (New-Object System.Net.WebClient).DownloadFile("http://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch { + Throw "Could not download packages.config." + } +} + +# Try find NuGet.exe in path if not exists +if (!(Test-Path $NUGET_EXE)) { + Write-Verbose -Message "Trying to find nuget.exe in PATH..." + $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_) } + $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1 + if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) { + Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)." + $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName + } +} + +# Try download NuGet.exe if not exists +if (!(Test-Path $NUGET_EXE)) { + Write-Verbose -Message "Downloading NuGet.exe..." + try { + (New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE) + } catch { + Throw "Could not download NuGet.exe." + } +} + +# Save nuget.exe path to environment to be available to child processed +$ENV:NUGET_EXE = $NUGET_EXE + +# Restore tools from NuGet? +if(-Not $SkipToolPackageRestore.IsPresent) { + Push-Location + Set-Location $TOOLS_DIR + + # Check for changes in packages.config and remove installed tools if true. + [string] $md5Hash = MD5HashFile($PACKAGES_CONFIG) + if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or + ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { + Write-Verbose -Message "Missing or changed package.config hash..." + Remove-Item * -Recurse -Exclude packages.config,nuget.exe + } + + Write-Verbose -Message "Restoring tools from NuGet..." + $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" + + if ($LASTEXITCODE -ne 0) { + Throw "An error occured while restoring NuGet tools." + } + else + { + $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII" + } + Write-Verbose -Message ($NuGetOutput | out-string) + Pop-Location +} + +# Make sure that Cake has been installed. +if (!(Test-Path $CAKE_EXE)) { + Throw "Could not find Cake.exe at $CAKE_EXE" +} + +# Start Cake +Write-Host "Running build script..." +Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs" +exit $LASTEXITCODE \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..58e86f6 --- /dev/null +++ b/build.sh @@ -0,0 +1,101 @@ +#!/usr/bin/env bash + +########################################################################## +# This is the Cake bootstrapper script for Linux and OS X. +# This file was downloaded from https://github.com/cake-build/resources +# Feel free to change this file to fit your needs. +########################################################################## + +# Define directories. +SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +TOOLS_DIR=$SCRIPT_DIR/tools +NUGET_EXE=$TOOLS_DIR/nuget.exe +CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe +PACKAGES_CONFIG=$TOOLS_DIR/packages.config +PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum + +# Define md5sum or md5 depending on Linux/OSX +MD5_EXE= +if [[ "$(uname -s)" == "Darwin" ]]; then + MD5_EXE="md5 -r" +else + MD5_EXE="md5sum" +fi + +# Define default arguments. +SCRIPT="build.cake" +TARGET="Default" +CONFIGURATION="Release" +VERBOSITY="verbose" +DRYRUN= +SHOW_VERSION=false +SCRIPT_ARGUMENTS=() + +# Parse arguments. +for i in "$@"; do + case $1 in + -s|--script) SCRIPT="$2"; shift ;; + -t|--target) TARGET="$2"; shift ;; + -c|--configuration) CONFIGURATION="$2"; shift ;; + -v|--verbosity) VERBOSITY="$2"; shift ;; + -d|--dryrun) DRYRUN="-dryrun" ;; + --version) SHOW_VERSION=true ;; + --) shift; SCRIPT_ARGUMENTS+=("$@"); break ;; + *) SCRIPT_ARGUMENTS+=("$1") ;; + esac + shift +done + +# Make sure the tools folder exist. +if [ ! -d "$TOOLS_DIR" ]; then + mkdir "$TOOLS_DIR" +fi + +# Make sure that packages.config exist. +if [ ! -f "$TOOLS_DIR/packages.config" ]; then + echo "Downloading packages.config..." + curl -Lsfo "$TOOLS_DIR/packages.config" http://cakebuild.net/download/bootstrapper/packages + if [ $? -ne 0 ]; then + echo "An error occured while downloading packages.config." + exit 1 + fi +fi + +# Download NuGet if it does not exist. +if [ ! -f "$NUGET_EXE" ]; then + echo "Downloading NuGet..." + curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe + if [ $? -ne 0 ]; then + echo "An error occured while downloading nuget.exe." + exit 1 + fi +fi + +# Restore tools from NuGet. +pushd "$TOOLS_DIR" >/dev/null +if [ ! -f $PACKAGES_CONFIG_MD5 ] || [ "$( cat $PACKAGES_CONFIG_MD5 | sed 's/\r$//' )" != "$( $MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' )" ]; then + find . -type d ! -name . | xargs rm -rf +fi + +mono "$NUGET_EXE" install -ExcludeVersion +if [ $? -ne 0 ]; then + echo "Could not restore NuGet packages." + exit 1 +fi + +$MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' >| $PACKAGES_CONFIG_MD5 + +popd >/dev/null + +# Make sure that Cake has been installed. +if [ ! -f "$CAKE_EXE" ]; then + echo "Could not find Cake.exe at '$CAKE_EXE'." + exit 1 +fi + +# Start Cake +if $SHOW_VERSION; then + exec mono "$CAKE_EXE" -version +else + exec mono "$CAKE_EXE" $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}" +fi diff --git a/src/RealmJson.Extensions/Properties/AssemblyInfo.cs b/src/CommonAssemblyInfo.cs similarity index 97% rename from src/RealmJson.Extensions/Properties/AssemblyInfo.cs rename to src/CommonAssemblyInfo.cs index 10b6390..e5472db 100644 --- a/src/RealmJson.Extensions/Properties/AssemblyInfo.cs +++ b/src/CommonAssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. diff --git a/src/RealmJson.Extensions.nuspec b/src/RealmJson.Extensions.nuspec index a1b87e1..690444a 100644 --- a/src/RealmJson.Extensions.nuspec +++ b/src/RealmJson.Extensions.nuspec @@ -1,12 +1,11 @@ + $version$ RealmJson.Extensions - 1.1.0 - - Extension Methods for adding JSON APIs to a Realm Instance - SushiHangover.RealmJson.Extensions + Extension Methods for adding JSON APIs to a Realm Instance + Extension Methods for adding JSON APIs to a Realm Instance en-US 2016 - SushiHangover/RobertN SushiHangover @@ -21,7 +20,6 @@ - + - diff --git a/src/RealmJson.Extensions/SushiHangover.RealmJson.csproj b/src/RealmJson.Extensions/SushiHangover.RealmJson.csproj index b47c5c1..60a5443 100644 --- a/src/RealmJson.Extensions/SushiHangover.RealmJson.csproj +++ b/src/RealmJson.Extensions/SushiHangover.RealmJson.csproj @@ -30,8 +30,10 @@ bin\Release\RealmJson.Extensions.xml - + + CommonAssemblyInfo.cs + @@ -54,6 +56,9 @@ + + + diff --git a/src/RealmJson.Test.Droid/RealmJson.Test.Droid.csproj b/src/RealmJson.Test.Droid/RealmJson.Test.Droid.csproj index f3e1e85..c547045 100644 --- a/src/RealmJson.Test.Droid/RealmJson.Test.Droid.csproj +++ b/src/RealmJson.Test.Droid/RealmJson.Test.Droid.csproj @@ -2695,6 +2695,21 @@ no-write-symbols false --> + + +