From 0b9eb6cb542e31375404a303f63c9bd75bb0ea03 Mon Sep 17 00:00:00 2001 From: Jericho Date: Tue, 30 Apr 2019 17:22:05 -0400 Subject: [PATCH 01/14] (GH-12) Cake.Core reference should be private --- src/Cake.ProtobufTools/Cake.ProtobufTools.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Cake.ProtobufTools/Cake.ProtobufTools.csproj b/src/Cake.ProtobufTools/Cake.ProtobufTools.csproj index ca77684..64d19f1 100644 --- a/src/Cake.ProtobufTools/Cake.ProtobufTools.csproj +++ b/src/Cake.ProtobufTools/Cake.ProtobufTools.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 @@ -11,6 +11,6 @@ bin\Release\netstandard2.0\Cake.ProtobufTools.xml - + From 327631249154146a9407e8b0bff6ef1c2cb47b66 Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Sat, 10 Aug 2019 22:14:43 +0100 Subject: [PATCH 02/14] (GH-14) Update to latest Cake bootstrappers --- build.ps1 | 170 ++++++++++++++++++++++++++++++++++++++---------------- build.sh | 117 +++++++++++++++++++++++++++++++++++++ 2 files changed, 238 insertions(+), 49 deletions(-) create mode 100755 build.sh diff --git a/build.ps1 b/build.ps1 index bdfb32b..aafd519 100644 --- a/build.ps1 +++ b/build.ps1 @@ -5,11 +5,14 @@ ########################################################################## <# + .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 @@ -18,38 +21,52 @@ The build script target to run. 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 ShowDescription +Shows description about tasks. +.PARAMETER DryRun +Performs a dry run. .PARAMETER SkipToolPackageRestore Skips restoring of packages. .PARAMETER ScriptArgs Remaining arguments are added here. + .LINK -http://cakebuild.net +https://cakebuild.net + #> [CmdletBinding()] Param( [string]$Script = "setup.cake", - [string]$Target = "Default", - [ValidateSet("Release", "Debug")] - [string]$Configuration = "Release", + [string]$Target, + [string]$Configuration, [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] - [string]$Verbosity = "Verbose", - [switch]$Experimental, - [Alias("DryRun","Noop")] - [switch]$WhatIf, - [switch]$Mono, + [string]$Verbosity, + [switch]$ShowDescription, + [Alias("WhatIf", "Noop")] + [switch]$DryRun, [switch]$SkipToolPackageRestore, [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] [string[]]$ScriptArgs ) +# Attempt to set highest encryption available for SecurityProtocol. +# PowerShell will not set this by default (until maybe .NET 4.6.x). This +# will typically produce a message for PowerShell v2 (just an info +# message though) +try { + # Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48) + # Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't + # exist in .NET 4.0, even though they are addressable if .NET 4.5+ is + # installed (.NET 4.5 is an in-place upgrade). + # PowerShell Core already has support for TLS 1.2 so we can skip this if running in that. + if (-not $IsCoreCLR) { + [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48 + } + } catch { + Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3' + } + [Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null function MD5HashFile([string] $filePath) { @@ -75,6 +92,15 @@ function MD5HashFile([string] $filePath) } } +function GetProxyEnabledWebClient +{ + $wc = New-Object System.Net.WebClient + $proxy = [System.Net.WebRequest]::GetSystemWebProxy() + $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials + $wc.Proxy = $proxy + return $wc +} + Write-Host "Preparing to run build script..." if(!$PSScriptRoot){ @@ -82,42 +108,29 @@ if(!$PSScriptRoot){ } $TOOLS_DIR = Join-Path $PSScriptRoot "tools" +$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins" +$MODULES_DIR = Join-Path $TOOLS_DIR "Modules" $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" -} +$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config" +$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config" # 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 + 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 { + try { + $wc = GetProxyEnabledWebClient + $wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) + } catch { Throw "Could not download packages.config." } } @@ -125,7 +138,7 @@ if (!(Test-Path $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 $_) } + $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)." @@ -137,14 +150,20 @@ if (!(Test-Path $NUGET_EXE)) { if (!(Test-Path $NUGET_EXE)) { Write-Verbose -Message "Downloading NuGet.exe..." try { - (New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE) + $wc = GetProxyEnabledWebClient + $wc.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 +$env:NUGET_EXE = $NUGET_EXE +$env:NUGET_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) { + "mono `"$NUGET_EXE`"" +} else { + "`"$NUGET_EXE`"" +} # Restore tools from NuGet? if(-Not $SkipToolPackageRestore.IsPresent) { @@ -152,24 +171,61 @@ if(-Not $SkipToolPackageRestore.IsPresent) { Set-Location $TOOLS_DIR # Check for changes in packages.config and remove installed tools if true. - [string] $md5Hash = MD5HashFile($PACKAGES_CONFIG) + [string] $md5Hash = MD5HashFile $PACKAGES_CONFIG if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or - ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { + ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { Write-Verbose -Message "Missing or changed package.config hash..." - Remove-Item * -Recurse -Exclude packages.config,nuget.exe + Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery | + Remove-Item -Recurse } Write-Verbose -Message "Restoring tools from NuGet..." - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -PreRelease -OutputDirectory `"$TOOLS_DIR`" -Source https://www.myget.org/F/cake/api/v3/index.json" + + $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" if ($LASTEXITCODE -ne 0) { - Throw "An error occured while restoring NuGet tools." + Throw "An error occurred while restoring NuGet tools." } else { $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII" } - Write-Verbose -Message ($NuGetOutput | out-string) + Write-Verbose -Message ($NuGetOutput | Out-String) + + Pop-Location +} + +# Restore addins from NuGet +if (Test-Path $ADDINS_PACKAGES_CONFIG) { + Push-Location + Set-Location $ADDINS_DIR + + Write-Verbose -Message "Restoring addins from NuGet..." + $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`"" + + if ($LASTEXITCODE -ne 0) { + Throw "An error occurred while restoring NuGet addins." + } + + Write-Verbose -Message ($NuGetOutput | Out-String) + + Pop-Location +} + +# Restore modules from NuGet +if (Test-Path $MODULES_PACKAGES_CONFIG) { + Push-Location + Set-Location $MODULES_DIR + + Write-Verbose -Message "Restoring modules from NuGet..." + $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`"" + + if ($LASTEXITCODE -ne 0) { + Throw "An error occurred while restoring NuGet modules." + } + + Write-Verbose -Message ($NuGetOutput | Out-String) + Pop-Location } @@ -178,7 +234,23 @@ if (!(Test-Path $CAKE_EXE)) { Throw "Could not find Cake.exe at $CAKE_EXE" } +$CAKE_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) { + "mono `"$CAKE_EXE`"" +} else { + "`"$CAKE_EXE`"" +} + + +# Build Cake arguments +$cakeArguments = @("$Script"); +if ($Target) { $cakeArguments += "-target=$Target" } +if ($Configuration) { $cakeArguments += "-configuration=$Configuration" } +if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" } +if ($ShowDescription) { $cakeArguments += "-showdescription" } +if ($DryRun) { $cakeArguments += "-dryrun" } +$cakeArguments += $ScriptArgs + # 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 +Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")" +exit $LASTEXITCODE diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..01d34b4 --- /dev/null +++ b/build.sh @@ -0,0 +1,117 @@ +#!/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 +ADDINS_DIR=$TOOLS_DIR/Addins +MODULES_DIR=$TOOLS_DIR/Modules +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 +ADDINS_PACKAGES_CONFIG=$ADDINS_DIR/packages.config +MODULES_PACKAGES_CONFIG=$MODULES_DIR/packages.config + +# 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="setup.cake" +CAKE_ARGUMENTS=() + +# Parse arguments. +for i in "$@"; do + case $1 in + -s|--script) SCRIPT="$2"; shift ;; + --) shift; CAKE_ARGUMENTS+=("$@"); break ;; + *) CAKE_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" https://cakebuild.net/download/bootstrapper/packages + if [ $? -ne 0 ]; then + echo "An error occurred 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 occurred 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 . ! -name 'Cake.Bakery' | xargs rm -rf +fi + +mono "$NUGET_EXE" install -ExcludeVersion +if [ $? -ne 0 ]; then + echo "Could not restore NuGet tools." + exit 1 +fi + +$MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5" + +popd >/dev/null + +# Restore addins from NuGet. +if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then + pushd "$ADDINS_DIR" >/dev/null + + mono "$NUGET_EXE" install -ExcludeVersion + if [ $? -ne 0 ]; then + echo "Could not restore NuGet addins." + exit 1 + fi + + popd >/dev/null +fi + +# Restore modules from NuGet. +if [ -f "$MODULES_PACKAGES_CONFIG" ]; then + pushd "$MODULES_DIR" >/dev/null + + mono "$NUGET_EXE" install -ExcludeVersion + if [ $? -ne 0 ]; then + echo "Could not restore NuGet modules." + exit 1 + fi + + popd >/dev/null +fi + +# 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 +exec mono "$CAKE_EXE" $SCRIPT "${CAKE_ARGUMENTS[@]}" From a52a776405955834ad543669fb307753c762881a Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Sat, 10 Aug 2019 22:15:59 +0100 Subject: [PATCH 03/14] (GH-14) Switch to recipe.cake file This provides some immediate information that a repository is using Cake.Recipe, and it is a convention now followed by a number of other repositories. --- .appveyor.yml | 2 +- build.ps1 | 2 +- build.sh | 2 +- setup.cake => recipe.cake | 0 src/Cake.ProtobufTools.sln | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename setup.cake => recipe.cake (100%) diff --git a/.appveyor.yml b/.appveyor.yml index ac2f44a..d01a7aa 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -28,4 +28,4 @@ branches: #---------------------------------# cache: - src\packages -> src\**\packages.config -- 'tools -> setup.cake,tools/packages.config' +- 'tools -> recipe.cake,tools/packages.config' diff --git a/build.ps1 b/build.ps1 index aafd519..4514a51 100644 --- a/build.ps1 +++ b/build.ps1 @@ -37,7 +37,7 @@ https://cakebuild.net [CmdletBinding()] Param( - [string]$Script = "setup.cake", + [string]$Script = "recipe.cake", [string]$Target, [string]$Configuration, [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] diff --git a/build.sh b/build.sh index 01d34b4..7fc4599 100755 --- a/build.sh +++ b/build.sh @@ -27,7 +27,7 @@ else fi # Define default arguments. -SCRIPT="setup.cake" +SCRIPT="recipe.cake" CAKE_ARGUMENTS=() # Parse arguments. diff --git a/setup.cake b/recipe.cake similarity index 100% rename from setup.cake rename to recipe.cake diff --git a/src/Cake.ProtobufTools.sln b/src/Cake.ProtobufTools.sln index b79e7d5..bba706b 100644 --- a/src/Cake.ProtobufTools.sln +++ b/src/Cake.ProtobufTools.sln @@ -11,7 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{CAEE09AF-1 ..\.gitignore = ..\.gitignore ..\nuspec\nuget\Cake.ProtobufTools.nuspec = ..\nuspec\nuget\Cake.ProtobufTools.nuspec ..\README.md = ..\README.md - ..\setup.cake = ..\setup.cake + ..\recipe.cake = ..\recipe.cake EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.ProtobufTools.Tests", "Cake.ProtobufTools.Tests\Cake.ProtobufTools.Tests.csproj", "{BE988A2E-EBFD-40F4-AAC2-DB93082E06CC}" From a123fe844f9bee916f12ffa1979e21f18c2afcee Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Sat, 10 Aug 2019 22:16:49 +0100 Subject: [PATCH 04/14] (GH-14) Pin to 1.0.0 of Cake.Recipe There are some breaking changes coming in the next release of Cake.Recipe, so to prepare for that, pin to the released major version. --- recipe.cake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipe.cake b/recipe.cake index b886957..17d86b4 100644 --- a/recipe.cake +++ b/recipe.cake @@ -1,9 +1,9 @@ -#load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease +#load nuget:?package=Cake.Recipe&version=1.0.0 Environment.SetVariableNames(); BuildParameters.SetParameters( - context: Context, + context: Context, buildSystem: BuildSystem, sourceDirectoryPath: "./src", title: "Cake.ProtobufTools", From 72b17e70bd1ae38dd6a40a8a7e24221f70f9d3ab Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Sat, 10 Aug 2019 22:21:06 +0100 Subject: [PATCH 05/14] (GH-14) Add BuildArtifacts folder to .gitignore --- .gitignore | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0c939e3..fcbc4d9 100644 --- a/.gitignore +++ b/.gitignore @@ -137,7 +137,7 @@ publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings +# TODO: Comment the next line if you want to checkin your web deploy settings # but database connection strings (with potential passwords) will be unencrypted *.pubxml *.publishproj @@ -238,4 +238,5 @@ MobileCenterParser/ integration-test/ /src/tools/* !tools/packages.config -testing \ No newline at end of file +testing +BuildArtifacts/ From 5b4fb3da71b6a2245774442d1ffab49b5ea86f53 Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Sat, 10 Aug 2019 22:22:11 +0100 Subject: [PATCH 06/14] (GH-14) Update NuGet metadata --- nuspec/nuget/Cake.ProtobufTools.nuspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nuspec/nuget/Cake.ProtobufTools.nuspec b/nuspec/nuget/Cake.ProtobufTools.nuspec index 0e01539..eb67a35 100644 --- a/nuspec/nuget/Cake.ProtobufTools.nuspec +++ b/nuspec/nuget/Cake.ProtobufTools.nuspec @@ -6,13 +6,13 @@ Miha Markic, Cake Contributors Miha Markic, Cake Contributors false - https://raw.githubusercontent.com/cake-contrib/Cake.ProtobufTools/master/LICENSE https://github.com/cake-contrib/Cake.ProtobufTools https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png ProtobufTools Addin for runing Google's Protobuf protoc tool. Copyright 2018 (c) Miha Markic and contributors Cake Script CodeGenerator ProtobufTools - + MIT + From b5c41edd119b27702a43e457738699802231747a Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Sat, 10 Aug 2019 22:22:41 +0100 Subject: [PATCH 07/14] (GH-14) Add standard AppVeyor Config file --- .appveyor.yml | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index d01a7aa..cf9c7b0 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -9,8 +9,21 @@ image: Visual Studio 2017 build_script: - ps: .\build.ps1 -Target AppVeyor +#---------------------------------# # Tests -test: on +#---------------------------------# +test: off + +#---------------------------------# +# Pull Requests # +#---------------------------------# +pull_requests: + do_not_increment_build_number: true + +#---------------------------------# +# General # +#---------------------------------# +skip_branch_with_pr: true #---------------------------------# # Branches to build # @@ -27,5 +40,11 @@ branches: # Build Cache # #---------------------------------# cache: -- src\packages -> src\**\packages.config -- 'tools -> recipe.cake,tools/packages.config' +- tools -> recipe.cake, tools/packages.config + +#---------------------------------# +# Skip builds for doc changes # +#---------------------------------# +skip_commits: + # Regex for matching commit message + message: /(doc).*/ From a9b0f31b0265242fa2d9829090f1347ac0e2a3e1 Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Sat, 10 Aug 2019 22:23:11 +0100 Subject: [PATCH 08/14] (GH-14) Add GitHub Template files --- .github/CODEOFCONDUCT.md | 24 +++++++++++++++ .github/CONTRIBUTING.md | 51 ++++++++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE.md | 30 +++++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 36 ++++++++++++++++++++++ 4 files changed, 141 insertions(+) create mode 100644 .github/CODEOFCONDUCT.md create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/CODEOFCONDUCT.md b/.github/CODEOFCONDUCT.md new file mode 100644 index 0000000..66f199c --- /dev/null +++ b/.github/CODEOFCONDUCT.md @@ -0,0 +1,24 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. + +We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery +- Personal attacks +- Trolling or insulting/derogatory comments +- Public or private harassment +- Publishing other's private information, such as physical or electronic addresses, without explicit permission +- Other unethical or unprofessional conduct + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a project maintainer at [abuse@gep13.co.uk](mailto:abuse@gep13.co.uk). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter of an incident. + +This Code of Conduct is adapted from the Contributor Covenant, version 1.3.0, available from http://contributor-covenant.org/version/1/3/0/ diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..66cc6a4 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,51 @@ +# How to contribute +Contributions to Cake.ProtobufTools are highly encouraged and desired. Below are some guidelines that will help make the process as smooth as possible. + +# Getting Started +* Make sure you have a [GitHub account](https://github.com/signup/free) +* Submit a new issue, assuming one does not already exist. + * Clearly describe the issue including steps to reproduce when it is a bug. + * Make sure you fill in the earliest version that you know has the issue. +* Fork the repository on GitHub + +# Suggesting Enhancements +We want to know what you think is missing from Cake.ProtobufTools and how it can be made better. +* When submitting an issue for an enhancement, please be as clear as possible about why you think the enhancement is needed and what the benefit of +it would be. + +# Making Changes +* From your fork of the repository, create a topic branch where work on your change will take place. +* To quickly create a topic branch based on master; `git checkout -b my_contribution master`. Please avoid working directly on the `master` branch. +* Make commits of logical units. +* Check for unnecessary whitespace with `git diff --check` before committing. +* Please follow the prevailing code conventions in the repository. Differences in style make the code harder to understand for everyone. +* Make sure your commit messages are in the proper format. +```` + Add more cowbell to Get-Something.ps1 + + The functionaly of Get-Something would be greatly improved if there was a little + more 'pizzazz' added to it. I propose a cowbell. Adding more cowbell has been + shown in studies to both increase one's mojo, and cement one's status + as a rock legend. +```` + +* Make sure you have added all the necessary Pester tests for your changes. +* Run _all_ PESTER tests in the module to assure nothing else was accidentally broken. + +# Documentation +We are infallible and as such the documenation needs no corectoin. In the highly +unlikely event that that is _not_ the case, commits to update or add documentation +are highly apprecaited. + +# Submitting Changes +* Push your changes to a topic branch in your fork of the repository. +* Submit a pull request to the main repository. +* Once the pull request has been reviewed and accepted, it will be merged with the master branch. +* Celebrate + +# Additional Resources +* [General GitHub documentation](https://help.github.com/) +* [GitHub forking documentation](https://guides.github.com/activities/forking/) +* [GitHub pull request documentation](https://help.github.com/send-pull-requests/) +* [GitHub Flow guide](https://guides.github.com/introduction/flow/) +* [GitHub's guide to contributing to open source projects](https://guides.github.com/activities/contributing-to-open-source/) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..93065f7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,30 @@ + + +## Expected Behavior + + + +## Current Behavior + + + +## Possible Solution + + + +## Steps to Reproduce (for bugs) + + +1. +2. +3. +4. + +## Context + + + +## Your Environment + +* Module version used: +* Operating System and PowerShell version: diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..fab5004 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,36 @@ + + +## Description + + +## Related Issue + + + + + +## Motivation and Context + + +## How Has This Been Tested? + + + + +## Screenshots (if appropriate): + +## Types of changes + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) + +## Checklist: + + +- [ ] My code follows the code style of this project. +- [ ] My change requires a change to the documentation. +- [ ] I have updated the documentation accordingly. +- [ ] I have read the **CONTRIBUTING** document. +- [ ] I have added tests to cover my changes. +- [ ] All new and existing tests passed. From 683860e07563a072b4ce131df29981885b52923f Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Sat, 10 Aug 2019 22:23:42 +0100 Subject: [PATCH 09/14] (GH-14) Add EditorConfig file --- .editorconfig | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1172014 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,23 @@ +; This file is for unifying the coding style for different editors and IDEs. +; More information at http://EditorConfig.org + +root = true + +[*] +end_of_line = CRLF + +[*.ps1] +indent_style = space +indent_size = 4 + +[*.cs] +indent_style = space +indent_size = 4 + +[*.cake] +indent_style = space +indent_size = 4 + +[*.js] +indent_style = tab +indent_size = 2 From c6423200ce0229b8317482e153fcdc976f8765ba Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Sat, 10 Aug 2019 22:24:03 +0100 Subject: [PATCH 10/14] (GH-14) Add .gitattributes file --- .gitattributes | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9244db0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto + +# Declare files that will always have CRLF line endings on checkout. +*.sln text eol=crlf + +# Denote all files that are truly binary and should not be modified. +*.png binary +*.jpg binary From 6f867c46286486688203d8e25766347898a63af9 Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Sat, 10 Aug 2019 22:24:21 +0100 Subject: [PATCH 11/14] (GH-14) Add GRM config file --- GitReleaseManager.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 GitReleaseManager.yaml diff --git a/GitReleaseManager.yaml b/GitReleaseManager.yaml new file mode 100644 index 0000000..e0975a8 --- /dev/null +++ b/GitReleaseManager.yaml @@ -0,0 +1,16 @@ +issue-labels-include: +- Breaking change +- Feature +- Bug +- Improvement +- Documentation +- security +issue-labels-exclude: +- Build +issue-labels-alias: + - name: Documentation + header: Documentation + plural: Documentation + - name: security + header: Security + plural: Security From fcf2cfb760305763fcb2596d7ae8a18e0951b32e Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Sat, 10 Aug 2019 22:27:43 +0100 Subject: [PATCH 12/14] (GH-14) Always run GitVersion --- recipe.cake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipe.cake b/recipe.cake index 17d86b4..414f87d 100644 --- a/recipe.cake +++ b/recipe.cake @@ -12,7 +12,8 @@ BuildParameters.SetParameters( appVeyorAccountName: "cakecontrib", shouldRunDupFinder: false, shouldRunInspectCode: false, - shouldRunCodecov: false); + shouldRunCodecov: false, + shouldRunGitVersion: true); BuildParameters.PrintParameters(Context); From 6fba9b6a4db356e37e695e5f292b308bf05a57d8 Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Sat, 10 Aug 2019 22:32:08 +0100 Subject: [PATCH 13/14] (GH-14) Fix test coverage --- recipe.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipe.cake b/recipe.cake index 414f87d..1316da7 100644 --- a/recipe.cake +++ b/recipe.cake @@ -20,7 +20,7 @@ BuildParameters.PrintParameters(Context); ToolSettings.SetToolSettings( context: Context, dupFinderExcludePattern: new string[] { BuildParameters.RootDirectoryPath + "/src/Cake.ProtobufTools.Tests/*.cs" }, - testCoverageFilter: "+[*]* -[nunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* ", + testCoverageFilter: "+[*]* -[nunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* -[NUnit3.*]*", testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*", testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs"); Build.RunDotNetCore(); From 2200724d20c2a8cf0e6f1b3e7d86d24da76d65ee Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 11 Nov 2020 16:58:54 -0800 Subject: [PATCH 14/14] Fixed typo in example to prevent copypasta errors --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0698442..5a7a952 100644 --- a/README.md +++ b/README.md @@ -30,12 +30,12 @@ To use the addin just add it to Cake call the aliases and configure any settings Task("ProtobufGenerator") .Does(() => { var settings = new ProtocSettings - { - CSharpOut = Directory("."), - }; - var file = File("./definitions.proto"); - Protoc(settings, file); - )}; + { + CSharpOut = Directory("."), + }; + var file = File("./definitions.proto"); + Protoc(settings, file); + }); ``` Since Google.ProtobufTools nuget package comes with different executable flavors (Linux, Windows, MacOS X - all having both x86 and x64 versions) the addin, unless explicitly defined, uses the most appropriate based on OS you are running the script.