Skip to content

Commit

Permalink
Merge pull request #10 from camalot/develop
Browse files Browse the repository at this point in the history
develop->master
  • Loading branch information
camalot committed Apr 7, 2016
2 parents ac53c7d + fdc982c commit ef91cdf
Show file tree
Hide file tree
Showing 376 changed files with 4,547 additions and 173 deletions.
28 changes: 28 additions & 0 deletions .appveyor/AppVeyorProperties.msbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0" DefaultTargets="Build">
<PropertyGroup>
<AppVeyorProperties>AppVeyorProperties</AppVeyorProperties>

<APPVEYOR_BUILD_VERSION Condition=" '$(APPVEYOR_BUILD_VERSION)' == ''"></APPVEYOR_BUILD_VERSION>

<APPVEYOR Condition=" '$(APPVEYOR)' == '' ">False</APPVEYOR>
<CI Condition=" '$(CI)' == '' ">False</CI>
<APPVEYOR_PROJECT_NAME Condition=" '$(APPVEYOR_PROJECT_NAME)' == '' ">MadBee</APPVEYOR_PROJECT_NAME>
<APPVEYOR_PROJECT_SLUG Condition=" '$(APPVEYOR_PROJECT_SLUG)' == '' ">madb</APPVEYOR_PROJECT_SLUG>
<APPVEYOR_ACCOUNT_NAME Condition=" '$(APPVEYOR_ACCOUNT_NAME)' == '' ">camalot</APPVEYOR_ACCOUNT_NAME>
<APPVEYOR_BUILD_FOLDER Condition=" '$(APPVEYOR_BUILD_FOLDER)' == ''"></APPVEYOR_BUILD_FOLDER>
<APPVEYOR_BUILD_ID Condition=" '$(APPVEYOR_BUILD_ID)' == '' "></APPVEYOR_BUILD_ID>
<APPVEYOR_BUILD_NUMBER Condition=" '$(APPVEYOR_BUILD_NUMBER)' == ''" >0</APPVEYOR_BUILD_NUMBER>
<APPVEYOR_REPO_PROVIDER Condition=" '$(APPVEYOR_REPO_PROVIDER)' == ''">UNKNOWN</APPVEYOR_REPO_PROVIDER>
<APPVEYOR_REPO_SCM Condition=" '$(APPVEYOR_REPO_SCM)' == '' ">UNKNOWN</APPVEYOR_REPO_SCM>
<APPVEYOR_REPO_NAME Condition=" '$(APPVEYOR_REPO_NAME)' == ''">$(APPVEYOR_ACCOUNT_NAME)/$(APPVEYOR_PROJECT_SLUG)</APPVEYOR_REPO_NAME>
<APPVEYOR_REPO_BRANCH Condition=" '$(APPVEYOR_REPO_BRANCH)' == '' ">UNKNOWN</APPVEYOR_REPO_BRANCH>
<APPVEYOR_REPO_TAG Condition=" '$(APPVEYOR_REPO_TAG)' == '' ">False</APPVEYOR_REPO_TAG>
<APPVEYOR_SCHEDULED_BUILD Condition=" '$(APPVEYOR_SCHEDULED_BUILD)' == '' ">False</APPVEYOR_SCHEDULED_BUILD>
<APPVEYOR_FORCED_BUILD Condition=" '$(APPVEYOR_FORCED_BUILD)' == ''" >False</APPVEYOR_FORCED_BUILD>
<APPVEYOR_RE_BUILD Condition=" '$(APPVEYOR_RE_BUILD)' == '' ">False</APPVEYOR_RE_BUILD>

<Platform Condition="'$(Platform)' == 'AnyCPU' OR '$(Platform)' == ''">x86</Platform>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
</PropertyGroup>
</Project>
121 changes: 121 additions & 0 deletions .appveyor/DeployCodePlex.msbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0" DefaultTargets="Publish">
<Import Project="$(MSBuildProjectDirectory)\..\.build\SharedProperties.msbuild" Condition="'$(SharedProperties)' == ''"/>
<Import Project="$(MSBuildProjectDirectory)\AppVeyorProperties.msbuild" Condition="'$(AppVeyorProperties)' == ''"/>
<Import Project="$(MSBuildProjectDirectory)\..\.build\MSBuild.Community.Tasks.Targets" Condition="'$(MSBuildCommunityTasksPath)' == ''"/>
<Import Project="$(MSBuildProjectDirectory)\..\.build\MSBuild.Deployment.Tasks.Targets" />

<PropertyGroup>
<DeployCodePlex>DeployCodePlex</DeployCodePlex>
<CI_DEPLOY_CODEPLEX Condition=" '$(CI_DEPLOY_CODEPLEX)' == '' ">False</CI_DEPLOY_CODEPLEX>
<CodePlexProject>de</CodePlexProject>


<!--<IsDefaultRelease>$(CI_DEPLOY_CODEPLEX)</IsDefaultRelease>
<IsShown>$(CI_DEPLOY_CODEPLEX)</IsShown>-->

<!-- For Testing -->
<IsDefaultRelease>False</IsDefaultRelease>
<IsShown>False</IsShown>

<Status>Beta</Status>

<ReleaseTimeout>120</ReleaseTimeout>
<UploadTimeout>1200</UploadTimeout>

<ChangeLogFile>$(MSBuildProjectDirectory)\..\.build\publish-changelog.txt</ChangeLogFile>
<ReleaseInfoFile>$(MSBuildProjectDirectory)\codeplex-release.txt</ReleaseInfoFile>
</PropertyGroup>


<Target Name="Publish" DependsOnTargets="PublishPrep">

<Error Condition=" '$(CI_CODEPLEX_USER)' == '' " Code="500" Text="'CI_CODEPLEX_USER' property was not set." />
<Error Condition=" '$(CI_CODEPLEX_PASSWORD)' == '' " Code="500" Text="'CI_CODEPLEX_PASSWORD' property was not set." />
<Error Condition=" '$(CI_DEPLOY_CODEPLEX)' == 'False' " Code="500" Text="'CI_DEPLOY_CODEPLEX' property is set to False" />
<Error Condition=" !Exists('$(ZipFile)') " Code="404" Text="Unable to locate '$(ZipFile)'" />

<CallTarget Targets="Upload" />
</Target>

<Target Name="PublishPrep">
<Error Condition=" '$(CI_BUILD_VERSION)' == '' AND '$(CI_BUILD_NUMBER)' == '' " Code="500" Text="'CI_BUILD_NUMBER' property was not set." />
<Error Condition=" '$(CI_BUILD_VERSION)' == '' AND '$(CI_BUILD_REVISION)' == '' " Code="500" Text="'CI_BUILD_REVISION' property was not set." />
<Error Condition=" '$(CI_PROJECT_FRIENDLY_NAME)' == ''" Code="500" Text="'CI_PROJECT_FRIENDLY_NAME' property was not set." />

<CreateProperty Value="$(Major).$(Minor).$(CI_BUILD_NUMBER).$(CI_BUILD_REVISION)" Condition=" '$(CI_BUILD_NUMBER)' != '' ">
<Output PropertyName="CI_BUILD_VERSION" TaskParameter="Value" />
</CreateProperty>

<Message Text="CI_BUILD_VERSION Set to $(CI_BUILD_VERSION)" />

<CreateProperty Value="$(APPVEYOR_BUILD_FOLDER)\bin\$(Configuration)\$(CI_BUILD_VERSION)\$(Platform)">
<Output PropertyName="OutputPath" TaskParameter="Value" />
</CreateProperty>

<CreateProperty Value="$(OutputPath)\$(CI_PROJECT_NAME).$(CI_BUILD_VERSION).$(Platform).$(ReleaseMode).zip">
<Output PropertyName="ZipFile" TaskParameter="Value" />
</CreateProperty>

<CreateProperty Value="$(CI_PROJECT_FRIENDLY_NAME) $(CI_BUILD_VERSION) $(Status)">
<Output PropertyName="ReleaseName" TaskParameter="Value" />
</CreateProperty>

<Message Text="ZipFile set: '$(ZipFile)'" />
<Message Text="ReleaseName set: '$(ReleaseName)'" />
</Target>


<!-- This should only create the release when it is x86 -->
<!-- BUT! When we do x64, we need to know the Release Name -->
<Target Name="CreateRelease">

<!-- Read the file if it was not read for some reason and put into ENV:CI_RELEASE_DESCRIPTION-->
<ReadTextFile Files="$(ChangeLogFile)" Condition=" '$(CI_RELEASE_DESCRIPTION)' == '' AND Exists($(ChangeLogFile)) ">
<Output TaskParameter="OutputText" PropertyName="CI_RELEASE_DESCRIPTION" />
</ReadTextFile>

<CodePlexCreateRelease
ContinueOnError="True"
Project="$(CodePlexProject)"
Username="$(CI_CODEPLEX_USER)"
Password="$(CI_CODEPLEX_PASSWORD)"
ProjectFriendlyName="$(CI_PROJECT_FRIENDLY_NAME)"
Version="$(CI_BUILD_VERSION)"
Description="$(CI_RELEASE_DESCRIPTION)"
IsDefaultRelease="$(IsDefaultRelease)"
IsShownToPublic="$(IsShown)"
TreatErrorsAsWarnings="True"
Status="$(Status)"
Timeout="$(ReleaseTimeout)">
<Output PropertyName="ReleaseName" TaskParameter="ReleaseName" />
<Output PropertyName="ReleaseId" TaskParameter="ReleaseId" />
<Output PropertyName="ReleaseUrl" TaskParameter="ReleaseUrl" />
</CodePlexCreateRelease>



<CreateItem Include="Id=$(ReleaseId);Name=$(ReleaseName);Url=$(ReleaseUrl)" Condition=" '$(Platform)' == 'x86' ">
<Output ItemName="CPLines" TaskParameter="Include"/>
</CreateItem>
<WriteLinesToFile File="$(ReleaseInfoFile)" Lines="@(CPLines)" Overwrite="true" Condition=" '$(Platform)' == 'x86' AND '$(ReleaseId)' != '' AND '$(ReleaseUrl)' != '' "/>
<Message Text="@(CPLines)" Condition=" '$(ReleaseId)' != '' AND '$(ReleaseUrl)' != '' AND '$(Platform)' == 'x86' "/>

<Exec Command="appveyor SetVariable -Name CP_RELEASE_NAME -Value &quot;$(ReleaseName)&quot;" Condition=" '$(APPVEYOR)' == 'True' AND '$(Platform)' == 'x86' AND '$(ReleaseName)' != '' " />
<Exec Command="appveyor SetVariable -Name CP_RELEASE_ID -Value &quot;$(ReleaseId)&quot;" Condition=" '$(APPVEYOR)' == 'True' AND '$(Platform)' == 'x86' AND '$(ReleaseId)' != '' " />
<Exec Command="appveyor SetVariable -Name CP_RELEASE_URL -Value &quot;$(ReleaseUrl)&quot;" Condition=" '$(APPVEYOR)' == 'True' AND '$(Platform)' == 'x86' AND '$(ReleaseUrl)' != '' " />
<Exec Command="appveyor SetVariable -Name CP_RELEASE_PROJECT -Value &quot;$(CodePlexProject)&quot;" Condition=" '$(APPVEYOR)' == 'True' AND '$(Platform)' == 'x86' AND '$(CodePlexProject)' != '' " />
</Target>

<Target Name="Upload" DependsOnTargets="CreateRelease">
<CodePlexUpload
Project="$(CodePlexProject)"
Username="$(CI_CODEPLEX_USER)"
Password="$(CI_CODEPLEX_PASSWORD)"
ReleaseName="$(ReleaseName)"
FileType="RuntimeBinary"
File="$(ZipFile)"
Timeout="$(UploadTimeout)" />
</Target>

</Project>
File renamed without changes.
Empty file.
87 changes: 87 additions & 0 deletions .appveyor/appveyor.after-deployment.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
Import-Module "$env:APPVEYOR_BUILD_FOLDER\.appveyor\modules\Invoke-MsBuild.psm1";
Import-Module "$env:APPVEYOR_BUILD_FOLDER\.appveyor\modules\Send-PushbulletMessage.psm1";

function Publish-Release {
Param (
[Parameter(Mandatory=$true)]
[string] $HostName
)
$appId = $env:CI_PUBLISHAPPID;
$appKey = $env:CI_PUBLISHKEY;


$url = "http://$HostName/api/update/create/";
$headers = @{};
$headers["Authentication-Token"] = $appKey;
$headers["Application-Identifier"] = $appId;

if(Test-Path -Path "$env:APPVEYOR_BUILD_FOLDER\.build\publishchangelog.txt") {
# read the publish text file
$publishNotes = (Get-Content -Path "$env:APPVEYOR_BUILD_FOLDER\.build\publishchangelog.txt") | Out-String;
}


$post = @{
Id = $env:CP_RELEASE_ID;
Version = $env:CI_BUILD_VERSION;
Description = $publishNotes;
Name = $env:CP_RELEASE_NAME;
Url = "http://$env:CP_RELEASE_PROJECT.codeplex.com/releases/view/$env:CP_RELEASE_ID";
};
$contentType = "application/x-www-form-urlencoded";
$method = "POST";

$response = Invoke-WebRequest -Uri $url -Method $method -Headers $headers -TimeoutSec 120 -Body $post -ContentType $contentType -UserAgent "AppVeyor Build Agent";

return $response;
}

# trigger the codeplex deployment script
if( $env:CI_DEPLOY_CODEPLEX -eq $true ) {
Invoke-MsBuild -Path "$env:APPVEYOR_BUILD_FOLDER\.appveyor\DeployCodePlex.msbuild" -MsBuildParameters "/verbosity:detailed /p:CI_BUILD_VERSION=$env:CI_BUILD_VERSION /p:CI_BUILD_REVISION=$env:CI_BUILD_REVISION /p:CI_BUILD_MAJOR=$env:CI_BUILD_MAJOR /p:CI_BUILD_MINOR=$env:CI_BUILD_MINOR"
} else {
Write-Host -BackgroundColor Yellow -ForegroundColor Black "Skip `"CodePlex`" deployment as environment variable has not matched (`"CI_DEPLOY_CODEPLEX`" is `"$false`", should be `"$true`")";
}

# publish release
if( $env:CI_DEPLOY_WEBAPI_RELEASE -eq $true -and $env:Platform -eq "x86" ) {
# this only gets called for the x86 platform so it is called once, and because the env:vars may not exist for x64
if( !$env:CP_RELEASE_NAME -or !$env:CP_RELEASE_ID -or !$env:CP_RELEASE_URL ) {
Write-Host -BackgroundColor Red -ForegroundColor White "Unable to read the required values to create the release";
$host.SetShouldExit(500);
return;
}
@($env:DevelopmentApiDomain,$env:ProductionApiDomain) | foreach {
$hostname = $_;
Write-Host "[WebApiRelease] Publishing Release Information '$env:CP_RELEASE_NAME' to $hostname";
$resp = Publish-Release -HostName $hostname;
if($resp.StatusCode -ne 200) {
Write-Host -BackgroundColor Red -ForegroundColor White $resp.StatusDescription;
$host.SetShouldExit($resp.StatusCode);
return;
}

}
} else {
Write-Host -BackgroundColor Yellow -ForegroundColor Black "Skip `"WebApiRelease`" deployment as environment variable has not matched (`"CI_DEPLOY_CODEPLEX`" is `"$false`", should be `"$true`")";
}

if($env:PUSHBULLET_API_TOKEN) {
$timestamp = (Get-Date).ToUniversalTime().ToString("MM/dd/yyyy hh:mm:ss");
# this allows for multiple tokens, just separate with a comma.
$env:PUSHBULLET_API_TOKEN.Split(",") | foreach {
$pbtoken = $_;
try {
# Send a pushbullet message if there is an api token available
Send-PushbulletMessage -apiKey $pbtoken -Type Message -Title "[Build] Managed.ADB $env:Platform v$env:CI_BUILD_VERSION Build Finished" -msg ("Build completed at $timestamp UTC");

if( $env:Platform -eq "x64" -and $env:CI_DEPLOY_PUSHBULLET -eq $true) {
Send-PushbulletMessage -apiKey $pbtoken -Type Message -Title "[Deploy] Managed.ADB v$env:CI_BUILD_VERSION Deployed" -msg ("Deployment completed at $timestamp UTC");
} else {
Write-Host -BackgroundColor Yellow -ForegroundColor Black "Skip `"PushBullet`" deployment as environment variable has not matched (`"CI_DEPLOY_PUSHBULLET`" is `"$false`", should be `"$true`" and `"Platform`" is `"$env:Platform`", should be `"x64`")";
}
} catch [Exeption] {
Write-Error ($_ -replace $pbtoken, "[`$env:PUSHBULLET_API_TOKEN]");
}
}
}
17 changes: 17 additions & 0 deletions .appveyor/appveyor.before-build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
try {
& nuget restore -NonInteractive;
} catch {
$_.Exception.Message | Write-Error;
}

Import-Module "$env:APPVEYOR_BUILD_FOLDER\.appveyor\modules\Import-PfxCertificate.psm1";
Import-Module "$env:APPVEYOR_BUILD_FOLDER\.appveyor\modules\Set-BuildVersion.psm1";


Import-PfxCertificate -pfx "$env:APPVEYOR_BUILD_FOLDER\Shared\madb.pfx" -password ((Get-Item Env:\MADB_PFX_KEY).Value) -containerName ((Get-Item Env:\VS_PFX_KEY).Value);

$env:CI_BUILD_DATE = ((Get-Date).ToUniversalTime().ToString("MM-dd-yyyy"));
$env:CI_BUILD_TIME = ((Get-Date).ToUniversalTime().ToString("hh:mm:ss"));

Set-BuildVersion;

33 changes: 33 additions & 0 deletions .appveyor/appveyor.before-deployment.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<#
#
#
#>

$commitMessageRegex = "^\[deploy\:(pre-release|draft|release)\]$";


# Must come from master branch.
# Must not have a PULL Request Number
# Must match regex
if ( ($env:APPVEYOR_REPO_BRANCH -eq "master") -and ($env:APPVEYOR_REPO_COMMIT_MESSAGE -match $commitMessageRegex) ) {
$env:CI_DEPLOY_NUGET = $true;
$env:CI_DEPLOY_GITHUB = $true;
$env:CI_DEPLOY_FTP = $false;
$env:CI_DEPLOY_WebHook = $true;
$env:CI_DEPLOY_WebDeploy = $true;
$env:CI_DEPLOY_CodePlex = $false;
$env:CI_DEPLOY_WEBAPI_RELEASE = $false;
$env:CI_DEPLOY_PUSHBULLET = $true;
$env:CI_DEPLOY = $true;
} else {
# Do not assign a release number or deploy
$env:CI_DEPLOY_NUGET = $false;
$env:CI_DEPLOY_GITHUB = $false;
$env:CI_DEPLOY_FTP = $false;
$env:CI_DEPLOY_WebHook = $false;
$env:CI_DEPLOY_WebDeploy = $false;
$env:CI_DEPLOY_CodePlex = $false;
$env:CI_DEPLOY_WEBAPI_RELEASE = $false;
$env:CI_DEPLOY_PUSHBULLET = $false;
$env:CI_DEPLOY = $false;
}
3 changes: 3 additions & 0 deletions .appveyor/appveyor.install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
choco install -y nuget.commandline --version 3.3.0;

$env:PATH = "C:\ProgramData\chocolatey\lib\NuGet.CommandLine\tools;$env:PATH";
39 changes: 39 additions & 0 deletions .appveyor/modules/Import-PfxCertificate.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<#
* Copyright (c) Inish Technology Ventures Limited. All rights reserved.
*
* This code is licensed under the BSD 3-Clause License included with this source
*
* ALSO SEE: https://github.com/SoftwarePotential/samples/wiki/License
#>

function Import-PfxCertificate {
Param (
[string] $pfx,
[string] $password,
[string] $containerName
);
process {
if(!(Test-Path -Path $pfx)) {
Write-Error "Unable to locate PFX file: $pfx";
return;
}

$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2;
$cert.Import($pfx, $password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable);
$exportPrivateKeyInformation = $true;
$certXml = $cert.PrivateKey.ToXmlString($exportPrivateKeyInformation);

$csp = New-Object System.Security.Cryptography.CspParameters;
$csp.KeyContainerName = $containerName;
$csp.Flags = [System.Security.Cryptography.CspProviderFlags]::UseMachineKeyStore -bor [System.Security.Cryptography.CspProviderFlags]::NoPrompt; # -bor is biwise or
$csp.KeyNumber = [System.Security.Cryptography.KeyNumber]::Signature;

$rsa = New-Object System.Security.Cryptography.RSACryptoServiceProvider $csp;
$rsa.FromXmlString($certXml);
$rsa.Clear();

"Sucesfully imported $pfx into StrongName CSP store";
}
}

Export-ModuleMember -Function Import-PfxCertificate;
Loading

0 comments on commit ef91cdf

Please sign in to comment.