Skip to content

Commit aaff6b2

Browse files
committed
rn
1 parent 5bd55ce commit aaff6b2

File tree

420 files changed

+1411
-976
lines changed

Some content is hidden

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

420 files changed

+1411
-976
lines changed

.build/Bootstrap.ps1

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
param (
2+
[string]$Action="default",
3+
[hashtable]$properties=@{},
4+
[switch]$Help
5+
)
6+
7+
$Here = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
8+
9+
Import-Module "$Here\Common"
10+
11+
Install-Chocolatey
12+
13+
Install-Psake
14+
15+
$psakeDirectory = (Resolve-Path $env:ChocolateyInstall\lib\Psake*)
16+
17+
Import-Module (Join-Path $psakeDirectory "tools\Psake.psm1")
18+
19+
if($Help)
20+
{
21+
try
22+
{
23+
Write-Host "Available build tasks:"
24+
psake -nologo -docs | Out-Host -paging
25+
}
26+
catch {}
27+
28+
return
29+
}
30+
31+
Invoke-Psake -buildFile "$Here\Default.ps1" -parameters $properties -tasklist $Action

.build/Common.psm1

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
###
2+
### Common Profile functions for all users
3+
###
4+
5+
$ErrorActionPreference = 'Stop'
6+
Set-StrictMode -Version Latest
7+
8+
$ScriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
9+
10+
$SolutionRoot = Split-Path -Parent $ScriptPath
11+
12+
$ToolsPath = Join-Path -Path $SolutionRoot -ChildPath "lib"
13+
14+
Export-ModuleMember -Variable @('ScriptPath', 'SolutionRoot', 'ToolsPath')
15+
16+
function Install-Chocolatey()
17+
{
18+
if(-not $env:ChocolateyInstall -or -not (Test-Path "$env:ChocolateyInstall"))
19+
{
20+
Write-Output "Chocolatey Not Found, Installing..."
21+
iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))
22+
}
23+
}
24+
25+
function Install-Psake()
26+
{
27+
if(!(Test-Path $env:ChocolateyInstall\lib\Psake*))
28+
{
29+
choco install psake -y
30+
}
31+
}
32+
33+
Export-ModuleMember -Function *-*

.build/default.ps1

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
$PSake.use_exit_on_error = $true
2+
3+
$Here = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
4+
5+
$SolutionRoot = (Split-Path -parent $Here)
6+
7+
$ProjectName = "Advanced.Algorithms"
8+
9+
$SolutionFile = "$SolutionRoot\$ProjectName.sln"
10+
11+
## This comes from the build server iteration
12+
if(!$BuildNumber) { $BuildNumber = $env:APPVEYOR_BUILD_NUMBER }
13+
if(!$BuildNumber) { $BuildNumber = "1"}
14+
15+
## The build configuration, i.e. Debug/Release
16+
if(!$Configuration) { $Configuration = $env:Configuration }
17+
if(!$Configuration) { $Configuration = "Release" }
18+
19+
if(!$Version) { $Version = $env:APPVEYOR_BUILD_VERSION }
20+
if(!$Version) { $Version = "1.0.$BuildNumber" }
21+
22+
if(!$Branch) { $Branch = $env:APPVEYOR_REPO_BRANCH }
23+
if(!$Branch) { $Branch = "local" }
24+
25+
if($Branch -eq "beta" ) { $Version = "$Version-beta" }
26+
27+
Import-Module "$Here\Common" -DisableNameChecking
28+
29+
$NuGet = Join-Path $SolutionRoot ".nuget\nuget.exe"
30+
31+
$MSBuild = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe"
32+
$MSBuild -replace ' ', '` '
33+
34+
35+
FormatTaskName (("-"*25) + "[{0}]" + ("-"*25))
36+
37+
Task default -depends Clean, Build, Package
38+
39+
Task Build -depends Restore-Packages{
40+
exec { . $MSBuild $SolutionFile /t:Build /v:normal /p:Configuration=$Configuration /t:restore }
41+
}
42+
43+
Task Package -depends Build {
44+
exec { . $NuGet pack "$SolutionRoot\Advanced.Algorithms\Advanced.Algorithms.nuspec" -Properties Configuration=$Configuration -OutputDirectory "$SolutionRoot" -Version "$Version" }
45+
}
46+
47+
Task Clean -depends Install-BuildTools {
48+
Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) { Remove-Item $_.fullname -Force -Recurse }
49+
exec { . $MSBuild $SolutionFile /t:Clean /v:quiet }
50+
}
51+
52+
Task Restore-Packages {
53+
exec { . dotnet restore "$SolutionRoot\Advanced.Algorithms.sln" }
54+
}
55+
56+
Task Install-MSBuild {
57+
if(!(Test-Path $MSBuild14))
58+
{
59+
cinst microsoft-build-tools -y
60+
}
61+
}
62+
63+
Task Install-BuildTools -depends Install-MSBuild

.nuget/NuGet.Config

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<configuration>
4+
<solution>
5+
<add key="disableSourceControlIntegration" value="true" />
6+
</solution>
7+
</configuration>

.nuget/NuGet.exe

4.38 MB
Binary file not shown.

.nuget/NuGet.targets

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
5+
6+
<!-- Enable the restore command to run before builds -->
7+
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
8+
9+
<!-- Property that enables building a package from a project -->
10+
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
11+
12+
<!-- Determines if package restore consent is required to restore packages -->
13+
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
14+
15+
<!-- Download NuGet.exe if it does not already exist -->
16+
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
17+
</PropertyGroup>
18+
19+
<ItemGroup Condition=" '$(PackageSources)' == '' ">
20+
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
21+
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
22+
<!--
23+
<PackageSource Include="https://www.nuget.org/api/v2/" />
24+
<PackageSource Include="https://my-nuget-source/nuget/" />
25+
-->
26+
</ItemGroup>
27+
28+
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
29+
<!-- Windows specific commands -->
30+
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
31+
</PropertyGroup>
32+
33+
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
34+
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
35+
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
36+
</PropertyGroup>
37+
38+
<PropertyGroup>
39+
<PackagesProjectConfig Condition=" '$(OS)' == 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
40+
<PackagesProjectConfig Condition=" '$(OS)' != 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesProjectConfig>
41+
</PropertyGroup>
42+
43+
<PropertyGroup>
44+
<PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
45+
<PackagesConfig Condition="Exists('$(PackagesProjectConfig)')">$(PackagesProjectConfig)</PackagesConfig>
46+
</PropertyGroup>
47+
48+
<PropertyGroup>
49+
<!-- NuGet command -->
50+
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
51+
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
52+
53+
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
54+
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 "$(NuGetExePath)"</NuGetCommand>
55+
56+
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
57+
58+
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
59+
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
60+
61+
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
62+
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
63+
64+
<!-- Commands -->
65+
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
66+
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
67+
68+
<!-- We need to ensure packages are restored prior to assembly resolve -->
69+
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
70+
RestorePackages;
71+
$(BuildDependsOn);
72+
</BuildDependsOn>
73+
74+
<!-- Make the build depend on restore packages -->
75+
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
76+
$(BuildDependsOn);
77+
BuildPackage;
78+
</BuildDependsOn>
79+
</PropertyGroup>
80+
81+
<Target Name="CheckPrerequisites">
82+
<!-- Raise an error if we're unable to locate nuget.exe -->
83+
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
84+
<!--
85+
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
86+
This effectively acts as a lock that makes sure that the download operation will only happen once and all
87+
parallel builds will have to wait for it to complete.
88+
-->
89+
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
90+
</Target>
91+
92+
<Target Name="_DownloadNuGet">
93+
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
94+
</Target>
95+
96+
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
97+
<Exec Command="$(RestoreCommand)"
98+
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
99+
100+
<Exec Command="$(RestoreCommand)"
101+
LogStandardErrorAsError="true"
102+
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
103+
</Target>
104+
105+
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
106+
<Exec Command="$(BuildCommand)"
107+
Condition=" '$(OS)' != 'Windows_NT' " />
108+
109+
<Exec Command="$(BuildCommand)"
110+
LogStandardErrorAsError="true"
111+
Condition=" '$(OS)' == 'Windows_NT' " />
112+
</Target>
113+
114+
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
115+
<ParameterGroup>
116+
<OutputFilename ParameterType="System.String" Required="true" />
117+
</ParameterGroup>
118+
<Task>
119+
<Reference Include="System.Core" />
120+
<Using Namespace="System" />
121+
<Using Namespace="System.IO" />
122+
<Using Namespace="System.Net" />
123+
<Using Namespace="Microsoft.Build.Framework" />
124+
<Using Namespace="Microsoft.Build.Utilities" />
125+
<Code Type="Fragment" Language="cs">
126+
<![CDATA[
127+
try {
128+
OutputFilename = Path.GetFullPath(OutputFilename);
129+
130+
Log.LogMessage("Downloading latest version of NuGet.exe...");
131+
WebClient webClient = new WebClient();
132+
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
133+
134+
return true;
135+
}
136+
catch (Exception ex) {
137+
Log.LogErrorFromException(ex);
138+
return false;
139+
}
140+
]]>
141+
</Code>
142+
</Task>
143+
</UsingTask>
144+
</Project>

Algorithm.Sandbox.Tests/Algorithm.Sandbox.Tests.csproj renamed to Advanced.Algorithms.Tests/Advanced.Algorithms.Tests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<ProjectGuid>{556705BD-1E64-426D-A9CA-08390156FB85}</ProjectGuid>
77
<OutputType>Library</OutputType>
88
<AppDesignerFolder>Properties</AppDesignerFolder>
9-
<RootNamespace>Algorithm.Sandbox.Tests</RootNamespace>
10-
<AssemblyName>Algorithm.Sandbox.Tests</AssemblyName>
9+
<RootNamespace>Advanced.Algorithms.Tests</RootNamespace>
10+
<AssemblyName>Advanced.Algorithms.Tests</AssemblyName>
1111
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@@ -250,9 +250,9 @@
250250
<Compile Include="DynamicProgramming\Minimizing\TravellingSalesman_Tests.cs" />
251251
</ItemGroup>
252252
<ItemGroup>
253-
<ProjectReference Include="..\Algorithm.Sandbox\Algorithm.Sandbox.csproj">
253+
<ProjectReference Include="..\Advanced.Algorithms\Advanced.Algorithms.csproj">
254254
<Project>{0bcbf659-72a2-4f4c-a481-b40d78490c2f}</Project>
255-
<Name>Algorithm.Sandbox</Name>
255+
<Name>Advanced.Algorithms</Name>
256256
</ProjectReference>
257257
</ItemGroup>
258258
<ItemGroup />

Algorithm.Sandbox.Tests/BitAlgorithms/AbsValue_Tests.cs renamed to Advanced.Algorithms.Tests/BitAlgorithms/AbsValue_Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
using Algorithm.Sandbox.BitAlgorithms;
1+
using Advanced.Algorithms.BitAlgorithms;
22
using Microsoft.VisualStudio.TestTools.UnitTesting;
33
using System;
44
using System.Collections.Generic;
55
using System.Linq;
66
using System.Text;
77
using System.Threading.Tasks;
88

9-
namespace Algorithm.Sandbox.Tests.BitAlgorithms
9+
namespace Advanced.Algorithms.Tests.BitAlgorithms
1010
{
1111
/// <summary>
1212
/// Problem details below

Algorithm.Sandbox.Tests/BitAlgorithms/AddOne_Tests.cs renamed to Advanced.Algorithms.Tests/BitAlgorithms/AddOne_Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
using Algorithm.Sandbox.BitAlgorithms;
1+
using Advanced.Algorithms.BitAlgorithms;
22
using Microsoft.VisualStudio.TestTools.UnitTesting;
33
using System;
44
using System.Collections.Generic;
55
using System.Linq;
66
using System.Text;
77
using System.Threading.Tasks;
88

9-
namespace Algorithm.Sandbox.Tests.BitAlgorithms
9+
namespace Advanced.Algorithms.Tests.BitAlgorithms
1010
{
1111
/// <summary>
1212
/// Problem details below

Algorithm.Sandbox.Tests/BitAlgorithms/AddTwoNumbers_Tests.cs renamed to Advanced.Algorithms.Tests/BitAlgorithms/AddTwoNumbers_Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
using Algorithm.Sandbox.BitAlgorithms;
1+
using Advanced.Algorithms.BitAlgorithms;
22
using Microsoft.VisualStudio.TestTools.UnitTesting;
33
using System;
44
using System.Collections.Generic;
55
using System.Linq;
66
using System.Text;
77
using System.Threading.Tasks;
88

9-
namespace Algorithm.Sandbox.Tests.BitAlgorithms
9+
namespace Advanced.Algorithms.Tests.BitAlgorithms
1010
{
1111
/// <summary>
1212
/// Add two numbers using bitwise operators

0 commit comments

Comments
 (0)