Skip to content

Commit

Permalink
Changed to use Cake.Recipe build scripts
Browse files Browse the repository at this point in the history
fixes #9
  • Loading branch information
AdmiringWorm committed Jul 20, 2017
1 parent 702683e commit e331ccf
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 32 deletions.
14 changes: 1 addition & 13 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,7 @@ tools/**
*.btm.cs
*.odx.cs
*.xsd.cs


# Custom
BuildArtifacts/
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cake.Transifex.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 5 additions & 15 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand All @@ -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
Expand Down Expand Up @@ -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)."
Expand Down Expand Up @@ -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."
Expand All @@ -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
48 changes: 48 additions & 0 deletions setup.cake
Original file line number Diff line number Diff line change
@@ -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[] {
"<auto-generated>"
},
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();
3 changes: 2 additions & 1 deletion src/Cake.Transifex/Cake.Transifex.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Cake.Transifex.xml</DocumentationFile>
<LangVersion>7</LangVersion>
<DebugType>pdbonly</DebugType>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<Authors>Kim Nordmo</Authors>
<Company />
<Description>
Expand All @@ -25,6 +25,7 @@ To install the transifex client, install python, then run `pip install transifex
<RepositoryType>git</RepositoryType>
<PackageTags>cake build transifex localization</PackageTags>
<IncludeSymbols>True</IncludeSymbols>
<PackageReleaseNotes>$(RepositoryUrl)/releases/tag/$(Version)</PackageReleaseNotes>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
2 changes: 1 addition & 1 deletion tools/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.19.5" />
<package id="Cake" version="0.20.0" />
</packages>

0 comments on commit e331ccf

Please sign in to comment.