diff --git a/.all-contributorsrc b/.all-contributorsrc new file mode 100644 index 0000000..4877286 --- /dev/null +++ b/.all-contributorsrc @@ -0,0 +1,74 @@ +{ + "projectName": "Cake.Transifex", + "projectOwner": "cake-contrib", + "repoType": "github", + "repoHost": "https://github.com", + "files": [ + "README.md" + ], + "imageSize": 100, + "commit": false, + "contributors": [ + { + "login": "AdmiringWorm", + "name": "Kim J. Nordmo", + "avatar_url": "https://avatars3.githubusercontent.com/u/1474648?v=4", + "profile": "https://github.com/AdmiringWorm", + "contributions": [ + "maintenance" + ] + }, + { + "login": "gep13", + "name": "Gary Ewan Park", + "avatar_url": "https://avatars3.githubusercontent.com/u/1271146?v=4", + "profile": "http://www.gep13.co.uk/blog", + "contributions": [ + "question", + "ideas", + "review" + ] + }, + { + "login": "codetriage-readme-bot", + "name": "README Bot", + "avatar_url": "https://avatars0.githubusercontent.com/u/35302948?v=4", + "profile": "https://www.codetriage.com", + "contributions": [ + "doc" + ] + }, + { + "login": "Jericho", + "name": "jericho", + "avatar_url": "https://avatars0.githubusercontent.com/u/112710?v=4", + "profile": "https://github.com/Jericho", + "contributions": [ + "ideas", + "question" + ] + }, + { + "login": "mholo65", + "name": "Martin Björkström", + "avatar_url": "https://avatars1.githubusercontent.com/u/7863439?v=4", + "profile": "https://twitter.com/mholo65", + "contributions": [ + "question" + ] + } + ], + "contributorsPerLine": 7, + "types": { + "bug": { + "symbol": "🐛", + "description": "Bug reports", + "link": "<%= options.repoHost %>/<%= options.projectOwner %>/<%= options.projectName %>/issues?q=author%3A<%= contributor.login %>+label%3Abug" + }, + "ideas": { + "symbol": "🤔", + "description": "Ideas, Planning, & Feedback", + "link": "<%= options.repoHost %>/<%= options.projectOwner %>/<%= options.projectName %>/issues?q=author%3A<%= contributor.login %>" + } + } +} diff --git a/.appveyor.yml b/.appveyor.yml index a5278ea..77fecdd 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -12,18 +12,18 @@ skip_commits: - .travis.yml image: - Visual Studio 2017 -#- Ubuntu -cache: tools -> setup.cake,appveyor.yml +- Ubuntu +cache: tools -> setup.cake,.appveyor.yml,setup.cake install: - cmd: cinst python3 -n - cmd: cinst transifex-client -- sh: sudo pip install transifex-client +- sh: sudo -H pip install transifex-client build_script: - pwsh: | if ($isLinux) { - .\build.ps1 -Configuration Release -Target Package + .\build.ps1 --configuration=Release --target=AppVeyor-Linux } else { - .\build.ps1 -Configuration Release -Target AppVeyor + .\build.ps1 --configuration=Release --target=AppVeyor } test: off deploy: off diff --git a/.gitignore b/.gitignore index 470fe47..3455108 100644 --- a/.gitignore +++ b/.gitignore @@ -294,3 +294,4 @@ BuildArtifacts/ *.dll *.hash docs/input/tasks/ +.dotnet/ \ No newline at end of file diff --git a/GitVersion.yml b/GitVersion.yml deleted file mode 100644 index 28840f4..0000000 --- a/GitVersion.yml +++ /dev/null @@ -1,6 +0,0 @@ -branches: - dev(elop)?(ment)?$: - mode: ContinuousDelivery - tag: alpha -ignore: - sha: [] diff --git a/LICENSE b/LICENSE index 2a857c3..e20ffaf 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017-2018 Kim J. Nordmo +Copyright (c) 2017-2019 Kim J. Nordmo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 1eca6b8..7b812b2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Cake.Transifex +[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors) [![license](https://img.shields.io/github/license/cake-contrib/Cake.Transifex.svg)](https://github.com/cake-contrib/Cake.Transifex/blob/master/LICENSE) [![Open Source Helpers](https://www.codetriage.com/wormiecorp/cake.transifex/badges/users.svg)](https://www.codetriage.com/wormiecorp/cake.transifex) @@ -8,7 +9,7 @@ This addin requires that the transifex client is already installed and is availa ## Information -To install the transifex client, install python, then run `pip install transifex-client`, or using the chocolatey package `choco install transifex-client --version 0.12.4` *(version can be omitted when package have been approved)*. +To install the transifex client, install python, then run `pip install transifex-client`, or using the chocolatey package `choco install transifex-client`. | |Stable|Pre-release| |:--:|:--:|:--:| @@ -16,17 +17,21 @@ To install the transifex client, install python, then run `pip install transifex |NuGet|[![NuGet](https://img.shields.io/nuget/v/Cake.Transifex.svg)](https://nuget.org/packages/Cake.Transifex)|[![NuGet Pre Release](https://img.shields.io/nuget/vpre/Cake.Transifex.svg)](https://nuget.org/packages/Cake.Transifex)| ### Where to get the addin + Officially published versions are available on [NuGet](https://www.nuget.org/packages/Cake.Transifex/). -Development versions is available at the following nuget api endpoint: +Development versions is available at the following nuget api endpoint: ### Usage + The following aliases is available from the cake build script: + - `TransifexInit` -> Initialize a simple configuration file in the repository - `TransifexStatus` -> Get the status of the current translations in the local repository. - `TransifexPush` -> Push translations to the remote transifex server (Optionally also the source file) - `TransifexPull` -> Pull monitored translations from the remote transifex server ## Build Status + | | master | develop | |:--:|:--:|:--:| |AppVeyor|[![AppVeyor branch master](https://img.shields.io/appveyor/ci/cakecontrib/cake-transifex/master.svg)](https://ci.appveyor.com/project/cakecontrib/cake-transifex/branch/master)|[![AppVeyor branch develop](https://img.shields.io/appveyor/ci/cakecontrib/cake-transifex/develop.svg)](https://ci.appveyor.com/project/cakecontrib/cake-transifex/branch/develop)| @@ -35,7 +40,7 @@ The following aliases is available from the cake build script: | |master|develop| |:--:|:--:|:--:| -|Codecov|[![Codecov branch](https://img.shields.io/codecov/c/github/cake-contrib/Cake.Transifex/master.svg)](https://codecov.io/github/cake-contrib/Cake.Transifex)|[![Codecov branch](https://img.shields.io/codecov/c/github/cake-contrib/Cake.Transifex/develop.svg)](https://codecov.io/github/cake-contrib/Cake.Transifex)| +|Codecov|[![Codecov branch](https://img.shields.io/codecov/c/github/cake-contrib/Cake.Transifex/master.svg)](https://codecov.io/gh/cake-contrib/Cake.Transifex/branch/master)|[![Codecov branch](https://img.shields.io/codecov/c/github/cake-contrib/Cake.Transifex/develop.svg)](https://codecov.io/gh/cake-contrib/Cake.Transifex/branch/develop)| |Coveralls|[![Coveralls branch](https://img.shields.io/coveralls/cake-contrib/Cake.Transifex/master.svg)](https://coveralls.io/github/cake-contrib/Cake.Transifex?branch=master)|[![Coveralls branch](https://img.shields.io/coveralls/cake-contrib/Cake.Transifex/develop.svg)](https://coveralls.io/github/cake-contrib/Cake.Transifex?branch=develop)| ## Quick Links @@ -52,7 +57,9 @@ Come join in the conversation about Cake.Transifex in our Gitter Chat Room ## Building Cake.Transifex ### 1. Building on Windows + The following are needed to build Cake.Transifex on Windows + - .NET Core 2.0 - .NET 4.6 - Visual Studio 2017 @@ -60,8 +67,19 @@ The following are needed to build Cake.Transifex on Windows Open up a powershell window and call `.\build.ps1`, this should build the projects, run the unit tests and create nuget packages in the `.\BuildArtifacts\Packages\NuGet` directory. ### 2. Building on Linux or OSX + - .NET Core 1.0.5 and 2.0 - Mono (uncertain of which version, and it may fail on some systems) Open up the terminal and call `sh build.sh`, this should build the projects, run the unit tests and create nuget packages in the `./artifacts/v{version}/nuget` directory. -**NOTE: By default we do not enable building of .NET Full on Linux and OSX, to also build .NET Full pass `--with-netfull` when calling `sh build.sh`** + +## Contributors + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + + + +
Kim J. Nordmo
Kim J. Nordmo

🚧
Gary Ewan Park
Gary Ewan Park

💬 🤔 👀
README Bot
README Bot

📖
jericho
jericho

🤔 💬
Martin Björkström
Martin Björkström

💬
+ + +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! \ No newline at end of file diff --git a/build.config b/build.config new file mode 100644 index 0000000..a816f2a --- /dev/null +++ b/build.config @@ -0,0 +1,2 @@ +DOTNET_VERSION=ANY +CAKE_VERSION=0.33.0 \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index 7718bc5..3d53e18 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,168 +1,126 @@ -########################################################################## -# 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 ShowDescription -Shows description about tasks. -.PARAMETER DryRun -Performs a dry run. -.PARAMETER Experimental -Uses the nightly builds of the Roslyn script engine. -.PARAMETER Mono -Uses the Mono Compiler rather than the Roslyn script engine. -.PARAMETER CakeVersion -The Cake version to use when running the build script. -.PARAMETER UseNetCore -The the CORE CLR edition of Cake. -.PARAMETER ScriptArgs -Remaining arguments are added here. - -.LINK -https://cakebuild.net - -#> - -[CmdletBinding()] -Param( - [string]$Script = "setup.cake", - [string]$Target, - [string]$Configuration, - [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] - [string]$Verbosity, - [switch]$ShowDescription, - [Alias("WhatIf", "Noop")] - [switch]$DryRun, - [switch]$Experimental, - [switch]$Mono, - [version]$CakeVersion = '0.25.0', - [switch]$UseNetCore, - [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] - [string[]]$ScriptArgs -) - -if (!(Test-Path Function:\Expand-Archive)) { - function Expand-Archive() { - param([string]$Path, [string]$DestinationPath) - - if (!(Test-Path $DestinationPath)) { New-Item -Type Directory -Path $DestinationPath } - - $isPowershellCore = $PSVersionTable -and $PSVersionTable.PSEdition -eq 'Core' - $haveNet45 = $PSVersionTable -and $PSVersionTable.CLRVersion -and ($PSVersionTable.CLRVersion -ge [version]'4.0.30319.17001') - - if ($isPowershellCore -or $haveNet45) { - Add-Type -AssemblyName System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::ExtractToDirectory($Path, $DestinationPath) - } else { - $shellApplication = New-Object -ComObject shell.application - $zipPackage = $shellApplication.namespace($Path) - $destinationFolder = $shellApplication.namespace($DestinationPath) - $destinationFolder.CopyHere($zipPackage.Items(), 16) - } +$SCRIPT_DIR = Split-Path -Parent $MyInvocation.MyCommand.Definition +$TOOLS_DIR="$SCRIPT_DIR/tools" +if ($IsMacOS -or $IsLinux) { + $CAKE_EXE="$TOOLS_DIR/dotnet-cake" +} else { + $CAKE_EXE="$TOOLS_DIR/dotnet-cake.exe" +} +$CAKE_PATH="$TOOLS_DIR/.store/cake.tool/$CAKE_VERSION" +$DOTNET_EXE="$(Get-Command dotnet -ea 0 | select -Expand Source)" +$INSTALL_NETCORE=$false +[string]$DOTNET_VERSION="" +[string]$CAKE_VERSION="" +foreach ($line in Get-Content "$SCRIPT_DIR/build.config" -Encoding utf8) { + if ($line -like "CAKE_VERSION=*") { + $CAKE_VERSION=$line.Substring($line.IndexOf('=') + 1) + } + elseif ($line -like "DOTNET_VERSION=*") { + $DOTNET_VERSION=$line.Substring($line.IndexOf('=') + 1) } } -function GetProxyEnabledWebClient -{ - $wc = New-Object System.Net.WebClient - $proxy = [System.Net.WebRequest]::GetSystemWebProxy() - $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials - $wc.Proxy = $proxy - return $wc +if ([string]::IsNullOrWhiteSpace($CAKE_VERSION) -or [string]::IsNullOrEmpty($DOTNET_VERSION)) { + "An errer occured while parsing Cake / .NET Core SDK version." + exit 1 } -if (!$PSScriptRoot) { $PSScriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Definition } +if ([string]::IsNullOrWhiteSpace($DOTNET_EXE)) { + $INSTALL_NETCORE=$true +} +elseif ("$DOTNET_VERSION" -ne "ANY") { + $DOTNET_INSTALLED_VERSION= . $DOTNET_EXE --version + if ("$DOTNET_VERSION" -ne "$DOTNET_INSTALLED_VERSION") { + $INSTALL_NETCORE=$true + } +} -$TOOLS_DIR = Join-Path $PSScriptRoot "tools" -$CAKE_EXE_DIR = "" +if ($true -eq $INSTALL_NETCORE) { + if (!(Test-Path "$SCRIPT_DIR/.dotnet")) { + New-Item -Path "$SCRIPT_DIR/.dotnet" -ItemType Directory -Force | Out-Null + } -if ($UseNetCore) { - $CAKE_DIR_NAME = "Cake.CoreCLR" -} else { - $CAKE_DIR_NAME = "Cake" -} + $arguments = @() + $ScriptPath = "" + $LaunchUrl = "" + $ScriptUrl = "" + $PathSep = ';' + if ($IsMacOS -or $IsLinux) { + $ScriptPath = "$SCRIPT_DIR/.dotnet/dotnet-install.sh" + $ScriptUrl = "https://dot.net/v1/dotnet-install.sh" + $LaunchUrl = "$(Get-Command bash)" + $PathSep = ":" + $arguments = @( + $ScriptPath + "--install-dir" + "$SCRIPT_DIR/.dotnet" + "--no-path" + ) + if ($DOTNET_VERSION -ne "ANY") { + $arguments += @( + "--version" + "$DOTNET_VERSION" + ) + } + } else { + $ScriptPath = "$SCRIPT_DIR/.dotnet/dotnet-install.ps1" + $ScriptUrl = "https://dot.net/v1/dotnet-install.ps1" + $LaunchUrl = "$ScriptPath" + $arguments = @( + "-InstallDir" + "$SCRIPT_DIR/.dotnet" + "-NoPath" + ) + if ($DOTNET_VERSION -ne "ANY") { + $arguments += @( + "-Version" + "$DOTNET_VERSION" + ) + } + } -$CAKE_URL = "https://www.nuget.org/api/v2/package/$($CAKE_DIR_NAME)/$($CakeVersion)" + (New-Object System.Net.WebClient).DownloadFile($ScriptUrl, $ScriptPath) -if ($CakeVersion) { - $CAKE_EXE_DIR = Join-Path "$TOOLS_DIR" "$CAKE_DIR_NAME.$($CakeVersion.ToString())" -} else { - $CAKE_EXE_DIR = Join-Path "$TOOLS_DIR" "$CAKE_DIR_NAME" -} + & $LaunchUrl @arguments -if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { - Write-Verbose "Creating tools directory..." - New-Item -Path $TOOLS_DIR -Type Directory | Out-Null -} + $env:PATH = "$SCRIPT_DIR/.dotnet${PathSep}${env:PATH}" + $env:DOTNET_ROOT = "$SCRIPT_DIR/.dotnet" -if (!(Test-Path $CAKE_EXE_DIR)) { - # We download and save it as a normal zip file, in cases - # were we need to extract it using com. - $tmpDownloadFile = Join-Path "$TOOLS_DIR" "$CAKE_DIR_NAME.zip" - Write-Verbose "Downloading Cake package..." - - try { - $wc = GetProxyEnabledWebClient - $wc.DownloadFile($CAKE_URL, $tmpDownloadFile) - } catch { - throw "Could not download Cake package...`n`nException:$_" - } + $DOTNET_EXE = Get-ChildItem -Path "$SCRIPT_DIR/.dotnet" -Filter "dotnet*" | select -First 1 -Expand FullName - Write-Verbose "Extracting Cake package..." - Expand-Archive -Path $tmpDownloadFile -DestinationPath $CAKE_EXE_DIR - Remove-Item -Recurse -Force $tmpDownloadFile,"$CAKE_EXE_DIR/_rels","$CAKE_EXE_DIR/``[Content_Types``].xml","$CAKE_EXE_DIR/package" +} elseif (Test-Path "/opt/dotnet/sdk" -ea 0) { + $env:DOTNET_ROOT = "/opt/dotnet/sdk" } -if ($UseNetCore) { - $CAKE_EXE = Get-ChildItem -LiteralPath $CAKE_EXE_DIR -Filter "Cake.dll" -Recurse | Select-Object -First 1 -ExpandProperty FullName - if (!$CAKE_EXE) { throw "Unable to find the Cake.dll library" } +$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +$env:DOTNET_CLI_TELEMETRY_OPTOUT=1 +$env:DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 + +$CAKE_INSTALLED_VERSION= Get-Command dotnet-cake -ea 0 | % { & $_.Source --version } + +if ($CAKE_INSTALLED_VERSION -eq $CAKE_VERSION) { + $CAKE_EXE = Get-Command dotnet-cake | % Source } else { - $CAKE_EXE = Get-ChildItem -LiteralPath $CAKE_EXE_DIR -Filter "Cake.exe" -Recurse | Select-Object -First 1 -ExpandProperty FullName - if (!$CAKE_EXE) { throw "Unable to find the Cake.exe executable" } -} + $CakePath = "$TOOLS_DIR/.store/cake.tool/$CAKE_VERSION" + $CAKE_EXE = (Get-ChildItem -Path $TOOLS_DIR -Filter "dotnet-cake*" -File -ea 0 | select -First 1 -Expand FullName) + + if (!(Test-Path -Path $CakePath -PathType Container) -or !(Test-Path $CAKE_EXE -PathType Leaf)) { + if (!([string]::IsNullOrWhiteSpace($CAKE_EXE)) -and (Test-Path $CAKE_EXE -PathType Leaf)) { + & $DOTNET_EXE tool uninstall --tool-path $TOOLS_DIR Cake.Tool + } -$cakeArguments = New-Object System.Collections.Generic.List[string] -$cakeArguments.Add($Script) | Out-Null -$excludeArgs = @("Script","CakeVersion","UseNetCore","ScriptArgs", "Verbose") + & $DOTNET_EXE tool install --tool-path $TOOLS_DIR --version $CAKE_VERSION Cake.Tool + if ($LASTEXITCODE -ne 0) { + "An error occured while installing Cake." + exit 1 + } -$PSBoundParameters.GetEnumerator() | ? { !$excludeArgs.Contains($_.Key) } | % { - if ($_.Value) { - $cakeArguments.Add("-$($_.Key)=$($_.Value)") - } else { - $cakeArguments.Add("-$($_.Key)") + $CAKE_EXE = (Get-ChildItem -Path $TOOLS_DIR -Filter "dotnet-cake*" -File | select -First 1 -Expand FullName) } -} | Out-Null -if ($ScriptArgs) { - $cakeArguments.AddRange($ScriptArgs) | Out-Null } -if ($UseNetCore) { - $cakeArguments.Insert(0, $CAKE_EXE) | Out-Null - $CAKE_EXE = Get-Command -Name dotnet | ForEach-Object Definition -} elseif ([System.Environment]::OSVersion.Platform -ne [System.PlatformID]::Win32NT) { - $cakeArguments.Insert(0, $CAKE_EXE) | Out-Null - $CAKE_EXE = Get-Command -Name mono | ForEach-Object Definition +& "$CAKE_EXE" setup.cake --bootstrap +if ($LASTEXITCODE -eq 0) { + & "$CAKE_EXE" setup.cake $args } -Write-Host "Running build script..." -Write-Verbose "Calling & $CAKE_EXE $cakeArguments" -& $Cake_EXE $cakeArguments -exit $LASTEXITCODE +exit $LASTEXITCODE \ No newline at end of file diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 index 01d34b4..0e594ff --- a/build.sh +++ b/build.sh @@ -1,117 +1,78 @@ #!/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. +# Define variables SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source $SCRIPT_DIR/build.config 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 +CAKE_EXE=$TOOLS_DIR/dotnet-cake +CAKE_PATH=$TOOLS_DIR/.store/cake.tool/$CAKE_VERSION +DOTNET_EXE=$(which dotnet 2>/dev/null) +INSTALL_NETCORE=0 -# Make sure the tools folder exist. -if [ ! -d "$TOOLS_DIR" ]; then - mkdir "$TOOLS_DIR" +if [ "$CAKE_VERSION" = "" ] || [ "$DOTNET_VERSION" = "" ]; then + echo "An error occured while parsing Cake / .NET Core SDK version." + exit 1 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 +if [ "$DOTNET_EXE" = "" ]; then + INSTALL_NETCORE=1 +elif [ "$DOTNET_VERSION" != "ANY" ]; then + DOTNET_INSTALLED_VERSION=$($DOTNET_EXE --version 2>&1) + if [ "$DOTNET_VERSION" != "$DOTNET_INSTALLED_VERSION" ]; then + $INSTALL_NETCORE=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 +if [ "$INSTALL_NETCORE" = "1" ]; then + if [ ! -d "$SCRIPT_DIR/.dotnet" ]; then + mkdir "$SCRIPT_DIR/.dotnet" 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 + curl -Lsfo "$SCRIPT_DIR/.dotnet/dotnet-install.sh" https://dot.net/v1/dotnet-install.sh -mono "$NUGET_EXE" install -ExcludeVersion -if [ $? -ne 0 ]; then - echo "Could not restore NuGet tools." - exit 1 + if [ "$DOTNET_VERSION" = "ANY" ]; then + bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --install-dir "$SCRIPT_DIR/.dotnet" --no-path + else + bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version $DOTNET_VERSION --install-dir "$SCRIPT_DIR/.dotnet" --no-path + fi + + DOTNET_EXE="$SCRIPT_DIR/.dotnet/dotnet" + export PATH="$SCRIPT_DIR/.dotnet:$PATH" + export DOTNET_ROOT="$SCRIPT_DIR/.dotnet" +elif [ -d "/opt/dotnet/sdk" ]; then # Fix for dotnet-cake not finding sdk version + export DOTNET_ROOT="/opt/dotnet" fi -$MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5" +export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +export DOTNET_CLI_TELEMETRY_OPTOUT=1 -popd >/dev/null +CAKE_INSTALLED_VERSION=$(dotnet-cake --version 2>&1) -# Restore addins from NuGet. -if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then - pushd "$ADDINS_DIR" >/dev/null +if [ "$CAKE_VERSION" != "$CAKE_INSTALLED_VERSION" ]; then + if [ ! -f "$CAKE_EXE" ] || [ ! -d "$CAKE_PATH" ]; then + if [ -f "$CAKE_EXE" ]; then + dotnet tool uninstall --tool-path $TOOLS_DIR Cake.Tool + fi - mono "$NUGET_EXE" install -ExcludeVersion - if [ $? -ne 0 ]; then - echo "Could not restore NuGet addins." - exit 1 + echo "Installing Cake $CAKE_VERSION..." + dotnet tool install --tool-path $TOOLS_DIR --version $CAKE_VERSION Cake.Tool + if [ $? -ne 0 ]; then + echo "An error occured while installing Cake." + exit 1 + fi 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." + # Make sure that Cake has been installed. + if [ ! -f "$CAKE_EXE" ]; then + echo "Could not find Cake.exe at '$CAKE_EXE'." exit 1 fi - - popd >/dev/null +else + CAKE_EXE="dotnet-cake" 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 +########################################################################### +# RUN BUILD SCRIPT +########################################################################### # Start Cake -exec mono "$CAKE_EXE" $SCRIPT "${CAKE_ARGUMENTS[@]}" +(exec "$CAKE_EXE" setup.cake --bootstrap) && (exec "$CAKE_EXE" setup.cake "$@") diff --git a/docs/input/blog/new-release-0.1.0.md b/docs/input/blog/new-release-0.1.0.md deleted file mode 100644 index ba98045..0000000 --- a/docs/input/blog/new-release-0.1.0.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -Title: New Release - 0.1.0 -Published: 2017-03-11 -Category: Release -Author: AdmiringWorm ---- - -# 0.1.0 Release - -I'm happy to anounce the first public release of the Cake.Transifex library. - -In this release, the following issue was resolved: - -__Feature__ - -- [__#1__](https://github.com/WormieCorp/Cake.Transifex/issues/1) Initial Release diff --git a/docs/input/blog/new-release-0.2.0.md b/docs/input/blog/new-release-0.2.0.md deleted file mode 100644 index 34bbe60..0000000 --- a/docs/input/blog/new-release-0.2.0.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -Title: New Release - 0.2.0 -Published: 2017-05-17 -Category: Release -Author: AdmiringWorm ---- - -# 0.2.0 Release - -As part of this release we had [1 issue](https://github.com/WormieCorp/Cake.Transifex/issues?milestone=2&state=closed) closed. - - -__Enhancement__ - -- [__#4__](https://github.com/WormieCorp/Cake.Transifex/issues/4) Support additional modes when pulling translations - diff --git a/docs/input/blog/new-release-0.3.0.md b/docs/input/blog/new-release-0.3.0.md deleted file mode 100644 index 977260c..0000000 --- a/docs/input/blog/new-release-0.3.0.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -Title: New Release - 0.3.0 -Published: 2017-08-01 -Category: Release -Author: AdmiringWorm ---- - -# 0.3.0 Release - -As part of this release we had [58 commits](https://github.com/cake-contrib/Cake.Transifex/compare/v0.1.0...0.3.0) which resulted in [8 issues](https://github.com/cake-contrib/Cake.Transifex/issues?milestone=3&state=closed) being closed. - - -__Feature__ - -- [__#7__](https://github.com/cake-contrib/Cake.Transifex/issues/7) Support the 'Init' command - -__Improvements__ - -- [__#10__](https://github.com/cake-contrib/Cake.Transifex/issues/10) Build against Cake.Core version 16.2 -- [__#9__](https://github.com/cake-contrib/Cake.Transifex/issues/9) Start using Cake.Recipe for windows builds -- [__#6__](https://github.com/cake-contrib/Cake.Transifex/issues/6) Use the Cake Contrib Icon - -__Documentation__ - -- [__#13__](https://github.com/cake-contrib/Cake.Transifex/issues/13) Update Readme to be similiar to other Cake addins -- [__#12__](https://github.com/cake-contrib/Cake.Transifex/issues/12) Configure gitreleasemanager to add package nuget url on releases -- [__#11__](https://github.com/cake-contrib/Cake.Transifex/issues/11) Start using wyam to document the addin - -### Where to get it -You can download this release from [nuget](https://nuget.org/packages/Cake.Transifex/0.3.0) diff --git a/docs/input/blog/new-release-0.4.0.md b/docs/input/blog/new-release-0.4.0.md deleted file mode 100644 index 5fbf254..0000000 --- a/docs/input/blog/new-release-0.4.0.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -Title: New Release - 0.4.0 -Published: 2017-12-18 -Category: Release -Author: AdmiringWorm ---- - -# 0.4.0 Compatibility Release - -This blog post is a little belated, but here it is. -This release is just a minor compatibility release to make Cake.Transifex -compatible with Cake above version 0.22, while maintaining compatibility with -previous releases. - - -## Release Notes - -As part of this release we had [9 commits](https://github.com/cake-contrib/Cake.Transifex/compare/0.3.0...0.4.0) which resulted in [2 issues](https://github.com/cake-contrib/Cake.Transifex/issues?milestone=4&state=closed) being closed. - - -__Feature__ - -- [__#16__](https://github.com/cake-contrib/Cake.Transifex/issues/16) Update Cake.Core dependency to version 0.22.0 - -### Where to get it -You can download this release from [nuget](https://nuget.org/packages/Cake.Transifex/0.4.0) diff --git a/docs/input/blog/new-release-0.5.0.md b/docs/input/blog/new-release-0.5.0.md deleted file mode 100644 index 8c63075..0000000 --- a/docs/input/blog/new-release-0.5.0.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -Title: New Release - 0.5.0 -Published: 2018-03-03 -Category: Release -Author: AdmiringWorm ---- - -# 0.5.0 Compatibility Release -The main feature of this release is adding the support for Cake version 0.26.0. -The project have also now been setup as a example project with pulling/pushing translations to transifex (these are also included in the package). - -EDIT: -It turns out this support, was only for partial support for Cake version 0.26.0. -It is only supported when targeting .NET Core 2.0, and not when targeting the full .NET Framework. - -## Release notes - -As part of this release we had [22 commits](https://github.com/cake-contrib/Cake.Transifex/compare/0.4.0...0.5.0) which resulted in [5 issues](https://github.com/cake-contrib/Cake.Transifex/issues?milestone=6&state=closed) being closed. - - -__Feature__ - -- [__#22__](https://github.com/cake-contrib/Cake.Transifex/issues/22) Support Cake.Core 0.26 - -__Improvement__ - -- [__#20__](https://github.com/cake-contrib/Cake.Transifex/issues/20) Change all hard coded strings to translatable strings - -__Documentation__ - -- [__#23__](https://github.com/cake-contrib/Cake.Transifex/issues/23) Updated documentation to the correct .NET Core and .NET Framework versions -- [__#19__](https://github.com/cake-contrib/Cake.Transifex/issues/19) Mention which cake versions are supported in wyam documentation. -- [__#18__](https://github.com/cake-contrib/Cake.Transifex/issues/18) Documentation in Readme.md is outdated - -### Where to get it -You can download this release from [nuget](https://nuget.org/packages/Cake.Transifex/0.5.0) diff --git a/docs/input/blog/new-release-0.6.0.md b/docs/input/blog/new-release-0.6.0.md deleted file mode 100644 index 0865def..0000000 --- a/docs/input/blog/new-release-0.6.0.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -Title: New Release - 0.5.0 -Published: 2018-03-03 -Category: Release -Author: AdmiringWorm ---- - -# 0.6.0 The breaking change release -Due to misunderstanding of the requirements, the previously released version only added partial support for Cake version 0.26.0. -This release fixes that, but unfortunately includes breaking changes due to this. -It was also decided to remove all support for cake versions released prior to version 0.26.0. - -## Release notes - -As part of this release we had [9 commits](https://github.com/cake-contrib/Cake.Transifex/compare/0.5.0...0.6.0) which resulted in [2 issues](https://github.com/cake-contrib/Cake.Transifex/issues?milestone=7&state=closed) being closed. - - -__Breaking Changes__ - -- [__#25__](https://github.com/cake-contrib/Cake.Transifex/issues/25) Add full support for Cake version 0.26.0 and above -- [__#24__](https://github.com/cake-contrib/Cake.Transifex/issues/24) Drop support for versions of Cake previous to 0.26.0 - -### Where to get it -You can download this release from [nuget](https://nuget.org/packages/Cake.Transifex/0.6.0) diff --git a/docs/input/docs/usage/intro.md b/docs/input/docs/usage/intro.md index f003f08..710ee80 100644 --- a/docs/input/docs/usage/intro.md +++ b/docs/input/docs/usage/intro.md @@ -21,6 +21,5 @@ This addin is designed to be used inside of cake scripts. To start using it, fir When the cake script is run, this will download the latest version of the `Cake.Transifex` nuget package and will now be available to use inside of the script. - *NOTE: Remember to also install the transifex (`tx`) client on the running computer, this can be installed through the python `pip` utility (`pip install transifex-client`) or through chocolatey `choco install transifex-client`.* diff --git a/docs/input/index.cshtml b/docs/input/index.cshtml index 71ed743..8e41cfc 100644 --- a/docs/input/index.cshtml +++ b/docs/input/index.cshtml @@ -19,21 +19,14 @@ NoGutter: false NuGet . While development versions are made available using the following nuget end point: - - https://www.myget.org/F/cake-contrib/api/v2 + + https://ci.appveyor.com/nuget/cake-transifex

Cake support

- This addin supports multiple frameworks and with that multiple Cake versions - The following is a list of the Cake versions this addin is expected to work with. + This addin makes use of the .NET Standard 2.0 framework, which should work + on both .NET Core 2.0+, and .NET Framework 4.6+.

- diff --git a/setup.cake b/setup.cake index b0e348d..4eaf902 100644 --- a/setup.cake +++ b/setup.cake @@ -1,4 +1,5 @@ -#load "nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease" +#addin "nuget:?package=Cake.Coverlet&version=2.0.1" +#load "nuget:https://ci.appveyor.com/nuget/cake-recipe-pylg5x5ru9c2?package=Cake.Recipe&prerelease&version=0.3.0-alpha0492" Environment.SetVariableNames(); @@ -14,7 +15,10 @@ BuildParameters.SetParameters( shouldBuildNugetSourcePackage: false, shouldDeployGraphDocumentation: false, solutionFilePath: "./Cake.Transifex.sln", - testFilePattern: "/**/*.Tests.csproj" + testFilePattern: "/**/*.Tests.csproj", + shouldRunCodecov: true, + shouldExecuteGitLink: false, + shouldRunGitVersion: true ); ToolSettings.SetToolSettings( @@ -35,6 +39,54 @@ if (BuildParameters.IsRunningOnAppVeyor && BuildParameters.Tasks.AppVeyorTask.IsDependentOn("Create-Release-Notes"); } +((CakeTask)BuildParameters.Tasks.DotNetCoreTestTask.Task).Actions.Clear(); +((CakeTask)BuildParameters.Tasks.DotNetCoreTestTask.Task).Criterias.Clear(); +((CakeTask)BuildParameters.Tasks.DotNetCoreTestTask.Task).Dependencies.Clear(); + +BuildParameters.Tasks.DotNetCoreTestTask + .IsDependentOn("Install-ReportGenerator") + .Does(() => { + var projects = GetFiles(BuildParameters.TestDirectoryPath + (BuildParameters.TestFilePattern ?? "/**/*Tests.csproj")); + var testFileName = BuildParameters.Paths.Files.TestCoverageOutputFilePath.GetFilename(); + var testDirectory = BuildParameters.Paths.Files.TestCoverageOutputFilePath.GetDirectory(); + + var settings = new CoverletSettings { + CollectCoverage = true, + CoverletOutputFormat = CoverletOutputFormat.opencover, + CoverletOutputDirectory = testDirectory, + CoverletOutputName = testFileName.ToString(), + MergeWithFile = BuildParameters.Paths.Files.TestCoverageOutputFilePath + }; + foreach (var line in ToolSettings.TestCoverageExcludeByFile.Split(';')) { + foreach (var file in GetFiles("**/" + line)) { + settings = settings.WithFileExclusion(file.FullPath); + } + } + + var testSettings = new DotNetCoreTestSettings { + Configuration = BuildParameters.Configuration, + NoBuild = true + }; + + foreach (var project in projects) { + DotNetCoreTest(project.FullPath, testSettings, settings); + } + + if (FileExists(BuildParameters.Paths.Files.TestCoverageOutputFilePath)) { + ReportGenerator(BuildParameters.Paths.Files.TestCoverageOutputFilePath, BuildParameters.Paths.Directories.TestCoverage); + } +}); + +BuildParameters.Tasks.TransifexPushSourceResource.WithCriteria(() => BuildParameters.IsRunningOnWindows); + +Task("Linux") + .IsDependentOn("Package") + .IsDependentOn("Upload-Coverage-Report"); + +Task("Appveyor-Linux") + .IsDependentOn("Linux") + .IsDependentOn("Upload-AppVeyor-Artifacts"); + BuildParameters.PrintParameters(Context); Build.RunDotNetCore(); diff --git a/src/Cake.Transifex.Tests/Cake.Transifex.Tests.csproj b/src/Cake.Transifex.Tests/Cake.Transifex.Tests.csproj index 9aa0347..1929f87 100644 --- a/src/Cake.Transifex.Tests/Cake.Transifex.Tests.csproj +++ b/src/Cake.Transifex.Tests/Cake.Transifex.Tests.csproj @@ -2,20 +2,18 @@ netcoreapp2.0 - - pdbonly - - - - - - - - - - + + + + + + + + runtime; build; native; contentfiles; analyzers + all + diff --git a/src/Cake.Transifex.Tests/TransifexRunnerFixture.cs b/src/Cake.Transifex.Tests/TransifexRunnerFixture.cs index e4507e0..4f8c1e8 100644 --- a/src/Cake.Transifex.Tests/TransifexRunnerFixture.cs +++ b/src/Cake.Transifex.Tests/TransifexRunnerFixture.cs @@ -14,7 +14,8 @@ public TransifexAliasesInitFixture() { var argumentsMoq = new Mock(); var registryMoq = new Mock(); - _context = new CakeContext(FileSystem, Environment, Globber, new FakeLog(), argumentsMoq.Object, ProcessRunner, registryMoq.Object, Tools); + var dataService = new Mock(); + _context = new CakeContext(FileSystem, Environment, Globber, new FakeLog(), argumentsMoq.Object, ProcessRunner, registryMoq.Object, Tools, dataService.Object, Configuration); } protected override void RunTool() @@ -38,7 +39,8 @@ public TransifexAliasesPullFixture() { var argumentsMoq = new Mock(); var registryMoq = new Mock(); - _context = new CakeContext(FileSystem, Environment, Globber, new FakeLog(), argumentsMoq.Object, ProcessRunner, registryMoq.Object, Tools); + var dataService = new Mock(); + _context = new CakeContext(FileSystem, Environment, Globber, new FakeLog(), argumentsMoq.Object, ProcessRunner, registryMoq.Object, Tools, dataService.Object, Configuration); } protected override void RunTool() @@ -62,7 +64,8 @@ public TransifexAliasesPushFixture() { var argumentsMoq = new Mock(); var registryMoq = new Mock(); - _context = new CakeContext(FileSystem, Environment, Globber, new FakeLog(), argumentsMoq.Object, ProcessRunner, registryMoq.Object, Tools); + var dataService = new Mock(); + _context = new CakeContext(FileSystem, Environment, Globber, new FakeLog(), argumentsMoq.Object, ProcessRunner, registryMoq.Object, Tools, dataService.Object, Configuration); } protected override void RunTool() @@ -86,7 +89,8 @@ public TransifexAliasesStatusFixture() { var argumentsMoq = new Mock(); var registryMoq = new Mock(); - _context = new CakeContext(FileSystem, Environment, Globber, new FakeLog(), argumentsMoq.Object, ProcessRunner, registryMoq.Object, Tools); + var dataService = new Mock(); + _context = new CakeContext(FileSystem, Environment, Globber, new FakeLog(), argumentsMoq.Object, ProcessRunner, registryMoq.Object, Tools, dataService.Object, Configuration); } protected override void RunTool() diff --git a/src/Cake.Transifex/Cake.Transifex.csproj b/src/Cake.Transifex/Cake.Transifex.csproj index 37ae8c1..166e859 100644 --- a/src/Cake.Transifex/Cake.Transifex.csproj +++ b/src/Cake.Transifex/Cake.Transifex.csproj @@ -5,7 +5,6 @@ bin\$(Configuration)\$(TargetFramework)\Cake.Transifex.xml 7 - pdbonly False Kim J. Nordmo @@ -14,10 +13,10 @@ Cake.Transifex is a addin for the Cake Build script adding support for working w This addin requires that the transifex client is already installed and is available as `tx`. To install the transifex client, install python, then run `pip install transifex-client`. - Copyright 2017-2018 - Kim J. Nordmo - https://cdn.rawgit.com/cake-contrib/graphics/a5cf0f881c390650144b2243ae551d5b9f836196/png/cake-contrib-medium.png + Copyright 2017-$([System.DateTime]::Now.Year) - Kim J. Nordmo + https://cdn.jsdelivr.net/gh/cake-contrib/graphics@49c3b71def749b86416d773f1ead0c0da2d590ea/png/cake-contrib-medium.png https://github.com/cake-contrib/Cake.Transifex - $(RepositoryUrl)/blob/master/LICENSE + MIT $(RepositoryUrl) git cake build transifex localization @@ -37,7 +36,7 @@ To install the transifex client, install python, then run `pip install transifex - + diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index 42a7b2c..f27456b 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -1,4 +1,4 @@ using System.Reflection -[assembly: AssemblyVersion("0.7.0")] -[assembly: AssemblyFileVersion("0.7.0")] +[assembly: AssemblyVersion("0.8.0")] +[assembly: AssemblyFileVersion("0.8.0")]