diff --git a/MvvmHelpers.Tests/MvvmHelpers.Tests.csproj b/MvvmHelpers.Tests/MvvmHelpers.Tests.csproj deleted file mode 100644 index 6a3bb4d..0000000 --- a/MvvmHelpers.Tests/MvvmHelpers.Tests.csproj +++ /dev/null @@ -1,73 +0,0 @@ - - - - Debug - AnyCPU - {FB9CBAC4-6CAE-451B-AB21-09E5B003F7D8} - Library - MvvmHelpers.Tests - MvvmHelpers.Tests - v4.5 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - - - full - true - bin\Release - prompt - 4 - false - - - - ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll - False - - - ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll - False - - - ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll - False - - - ..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll - False - - - - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - - - - - - - - - - - - - - - - - - - - {7d6855f0-c8de-4222-b7b6-dfb7650700e1} - MvvmHelpers - - - \ No newline at end of file diff --git a/MvvmHelpers.Tests/packages.config b/MvvmHelpers.Tests/packages.config deleted file mode 100644 index 1f8800b..0000000 --- a/MvvmHelpers.Tests/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/MvvmHelpers.Tests/BaseVewModelTests.cs b/MvvmHelpers.UnitTests/BaseVewModelTests.cs similarity index 93% rename from MvvmHelpers.Tests/BaseVewModelTests.cs rename to MvvmHelpers.UnitTests/BaseVewModelTests.cs index 8483ff1..f381ac1 100644 --- a/MvvmHelpers.Tests/BaseVewModelTests.cs +++ b/MvvmHelpers.UnitTests/BaseVewModelTests.cs @@ -1,14 +1,14 @@ -using NUnit.Framework; +using Microsoft.VisualStudio.TestTools.UnitTesting; using System.ComponentModel; namespace MvvmHelpers.Tests { - [TestFixture()] + [TestClass] public class BaseViewModelTests { - [Test()] - public void TitleTest() + [TestMethod] + public void TitleTestMethod() { PropertyChangedEventArgs updated = null; var vm = new PersonViewModel(); @@ -23,7 +23,7 @@ public void TitleTest() Assert.AreEqual(updated.PropertyName, nameof(vm.Title), "Correct Property name didn't get raised"); } - [Test()] + [TestMethod] public void SubTitle() { PropertyChangedEventArgs updated = null; @@ -38,7 +38,7 @@ public void SubTitle() Assert.IsNotNull(updated, "Property changed didn't raise"); Assert.AreEqual(updated.PropertyName, nameof(vm.Subtitle), "Correct Property name didn't get raised"); } - [Test()] + [TestMethod] public void CanLoadMore() { PropertyChangedEventArgs updated = null; @@ -54,7 +54,7 @@ public void CanLoadMore() Assert.AreEqual(updated.PropertyName, nameof(vm.CanLoadMore), "Correct Property name didn't get raised"); } - [Test()] + [TestMethod] public void Icon() { PropertyChangedEventArgs updated = null; @@ -70,7 +70,7 @@ public void Icon() Assert.AreEqual(updated.PropertyName, nameof(vm.Icon), "Correct Property name didn't get raised"); } - [Test()] + [TestMethod] public void IsBusy() { PropertyChangedEventArgs updated = null; @@ -89,7 +89,7 @@ public void IsBusy() Assert.IsFalse(vm.IsNotBusy, "Is Not Busy didn't change."); } - [Test()] + [TestMethod] public void IsNotBusy() { PropertyChangedEventArgs updated = null; diff --git a/MvvmHelpers.Tests/GroupingTests.cs b/MvvmHelpers.UnitTests/GroupingTests.cs similarity index 96% rename from MvvmHelpers.Tests/GroupingTests.cs rename to MvvmHelpers.UnitTests/GroupingTests.cs index 818fc18..61c06e9 100644 --- a/MvvmHelpers.Tests/GroupingTests.cs +++ b/MvvmHelpers.UnitTests/GroupingTests.cs @@ -1,4 +1,4 @@ -using NUnit.Framework; +using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; @@ -7,10 +7,10 @@ namespace MvvmHelpers.Tests { - [TestFixture()] + [TestClass] public class GroupingTests { - [Test()] + [TestMethod] public void Grouping() { @@ -42,7 +42,7 @@ group person by person.SortName into personGroup } - [Test()] + [TestMethod] public void GroupingSubKey() { diff --git a/MvvmHelpers.UnitTests/MvvmHelpers.UnitTests.csproj b/MvvmHelpers.UnitTests/MvvmHelpers.UnitTests.csproj new file mode 100644 index 0000000..a39ce64 --- /dev/null +++ b/MvvmHelpers.UnitTests/MvvmHelpers.UnitTests.csproj @@ -0,0 +1,19 @@ + + + + netcoreapp2.0 + + false + + + + + + + + + + + + + diff --git a/MvvmHelpers.Tests/ObservableObjectTests.cs b/MvvmHelpers.UnitTests/ObservableObjectTests.cs similarity index 87% rename from MvvmHelpers.Tests/ObservableObjectTests.cs rename to MvvmHelpers.UnitTests/ObservableObjectTests.cs index 964a2e0..ba5448c 100644 --- a/MvvmHelpers.Tests/ObservableObjectTests.cs +++ b/MvvmHelpers.UnitTests/ObservableObjectTests.cs @@ -1,4 +1,4 @@ -using NUnit.Framework; +using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.ComponentModel; using System.Linq; @@ -6,11 +6,11 @@ namespace MvvmHelpers.Tests { - [TestFixture()] + [TestClass] public class ObservableObjectTests { Person person; - [SetUp] + [TestInitialize] public void Setup() { person = new Person(); @@ -18,7 +18,7 @@ public void Setup() person.LastName = "Montemagno"; } - [Test()] + [TestMethod] public void OnPropertyChanged() { PropertyChangedEventArgs updated = null; @@ -34,7 +34,7 @@ public void OnPropertyChanged() Assert.AreEqual(updated.PropertyName, nameof(person.FirstName), "Correct Property name didn't get raised"); } - [Test()] + [TestMethod] public void OnDidntChange() { PropertyChangedEventArgs updated = null; @@ -49,7 +49,7 @@ public void OnDidntChange() Assert.IsNull(updated, "Property changed was raised, but shouldn't have been"); } - [Test()] + [TestMethod] public void OnChangedEvent() { @@ -64,7 +64,7 @@ public void OnChangedEvent() Assert.IsTrue(triggered, "OnChanged didn't raise"); } - [Test()] + [TestMethod] public void ValidateEvent() { var contol = "Motz"; @@ -82,7 +82,7 @@ public void ValidateEvent() } - [Test()] + [TestMethod] public void NotValidateEvent() { var contol = person.FirstName; @@ -100,7 +100,7 @@ public void NotValidateEvent() } - [Test()] + [TestMethod] public void ValidateEventException() { person.Validate = (oldValue, newValue) => @@ -109,7 +109,7 @@ public void ValidateEventException() return false; }; - Assert.Throws(() => person.FirstName = "Motz", "Should throw ArgumentOutOfRangeException"); + Assert.ThrowsException(() => person.FirstName = "Motz", "Should throw ArgumentOutOfRangeException"); } } diff --git a/MvvmHelpers.Tests/ObservableRangeTests.cs b/MvvmHelpers.UnitTests/ObservableRangeTests.cs similarity index 95% rename from MvvmHelpers.Tests/ObservableRangeTests.cs rename to MvvmHelpers.UnitTests/ObservableRangeTests.cs index 75d6b7a..c30055b 100644 --- a/MvvmHelpers.Tests/ObservableRangeTests.cs +++ b/MvvmHelpers.UnitTests/ObservableRangeTests.cs @@ -1,4 +1,4 @@ -using NUnit.Framework; +using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Specialized; using System.Linq; @@ -6,10 +6,10 @@ namespace MvvmHelpers.Tests { - [TestFixture()] + [TestClass] public class ObservableRangeTests { - [Test()] + [TestMethod] public void AddRange() { ObservableRangeCollection collection = new ObservableRangeCollection(); @@ -36,7 +36,7 @@ public void AddRange() collection.AddRange(toAdd); } - [Test()] + [TestMethod] public void ReplaceRange() { ObservableRangeCollection collection = new ObservableRangeCollection(); @@ -64,8 +64,8 @@ public void ReplaceRange() } - [Test()] - public void RemoveRangeRemoveTest() + [TestMethod] + public void RemoveRangeRemoveTestMethod() { ObservableRangeCollection collection = new ObservableRangeCollection(); int[] toAdd = new[] { 3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2, 3 }; diff --git a/MvvmHelpers.Tests/Person.cs b/MvvmHelpers.UnitTests/Person.cs similarity index 100% rename from MvvmHelpers.Tests/Person.cs rename to MvvmHelpers.UnitTests/Person.cs diff --git a/MvvmHelpers.Tests/UtilTests.cs b/MvvmHelpers.UnitTests/UtilTests.cs similarity index 100% rename from MvvmHelpers.Tests/UtilTests.cs rename to MvvmHelpers.UnitTests/UtilTests.cs diff --git a/MvvmHelpers.sln b/MvvmHelpers.sln index dccb9af..a79c78e 100644 --- a/MvvmHelpers.sln +++ b/MvvmHelpers.sln @@ -1,21 +1,17 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26403.0 +VisualStudioVersion = 15.0.27130.2027 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{93B692A1-FE26-4A59-B906-0CBADB102B8F}" ProjectSection(SolutionItems) = preProject - appveyor.yml = appveyor.yml - bootstrapper.ps1 = bootstrapper.ps1 - build.cake = build.cake CHANGELOG.md = CHANGELOG.md - MvvmHelpers.nuspec = MvvmHelpers.nuspec README.md = README.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvvmHelpers.Tests", "MvvmHelpers.Tests\MvvmHelpers.Tests.csproj", "{FB9CBAC4-6CAE-451B-AB21-09E5B003F7D8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MvvmHelpers", "MvvmHelpers\MvvmHelpers.csproj", "{7D6855F0-C8DE-4222-B7B6-DFB7650700E1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvvmHelpers", "MvvmHelpers\MvvmHelpers.csproj", "{7D6855F0-C8DE-4222-B7B6-DFB7650700E1}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvvmHelpers.UnitTests", "MvvmHelpers.UnitTests\MvvmHelpers.UnitTests.csproj", "{620ED767-21A2-4CFB-9B9F-6F42E9F6ECDA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -23,16 +19,19 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FB9CBAC4-6CAE-451B-AB21-09E5B003F7D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FB9CBAC4-6CAE-451B-AB21-09E5B003F7D8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FB9CBAC4-6CAE-451B-AB21-09E5B003F7D8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FB9CBAC4-6CAE-451B-AB21-09E5B003F7D8}.Release|Any CPU.Build.0 = Release|Any CPU {7D6855F0-C8DE-4222-B7B6-DFB7650700E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7D6855F0-C8DE-4222-B7B6-DFB7650700E1}.Debug|Any CPU.Build.0 = Debug|Any CPU {7D6855F0-C8DE-4222-B7B6-DFB7650700E1}.Release|Any CPU.ActiveCfg = Release|Any CPU {7D6855F0-C8DE-4222-B7B6-DFB7650700E1}.Release|Any CPU.Build.0 = Release|Any CPU + {620ED767-21A2-4CFB-9B9F-6F42E9F6ECDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {620ED767-21A2-4CFB-9B9F-6F42E9F6ECDA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {620ED767-21A2-4CFB-9B9F-6F42E9F6ECDA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {620ED767-21A2-4CFB-9B9F-6F42E9F6ECDA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4C19D861-682A-4971-BE87-6D0443235729} + EndGlobalSection EndGlobal diff --git a/MvvmHelpers/ObservableObject.cs b/MvvmHelpers/ObservableObject.cs index 1e068fc..a5dca57 100644 --- a/MvvmHelpers/ObservableObject.cs +++ b/MvvmHelpers/ObservableObject.cs @@ -26,8 +26,12 @@ protected virtual bool SetProperty( Action onChanged = null, Func validateValue = null) { - if ((validateValue == null && EqualityComparer.Default.Equals(backingStore, value)) || - (validateValue != null && !validateValue(backingStore, value))) + //if value didn't change + if (EqualityComparer.Default.Equals(backingStore, value)) + return false; + + //if value changed but didn't validate + if (validateValue != null && !validateValue(backingStore, value)) return false; backingStore = value; diff --git a/README.md b/README.md index 74ad570..cf84870 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,14 @@ Collection of MVVM helper classes for any application. -Grab the NuGet: https://www.nuget.org/packages/Refractored.MvvmHelpers +**Build Status**: ![](https://jamesmontemagno.visualstudio.com/_apis/public/build/definitions/5c11b5bc-b611-475d-a50c-4043a0cbb441/11/badge) -Build Status: [![Build status](https://ci.appveyor.com/api/projects/status/nsj9rae1g93hy62o/branch/master?svg=true)](https://ci.appveyor.com/project/JamesMontemagno/mvvm-helpers/branch/master) +**NuGets** -Built with C# 7 features, you must be running Visual Studio 2017 or Visual Studio for Mac to compile. **NuGets of course work everywhere!** +|Name|Info| +| ------------------- | :------------------: | +|MvvmHelpers|[![NuGet](https://img.shields.io/nuget/v/Refractored.MvvmHelpers.svg?label=NuGet)](https://www.nuget.org/packages/Refractored.MvvmHelpers/)| +|Development Feed|[MyGet](http://myget.org/F/mvvm-helpers)| ## What's included? diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 2367822..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: 1.3.2.{build}-beta -image: Visual Studio 2017 -configuration: Release -assembly_info: - patch: true - file: '**\AssemblyInfo.*' - assembly_version: '{version}' - assembly_file_version: '{version}' - assembly_informational_version: '{version}' -build_script: -- cmd: >- - nuget restore .\MvvmHelpers.sln - - powershell .\build.ps1 -Target NuGetPack -Verbosity diagnostic -artifacts: -- path: '*.nupkg' - name: NuGet diff --git a/build.cake b/build.cake deleted file mode 100755 index 62f03ed..0000000 --- a/build.cake +++ /dev/null @@ -1,40 +0,0 @@ -var TARGET = Argument ("target", Argument ("t", "Default")); -var VERSION = EnvironmentVariable ("APPVEYOR_BUILD_VERSION") ?? Argument("version", "0.0.9999"); -var CONFIG = Argument("configuration", EnvironmentVariable ("CONFIGURATION") ?? "Release"); -var SLN = "./MvvmHelpers.sln"; - -Task("Libraries").Does(()=> -{ - NuGetRestore (SLN); - MSBuild (SLN, c => { - c.Configuration = CONFIG; - c.MSBuildPlatform = Cake.Common.Tools.MSBuild.MSBuildPlatform.x86; - }); -}); - -Task ("NuGet") - .IsDependentOn ("Libraries") - .Does (() => -{ - if(!DirectoryExists("./Build/nuget/")) - CreateDirectory("./Build/nuget"); - - NuGetPack ("./MvvmHelpers.nuspec", new NuGetPackSettings { - Version = VERSION, - OutputDirectory = "./Build/nuget/", - BasePath = "./" - }); -}); - -//Build the component, which build samples, nugets, and libraries -Task ("Default").IsDependentOn("NuGet"); - -Task ("Clean").Does (() => -{ - CleanDirectory ("./component/tools/"); - CleanDirectories ("./Build/"); - CleanDirectories ("./**/bin"); - CleanDirectories ("./**/obj"); -}); - -RunTarget (TARGET); diff --git a/build.ps1 b/build.ps1 deleted file mode 100644 index 3a8ef5c..0000000 --- a/build.ps1 +++ /dev/null @@ -1,189 +0,0 @@ -########################################################################## -# 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 $_ -PathType Container) } - $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 deleted file mode 100644 index 6e8f207..0000000 --- a/build.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/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 \ No newline at end of file diff --git a/cake.packages.config b/cake.packages.config deleted file mode 100644 index 965d0eb..0000000 --- a/cake.packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file