From 8a74914ba28a8d035a7da2870ad2feb4ab2c0ba8 Mon Sep 17 00:00:00 2001 From: Jonathan Dick Date: Mon, 25 Sep 2017 15:40:37 -0400 Subject: [PATCH] Convert to cake 0.22 --- .gitignore | 2 + Cake.XCode.Tests/Cake.XCode.Tests.csproj | 61 ------ Cake.XCode.Tests/packages.config | 7 - Cake.XCode.nuspec | 27 --- Cake.XCode/Cake.XCode.csproj | 49 ----- Cake.XCode/Properties/AssemblyInfo.cs | 27 --- Cake.XCode/packages.config | 4 - .../contents.xcworkspacedata | 0 .../xcshareddata/FieldExporter.xccheckout | 0 .../UserInterfaceState.xcuserstate | Bin .../WorkspaceSettings.xcsettings | 0 .../FieldExporter.xcodeproj/project.pbxproj | 0 .../contents.xcworkspacedata | 0 .../xcshareddata/GAFieldExporter.xccheckout | 0 .../xcschemes/FieldExporter.xcscheme | 0 .../xcschemes/xcschememanagement.plist | 0 .../FieldExporter/FieldExporter.h | 0 .../FieldExporter/FieldExporter.m | 0 .../XCodeProject/Podfile | 0 appveyor.yml | 19 ++ build.cake | 52 ----- build.ps1 | 189 ++++++++++++++++++ setup.cake | 27 +++ src/Cake.XCode.Tests/Cake.XCode.Tests.csproj | 19 ++ .../Fakes/FakeCakeArguments.cs | 0 .../Fakes/FakeCakeContext.cs | 3 +- .../Cake.XCode.Tests}/Fakes/FakeLog.cs | 0 .../Cake.XCode.Tests}/Test.cs | 39 ++-- Cake.XCode.sln => src/Cake.XCode.sln | 0 src/Cake.XCode/Cake.XCode.csproj | 31 +++ .../Cake.XCode}/CocoaPodAliases.cs | 0 .../Cake.XCode}/CocoaPodRunner.cs | 0 {Cake.XCode => src/Cake.XCode}/Namespaces.cs | 0 .../Cake.XCode}/XCodeAliases.cs | 0 .../Cake.XCode}/XCodeBuildRunner.cs | 0 35 files changed, 306 insertions(+), 250 deletions(-) delete mode 100644 Cake.XCode.Tests/Cake.XCode.Tests.csproj delete mode 100644 Cake.XCode.Tests/packages.config delete mode 100644 Cake.XCode.nuspec delete mode 100644 Cake.XCode/Cake.XCode.csproj delete mode 100644 Cake.XCode/Properties/AssemblyInfo.cs delete mode 100644 Cake.XCode/packages.config rename {Cake.XCode.Tests/TestProjects => TestProjects}/XCodeProject/FieldExporter.xcworkspace/contents.xcworkspacedata (100%) rename {Cake.XCode.Tests/TestProjects => TestProjects}/XCodeProject/FieldExporter.xcworkspace/xcshareddata/FieldExporter.xccheckout (100%) rename {Cake.XCode.Tests/TestProjects => TestProjects}/XCodeProject/FieldExporter.xcworkspace/xcuserdata/redth.xcuserdatad/UserInterfaceState.xcuserstate (100%) rename {Cake.XCode.Tests/TestProjects => TestProjects}/XCodeProject/FieldExporter.xcworkspace/xcuserdata/redth.xcuserdatad/WorkspaceSettings.xcsettings (100%) rename {Cake.XCode.Tests/TestProjects => TestProjects}/XCodeProject/FieldExporter/FieldExporter.xcodeproj/project.pbxproj (100%) rename {Cake.XCode.Tests/TestProjects => TestProjects}/XCodeProject/FieldExporter/FieldExporter.xcodeproj/project.xcworkspace/contents.xcworkspacedata (100%) rename {Cake.XCode.Tests/TestProjects => TestProjects}/XCodeProject/FieldExporter/FieldExporter.xcodeproj/project.xcworkspace/xcshareddata/GAFieldExporter.xccheckout (100%) rename {Cake.XCode.Tests/TestProjects => TestProjects}/XCodeProject/FieldExporter/FieldExporter.xcodeproj/xcshareddata/xcschemes/FieldExporter.xcscheme (100%) rename {Cake.XCode.Tests/TestProjects => TestProjects}/XCodeProject/FieldExporter/FieldExporter.xcodeproj/xcuserdata/redth.xcuserdatad/xcschemes/xcschememanagement.plist (100%) rename {Cake.XCode.Tests/TestProjects => TestProjects}/XCodeProject/FieldExporter/FieldExporter/FieldExporter.h (100%) rename {Cake.XCode.Tests/TestProjects => TestProjects}/XCodeProject/FieldExporter/FieldExporter/FieldExporter.m (100%) rename {Cake.XCode.Tests/TestProjects => TestProjects}/XCodeProject/Podfile (100%) create mode 100644 appveyor.yml delete mode 100644 build.cake create mode 100644 build.ps1 create mode 100644 setup.cake create mode 100644 src/Cake.XCode.Tests/Cake.XCode.Tests.csproj rename {Cake.XCode.Tests => src/Cake.XCode.Tests}/Fakes/FakeCakeArguments.cs (100%) rename {Cake.XCode.Tests => src/Cake.XCode.Tests}/Fakes/FakeCakeContext.cs (91%) mode change 100755 => 100644 rename {Cake.XCode.Tests => src/Cake.XCode.Tests}/Fakes/FakeLog.cs (100%) rename {Cake.XCode.Tests => src/Cake.XCode.Tests}/Test.cs (80%) rename Cake.XCode.sln => src/Cake.XCode.sln (100%) create mode 100644 src/Cake.XCode/Cake.XCode.csproj rename {Cake.XCode => src/Cake.XCode}/CocoaPodAliases.cs (100%) rename {Cake.XCode => src/Cake.XCode}/CocoaPodRunner.cs (100%) rename {Cake.XCode => src/Cake.XCode}/Namespaces.cs (100%) rename {Cake.XCode => src/Cake.XCode}/XCodeAliases.cs (100%) rename {Cake.XCode => src/Cake.XCode}/XCodeBuildRunner.cs (100%) diff --git a/.gitignore b/.gitignore index 83fe33d..ddc5b8d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ nupkg/ xtc-api-key xtc-email tmp/ +BuildArtifacts/ +.vs/ diff --git a/Cake.XCode.Tests/Cake.XCode.Tests.csproj b/Cake.XCode.Tests/Cake.XCode.Tests.csproj deleted file mode 100644 index 64270f1..0000000 --- a/Cake.XCode.Tests/Cake.XCode.Tests.csproj +++ /dev/null @@ -1,61 +0,0 @@ - - - - Debug - AnyCPU - {BA489A68-848C-4B01-AA8D-3E5A094EBCD8} - Library - Cake.XCode.Tests - Cake.XCode.Tests - v4.5 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - - - full - true - bin\Release - prompt - 4 - false - - - - - ..\packages\NUnit.3.0.1\lib\net45\nunit.framework.dll - - - ..\packages\Cake.Core.0.17.0\lib\net45\Cake.Core.dll - - - ..\packages\Cake.Testing.0.17.1\lib\net45\Cake.Testing.dll - - - ..\packages\Cake.Common.0.17.0\lib\net45\Cake.Common.dll - - - - - - - - - - - - - - - {0E0EA411-ADFB-4A0D-A7C3-CA32E1DB2354} - Cake.XCode - - - \ No newline at end of file diff --git a/Cake.XCode.Tests/packages.config b/Cake.XCode.Tests/packages.config deleted file mode 100644 index a4e806d..0000000 --- a/Cake.XCode.Tests/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Cake.XCode.nuspec b/Cake.XCode.nuspec deleted file mode 100644 index 0f73be0..0000000 --- a/Cake.XCode.nuspec +++ /dev/null @@ -1,27 +0,0 @@ - - - - Cake.XCode - $version$ - Redth - Redth - Cake.XCode - Cake Build addon for XCode and CocoaPods. - XCode and CocoaPods addon for cake build. - https://raw.githubusercontent.com/Redth/Cake.XCode/master/LICENSE.md - https://github.com/Redth/Cake.XCode - https://raw.githubusercontent.com/Redth/Cake.XCode/master/icon.png - false - Copyright (c) Redth 2015-2017 - Initial Release - Cake Script Build XCode CocoaPods Pod - - - - - - - - - - \ No newline at end of file diff --git a/Cake.XCode/Cake.XCode.csproj b/Cake.XCode/Cake.XCode.csproj deleted file mode 100644 index e67a923..0000000 --- a/Cake.XCode/Cake.XCode.csproj +++ /dev/null @@ -1,49 +0,0 @@ - - - - Debug - AnyCPU - {0E0EA411-ADFB-4A0D-A7C3-CA32E1DB2354} - Library - Cake.XCode - Cake.XCode - v4.5 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - bin\Debug\Cake.XCode.xml - - - true - bin\Release - prompt - 4 - false - bin\Release\Cake.XCode.xml - - - - - ..\packages\Cake.Core.0.17.0\lib\net45\Cake.Core.dll - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Cake.XCode/Properties/AssemblyInfo.cs b/Cake.XCode/Properties/AssemblyInfo.cs deleted file mode 100644 index bf72ea2..0000000 --- a/Cake.XCode/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following attributes. -// Change them to the values specific to your project. - -[assembly: AssemblyTitle ("Cake.XCode")] -[assembly: AssemblyDescription ("")] -[assembly: AssemblyConfiguration ("")] -[assembly: AssemblyCompany ("")] -[assembly: AssemblyProduct ("")] -[assembly: AssemblyCopyright ("redth")] -[assembly: AssemblyTrademark ("")] -[assembly: AssemblyCulture ("")] - -// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". -// The form "{Major}.{Minor}.*" will automatically update the build and revision, -// and "{Major}.{Minor}.{Build}.*" will update just the revision. - -[assembly: AssemblyVersion ("2.0.0.0")] - -// The following attributes are used to specify the signing key for the assembly, -// if desired. See the Mono documentation for more information about signing. - -//[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - diff --git a/Cake.XCode/packages.config b/Cake.XCode/packages.config deleted file mode 100644 index 97366f9..0000000 --- a/Cake.XCode/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter.xcworkspace/contents.xcworkspacedata b/TestProjects/XCodeProject/FieldExporter.xcworkspace/contents.xcworkspacedata similarity index 100% rename from Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter.xcworkspace/contents.xcworkspacedata rename to TestProjects/XCodeProject/FieldExporter.xcworkspace/contents.xcworkspacedata diff --git a/Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter.xcworkspace/xcshareddata/FieldExporter.xccheckout b/TestProjects/XCodeProject/FieldExporter.xcworkspace/xcshareddata/FieldExporter.xccheckout similarity index 100% rename from Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter.xcworkspace/xcshareddata/FieldExporter.xccheckout rename to TestProjects/XCodeProject/FieldExporter.xcworkspace/xcshareddata/FieldExporter.xccheckout diff --git a/Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter.xcworkspace/xcuserdata/redth.xcuserdatad/UserInterfaceState.xcuserstate b/TestProjects/XCodeProject/FieldExporter.xcworkspace/xcuserdata/redth.xcuserdatad/UserInterfaceState.xcuserstate similarity index 100% rename from Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter.xcworkspace/xcuserdata/redth.xcuserdatad/UserInterfaceState.xcuserstate rename to TestProjects/XCodeProject/FieldExporter.xcworkspace/xcuserdata/redth.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter.xcworkspace/xcuserdata/redth.xcuserdatad/WorkspaceSettings.xcsettings b/TestProjects/XCodeProject/FieldExporter.xcworkspace/xcuserdata/redth.xcuserdatad/WorkspaceSettings.xcsettings similarity index 100% rename from Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter.xcworkspace/xcuserdata/redth.xcuserdatad/WorkspaceSettings.xcsettings rename to TestProjects/XCodeProject/FieldExporter.xcworkspace/xcuserdata/redth.xcuserdatad/WorkspaceSettings.xcsettings diff --git a/Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/project.pbxproj b/TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/project.pbxproj similarity index 100% rename from Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/project.pbxproj rename to TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/project.pbxproj diff --git a/Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/project.xcworkspace/xcshareddata/GAFieldExporter.xccheckout b/TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/project.xcworkspace/xcshareddata/GAFieldExporter.xccheckout similarity index 100% rename from Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/project.xcworkspace/xcshareddata/GAFieldExporter.xccheckout rename to TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/project.xcworkspace/xcshareddata/GAFieldExporter.xccheckout diff --git a/Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/xcshareddata/xcschemes/FieldExporter.xcscheme b/TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/xcshareddata/xcschemes/FieldExporter.xcscheme similarity index 100% rename from Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/xcshareddata/xcschemes/FieldExporter.xcscheme rename to TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/xcshareddata/xcschemes/FieldExporter.xcscheme diff --git a/Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/xcuserdata/redth.xcuserdatad/xcschemes/xcschememanagement.plist b/TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/xcuserdata/redth.xcuserdatad/xcschemes/xcschememanagement.plist similarity index 100% rename from Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/xcuserdata/redth.xcuserdatad/xcschemes/xcschememanagement.plist rename to TestProjects/XCodeProject/FieldExporter/FieldExporter.xcodeproj/xcuserdata/redth.xcuserdatad/xcschemes/xcschememanagement.plist diff --git a/Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter/FieldExporter/FieldExporter.h b/TestProjects/XCodeProject/FieldExporter/FieldExporter/FieldExporter.h similarity index 100% rename from Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter/FieldExporter/FieldExporter.h rename to TestProjects/XCodeProject/FieldExporter/FieldExporter/FieldExporter.h diff --git a/Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter/FieldExporter/FieldExporter.m b/TestProjects/XCodeProject/FieldExporter/FieldExporter/FieldExporter.m similarity index 100% rename from Cake.XCode.Tests/TestProjects/XCodeProject/FieldExporter/FieldExporter/FieldExporter.m rename to TestProjects/XCodeProject/FieldExporter/FieldExporter/FieldExporter.m diff --git a/Cake.XCode.Tests/TestProjects/XCodeProject/Podfile b/TestProjects/XCodeProject/Podfile similarity index 100% rename from Cake.XCode.Tests/TestProjects/XCodeProject/Podfile rename to TestProjects/XCodeProject/Podfile diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..b86dc6b --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,19 @@ +#---------------------------------# +# Build Script # +#---------------------------------# +build_script: + - ps: .\build.ps1 -Script setup.cake -Target AppVeyor -Verbosity Diagnostic --settings_skipverification=true + +# Tests +test: off + +#---------------------------------# +# Branches to build # +#---------------------------------# +branches: + # Whitelist + only: + - develop + - master + - /release/.*/ + - /hotfix/.*/ diff --git a/build.cake b/build.cake deleted file mode 100644 index a498ca5..0000000 --- a/build.cake +++ /dev/null @@ -1,52 +0,0 @@ -var sln = "./Cake.XCode.sln"; -var nuspec = "./Cake.XCode.nuspec"; - -var target = Argument ("target", "lib"); - -Task ("lib").Does (() => -{ - NuGetRestore (sln); - - DotNetBuild (sln, c => c.Configuration = "Release"); -}); - -Task ("nuget").IsDependentOn ("lib").Does (() => -{ - CreateDirectory ("./nupkg/"); - - NuGetPack (nuspec, new NuGetPackSettings { - Verbosity = NuGetVerbosity.Detailed, - OutputDirectory = "./nupkg/", - // NuGet messes up path on mac, so let's add ./ in front again - BasePath = "././", - }); -}); - -Task ("push").IsDependentOn ("nuget").Does (() => -{ - // Get the newest (by last write time) to publish - var newestNupkg = GetFiles ("nupkg/*.nupkg") - .OrderBy (f => new System.IO.FileInfo (f.FullPath).LastWriteTimeUtc) - .LastOrDefault (); - - var apiKey = TransformTextFile ("./.nugetapikey").ToString (); - - NuGetPush (newestNupkg, new NuGetPushSettings { - Verbosity = NuGetVerbosity.Detailed, - ApiKey = apiKey - }); -}); - -Task ("clean").Does (() => -{ - CleanDirectories ("./**/bin"); - CleanDirectories ("./**/obj"); - - CleanDirectories ("./**/Components"); - CleanDirectories ("./**/tools"); - - if (DirectoryExists ("./Cake.XCode.Tests/TestProjects/tmp")) - DeleteDirectory ("./Cake.XCode.Tests/TestProjects/tmp", true); -}); - -RunTarget (target); diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..8c71613 --- /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 $_ -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/setup.cake b/setup.cake new file mode 100644 index 0000000..161c8a1 --- /dev/null +++ b/setup.cake @@ -0,0 +1,27 @@ +#load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease + +Environment.SetVariableNames(); + +BuildParameters.SetParameters(context: Context, + buildSystem: BuildSystem, + sourceDirectoryPath: "./src", + title: "Cake.XCode", + repositoryOwner: "redth", + repositoryName: "Cake.XCode", + appVeyorAccountName: "redth", + shouldRunCodecov: false, + shouldRunDotNetCorePack: true, + shouldRunDupFinder: false, + shouldRunInspectCode: false, + shouldRunIntegrationTests: false, + testFilePattern: "DO_NOT_RUN_TESTS"); + +BuildParameters.PrintParameters(Context); + +ToolSettings.SetToolSettings(context: Context, + dupFinderExcludePattern: new string[] { + BuildParameters.RootDirectoryPath + "/Cake.XCode.Tests/*.cs" }, + testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* -[FakeItEasy]*", + testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*", + testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs;*TestProjects*"); +Build.RunDotNetCore(); diff --git a/src/Cake.XCode.Tests/Cake.XCode.Tests.csproj b/src/Cake.XCode.Tests/Cake.XCode.Tests.csproj new file mode 100644 index 0000000..69310e7 --- /dev/null +++ b/src/Cake.XCode.Tests/Cake.XCode.Tests.csproj @@ -0,0 +1,19 @@ + + + + netcoreapp1.1 + + + + + + + + + + + + + + + diff --git a/Cake.XCode.Tests/Fakes/FakeCakeArguments.cs b/src/Cake.XCode.Tests/Fakes/FakeCakeArguments.cs similarity index 100% rename from Cake.XCode.Tests/Fakes/FakeCakeArguments.cs rename to src/Cake.XCode.Tests/Fakes/FakeCakeArguments.cs diff --git a/Cake.XCode.Tests/Fakes/FakeCakeContext.cs b/src/Cake.XCode.Tests/Fakes/FakeCakeContext.cs old mode 100755 new mode 100644 similarity index 91% rename from Cake.XCode.Tests/Fakes/FakeCakeContext.cs rename to src/Cake.XCode.Tests/Fakes/FakeCakeContext.cs index caeca5d..62c7b15 --- a/Cake.XCode.Tests/Fakes/FakeCakeContext.cs +++ b/src/Cake.XCode.Tests/Fakes/FakeCakeContext.cs @@ -15,8 +15,7 @@ public class FakeCakeContext public FakeCakeContext () { - testsDir = new DirectoryPath ( - System.IO.Path.GetDirectoryName (System.Reflection.Assembly.GetExecutingAssembly ().Location)); + testsDir = new DirectoryPath (System.IO.Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "..")); var fileSystem = new FileSystem (); var environment = new FakeEnvironment (PlatformFamily.OSX); diff --git a/Cake.XCode.Tests/Fakes/FakeLog.cs b/src/Cake.XCode.Tests/Fakes/FakeLog.cs similarity index 100% rename from Cake.XCode.Tests/Fakes/FakeLog.cs rename to src/Cake.XCode.Tests/Fakes/FakeLog.cs diff --git a/Cake.XCode.Tests/Test.cs b/src/Cake.XCode.Tests/Test.cs similarity index 80% rename from Cake.XCode.Tests/Test.cs rename to src/Cake.XCode.Tests/Test.cs index a533805..7ae6bff 100644 --- a/Cake.XCode.Tests/Test.cs +++ b/src/Cake.XCode.Tests/Test.cs @@ -4,17 +4,15 @@ using Cake.Common.IO; using Cake.Core.IO; using Cake.XCode.Tests.Fakes; -using NUnit.Framework; +using Xunit; namespace Cake.XCode.Tests { - [TestFixture, Category ("XCodeTests")] - public class XCodeTests + public class XCodeTests : IDisposable { FakeCakeContext context; - [SetUp] - public void Setup () + public XCodeTests () { context = new FakeCakeContext (); @@ -26,22 +24,21 @@ public void Setup () context.CakeContext.CreateDirectory ("./TestProjects/tmp"); } - - [TearDown] - public void Teardown () + + public void Dispose () { context.DumpLogs (); } - [Test] + [Fact] public void PodVersion () { var version = context.CakeContext.CocoaPodVersion (); - Assert.IsNotNull (version); + Assert.NotNull (version); } - [Test] + [Fact] public void PodInstall () { var podfile = new List { @@ -66,11 +63,11 @@ public void PodInstall () NoIntegrate = true }); - Assert.IsTrue (context.CakeContext.FileExists ("./TestProjects/tmp/Podfile.lock")); - Assert.IsTrue (context.CakeContext.DirectoryExists ("./TestProjects/tmp/Pods/GoogleAnalytics")); + Assert.True (context.CakeContext.FileExists ("./TestProjects/tmp/Podfile.lock")); + Assert.True (context.CakeContext.DirectoryExists ("./TestProjects/tmp/Pods/GoogleAnalytics")); } - [Test] + [Fact] public void PodUpdate () { var podfile = new List { @@ -95,8 +92,8 @@ public void PodUpdate () NoIntegrate = true }); - Assert.IsTrue (context.CakeContext.FileExists ("./TestProjects/tmp/Podfile.lock")); - Assert.IsTrue (context.CakeContext.DirectoryExists ("./TestProjects/tmp/Pods/GoogleAnalytics")); + Assert.True (context.CakeContext.FileExists ("./TestProjects/tmp/Podfile.lock")); + Assert.True (context.CakeContext.DirectoryExists ("./TestProjects/tmp/Pods/GoogleAnalytics")); context.CakeContext.CocoaPodUpdate ("./TestProjects/tmp/", new CocoaPodUpdateSettings { NoIntegrate = true @@ -105,18 +102,18 @@ public void PodUpdate () var pfl = new FilePath ("./TestProjects/tmp/Podfile.lock"); var text = System.IO.File.ReadAllText (pfl.MakeAbsolute (context.CakeContext.Environment).FullPath); - Assert.IsFalse (text.Contains ("- GoogleAnalytics (3.12.0)")); + Assert.False (text.Contains ("- GoogleAnalytics (3.12.0)")); } - [Test] + [Fact] public void XCodeSDKs () { var sdks = context.CakeContext.XCodeSdks (); - Assert.IsNotEmpty (sdks); + Assert.NotEmpty (sdks); } - [Test] + [Fact] public void XCodeBuild () { context.CakeContext.CopyDirectory ("./TestProjects/XCodeProject/", "./TestProjects/tmp/"); @@ -133,7 +130,7 @@ public void XCodeBuild () Clean = true }); - Assert.IsTrue (context.CakeContext.DirectoryExists ("./TestProjects/tmp/build/Build/")); + Assert.True (context.CakeContext.DirectoryExists ("./TestProjects/tmp/build/Build/")); } } } diff --git a/Cake.XCode.sln b/src/Cake.XCode.sln similarity index 100% rename from Cake.XCode.sln rename to src/Cake.XCode.sln diff --git a/src/Cake.XCode/Cake.XCode.csproj b/src/Cake.XCode/Cake.XCode.csproj new file mode 100644 index 0000000..65d5a45 --- /dev/null +++ b/src/Cake.XCode/Cake.XCode.csproj @@ -0,0 +1,31 @@ + + + + netstandard1.6;net46 + 1.6.1 + true + + + + Cake.XCode + Cake.XCode + XCode and CocoaPods addon for cake build. + Cake Build addon for XCode and CocoaPods. + Cake Script Build XCode CocoaPods Pod + Redth + Redth + https://github.com/redth/Cake.XCode + https://raw.githubusercontent.com/redth/Cake.XCode/master/icon.png + https://raw.githubusercontent.com/redth/Cake.XCode/master/LICENSE.md + + + + + + + + + + + + diff --git a/Cake.XCode/CocoaPodAliases.cs b/src/Cake.XCode/CocoaPodAliases.cs similarity index 100% rename from Cake.XCode/CocoaPodAliases.cs rename to src/Cake.XCode/CocoaPodAliases.cs diff --git a/Cake.XCode/CocoaPodRunner.cs b/src/Cake.XCode/CocoaPodRunner.cs similarity index 100% rename from Cake.XCode/CocoaPodRunner.cs rename to src/Cake.XCode/CocoaPodRunner.cs diff --git a/Cake.XCode/Namespaces.cs b/src/Cake.XCode/Namespaces.cs similarity index 100% rename from Cake.XCode/Namespaces.cs rename to src/Cake.XCode/Namespaces.cs diff --git a/Cake.XCode/XCodeAliases.cs b/src/Cake.XCode/XCodeAliases.cs similarity index 100% rename from Cake.XCode/XCodeAliases.cs rename to src/Cake.XCode/XCodeAliases.cs diff --git a/Cake.XCode/XCodeBuildRunner.cs b/src/Cake.XCode/XCodeBuildRunner.cs similarity index 100% rename from Cake.XCode/XCodeBuildRunner.cs rename to src/Cake.XCode/XCodeBuildRunner.cs