Skip to content

Commit

Permalink
Add Nuke build system
Browse files Browse the repository at this point in the history
Will be amended as necessary before pushing public, but a commit while this at least partially works seems wise.
  • Loading branch information
ItEndsWithTens committed Dec 29, 2018
1 parent 0c58519 commit 795f325
Show file tree
Hide file tree
Showing 121 changed files with 875 additions and 107 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ dotnet_style_prefer_auto_properties = true
dotnet_style_coalesce_expression = true
dotnet_style_null_propagation = true

[*.csproj]
[*.{csproj,props,targets}]

indent_style = space
indent_size = 2
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ MigrationBackup/
# design plans, a todo list, and general notes. Useful, but not for the repo.
scratch/

staging/

# J.A.C.K. backups of .map files
*.max

Expand Down Expand Up @@ -265,6 +267,9 @@ paket-files/
# Re-include dependencies otherwise excluded by the above.
!lib/**

tools/*
!tools/packages.config

# =========================
# Operating System Files
# =========================
Expand Down
Empty file added .nuke
Empty file.
6 changes: 0 additions & 6 deletions Arbatel.Gtk/App.config

This file was deleted.

44 changes: 36 additions & 8 deletions Arbatel.sln
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Arbatel.Core", "Arbatel.Core\Arbatel.Core.csproj", "{A5FFC3A4-78CA-44F2-B8A8-F18DADF1690A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Arbatel.Core", "src\Arbatel.Core\Arbatel.Core.csproj", "{A5FFC3A4-78CA-44F2-B8A8-F18DADF1690A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Arbatel.WinForms", "Arbatel.WinForms\Arbatel.WinForms.csproj", "{4925B6D7-8B10-43D7-8CA9-D7A03B2B622E}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Arbatel.WinForms", "src\gui\Arbatel.WinForms\Arbatel.WinForms.csproj", "{4925B6D7-8B10-43D7-8CA9-D7A03B2B622E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArbatelTest.Core", "ArbatelTest.Core\ArbatelTest.Core.csproj", "{4B4E25A8-B7D3-420D-8193-1785E0528D5E}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArbatelTest.Core", "test\src\ArbatelTest.Core\ArbatelTest.Core.csproj", "{4B4E25A8-B7D3-420D-8193-1785E0528D5E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Arbatel.Wpf", "Arbatel.Wpf\Arbatel.Wpf.csproj", "{63B65D5D-D3F6-4C18-B4B4-75A0DFEEE635}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Arbatel.Wpf", "src\gui\Arbatel.Wpf\Arbatel.Wpf.csproj", "{63B65D5D-D3F6-4C18-B4B4-75A0DFEEE635}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Arbatel.Mac", "Arbatel.Mac\Arbatel.Mac.csproj", "{82126DF9-6E7A-4DB4-8C78-7406786CC70C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Arbatel.Mac", "src\gui\Arbatel.Mac\Arbatel.Mac.csproj", "{82126DF9-6E7A-4DB4-8C78-7406786CC70C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Arbatel.Gtk", "Arbatel.Gtk\Arbatel.Gtk.csproj", "{94AE77B4-896E-4184-B351-A2E35F98535E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Arbatel.Gtk", "src\gui\Arbatel.Gtk\Arbatel.Gtk.csproj", "{94AE77B4-896E-4184-B351-A2E35F98535E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Arbatel.XamMac", "Arbatel.XamMac\Arbatel.XamMac.csproj", "{73F11BF1-A18D-4091-B451-C884FDDD922F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Arbatel.XamMac", "src\gui\Arbatel.XamMac\Arbatel.XamMac.csproj", "{73F11BF1-A18D-4091-B451-C884FDDD922F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{16A799F0-6BE4-430B-9D9C-2645193C7ED3}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "common", "common", "{16A799F0-6BE4-430B-9D9C-2645193C7ED3}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{25570A55-7D75-4A24-84C1-864BBB2A0545}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gui", "gui", "{697D0DF3-4FE0-49DC-828E-60A3898F2368}"
ProjectSection(SolutionItems) = preProject
src\gui\Directory.Build.targets = src\gui\Directory.Build.targets
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{9E70FBE8-83E7-49E5-9495-626693C6D26A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0CA443D2-1B96-46DE-A904-AF9E2E8A5731}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -55,10 +69,24 @@ Global
{73F11BF1-A18D-4091-B451-C884FDDD922F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73F11BF1-A18D-4091-B451-C884FDDD922F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73F11BF1-A18D-4091-B451-C884FDDD922F}.Release|Any CPU.Build.0 = Release|Any CPU
{25570A55-7D75-4A24-84C1-864BBB2A0545}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25570A55-7D75-4A24-84C1-864BBB2A0545}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25570A55-7D75-4A24-84C1-864BBB2A0545}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25570A55-7D75-4A24-84C1-864BBB2A0545}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A5FFC3A4-78CA-44F2-B8A8-F18DADF1690A} = {9E70FBE8-83E7-49E5-9495-626693C6D26A}
{4925B6D7-8B10-43D7-8CA9-D7A03B2B622E} = {697D0DF3-4FE0-49DC-828E-60A3898F2368}
{4B4E25A8-B7D3-420D-8193-1785E0528D5E} = {0CA443D2-1B96-46DE-A904-AF9E2E8A5731}
{63B65D5D-D3F6-4C18-B4B4-75A0DFEEE635} = {697D0DF3-4FE0-49DC-828E-60A3898F2368}
{82126DF9-6E7A-4DB4-8C78-7406786CC70C} = {697D0DF3-4FE0-49DC-828E-60A3898F2368}
{94AE77B4-896E-4184-B351-A2E35F98535E} = {697D0DF3-4FE0-49DC-828E-60A3898F2368}
{73F11BF1-A18D-4091-B451-C884FDDD922F} = {697D0DF3-4FE0-49DC-828E-60A3898F2368}
{25570A55-7D75-4A24-84C1-864BBB2A0545} = {16A799F0-6BE4-430B-9D9C-2645193C7ED3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3C1D08AD-2C29-462B-BE50-224C00AC61D4}
EndGlobalSection
Expand Down
20 changes: 20 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<BuildOS Condition="$([MSBuild]::IsOsPlatform(`Windows`)) == true">Windows</BuildOS>
<BuildOS Condition="$([MSBuild]::IsOsPlatform(`Linux`)) == true">Linux</BuildOS>
<BuildOS Condition="$([MSBuild]::IsOsPlatform(`OSX`)) == true">macOS</BuildOS>
</PropertyGroup>

<PropertyGroup>
<AssemblyVersion>0.1.0</AssemblyVersion>
<Company>Big Dumb Idiot</Company>
<Copyright>Copyright © 2018</Copyright>
<Product>Arbatel</Product>
</PropertyGroup>

<PropertyGroup>
<Deterministic>true</Deterministic>
</PropertyGroup>

</Project>
20 changes: 20 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!--
<Target Name="Clean">
<RemoveDir Directories="$(OutputPath)" />
</Target>
<ItemGroup>
<Blobus Include="$(OutputPath)\*" />
</ItemGroup>
<Target Name="Package">
<Message Text="$(MSBuildThisFileDirectory)" />
<Zip
Files="@(Blobus)"
WorkingDirectory="$(OutputPath)"
ZipFileName="$(OutputPath)\CrystalsOfGringief.zip" />
</Target>-->

</Project>
24 changes: 0 additions & 24 deletions SharedAssemblyInfo.cs

This file was deleted.

69 changes: 69 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[CmdletBinding()]
Param(
#[switch]$CustomParam,
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$BuildArguments
)

Write-Output "Windows PowerShell $($Host.Version)"

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

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

$BuildProjectFile = "$PSScriptRoot\build\_build.csproj"
$TempDirectory = "$PSScriptRoot\\.tmp"

$DotNetGlobalFile = "$PSScriptRoot\\global.json"
$DotNetInstallUrl = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1"
$DotNetChannel = "Current"

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

###########################################################################
# EXECUTION
###########################################################################

function ExecSafe([scriptblock] $cmd) {
& $cmd
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}

# If global.json exists, load expected version
if (Test-Path $DotNetGlobalFile) {
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
$DotNetVersion = $DotNetGlobal.sdk.version
}
}

# If dotnet is installed locally, and expected version is not set or installation matches the expected version
if ((Get-Command "dotnet" -ErrorAction SilentlyContinue) -ne $null -and `
(!(Test-Path variable:DotNetVersion) -or $(& dotnet --version) -eq $DotNetVersion)) {
$env:DOTNET_EXE = (Get-Command "dotnet").Path
}
else {
$DotNetDirectory = "$TempDirectory\dotnet-win"
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"

# Download install script
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
md -force $TempDirectory > $null
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)

# Install by channel or version
if (!(Test-Path variable:DotNetVersion)) {
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
} else {
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
}
}

Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"

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

echo $(bash --version 2>&1 | head -n 1)

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

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

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

BUILD_PROJECT_FILE="$SCRIPT_DIR/build/_build.csproj"
TEMP_DIRECTORY="$SCRIPT_DIR//.tmp"

DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
DOTNET_INSTALL_URL="https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh"
DOTNET_CHANNEL="Current"

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

###########################################################################
# EXECUTION
###########################################################################

function FirstJsonValue {
perl -nle 'print $1 if m{"'$1'": "([^"\-]+)",?}' <<< ${@:2}
}

# If global.json exists, load expected version
if [ -f "$DOTNET_GLOBAL_FILE" ]; then
DOTNET_VERSION=$(FirstJsonValue "version" $(cat "$DOTNET_GLOBAL_FILE"))
if [ "$DOTNET_VERSION" == "" ]; then
unset DOTNET_VERSION
fi
fi

# If dotnet is installed locally, and expected version is not set or installation matches the expected version
if [[ -x "$(command -v dotnet)" && (-z ${DOTNET_VERSION+x} || $(dotnet --version) == "$DOTNET_VERSION") ]]; then
export DOTNET_EXE="$(command -v dotnet)"
else
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"

# Download install script
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
mkdir -p "$TEMP_DIRECTORY"
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
chmod +x "$DOTNET_INSTALL_FILE"

# Install by channel or version
if [ -z ${DOTNET_VERSION+x} ]; then
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path
else
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
fi
fi

echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"

"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" -- ${BUILD_ARGUMENTS[@]}
10 changes: 10 additions & 0 deletions build/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[*.cs]
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_property = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_style_qualification_for_event = false:warning
dotnet_style_require_accessibility_modifiers = never:warning

csharp_style_expression_bodied_properties = true:warning
csharp_style_expression_bodied_indexers = true:warning
csharp_style_expression_bodied_accessors = true:warning
Loading

0 comments on commit 795f325

Please sign in to comment.