Skip to content

Commit

Permalink
Merge pull request #34 from conube/fluent-mapping
Browse files Browse the repository at this point in the history
Fluent mapping and scripts to build & publish to nuget
  • Loading branch information
gblmarquez committed Aug 9, 2014
2 parents 8419c33 + db79af5 commit 53e5ea0
Show file tree
Hide file tree
Showing 24 changed files with 2,431 additions and 773 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
storage.xml
builds/
build.properties.ps1

# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
[Bb]in/
[Oo]bj/
Expand Down
21 changes: 20 additions & 1 deletion WindowsAzure.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 2013
VisualStudioVersion = 12.0.30110.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsAzure", "src\WindowsAzure\WindowsAzure.csproj", "{0C174C38-3AD7-4810-B165-95DCC327288F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsAzure.Tests", "test\WindowsAzure.Tests\WindowsAzure.Tests.csproj", "{7B133A3F-612C-4647-93B3-A8CC4FBF1E39}"
Expand All @@ -12,6 +14,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{1156D6
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".scripts", ".scripts", "{4AA7D406-B158-4FCA-97BE-B3CE4B9ED1AA}"
ProjectSection(SolutionItems) = preProject
scripts\build.cmd = scripts\build.cmd
scripts\build.properties.sample.ps1 = scripts\build.properties.sample.ps1
scripts\build.ps1 = scripts\build.ps1
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{F729740C-2635-49A7-9342-2A2A7158992D}"
ProjectSection(SolutionItems) = preProject
scripts\libs\core_build.ps1 = scripts\libs\core_build.ps1
scripts\libs\psake.psm1 = scripts\libs\psake.psm1
scripts\libs\psake_ext.ps1 = scripts\libs\psake_ext.ps1
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -30,4 +46,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F729740C-2635-49A7-9342-2A2A7158992D} = {4AA7D406-B158-4FCA-97BE-B3CE4B9ED1AA}
EndGlobalSection
EndGlobal
1 change: 1 addition & 0 deletions scripts/build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
powershell -NoProfile -Command "& {Import-Module BitsTransfer; Import-Module .\libs\psake.psm1; Invoke-psake .\build.ps1 -framework 4.0x64}"
12 changes: 12 additions & 0 deletions scripts/build.properties.sample.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
properties {

# NuGet Publish
$nuget_publish = $false

## NuGet API Key
$nuget_apiKey = "00000000-0000-0000-0000-000000000000"

## NuGet Source URL
$nuget_source = "https://www.nuget.org/api/v2/"

}
32 changes: 32 additions & 0 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
include libs\psake_ext.ps1

properties {
## NuGet ID for the package
$nuget_id = "WindowsAzure.StorageExtensions"

## NuGet Source URL
$nuget_source = "https://www.nuget.org/api/v2/"

## Version info
$majorVersion = 0
$minorVersion = 8

## Path location for the project file.
$projectPath = "WindowsAzure\WindowsAzure.csproj"

## Path location for the VersionAssemblyInfo.cs file.
$versionAssemblyPath = "WindowsAzure\Properties\VersionAssemblyInfo.cs"

## Select with Version Control System the build should use.
## Use: 'git' or 'hg' for mercurial.
$versionControlSystem = "git"

## Sources directory will be the 'src' folder
## on the same level of the 'build' folder.
## Changing this to a wrong folder can brick the build script.
$base_directory = resolve-path "..\."
$source_directory = "$base_directory\src"
$nuget_directory = "$base_directory\builds"
}

include libs\core_build.ps1
100 changes: 100 additions & 0 deletions scripts/libs/core_build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
formatTaskName "-------------------------------- {0} --------------------------------"

# includes the NuGet API Key file.
include build.properties.ps1

properties {
## After compiling and publishing the package
## the build script commits and tags it using the $logTitle variable.
## Example of commit message "BUILD: New version of $logTitle"
## Example of tag "$logTitle-v$commitVersion"
$logTitle = $nuget_id

$nuget_symbolsPack = $true

# git version
if ($versionControlSystem -eq "git") {
$revisionNumber = exec { git rev-list --count HEAD }
}
# mercurial version
if ($versionControlSystem -eq "hg") {
$revisionNumber = exec { hg identify -n }
}

## Do Not Change
$buildVersion = $revisionNumber.Replace("+", "")
$version = "$majorVersion.$minorVersion.$buildVersion"
$fileVersion = $version
$commitVersion = "$majorVersion.$minorVersion.$buildVersion"
$nuget_packPath = "$nuget_directory\$nuget_id.$version.nupkg"
$nuget_packSymbolsPath = "$nuget_directory\$nuget_id.$version.symbols.nupkg"
$build_directory = "$nuget_directory\$version"
$build_assemblyPath = "$source_directory\$versionAssemblyPath"
$build_appPath = "$source_directory\$projectPath"
}

#
# default task, this task starts the build
#
task default -depends NuGet_Publish, CommitAndTag

task Clean {
Remove-Item $build_directory -Force -Recurse -ErrorAction SilentlyContinue
}

task Compile -depends Clean {

## Create Version Assembly Info
Generate-Version-Assembly-Info `
-file $build_assemblyPath `
-version $version `
-fileVersion $fileVersion

if ((Test-Path $build_directory) -eq $false) {
New-Item $build_directory -ItemType Directory | Out-Null
}
}

task NuGet_Pack -depends Compile {

# if we want to pack the symbols too.
if ($nuget_symbolsPack) {
exec { nuget pack $build_appPath -Symbols -Build -Properties "Configuration=Release;Platform=AnyCPU" -Version $version -OutputDirectory $nuget_directory }
}
else {
exec { nuget pack $build_appPath -Build -Properties "Configuration=Release;Platform=AnyCPU" -Version $version -OutputDirectory $nuget_directory }
}

}

task NuGet_Publish -depends NuGet_Pack {

if ($nuget_publish) {
Remove-Item $build_directory -Force -Recurse -ErrorAction SilentlyContinue

# push the package with assmblies.
exec { nuget push $nuget_packPath -ApiKey $nuget_apiKey -Source $nuget_source }

# if there are symbols push them too.
if ($nuget_symbolsPack) {
Write-Host "Push Symbols"
exec { nuget push $nuget_packSymbolsPath -ApiKey $nuget_apiKey -Source $nuget_source }
}
}

}

task CommitAndTag {

if ($nuget_publish) {
if ($versionControlSystem -eq "git") {
exec { git commit -a -m "BUILD: New version of $logTitle" }
exec { git tag "$logTitle-v$commitVersion" }
}
if ($versionControlSystem -eq "hg") {
exec { hg commit -m "BUILD: New version of $logTitle" }
exec { hg tag "$logTitle-v$commitVersion" }
}
}

}
Loading

0 comments on commit 53e5ea0

Please sign in to comment.