Skip to content

Commit 4dd8afc

Browse files
Merge pull request #9 from justcoding121/master
Beta test
2 parents 135e2eb + 9e5dba4 commit 4dd8afc

File tree

239 files changed

+77299
-266
lines changed

Some content is hidden

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

239 files changed

+77299
-266
lines changed

.build/Bootstrap.ps1

Lines changed: 0 additions & 31 deletions
This file was deleted.

.build/Common.psm1

Lines changed: 0 additions & 33 deletions
This file was deleted.

.build/build.ps1

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
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+
$GitHubProjectName = "Advanced-Algorithms"
9+
$GitHubUserName = "justcoding121"
10+
11+
$SolutionFile = "$SolutionRoot\$ProjectName.sln"
12+
13+
## This comes from the build server iteration
14+
if(!$BuildNumber) { $BuildNumber = $env:APPVEYOR_BUILD_NUMBER }
15+
if(!$BuildNumber) { $BuildNumber = "0"}
16+
17+
## The build configuration, i.e. Debug/Release
18+
if(!$Configuration) { $Configuration = $env:Configuration }
19+
if(!$Configuration) { $Configuration = "Release" }
20+
21+
if(!$Version) { $Version = $env:APPVEYOR_BUILD_VERSION }
22+
if(!$Version) { $Version = "0.0.$BuildNumber" }
23+
24+
if(!$Branch) { $Branch = $env:APPVEYOR_REPO_BRANCH }
25+
if(!$Branch) { $Branch = "local" }
26+
27+
if($Branch -eq "beta" ) { $Version = "$Version-beta" }
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+
FormatTaskName (("-"*25) + "[{0}]" + ("-"*25))
35+
36+
#default task
37+
Task default -depends Clean, Build, Document, Package
38+
39+
#cleans obj, b
40+
Task Clean {
41+
Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) { Remove-Item $_.fullname -Force -Recurse }
42+
exec { . $MSBuild $SolutionFile /t:Clean /v:quiet }
43+
}
44+
45+
#install build tools
46+
Task Install-BuildTools -depends Clean {
47+
if(!(Test-Path $MSBuild))
48+
{
49+
cinst microsoft-build-tools -y
50+
}
51+
}
52+
53+
#restore nuget packages
54+
Task Restore-Packages -depends Install-BuildTools {
55+
exec { . dotnet restore "$SolutionRoot\$ProjectName.sln" }
56+
}
57+
58+
#build
59+
Task Build -depends Restore-Packages{
60+
exec { . $MSBuild $SolutionFile /t:Build /v:normal /p:Configuration=$Configuration /t:restore }
61+
}
62+
63+
#publish API documentation changes for GitHub pages under master\docs directory
64+
Task Document -depends Build {
65+
66+
if($Branch -eq "master")
67+
{
68+
#use docfx to generate API documentation from source metadata
69+
docfx docfx.json
70+
71+
#patch index.json so that it is always sorted
72+
#otherwise git will think file was changed
73+
$IndexJsonFile = "$SolutionRoot\docs\index.json"
74+
$unsorted = Get-Content $IndexJsonFile | Out-String
75+
[Reflection.Assembly]::LoadFile("$Here\lib\Newtonsoft.Json.dll")
76+
[System.Reflection.Assembly]::LoadWithPartialName("System")
77+
$hashTable = [Newtonsoft.Json.JsonConvert]::DeserializeObject($unsorted, [System.Collections.Generic.SortedDictionary[[string],[object]]])
78+
$obj = [Newtonsoft.Json.JsonConvert]::SerializeObject($hashTable, [Newtonsoft.Json.Formatting]::Indented)
79+
Set-Content -Path $IndexJsonFile -Value $obj
80+
81+
#setup clone directory
82+
$TEMP_REPO_DIR =(Split-Path -parent $SolutionRoot) + "\temp-repo-clone"
83+
84+
If(test-path $TEMP_REPO_DIR)
85+
{
86+
Remove-Item $TEMP_REPO_DIR -Force -Recurse
87+
}
88+
89+
New-Item -ItemType Directory -Force -Path $TEMP_REPO_DIR
90+
91+
#clone
92+
git clone https://github.com/$GitHubUserName/$GitHubProjectName.git --branch master $TEMP_REPO_DIR
93+
94+
If(test-path "$TEMP_REPO_DIR\docs")
95+
{
96+
Remove-Item "$TEMP_REPO_DIR\docs" -Force -Recurse
97+
}
98+
New-Item -ItemType Directory -Force -Path "$TEMP_REPO_DIR\docs"
99+
100+
#cd to docs folder
101+
cd "$TEMP_REPO_DIR\docs"
102+
103+
#copy docs to clone directory\docs
104+
Copy-Item -Path "$SolutionRoot\docs\*" -Destination "$TEMP_REPO_DIR\docs" -Recurse -Force
105+
106+
#push changes to master
107+
git config --global credential.helper store
108+
Add-Content "$HOME\.git-credentials" "https://$($env:github_access_token):[email protected]`n"
109+
git config --global user.email $env:github_email
110+
git config --global user.name "buildbot121"
111+
git add . -A
112+
git commit -m "Maintanance commit by build server"
113+
git push origin master
114+
115+
#move cd back to current location
116+
cd $Here
117+
}
118+
}
119+
120+
#package nuget files
121+
Task Package -depends Document {
122+
exec { . $NuGet pack "$SolutionRoot\$ProjectName\$ProjectName.nuspec" -Properties Configuration=$Configuration -OutputDirectory "$SolutionRoot" -Version "$Version" }
123+
}

.build/default.ps1

Lines changed: 0 additions & 63 deletions
This file was deleted.

.build/docfx.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"metadata": [
3+
{
4+
"src": [
5+
{
6+
"files": [ "Advanced.Algorithms.Docs.sln"],
7+
"src": "../"
8+
}
9+
],
10+
"dest": "obj/api"
11+
}
12+
],
13+
"build": {
14+
"content": [
15+
{
16+
"files": [ "**/*.yml" ],
17+
"src": "obj/api",
18+
"dest": "api"
19+
},
20+
{
21+
"files": [ "*.md" ]
22+
}
23+
],
24+
"resource": [
25+
{
26+
"files": [ ""]
27+
}
28+
],
29+
"overwrite": "specs/*.md",
30+
"globalMetadata": {
31+
"_appTitle": "Advanced Algorithms",
32+
"_enableSearch": true
33+
},
34+
"dest": "../docs",
35+
"xrefService": [ "https://xref.docs.microsoft.com/query?uid={uid}" ]
36+
}
37+
}

.build/lib/Newtonsoft.Json.dll

647 KB
Binary file not shown.

.build/setup.ps1

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
param (
2+
[string]$Action="default",
3+
[hashtable]$properties=@{},
4+
[switch]$Help
5+
)
6+
7+
function Install-Chocolatey()
8+
{
9+
if(-not $env:ChocolateyInstall -or -not (Test-Path "$env:ChocolateyInstall"))
10+
{
11+
Write-Output "Chocolatey Not Found, Installing..."
12+
iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))
13+
}
14+
$env:Path += ";${env:ChocolateyInstall}"
15+
}
16+
17+
function Install-Psake()
18+
{
19+
if(!(Test-Path $env:ChocolateyInstall\lib\Psake\tools\Psake*))
20+
{
21+
choco install psake -y
22+
}
23+
}
24+
25+
function Install-Git()
26+
{
27+
if(!((Test-Path ${env:ProgramFiles(x86)}\Git*) -Or (Test-Path ${env:ProgramFiles}\Git*)))
28+
{
29+
choco install git.install
30+
}
31+
$env:Path += ";${env:ProgramFiles(x86)}\Git"
32+
$env:Path += ";${env:ProgramFiles}\Git"
33+
}
34+
35+
function Install-DocFx()
36+
{
37+
if(!(Test-Path $env:ChocolateyInstall\lib\docfx\tools*))
38+
{
39+
choco install docfx
40+
}
41+
$env:Path += ";$env:ChocolateyInstall\lib\docfx\tools"
42+
}
43+
44+
#current directory
45+
$Here = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
46+
47+
$ErrorActionPreference = 'Stop'
48+
Set-StrictMode -Version Latest
49+
50+
$ScriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
51+
$SolutionRoot = Split-Path -Parent $ScriptPath
52+
$ToolsPath = Join-Path -Path $SolutionRoot -ChildPath "lib"
53+
54+
if(-not $env:ChocolateyInstall)
55+
{
56+
$env:ChocolateyInstall = "${env:ALLUSERSPROFILE}\chocolatey";
57+
}
58+
59+
Install-Chocolatey
60+
61+
Install-Psake
62+
63+
Install-Git
64+
65+
Install-DocFx
66+
67+
$psakeDirectory = (Resolve-Path $env:ChocolateyInstall\lib\Psake*)
68+
69+
#appveyor for some reason have different location for psake (it has older psake version?)
70+
if(Test-Path $psakeDirectory\tools\Psake\Psake.psm*)
71+
{
72+
Import-Module (Join-Path $psakeDirectory "tools\Psake\Psake.psm1")
73+
}
74+
else
75+
{
76+
Import-Module (Join-Path $psakeDirectory "tools\Psake.psm1")
77+
}
78+
79+
80+
#invoke the task
81+
Invoke-Psake -buildFile "$Here\build.ps1" -parameters $properties -tasklist $Action

0 commit comments

Comments
 (0)