Skip to content

Commit

Permalink
Use NUKE Build instead of PowerShell scripts for automation
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgDangl committed Mar 19, 2018
1 parent 7c392e1 commit ec07554
Show file tree
Hide file tree
Showing 23 changed files with 565 additions and 241 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,4 @@ generated_docs/**/*
docs.zip

docs/docfx.console.**/*
output/
1 change: 1 addition & 0 deletions .nuke
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dangl.Calculator.sln
31 changes: 0 additions & 31 deletions AppendxUnitFramework.ps1

This file was deleted.

16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

All notable changes to **Dangl.Calculator** are documented here.

## v1.0.6
- Add `netstandard2.0` target
- Switch build system to NUKE

## v1.0.5
- Downgrade to netstandard1.1 and net45 for broader compatibility

## v1.0.4
- Update ANTLR to latest version

## v1.0.3
- Target NETStandard 1.3
11 changes: 11 additions & 0 deletions Dangl.Calculator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = ".build", "build\.build.csproj", "{FCAE6E2B-0767-4A72-9011-523D79095BCA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{14D9A542-33AB-4BA0-9406-EEC4CCA998CF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{28154CDD-0EDC-4658-9DBA-B02D5366AC2F}"
ProjectSection(SolutionItems) = preProject
CHANGELOG.md = CHANGELOG.md
docfx.json = docfx.json
GitVersion.yml = GitVersion.yml
LICENSE.md = LICENSE.md
README.md = README.md
TestsAndCoverage.ps1 = TestsAndCoverage.ps1
toc.yml = toc.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{6AEF004B-5B69-431F-9930-9A8B431945F3}"
Expand All @@ -24,6 +30,8 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FCAE6E2B-0767-4A72-9011-523D79095BCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FCAE6E2B-0767-4A72-9011-523D79095BCA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6ADBFC78-3CC4-4CAC-BFEB-ADE2BCB52BF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6ADBFC78-3CC4-4CAC-BFEB-ADE2BCB52BF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6ADBFC78-3CC4-4CAC-BFEB-ADE2BCB52BF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -40,4 +48,7 @@ Global
{6ADBFC78-3CC4-4CAC-BFEB-ADE2BCB52BF4} = {14D9A542-33AB-4BA0-9406-EEC4CCA998CF}
{621BFED8-ECD1-4B9B-9216-9648EA889ABC} = {6AEF004B-5B69-431F-9930-9A8B431945F3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B58C156B-CD25-4485-8E18-BED3AF1AF434}
EndGlobalSection
EndGlobal
47 changes: 0 additions & 47 deletions GenerateAndDeployDocs.ps1

This file was deleted.

10 changes: 10 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch

branches:
master:
regex: (origin/)?master
develop:
increment: Patch
tag: beta
regex: (origin/)?dev(elop)?(ment)?$
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
[![NuGet](https://img.shields.io/nuget/v/Dangl.Calculator.svg)](https://www.nuget.org/packages/Dangl.Calculator)
[![MyGet](https://img.shields.io/myget/dangl/v/Dangl.Calculator.svg)]()

[Online Documentation](https://docs.dangl-it.com/Projects/Dangl.Calculator)
[![Built with Nuke](http://nuke.build/rounded)](https://www.nuke.build)

[Online Documentation](https://docs.dangl-it.com/Projects/Dangl.Calculator)
[Changelog](./CHANGELOG.md)

This calculator is using the [ANTLR4 C# target](https://github.com/tunnelvisionlabs/antlr4cs)
to calculate results from formulas that are passed in as string.
Expand Down
57 changes: 0 additions & 57 deletions TestsAndCoverage.ps1

This file was deleted.

File renamed without changes
2 changes: 2 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
powershell %0\..\build.ps1 %*
54 changes: 54 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[CmdletBinding()]
Param(
[switch]$NoInit,
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$BuildArguments
)

Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { $host.SetShouldExit(1) }
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent

###########################################################################
# CONFIGURATION
###########################################################################

$DotNetChannel = "2.0"
$BuildProjectFile = "$PSScriptRoot\.\build\.build.csproj"

$TempDirectory = "$PSScriptRoot\.\.tmp"

$DotNetScriptUrl = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1"
$DotNetDirectory = "$TempDirectory\dotnet-win"
$DotNetFile = "$DotNetDirectory\dotnet.exe"
$env:DOTNET_EXE = $DotNetFile

$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
$env:NUGET_XMLDOC_MODE = "skip"

###########################################################################
# PREPARE BUILD
###########################################################################

function ExecSafe([scriptblock] $cmd) {
& $cmd
if ($LastExitCode -ne 0) { throw "The following call failed with exit code $LastExitCode. '$cmd'" }
}

if (!$NoInit) {
md -force $DotNetDirectory > $null

$DotNetScriptFile = "$TempDirectory\dotnet-install.ps1"
if (!(Test-Path $DotNetScriptFile)) { (New-Object System.Net.WebClient).DownloadFile($DotNetScriptUrl, $DotNetScriptFile) }
ExecSafe { & $DotNetScriptFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }

ExecSafe { & $DotNetFile restore $BuildProjectFile }
}

ExecSafe { & $DotNetFile build $BuildProjectFile --no-restore }

###########################################################################
# EXECUTE BUILD
###########################################################################

ExecSafe { & $DotNetFile run --project $BuildProjectFile --no-build -- $BuildArguments }
54 changes: 54 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

NOINIT=0
BUILD_ARGUMENTS=()
for i in "$@"; do
case $(echo $1 | awk '{print tolower($0)}') in
-noinit) NOINIT=1;;
*) BUILD_ARGUMENTS+=("$1") ;;
esac
shift
done

set -eo pipefail
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)

###########################################################################
# CONFIGURATION
###########################################################################

DOTNET_CHANNEL="2.0"
BUILD_PROJECT_FILE="$SCRIPT_DIR/./build/.build.csproj"

TEMP_DIRECTORY="$SCRIPT_DIR/./.tmp"

DOTNET_SCRIPT_URL="https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh"
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
DOTNET_FILE="$DOTNET_DIRECTORY/dotnet"
export DOTNET_EXE="$DOTNET_FILE"

export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export NUGET_XMLDOC_MODE="skip"

###########################################################################
# PREPARE BUILD
###########################################################################

if ! ((NOINIT)); then
mkdir -p "$DOTNET_DIRECTORY"

DOTNET_SCRIPT_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
if [ ! -f "$DOTNET_SCRIPT_FILE" ]; then curl -Lsfo "$DOTNET_SCRIPT_FILE" $DOTNET_SCRIPT_URL; chmod +x "$DOTNET_SCRIPT_FILE"; fi
"$DOTNET_SCRIPT_FILE" --install-dir "$DOTNET_DIRECTORY" --channel 2.0 --no-path

"$DOTNET_FILE" restore "$BUILD_PROJECT_FILE"
fi

"$DOTNET_FILE" build "$BUILD_PROJECT_FILE" --no-restore

###########################################################################
# EXECUTE BUILD
###########################################################################

"$DOTNET_FILE" run --project "$BUILD_PROJECT_FILE" --no-build -- ${BUILD_ARGUMENTS[@]}
35 changes: 35 additions & 0 deletions build/.build.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RootNamespace></RootNamespace>
<IsPackable>False</IsPackable>
<NoWarn>CS0649;CS0169</NoWarn>

<!-- NUKE CONFIGURATION -->
<NukeVersion>0.2.26</NukeVersion>
<NukeCodeGeneration>False</NukeCodeGeneration>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dangl.Nuke.CoberturaConverter" Version="1.0.1" />
<PackageReference Include="Nuke.Common" Version="$(NukeVersion)" />
<PackageReference Include="Nuke.CodeGeneration" Version="$(NukeVersion)" Condition="'$(NukeCodeGeneration)' == 'True'" />
<PackageReference Include="GitVersion.CommandLine" Version="4.0.0-beta0012" />
<PackageReference Include="Nuke.WebDocu" Version="1.0.2" />
<PackageReference Include="Nuke.GitHub" Version="1.0.2" />
<PackageReference Include="JetBrains.dotCover.CommandLineTools" Version="2018.1.0-eap01" />
<PackageReference Include="ReportGenerator" Version="3.1.2" />
<PackageReference Include="docfx.console" Version="2.31.0">
<ExcludeAssets>build</ExcludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<NukeMetadata Include="**/*.json" Exclude="bin/**;obj/**" />
<None Remove="*.csproj.DotSettings;*.ref.*.txt" />
</ItemGroup>

</Project>
23 changes: 23 additions & 0 deletions build/.build.csproj.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/ImplicitNullability/EnableFields/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_INTERNAL_MODIFIER/@EntryValue">Implicit</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_PRIVATE_MODIFIER/@EntryValue">Implicit</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/METHOD_OR_OPERATOR_BODY/@EntryValue">ExpressionBody</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ThisQualifier/INSTANCE_MEMBERS_QUALIFY_MEMBERS/@EntryValue">0</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_USER_LINEBREAKS/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_INVOCATION_LPAR/@EntryValue">False</s:Boolean>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/MAX_ATTRIBUTE_LENGTH_FOR_SAME_LINE/@EntryValue">120</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">IF_OWNER_IS_SINGLE_LINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARGUMENTS_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Loading

0 comments on commit ec07554

Please sign in to comment.