Skip to content

Commit 29dc206

Browse files
committed
initial
1 parent 9c9370c commit 29dc206

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1561
-0
lines changed

.build/.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[*.cs]
2+
dotnet_style_qualification_for_field = false:warning
3+
dotnet_style_qualification_for_property = false:warning
4+
dotnet_style_qualification_for_method = false:warning
5+
dotnet_style_qualification_for_event = false:warning
6+
dotnet_style_require_accessibility_modifiers = never:warning
7+
8+
csharp_style_expression_bodied_methods = true:silent
9+
csharp_style_expression_bodied_properties = true:warning
10+
csharp_style_expression_bodied_indexers = true:warning
11+
csharp_style_expression_bodied_accessors = true:warning

.build/Build.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System;
2+
using System.Linq;
3+
using Nuke.Common;
4+
using Nuke.Common.CI;
5+
using Nuke.Common.Execution;
6+
using Nuke.Common.IO;
7+
using Nuke.Common.ProjectModel;
8+
using Nuke.Common.Tooling;
9+
using Nuke.Common.Utilities.Collections;
10+
using static Nuke.Common.EnvironmentInfo;
11+
using static Nuke.Common.IO.FileSystemTasks;
12+
using static Nuke.Common.IO.PathConstruction;
13+
14+
class Build : NukeBuild
15+
{
16+
/// Support plugins are available for:
17+
/// - JetBrains ReSharper https://nuke.build/resharper
18+
/// - JetBrains Rider https://nuke.build/rider
19+
/// - Microsoft VisualStudio https://nuke.build/visualstudio
20+
/// - Microsoft VSCode https://nuke.build/vscode
21+
22+
public static int Main () => Execute<Build>(x => x.Compile);
23+
24+
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
25+
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
26+
27+
Target Clean => _ => _
28+
.Before(Restore)
29+
.Executes(() =>
30+
{
31+
});
32+
33+
Target Restore => _ => _
34+
.Executes(() =>
35+
{
36+
});
37+
38+
Target Compile => _ => _
39+
.DependsOn(Restore)
40+
.Executes(() =>
41+
{
42+
});
43+
44+
}

.build/Builder.Shared.csproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace></RootNamespace>
7+
<NoWarn>CS0649;CS0169;CA1050;CA1822;CA2211;IDE1006</NoWarn>
8+
<NukeRootDirectory>..</NukeRootDirectory>
9+
<NukeScriptDirectory>..</NukeScriptDirectory>
10+
<NukeTelemetryVersion>1</NukeTelemetryVersion>
11+
<IsPackable>false</IsPackable>
12+
</PropertyGroup>
13+
14+
<ItemGroup>
15+
<PackageReference Include="Nuke.Common" Version="8.1.2" />
16+
</ItemGroup>
17+
18+
</Project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<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">
2+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=HeapView_002EDelegateAllocation/@EntryIndexedValue">DO_NOT_SHOW</s:String>
3+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=VariableHidesOuterVariable/@EntryIndexedValue">DO_NOT_SHOW</s:String>
4+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ClassNeverInstantiated_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
5+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MemberCanBeMadeStatic_002ELocal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
6+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=InterpolatedStringExpressionIsNotIFormattable/@EntryIndexedValue">DO_NOT_SHOW</s:String>
7+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_INTERNAL_MODIFIER/@EntryValue">Implicit</s:String>
8+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_PRIVATE_MODIFIER/@EntryValue">Implicit</s:String>
9+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/METHOD_OR_OPERATOR_BODY/@EntryValue">ExpressionBody</s:String>
10+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ThisQualifier/INSTANCE_MEMBERS_QUALIFY_MEMBERS/@EntryValue">0</s:String>
11+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
12+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_USER_LINEBREAKS/@EntryValue">True</s:Boolean>
13+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_INVOCATION_LPAR/@EntryValue">False</s:Boolean>
14+
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/MAX_ATTRIBUTE_LENGTH_FOR_SAME_LINE/@EntryValue">120</s:Int64>
15+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">IF_OWNER_IS_SINGLE_LINE</s:String>
16+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARGUMENTS_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
17+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
18+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
19+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
20+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
21+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
22+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
23+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
24+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
25+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
26+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
27+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
28+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
29+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
30+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
31+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

.build/Configuration.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.ComponentModel;
3+
using System.Linq;
4+
using Nuke.Common.Tooling;
5+
6+
[TypeConverter(typeof(TypeConverter<Configuration>))]
7+
public class Configuration : Enumeration
8+
{
9+
public static Configuration Debug = new Configuration { Value = nameof(Debug) };
10+
public static Configuration Release = new Configuration { Value = nameof(Release) };
11+
12+
public static implicit operator string(Configuration configuration)
13+
{
14+
return configuration.Value;
15+
}
16+
}

.build/Directory.Build.props

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<!-- This file prevents unintended imports of unrelated MSBuild files -->
5+
<!-- Uncomment to include parent Directory.Build.props file -->
6+
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />-->
7+
8+
</Project>

.build/Directory.Build.targets

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<!-- This file prevents unintended imports of unrelated MSBuild files -->
5+
<!-- Uncomment to include parent Directory.Build.targets file -->
6+
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />-->
7+
8+
</Project>

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Common settings
2+
.vs/
3+
.vscode/
4+
.idea
5+
.nuke/
6+
[Bb]in/
7+
[Oo]bj/
8+
packages/
9+
_ReSharper*/
10+
_dotCover*/
11+
node_modules/
12+
*.suo
13+
*.user
14+
*.sln.docstates
15+
riderModule.iml
16+
17+
# local settings
18+
*.local.*
19+
.local/
20+
_temp/

RestApia.Shared.sln

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RestApia.Shared", "src\RestApia.Shared\RestApia.Shared.csproj", "{BF1B9820-AB0D-77E6-5027-0C003EAE48D0}"
4+
EndProject
5+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{E2CF6B65-E284-39DA-C77D-4FDAB55B16AD}"
6+
EndProject
7+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RestApia.Extensions.Auth.Basic", "src\Extensions\RestApia.Extensions.Auth.Basic\RestApia.Extensions.Auth.Basic.csproj", "{9B2C67A1-83B9-157D-5EAF-ADD07B0E8D3F}"
8+
EndProject
9+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RestApia.Extensions.Auth.OAuth2", "src\Extensions\RestApia.Extensions.Auth.OAuth2\RestApia.Extensions.Auth.OAuth2.csproj", "{AE97EEF8-CE4E-0976-B0FB-8C4FC7616E01}"
10+
EndProject
11+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Builder.Shared", ".build\Builder.Shared.csproj", "{EF392B68-6342-4290-AC77-287603D43A0B}"
12+
EndProject
13+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{D8C602A6-0B21-4230-98F2-A2BEBEEA783C}"
14+
EndProject
15+
Global
16+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
17+
Debug|Any CPU = Debug|Any CPU
18+
Release|Any CPU = Release|Any CPU
19+
EndGlobalSection
20+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
21+
{EF392B68-6342-4290-AC77-287603D43A0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22+
{EF392B68-6342-4290-AC77-287603D43A0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{BF1B9820-AB0D-77E6-5027-0C003EAE48D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24+
{BF1B9820-AB0D-77E6-5027-0C003EAE48D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
25+
{BF1B9820-AB0D-77E6-5027-0C003EAE48D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
26+
{BF1B9820-AB0D-77E6-5027-0C003EAE48D0}.Release|Any CPU.Build.0 = Release|Any CPU
27+
{9B2C67A1-83B9-157D-5EAF-ADD07B0E8D3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
28+
{9B2C67A1-83B9-157D-5EAF-ADD07B0E8D3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
29+
{9B2C67A1-83B9-157D-5EAF-ADD07B0E8D3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
30+
{9B2C67A1-83B9-157D-5EAF-ADD07B0E8D3F}.Release|Any CPU.Build.0 = Release|Any CPU
31+
{AE97EEF8-CE4E-0976-B0FB-8C4FC7616E01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
32+
{AE97EEF8-CE4E-0976-B0FB-8C4FC7616E01}.Debug|Any CPU.Build.0 = Debug|Any CPU
33+
{AE97EEF8-CE4E-0976-B0FB-8C4FC7616E01}.Release|Any CPU.ActiveCfg = Release|Any CPU
34+
{AE97EEF8-CE4E-0976-B0FB-8C4FC7616E01}.Release|Any CPU.Build.0 = Release|Any CPU
35+
EndGlobalSection
36+
GlobalSection(NestedProjects) = preSolution
37+
{9B2C67A1-83B9-157D-5EAF-ADD07B0E8D3F} = {E2CF6B65-E284-39DA-C77D-4FDAB55B16AD}
38+
{AE97EEF8-CE4E-0976-B0FB-8C4FC7616E01} = {E2CF6B65-E284-39DA-C77D-4FDAB55B16AD}
39+
{EF392B68-6342-4290-AC77-287603D43A0B} = {D8C602A6-0B21-4230-98F2-A2BEBEEA783C}
40+
EndGlobalSection
41+
EndGlobal

build.cmd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:; set -eo pipefail
2+
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
3+
:; ${SCRIPT_DIR}/build.sh "$@"
4+
:; exit $?
5+
6+
@ECHO OFF
7+
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %*

build.ps1

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
[CmdletBinding()]
2+
Param(
3+
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
4+
[string[]]$BuildArguments
5+
)
6+
7+
Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)"
8+
9+
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 }
10+
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
11+
12+
###########################################################################
13+
# CONFIGURATION
14+
###########################################################################
15+
16+
$BuildProjectFile = "$PSScriptRoot\.build\Builder.Shared.csproj"
17+
$TempDirectory = "$PSScriptRoot\\.nuke\temp"
18+
19+
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
20+
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
21+
$DotNetChannel = "STS"
22+
23+
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
24+
$env:DOTNET_NOLOGO = 1
25+
26+
###########################################################################
27+
# EXECUTION
28+
###########################################################################
29+
30+
function ExecSafe([scriptblock] $cmd) {
31+
& $cmd
32+
if ($LASTEXITCODE) { exit $LASTEXITCODE }
33+
}
34+
35+
# If dotnet CLI is installed globally and it matches requested version, use for execution
36+
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
37+
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
38+
$env:DOTNET_EXE = (Get-Command "dotnet").Path
39+
}
40+
else {
41+
# Download install script
42+
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
43+
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
44+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
45+
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
46+
47+
# If global.json exists, load expected version
48+
if (Test-Path $DotNetGlobalFile) {
49+
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
50+
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
51+
$DotNetVersion = $DotNetGlobal.sdk.version
52+
}
53+
}
54+
55+
# Install by channel or version
56+
$DotNetDirectory = "$TempDirectory\dotnet-win"
57+
if (!(Test-Path variable:DotNetVersion)) {
58+
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
59+
} else {
60+
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
61+
}
62+
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
63+
$env:PATH = "$DotNetDirectory;$env:PATH"
64+
}
65+
66+
Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"
67+
68+
if (Test-Path env:NUKE_ENTERPRISE_TOKEN) {
69+
& $env:DOTNET_EXE nuget remove source "nuke-enterprise" > $null
70+
& $env:DOTNET_EXE nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password $env:NUKE_ENTERPRISE_TOKEN > $null
71+
}
72+
73+
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
74+
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }

build.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env bash
2+
3+
bash --version 2>&1 | head -n 1
4+
5+
set -eo pipefail
6+
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
7+
8+
###########################################################################
9+
# CONFIGURATION
10+
###########################################################################
11+
12+
BUILD_PROJECT_FILE="$SCRIPT_DIR/.build/Builder.Shared.csproj"
13+
TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"
14+
15+
DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
16+
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
17+
DOTNET_CHANNEL="STS"
18+
19+
export DOTNET_CLI_TELEMETRY_OPTOUT=1
20+
export DOTNET_NOLOGO=1
21+
22+
###########################################################################
23+
# EXECUTION
24+
###########################################################################
25+
26+
function FirstJsonValue {
27+
perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}"
28+
}
29+
30+
# If dotnet CLI is installed globally and it matches requested version, use for execution
31+
if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then
32+
export DOTNET_EXE="$(command -v dotnet)"
33+
else
34+
# Download install script
35+
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
36+
mkdir -p "$TEMP_DIRECTORY"
37+
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
38+
chmod +x "$DOTNET_INSTALL_FILE"
39+
40+
# If global.json exists, load expected version
41+
if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then
42+
DOTNET_VERSION=$(FirstJsonValue "version" "$(cat "$DOTNET_GLOBAL_FILE")")
43+
if [[ "$DOTNET_VERSION" == "" ]]; then
44+
unset DOTNET_VERSION
45+
fi
46+
fi
47+
48+
# Install by channel or version
49+
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
50+
if [[ -z ${DOTNET_VERSION+x} ]]; then
51+
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path
52+
else
53+
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
54+
fi
55+
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
56+
export PATH="$DOTNET_DIRECTORY:$PATH"
57+
fi
58+
59+
echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"
60+
61+
if [[ ! -z ${NUKE_ENTERPRISE_TOKEN+x} && "$NUKE_ENTERPRISE_TOKEN" != "" ]]; then
62+
"$DOTNET_EXE" nuget remove source "nuke-enterprise" &>/dev/null || true
63+
"$DOTNET_EXE" nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password "$NUKE_ENTERPRISE_TOKEN" --store-password-in-clear-text &>/dev/null || true
64+
fi
65+
66+
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
67+
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"

0 commit comments

Comments
 (0)