Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Build for New Contributors #513

Merged
merged 7 commits into from
Jun 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
* text=auto

# Source code files
*.cs text
.cs text diff=csharp
*.vsixmanifest text
*.config text
*.resx text
Expand All @@ -10,15 +12,9 @@
*.ps1 text
LICENSE text

# SHFB Content Files
*.aml text
*.content text
*.tokens text

# Projects and solutions
*.sln text
*.csproj text
*.shfbproj text
*.sln text merge=union eol=crlf
*.csproj text merge=union eol=crlf

# Certainly binary files
*.png binary
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#Build Output
/artifacts

#OS junk files
[Tt]humbs.db
*.DS_Store
Expand Down Expand Up @@ -70,6 +73,7 @@ TestResults
# Sandcastle Output
docs/Api/
docs/html/
/src/Documentation/Help/

#NuGet
*.nupkg
Expand Down
42 changes: 0 additions & 42 deletions .gitmodules

This file was deleted.

10 changes: 10 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositorypath" value="src/packages" />
</config>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
</configuration>
26 changes: 3 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,13 @@ including an explanation of our issue labels and common emoji used in discussion
### Prerequisites

The recommended development environment for this project is Visual Studio 2013 or Visual Studio 2015. When using Visual
Studio 2015, a [custom analyzer][OpenStackNetAnalyzers] is automatically provided
Studio 2015, a [custom analyzer](https://github.com/openstacknetsdk/OpenStackNetAnalyzers) is provided
which uses static analysis to identify common mistakes, and in many cases is able to automatically fix the issue.

To edit the documentation projects within Visual Studio, Sandcastle Help File Builder (SHFB) must be installed on the
development machine. Currently the project uses a [custom build of SHFB][SHFB]. Automated builds do not require manual
installation of SHFB, as described below.

[OpenStackNetAnalyzers]: https://github.com/openstacknetsdk/OpenStackNetAnalyzers
[SHFB]: https://github.com/tunnelvisionlabs/SHFB/releases/tag/v2014.11.22.0-beta

### Build script

The complete project may be built from source using the **build.ps1** PowerShell script. In addition to the library
binaries, this script will create the NuGet packages for the SDK. The `-InstallSHFB` command ensures that the correct
version of SHFB is used for the automated build (and uses NuGet to download it on demand).

```powershell
cd build
.\build.ps1 -InstallSHFB
```

To build the project without documentation, use the `-NoDocs` switch. This switch is equivalent to using the
**ReleaseNoDocs** solution configuration instead of the normal **Release** configuration.
Execute `build.cmd` (or `build.sh` if you are using Git Bash).

```powershell
cd build
.\build.ps1 -NoDocs
```
See the [Documentation README](src/Documentation/README.md) if you would like to build the Sandcastle documentation which is published to http://openstacknetsdk.org/docs.

#### This is not an official OpenStack project
13 changes: 2 additions & 11 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
version: 1.0.{build}
os: Visual Studio 2015 RC
init:
- git config --global core.autocrlf true
build_script:
- cd build
- powershell -Command .\build.ps1 -VisualStudioVersion "14.0" -InstallSHFB -Verbosity minimal -Logger "${env:ProgramFiles}\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- cd ..
- msbuild build\build.proj /nologo /t:CI
after_build:
- cd build
- powershell -Command .\appveyor-deploy-docs.ps1
- cd ..
# Only run tests with the attribute [TestCategory("Unit")]. These tests are expected to
# run consistently in an automated build environment, and failure certainly indicates
# a bug or regression in the codebase.
test_script:
- vstest.console /logger:Appveyor /TestCaseFilter:"TestCategory=Unit" "src\testing\integration\bin\Release\OpenStackNet.Testing.Integration.dll"
- vstest.console /logger:Appveyor /TestCaseFilter:"TestCategory=Unit" "src\testing\unit\bin\Release\OpenStackNet.Testing.Unit.dll"
test: off
22 changes: 22 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@echo off
setlocal

:: Load the environment of the most recent version of Visual Studio installed
if not defined VisualStudioVersion (
if defined VS140COMNTOOLS (
call "%VS140COMNTOOLS%\VsDevCmd.bat"
goto :build
)

if defined VS120COMNTOOLS (
call "%VS120COMNTOOLS%\VsDevCmd.bat"
goto :build
)

echo Error: build.cmd requires Visual Studio 2013 or 2015.
exit /b 1
)

:build
msbuild build\build.proj /nologo
exit /b %ERRORLEVEL%
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
cmd.exe //C build.cmd "$@"
3 changes: 1 addition & 2 deletions build/appveyor-deploy-docs.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$DocsPath = "..\docs\html"
$DocsPath = "..\artifacts\docs\html"

# make sure the script was run from the expected path
If (!(Test-Path $DocsPath)) {
Expand All @@ -15,4 +15,3 @@ function Upload-Folder() {
}

Upload-Folder -LocalPath "$DocsPath\v4.0" -ArtifactName "docs-v1.zip"
Upload-Folder -LocalPath "$DocsPath\net45" -ArtifactName "docs-v2.zip"
66 changes: 66 additions & 0 deletions build/build.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<Configuration>Debug</Configuration>
<Version>1.3.5.0-dev</Version>

<NuGet>$(LocalAppData)\NuGet\NuGet.exe</NuGet>
<MSBuild>&quot;$(MSBuildToolsPath)\MSBuild.exe&quot;</MSBuild>
</PropertyGroup>

<Target Name="CI">
<PropertyGroup>
<Configuration>Release</Configuration>
</PropertyGroup>

<CallTarget Targets="Build" />
<CallTarget Targets="Documentation" />
<CallTarget Targets="UnitTest" />
<CallTarget Targets="Package" />
</Target>

<Target Name="Build" DependsOnTargets="RestorePackages">
<Exec Command="$(MSBuild) ..\src\openstack.net.sln /p:Configuration=$(Configuration) /nologo /v:minimal" WorkingDirectory="$(MSBuildThisFileDirectory)" />
</Target>

<Target Name="Documentation" DependsOnTargets="Build">
<PropertyGroup>
<SHFBROOT>$(MSBuildThisFileDirectory.Replace('build\','src'))\packages\EWSoftware.SHFB.2014.11.22-beta\tools</SHFBROOT>
</PropertyGroup>

<Exec Command="$(NuGet) restore ..\src\Documentation\Documentation.sln" WorkingDirectory="$(MSBuildThisFileDirectory)" />
<Exec Command="(set SHFBROOT=$(SHFBROOT)) &amp; $(MSBuild) ..\src\Documentation\Documentation.sln /p:Configuration=$(Configuration) /nologo /v:minimal" WorkingDirectory="$(MSBuildThisFileDirectory)" />
</Target>

<Target Name="RestorePackages" DependsOnTargets="DownloadNuGet">
<Exec Command="$(NuGet) restore ..\src\openstack.net.sln" WorkingDirectory="$(MSBuildThisFileDirectory)" />
</Target>

<Target Name="DownloadNuGet" Condition="!Exists('$(NuGet)')">
<MakeDir Directories="$(LocalAppData)\NuGet" />
<Exec Command="@powershell -NoProfile -ExecutionPolicy unrestricted -Command &quot;$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '$(NuGet)'&quot;" />
</Target>

<Target Name="UnitTest" DependsOnTargets="Build">
<PropertyGroup>
<MSTest Condition=" '$(VS140COMNTOOLS)' != '' ">&quot;$(VS140COMNTOOLS)..\IDE\MSTest.exe&quot;</MSTest>
<MSTest Condition=" '$(VS120COMNTOOLS)' != '' ">&quot;$(VS120COMNTOOLS)..\IDE\MSTest.exe&quot;</MSTest>
</PropertyGroup>

<MakeDir Directories="..\artifacts\TestResults\" />
<Exec Command="$(MSTest) /testcontainer:..\src\testing\unit\bin\$(Configuration)\OpenStackNet.Testing.Unit.dll /category:Unit /resultsfile:..\artifacts\TestResults\unit.trx" ContinueOnError="true" WorkingDirectory="$(MSBuildThisFileDirectory)" />
<!--<Exec Command="$(MSTest) /testcontainer:..\src\testing\integration\bin\$(Configuration)\OpenStackNet.Testing.Integration.dll /resultsfile:..\artifacts\TestResults\integration.trx" ContinueOnError="true" WorkingDirectory="$(MSBuildThisFileDirectory)" /> -->
</Target>

<Target Name="Package" DependsOnTargets="Build">
<MakeDir Directories="..\artifacts\packages\" />
<Exec Command="$(NuGet) pack ..\src\corelib\corelib.nuspec -OutputDirectory ..\artifacts\packages -Prop Configuration=$(Configuration) -Version $(Version) -Symbols" WorkingDirectory="$(MSBuildThisFileDirectory)" />
</Target>

<Target Name="Publish" DependsOnTargets="DownloadNuGet">
<!-- The environment variable BAMBOO_NUGET_PASSWORD comes from the nuget.password variable defined on the openstack.net plan in Bamboo -->
<Exec Command="$(NuGet) push ..\artifacts\packages\openstack.net.$(Version).nupkg %BAMBOO_NUGET_PASSWORD%" WorkingDirectory="$(MSBuildThisFileDirectory)" />
</Target>

</Project>
133 changes: 0 additions & 133 deletions build/build.ps1

This file was deleted.

Loading