diff --git a/.appveyor.yml b/.appveyor.yml index daeaa6f..9695243 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -11,19 +11,7 @@ skip_commits: - LICENSE - .travis.yml image: Visual Studio 2017 -environment: - MYGET_API_KEY: - secure: PiwP8bD2HnXNwjM8xcE009XPYp7K5xdwS4xtz8aoVuUxdIpqtXf5PeWlg25RW5c3 - MYGET_API_URL: https://www.myget.org/F/wormie-nugets/api/v2/package - MYGET_SYMBOLS_URL: https://www.myget.org/F/wormie-nugets/symbols/api/v2/package - NUGET_API_KEY: - secure: koMAZYSTMVgMKHVVuyfoyVsqyFJc7KQ7UpmNixgflGJC0Mo6CQa8S5cQfbXaBXTH - NUGET_API_URL: https://www.nuget.org/api/v2/package - GITHUB_USERNAME: - secure: Bx5iVoapUFFKud44e1qbAQ== - GITHUB_PASSWORD: - secure: atNrzVTaIk7ivnzuOV0vwfti0qWEQAb2r+Oq+DROAoVDoVWzJltYeEWDxbnHx1wu -cache: tools -> .build/tools.cake,tools/packages.config +cache: tools -> setup.cake,tools/packages.config build_script: - ps: .\build.ps1 -Configuration Release -Target AppVeyor test: off diff --git a/.gitignore b/.gitignore index 65429c6..b40eec2 100644 --- a/.gitignore +++ b/.gitignore @@ -286,3 +286,7 @@ tools/** *.btm.cs *.odx.cs *.xsd.cs + + +# Custom +BuildArtifacts/ diff --git a/.travis.yml b/.travis.yml index 1f40ec5..78fc3c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ branches: - /^v[0-9]/ # Skip tag builds, these should already have been tested before the tag was created before_script: - - git fetch --unshallow # Not needed until we reach a commit history of 50+ + - git fetch --unshallow - if [ "$TRAVIS_OS_NAME" == "osx" ]; then ulimit -n 1024; fi - if [ "$TRAVIS_OS_NAME" != "osx" ]; then export FrameworkPathOverride=/usr/lib/mono/4.5/; fi - chmod +x build.sh diff --git a/Cake.Transifex.sln b/Cake.Transifex.sln index bf17151..f4db773 100644 --- a/Cake.Transifex.sln +++ b/Cake.Transifex.sln @@ -9,7 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C7CD914A-3A1 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{79621E89-D86A-493B-A2BE-BDB9921CF0C5}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.Transifex.Tests", "tests\Cake.Transifex.Tests\Cake.Transifex.Tests.csproj", "{A7402949-439A-44B1-9B7B-50E61C3E0A94}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.Transifex.Tests", "src\Cake.Transifex.Tests\Cake.Transifex.Tests.csproj", "{A7402949-439A-44B1-9B7B-50E61C3E0A94}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/build.cake b/build.cake index e411db7..a2efa68 100644 --- a/build.cake +++ b/build.cake @@ -3,6 +3,12 @@ var parameters = BuildParameters.GetParameters(Context); var publishingError = false; +if (Context.IsRunningOnWindows()) { + Warning(@"Please use the setup.cake file when building on Windows. +build.cake is only provided to allow building on Unix like systems as 'Cake.Recipe' +currently do not support those kind of systems."); +} + Setup(context => { parameters.Initialize(context); diff --git a/build.ps1 b/build.ps1 index 394924a..bdfb32b 100644 --- a/build.ps1 +++ b/build.ps1 @@ -5,14 +5,11 @@ ########################################################################## <# - .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 @@ -32,15 +29,13 @@ Tells Cake to use the Mono scripting engine. Skips restoring of packages. .PARAMETER ScriptArgs Remaining arguments are added here. - .LINK http://cakebuild.net - #> [CmdletBinding()] Param( - [string]$Script = "build.cake", + [string]$Script = "setup.cake", [string]$Target = "Default", [ValidateSet("Release", "Debug")] [string]$Configuration = "Release", @@ -50,7 +45,6 @@ Param( [Alias("DryRun","Noop")] [switch]$WhatIf, [switch]$Mono, - [switch]$NetCoreOnly, [switch]$SkipToolPackageRestore, [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] [string[]]$ScriptArgs @@ -131,7 +125,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 $_ -PathType Container) } + $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_) } $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1 if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) { Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)." @@ -166,7 +160,7 @@ if(-Not $SkipToolPackageRestore.IsPresent) { } Write-Verbose -Message "Restoring tools from NuGet..." - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" + $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -PreRelease -OutputDirectory `"$TOOLS_DIR`" -Source https://www.myget.org/F/cake/api/v3/index.json" if ($LASTEXITCODE -ne 0) { Throw "An error occured while restoring NuGet tools." @@ -183,12 +177,8 @@ if(-Not $SkipToolPackageRestore.IsPresent) { if (!(Test-Path $CAKE_EXE)) { Throw "Could not find Cake.exe at $CAKE_EXE" } -$COMPILE_NET_CORE_ONLY='false' -if ($NetCoreOnly.IsPresent) { - $COMPILE_NET_CORE_ONLY='true' -} # Start Cake Write-Host "Running build script..." -Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" -netcoreonly=`"$COMPILE_NET_CORE_ONLY`" $UseMono $UseDryRun $UseExperimental $ScriptArgs" -exit $LASTEXITCODE +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..73a01f4 --- /dev/null +++ b/setup.cake @@ -0,0 +1,48 @@ +#load "nuget:https://www.myget.org/F/wormie-nugets/api/v2?package=Cake.Recipe&prerelease" + +Environment.SetVariableNames(); + +BuildParameters.SetParameters( + context: Context, + buildSystem: BuildSystem, + sourceDirectoryPath: "./src", + title: "Cake.Transifex", + repositoryOwner: "WormieCorp", + repositoryName: "Cake.Transifex", + appVeyorAccountName: "AdmiringWorm", + shouldRunDotNetCorePack: true, + shouldBuildNugetSourcePackage: true, + solutionFilePath: "./Cake.Transifex.sln" +); + +ToolSettings.SetToolSettings( + context: Context, + dupFinderExcludePattern: new string[] { + BuildParameters.RootDirectoryPath + "/src/*.Tests/**/*.cs" + }, + dupFinderExcludeFilesByStartingCommentSubstring: new string[] { + "" + }, + testCoverageFilter: "+[Cake.Transifex*]* -[*.Tests]*", + testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*", + testCoverageExcludeByFile: "*Designer.cs;*.g.cs;*.g.i.cs" +); + +BuildParameters.PrintParameters(Context); + +// We want to override the creation of release notes +// when the following is true: +// We are running on appveyor +// We are inside the Main Repository +// We are on the main branch +// And we're not using a tagged branch +if (BuildParameters.IsRunningOnAppVeyor) { + BuildParameters.Tasks.CreateReleaseNotesTask + .WithCriteria(() => BuildParameters.IsMainRepository + && BuildParameters.IsMasterBranch + && !BuildParameters.IsTagged); + BuildParameters.Tasks.ExportReleaseNotesTask + .IsDependentOn(BuildParameters.Tasks.CreateReleaseNotesTask); +} + +Build.RunDotNetCore(); diff --git a/tests/Cake.Transifex.Tests/Cake.Transifex.Tests.csproj b/src/Cake.Transifex.Tests/Cake.Transifex.Tests.csproj similarity index 100% rename from tests/Cake.Transifex.Tests/Cake.Transifex.Tests.csproj rename to src/Cake.Transifex.Tests/Cake.Transifex.Tests.csproj diff --git a/tests/Cake.Transifex.Tests/TransifexPullRunnerTests.cs b/src/Cake.Transifex.Tests/TransifexPullRunnerTests.cs similarity index 100% rename from tests/Cake.Transifex.Tests/TransifexPullRunnerTests.cs rename to src/Cake.Transifex.Tests/TransifexPullRunnerTests.cs diff --git a/tests/Cake.Transifex.Tests/TransifexPushRunnerTests.cs b/src/Cake.Transifex.Tests/TransifexPushRunnerTests.cs similarity index 100% rename from tests/Cake.Transifex.Tests/TransifexPushRunnerTests.cs rename to src/Cake.Transifex.Tests/TransifexPushRunnerTests.cs diff --git a/tests/Cake.Transifex.Tests/TransifexRunnerAlisesTests.cs b/src/Cake.Transifex.Tests/TransifexRunnerAlisesTests.cs similarity index 100% rename from tests/Cake.Transifex.Tests/TransifexRunnerAlisesTests.cs rename to src/Cake.Transifex.Tests/TransifexRunnerAlisesTests.cs diff --git a/tests/Cake.Transifex.Tests/TransifexRunnerFixture.cs b/src/Cake.Transifex.Tests/TransifexRunnerFixture.cs similarity index 100% rename from tests/Cake.Transifex.Tests/TransifexRunnerFixture.cs rename to src/Cake.Transifex.Tests/TransifexRunnerFixture.cs diff --git a/tests/Cake.Transifex.Tests/TransifexStatusRunnerTests.cs b/src/Cake.Transifex.Tests/TransifexStatusRunnerTests.cs similarity index 100% rename from tests/Cake.Transifex.Tests/TransifexStatusRunnerTests.cs rename to src/Cake.Transifex.Tests/TransifexStatusRunnerTests.cs diff --git a/src/Cake.Transifex/Cake.Transifex.csproj b/src/Cake.Transifex/Cake.Transifex.csproj index e3e89a2..a898e64 100644 --- a/src/Cake.Transifex/Cake.Transifex.csproj +++ b/src/Cake.Transifex/Cake.Transifex.csproj @@ -10,7 +10,7 @@ bin\$(Configuration)\$(TargetFramework)\Cake.Transifex.xml 7 pdbonly - True + False Kim Nordmo @@ -25,6 +25,7 @@ To install the transifex client, install python, then run `pip install transifex git cake build transifex localization True + $(RepositoryUrl)/releases/tag/$(Version) diff --git a/tools/packages.config b/tools/packages.config index a4d70bc..9aea4ae 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -1,4 +1,4 @@ - +