Skip to content

Commit eeea101

Browse files
committed
build: add nuke build script and move project to src dir
1 parent 0ce42df commit eeea101

Some content is hidden

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

46 files changed

+310
-66
lines changed

.nuke

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ubiety.Stringprep.Core.sln

GitVersion.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
mode: ContinuousDelivery
2+
branches: {}
3+
ignore:
4+
sha: []

Ubiety.Stringprep.Core.sln

+4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@ VisualStudioVersion = 16.0.28315.86
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ubiety.Stringprep.Core", "Ubiety.Stringprep.Core\Ubiety.Stringprep.Core.csproj", "{CC65EA4D-799E-4ECE-A0B3-23610AF6DEBB}"
77
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{4B9462B8-7C12-4FF8-B198-420A37AD1C34}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|Any CPU = Debug|Any CPU
1113
Release|Any CPU = Release|Any CPU
1214
EndGlobalSection
1315
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{4B9462B8-7C12-4FF8-B198-420A37AD1C34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{4B9462B8-7C12-4FF8-B198-420A37AD1C34}.Release|Any CPU.ActiveCfg = Release|Any CPU
1418
{CC65EA4D-799E-4ECE-A0B3-23610AF6DEBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1519
{CC65EA4D-799E-4ECE-A0B3-23610AF6DEBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
1620
{CC65EA4D-799E-4ECE-A0B3-23610AF6DEBB}.Release|Any CPU.ActiveCfg = Release|Any CPU

Ubiety.Stringprep.Core/GlobalSuppressions.cs

-27
This file was deleted.

Ubiety.Stringprep.Core/Ubiety.Stringprep.Core.ruleset

-4
This file was deleted.

Ubiety.Stringprep.Core/stylecop.json

-17
This file was deleted.

build.ps1

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
[CmdletBinding()]
2+
Param(
3+
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
4+
[string[]]$BuildArguments
5+
)
6+
7+
Write-Output "Windows PowerShell $($Host.Version)"
8+
9+
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { exit 1 }
10+
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
11+
12+
###########################################################################
13+
# CONFIGURATION
14+
###########################################################################
15+
16+
$BuildProjectFile = "$PSScriptRoot\build\_build.csproj"
17+
$TempDirectory = "$PSScriptRoot\\.tmp"
18+
19+
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
20+
$DotNetInstallUrl = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1"
21+
$DotNetChannel = "Current"
22+
23+
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
24+
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
25+
26+
###########################################################################
27+
# EXECUTION
28+
###########################################################################
29+
30+
function ExecSafe([scriptblock] $cmd) {
31+
& $cmd
32+
if ($LASTEXITCODE) { exit $LASTEXITCODE }
33+
}
34+
35+
# If global.json exists, load expected version
36+
if (Test-Path $DotNetGlobalFile) {
37+
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
38+
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
39+
$DotNetVersion = $DotNetGlobal.sdk.version
40+
}
41+
}
42+
43+
# If dotnet is installed locally, and expected version is not set or installation matches the expected version
44+
if ((Get-Command "dotnet" -ErrorAction SilentlyContinue) -ne $null -and `
45+
(!(Test-Path variable:DotNetVersion) -or $(& dotnet --version) -eq $DotNetVersion)) {
46+
$env:DOTNET_EXE = (Get-Command "dotnet").Path
47+
}
48+
else {
49+
$DotNetDirectory = "$TempDirectory\dotnet-win"
50+
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
51+
52+
# Download install script
53+
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
54+
md -force $TempDirectory > $null
55+
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
56+
57+
# Install by channel or version
58+
if (!(Test-Path variable:DotNetVersion)) {
59+
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
60+
} else {
61+
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
62+
}
63+
}
64+
65+
Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"
66+
67+
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false }
68+
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }

build.sh

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env bash
2+
3+
echo $(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/_build.csproj"
13+
TEMP_DIRECTORY="$SCRIPT_DIR//.tmp"
14+
15+
DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
16+
DOTNET_INSTALL_URL="https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh"
17+
DOTNET_CHANNEL="Current"
18+
19+
export DOTNET_CLI_TELEMETRY_OPTOUT=1
20+
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
21+
22+
###########################################################################
23+
# EXECUTION
24+
###########################################################################
25+
26+
function FirstJsonValue {
27+
perl -nle 'print $1 if m{"'$1'": "([^"\-]+)",?}' <<< ${@:2}
28+
}
29+
30+
# If global.json exists, load expected version
31+
if [ -f "$DOTNET_GLOBAL_FILE" ]; then
32+
DOTNET_VERSION=$(FirstJsonValue "version" $(cat "$DOTNET_GLOBAL_FILE"))
33+
if [ "$DOTNET_VERSION" == "" ]; then
34+
unset DOTNET_VERSION
35+
fi
36+
fi
37+
38+
# If dotnet is installed locally, and expected version is not set or installation matches the expected version
39+
if [[ -x "$(command -v dotnet)" && (-z ${DOTNET_VERSION+x} || $(dotnet --version) == "$DOTNET_VERSION") ]]; then
40+
export DOTNET_EXE="$(command -v dotnet)"
41+
else
42+
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
43+
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
44+
45+
# Download install script
46+
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
47+
mkdir -p "$TEMP_DIRECTORY"
48+
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
49+
chmod +x "$DOTNET_INSTALL_FILE"
50+
51+
# Install by channel or version
52+
if [ -z ${DOTNET_VERSION+x} ]; then
53+
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path
54+
else
55+
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
56+
fi
57+
fi
58+
59+
echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
60+
61+
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false
62+
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"

build/.editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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_properties = true:warning
9+
csharp_style_expression_bodied_indexers = true:warning
10+
csharp_style_expression_bodied_accessors = true:warning

build/Build.cs

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
using System;
2+
using System.Linq;
3+
using Nuke.Common;
4+
using Nuke.Common.Execution;
5+
using Nuke.Common.Git;
6+
using Nuke.Common.ProjectModel;
7+
using Nuke.Common.Tooling;
8+
using Nuke.Common.Tools.DotNet;
9+
using Nuke.Common.Tools.GitVersion;
10+
using Nuke.Common.Utilities.Collections;
11+
using static Nuke.Common.EnvironmentInfo;
12+
using static Nuke.Common.IO.FileSystemTasks;
13+
using static Nuke.Common.IO.PathConstruction;
14+
using static Nuke.Common.Tools.DotNet.DotNetTasks;
15+
16+
[CheckBuildProjectConfigurations]
17+
[UnsetVisualStudioEnvironmentVariables]
18+
class Build : NukeBuild
19+
{
20+
/// Support plugins are available for:
21+
/// - JetBrains ReSharper https://nuke.build/resharper
22+
/// - JetBrains Rider https://nuke.build/rider
23+
/// - Microsoft VisualStudio https://nuke.build/visualstudio
24+
/// - Microsoft VSCode https://nuke.build/vscode
25+
26+
public static int Main () => Execute<Build>(x => x.Compile);
27+
28+
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
29+
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
30+
31+
[Solution] readonly Solution Solution;
32+
[GitRepository] readonly GitRepository GitRepository;
33+
[GitVersion] readonly GitVersion GitVersion;
34+
35+
AbsolutePath SourceDirectory => RootDirectory / "src";
36+
AbsolutePath TestsDirectory => RootDirectory / "tests";
37+
AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
38+
39+
Target Clean => _ => _
40+
.Before(Restore)
41+
.Executes(() =>
42+
{
43+
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
44+
TestsDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
45+
EnsureCleanDirectory(ArtifactsDirectory);
46+
});
47+
48+
Target Restore => _ => _
49+
.Executes(() =>
50+
{
51+
DotNetRestore(s => s
52+
.SetProjectFile(Solution));
53+
});
54+
55+
Target Compile => _ => _
56+
.DependsOn(Restore)
57+
.Executes(() =>
58+
{
59+
DotNetBuild(s => s
60+
.SetProjectFile(Solution)
61+
.SetConfiguration(Configuration)
62+
.SetAssemblyVersion(GitVersion.GetNormalizedAssemblyVersion())
63+
.SetFileVersion(GitVersion.GetNormalizedFileVersion())
64+
.SetInformationalVersion(GitVersion.InformationalVersion)
65+
.EnableNoRestore());
66+
});
67+
68+
}

build/_build.csproj

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp2.0</TargetFramework>
6+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
7+
<RootNamespace></RootNamespace>
8+
<IsPackable>False</IsPackable>
9+
<NoWarn>CS0649;CS0169</NoWarn>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="Nuke.Common" Version="0.17.6" />
14+
<PackageReference Include="GitVersion.CommandLine.DotNetCore" Version="4.0.1-beta1-49" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<NukeMetadata Include="**\*.json" Exclude="bin\**;obj\**" />
19+
<NukeExternalFiles Include="**\*.*.ext" Exclude="bin\**;obj\**" />
20+
<None Remove="*.csproj.DotSettings;*.ref.*.txt" />
21+
22+
<!-- Common build related files -->
23+
<None Include="..\build.ps1" />
24+
<None Include="..\build.sh" />
25+
<None Include="..\.nuke" />
26+
<None Include="..\global.json" Condition="Exists('..\global.json')" />
27+
<None Include="..\nuget.config" Condition="Exists('..\nuget.config')" />
28+
<None Include="..\azure-pipelines.yml" Condition="Exists('..\azure-pipelines.yml')" />
29+
<None Include="..\Jenkinsfile" Condition="Exists('..\Jenkinsfile')" />
30+
<None Include="..\appveyor.yml" Condition="Exists('..\appveyor.yml')" />
31+
<None Include="..\.travis.yml" Condition="Exists('..\.travis.yml')" />
32+
<None Include="..\GitVersion.yml" Condition="Exists('..\GitVersion.yml')" />
33+
</ItemGroup>
34+
35+
</Project>

build/_build.csproj.DotSettings

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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:Boolean x:Key="/Default/CodeInspection/ImplicitNullability/EnableFields/@EntryValue">False</s:Boolean>
3+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_INTERNAL_MODIFIER/@EntryValue">Implicit</s:String>
4+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_PRIVATE_MODIFIER/@EntryValue">Implicit</s:String>
5+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/METHOD_OR_OPERATOR_BODY/@EntryValue">ExpressionBody</s:String>
6+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ThisQualifier/INSTANCE_MEMBERS_QUALIFY_MEMBERS/@EntryValue">0</s:String>
7+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
8+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_USER_LINEBREAKS/@EntryValue">True</s:Boolean>
9+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_INVOCATION_LPAR/@EntryValue">False</s:Boolean>
10+
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/MAX_ATTRIBUTE_LENGTH_FOR_SAME_LINE/@EntryValue">120</s:Int64>
11+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">IF_OWNER_IS_SINGLE_LINE</s:String>
12+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARGUMENTS_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
13+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
14+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
15+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
16+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
17+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
18+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
19+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
20+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
21+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
22+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
23+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
24+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

images/rope64.png

3.81 KB
Loading

Ubiety.Stringprep.Core/Ubiety.Stringprep.Core.csproj renamed to src/Ubiety.Stringprep.Core/Ubiety.Stringprep.Core.csproj

+3-18
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<Version>0.2.2</Version>
66
</PropertyGroup>
77

8-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
9-
<CodeAnalysisRuleSet>Ubiety.Stringprep.Core.ruleset</CodeAnalysisRuleSet>
10-
</PropertyGroup>
11-
128
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
13-
<CodeAnalysisRuleSet>Ubiety.Stringprep.Core.ruleset</CodeAnalysisRuleSet>
149
<DocumentationFile>Ubiety.Stringprep.Core.xml</DocumentationFile>
1510
</PropertyGroup>
1611

1712
<ItemGroup>
18-
<None Remove=".gitattributes" />
19-
<None Remove=".gitignore" />
20-
<None Remove="stylecop.json" />
21-
<None Remove="Ubiety.Stringprep.Core.xml" />
22-
</ItemGroup>
23-
24-
<ItemGroup>
25-
<AdditionalFiles Include="stylecop.json" />
26-
</ItemGroup>
27-
28-
<ItemGroup>
29-
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
13+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.1-rc.114">
3014
<PrivateAssets>all</PrivateAssets>
3115
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
3216
</PackageReference>
17+
<PackageReference Include="Ubiety.StyleCop" Version="0.0.5" />
3318
</ItemGroup>
3419

3520
<ItemGroup>

0 commit comments

Comments
 (0)