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

Added Selfhosting support #4

Closed
wants to merge 5 commits into from
Closed
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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
/dist/*
obj
Bin
bin
*.user
*.suo
*.dotCover
_ReSharper.Ninject.Web.WebApi
/lib/Ninject/*.zip
/lib/Ninject/*/**
/lib/Ninject.Web.Common/*.zip
/lib/Ninject.Web.Common/*/**
/lib/Ninject.Web.Common/*/**
/lib/Ninject.Extensions.NamedScope/*.zip
/lib/Ninject.Extensions.NamedScope/*/**
/lib/Ninject.Extensions.ContextPreservation/*.zip
/lib/Ninject.Extensions.ContextPreservation/*/**
73 changes: 69 additions & 4 deletions Ninject.Web.WebApi.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<property name="product.description" value="Ninject support for MVC Web API" overwrite="false"/>
<property name="product.platforms" value="net-4.0,net-4.5" overwrite="false"/>
<property name="product.buildserverPlatforms" value="net-4.0" overwrite="false"/>
<property name="product.packagePostfix" value="4" overwrite="false"/>
<property name="dependencies" value="Ninject,Ninject.Web.Common" overwrite="false"/>
<property name="product.packagePostfix" value="" overwrite="false"/>
<property name="dependencies" value="Ninject,Ninject.Web.Common,Ninject.Extensions.NamedScope,Ninject.Extensions.ContextPreservation" overwrite="false"/>

<include buildfile="Ninject.include" />
<target name="all" depends="core"/>
<target name="nuget-all" depends="nuget-webapi"/>
<target name="all" depends="core selfhost"/>
<target name="nuget-all" depends="nuget-webapi nuget-selfhost nuget-webhost"/>

<target name="core" depends="init">
<csc noconfig="true" warnaserror="true" target="library" debug="${build.debug}" optimize="${build.optimize}" define="${build.defines}" output="${current.path.build}/${product.assembly}" doc="${current.path.build}/${product.docfile}" keyfile="${path.src}/${product.keyfile}">
Expand All @@ -39,6 +39,39 @@
</csc>
</target>

<target name="selfhost" depends="core">
<property name="current.path.build.extensions" value="${path.build}/${build.platform}/${build.config}/extensions"/>
<mkdir dir="${current.path.build.extensions}" if="${not(directory::exists(current.path.build.extensions))}"/>

<csc noconfig="true" warnaserror="true" target="library" debug="${build.debug}" optimize="${build.optimize}" define="${build.defines}"
output="${current.path.build}/${product.name}.SelfHost.dll" doc="${current.path.build}/${product.name}.SelfHost.xml" keyfile="${path.src}/${product.keyfile}">
<arg line="/filealign:512" unless="${nant.settings.currentframework == 'mono-2.0'}"/>
<sources basedir="${path.src}">
<include name="${build.asminfo}"/>
<include name="${product.name}.Selfhost/**/*.cs"/>
</sources>
<references basedir="${current.path.build}">
<include name="mscorlib.dll"/>
<include name="System.dll"/>
<include name="System.Core.dll"/>
<include name="System.Web.dll"/>
<include name="System.Web.Abstractions.dll"/>
<include name="System.Web.Routing.dll"/>
<include name="System.ComponentModel.DataAnnotations.dll"/>
<include name="${path.lib}/WebApi/System.Net.Http.dll"/>
<include name="${path.lib}/WebApi/System.Web.Http.dll"/>
<include name="${path.lib}/WebApi/System.Web.Http.Common.dll"/>
<include name="${path.lib}/WebApi/System.Web.Http.SelfHost.dll"/>
<include name="${path.lib}/Ninject/${build.platform}/Ninject.dll"/>
<include name="${path.lib}/Ninject.Web.Common/${build.platform}/Ninject.Web.Common.dll"/>
<include name="${path.lib}/Ninject.Web.Common/${build.platform}/Ninject.Web.Common.SelfHost.dll"/>
<include name="${path.lib}/Ninject.Extensions.ContextPreservation/${build.platform}/Ninject.Extensions.ContextPreservation.dll"/>
<include name="${path.lib}/Ninject.Extensions.NamedScope/${build.platform}/Ninject.Extensions.NamedScope.dll"/>
<include name="${current.path.build}/${product.assembly}"/>
</references>
</csc>
</target>

<target name="compile-tests"/>
<target name="compile-silverlight-tests"/>

Expand All @@ -56,4 +89,36 @@

<call target="nuget-run"/>
</target>

<target name="nuget-selfhost">
<property name="nuget.sourcedir" value="${path.base}/nuget-selfhost" />
<property name="nuget.basedir" value="${path.base}/build/nuget-selfhost" />
<property name="nuget.platforms" value="${product.platforms}" />
<property name="nuget.name" value="${product.name}.Selfhost" />
<property name="nuget.releaseDirectory" value="${path.build}\${build.platform}\release\Selfhost" dynamic="true"/>
<property name="nuget.dependencies" value="${product.name}" />
<property name="nuget.additionalFiles" value="-" />
<property name="nuget.packageName" value="${nuget.name}${product.packagePostfix}" />
<property name="nuget.symbol.basedir" value="${path.base}/build/nuget-selfhost_symbol" />
<property name="nuget.project" value="${path.src}/${product.name}.Selfhost/${product.name}.Selfhost.csproj" />

<property name="nant.settings.currentframework" value="net-4.0"/>
<msbuild project="${nuget.project}" />
<call target="nuget-run"/>
</target>

<target name="nuget-webhost">
<property name="nuget.sourcedir" value="${path.base}/nuget-webhost" />
<property name="nuget.basedir" value="${path.base}/build/nuget-webhost" />
<property name="nuget.platforms" value="" />
<property name="nuget.name" value="${product.name}.WebHost" />
<property name="nuget.dependencies" value="${product.name}" />
<property name="nuget.additionalFiles" value="-" />
<property name="nuget.packageName" value="${nuget.name}${product.packagePostfix}" />
<property name="nuget.symbol.basedir" value="" />
<property name="nuget.project" value="" />

<property name="nant.settings.currentframework" value="net-4.0"/>
<call target="nuget-run"/>
</target>
</project>
60 changes: 59 additions & 1 deletion Ninject.Web.WebApi.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,85 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ninject.Web.WebApi", "src\Ninject.Web.WebApi\Ninject.Web.WebApi.csproj", "{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleApplication", "SampleApplication\SampleApplication.csproj", "{776D2ADD-1AC3-4219-8F95-6E581A7439E4}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleApplication", "src\SampleApplication\SampleApplication.csproj", "{776D2ADD-1AC3-4219-8F95-6E581A7439E4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SelfHosted-SampleApplication", "src\SelfHosted-SampleApplication\SelfHosted-SampleApplication.csproj", "{4DF31461-1DB8-4777-87C3-155FF2932B30}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ninject.Web.WebApi.Selfhost", "src\Ninject.Web.WebApi.Selfhost\Ninject.Web.WebApi.Selfhost.csproj", "{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
AutomatedRelease|Any CPU = AutomatedRelease|Any CPU
AutomatedRelease|Mixed Platforms = AutomatedRelease|Mixed Platforms
AutomatedRelease|x86 = AutomatedRelease|x86
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}.AutomatedRelease|Any CPU.ActiveCfg = Release|Any CPU
{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}.AutomatedRelease|Any CPU.Build.0 = Release|Any CPU
{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}.AutomatedRelease|Mixed Platforms.ActiveCfg = Release|Any CPU
{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}.AutomatedRelease|Mixed Platforms.Build.0 = Release|Any CPU
{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}.AutomatedRelease|x86.ActiveCfg = Release|Any CPU
{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}.Debug|x86.ActiveCfg = Debug|Any CPU
{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}.Release|Any CPU.Build.0 = Release|Any CPU
{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{F8980B1F-899E-4C2D-A0DC-E76DB52DAA03}.Release|x86.ActiveCfg = Release|Any CPU
{776D2ADD-1AC3-4219-8F95-6E581A7439E4}.AutomatedRelease|Any CPU.ActiveCfg = Release|Any CPU
{776D2ADD-1AC3-4219-8F95-6E581A7439E4}.AutomatedRelease|Any CPU.Build.0 = Release|Any CPU
{776D2ADD-1AC3-4219-8F95-6E581A7439E4}.AutomatedRelease|Mixed Platforms.ActiveCfg = Release|Any CPU
{776D2ADD-1AC3-4219-8F95-6E581A7439E4}.AutomatedRelease|Mixed Platforms.Build.0 = Release|Any CPU
{776D2ADD-1AC3-4219-8F95-6E581A7439E4}.AutomatedRelease|x86.ActiveCfg = Release|Any CPU
{776D2ADD-1AC3-4219-8F95-6E581A7439E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{776D2ADD-1AC3-4219-8F95-6E581A7439E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{776D2ADD-1AC3-4219-8F95-6E581A7439E4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{776D2ADD-1AC3-4219-8F95-6E581A7439E4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{776D2ADD-1AC3-4219-8F95-6E581A7439E4}.Debug|x86.ActiveCfg = Debug|Any CPU
{776D2ADD-1AC3-4219-8F95-6E581A7439E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{776D2ADD-1AC3-4219-8F95-6E581A7439E4}.Release|Any CPU.Build.0 = Release|Any CPU
{776D2ADD-1AC3-4219-8F95-6E581A7439E4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{776D2ADD-1AC3-4219-8F95-6E581A7439E4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{776D2ADD-1AC3-4219-8F95-6E581A7439E4}.Release|x86.ActiveCfg = Release|Any CPU
{4DF31461-1DB8-4777-87C3-155FF2932B30}.AutomatedRelease|Any CPU.ActiveCfg = Release|x86
{4DF31461-1DB8-4777-87C3-155FF2932B30}.AutomatedRelease|Mixed Platforms.ActiveCfg = Release|x86
{4DF31461-1DB8-4777-87C3-155FF2932B30}.AutomatedRelease|Mixed Platforms.Build.0 = Release|x86
{4DF31461-1DB8-4777-87C3-155FF2932B30}.AutomatedRelease|x86.ActiveCfg = Release|x86
{4DF31461-1DB8-4777-87C3-155FF2932B30}.AutomatedRelease|x86.Build.0 = Release|x86
{4DF31461-1DB8-4777-87C3-155FF2932B30}.Debug|Any CPU.ActiveCfg = Debug|x86
{4DF31461-1DB8-4777-87C3-155FF2932B30}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{4DF31461-1DB8-4777-87C3-155FF2932B30}.Debug|Mixed Platforms.Build.0 = Debug|x86
{4DF31461-1DB8-4777-87C3-155FF2932B30}.Debug|x86.ActiveCfg = Debug|x86
{4DF31461-1DB8-4777-87C3-155FF2932B30}.Debug|x86.Build.0 = Debug|x86
{4DF31461-1DB8-4777-87C3-155FF2932B30}.Release|Any CPU.ActiveCfg = Release|x86
{4DF31461-1DB8-4777-87C3-155FF2932B30}.Release|Mixed Platforms.ActiveCfg = Release|x86
{4DF31461-1DB8-4777-87C3-155FF2932B30}.Release|Mixed Platforms.Build.0 = Release|x86
{4DF31461-1DB8-4777-87C3-155FF2932B30}.Release|x86.ActiveCfg = Release|x86
{4DF31461-1DB8-4777-87C3-155FF2932B30}.Release|x86.Build.0 = Release|x86
{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}.AutomatedRelease|Any CPU.ActiveCfg = Release|Any CPU
{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}.AutomatedRelease|Any CPU.Build.0 = Release|Any CPU
{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}.AutomatedRelease|Mixed Platforms.ActiveCfg = Release|Any CPU
{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}.AutomatedRelease|Mixed Platforms.Build.0 = Release|Any CPU
{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}.AutomatedRelease|x86.ActiveCfg = Release|Any CPU
{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}.Debug|x86.ActiveCfg = Debug|Any CPU
{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}.Release|Any CPU.Build.0 = Release|Any CPU
{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{A8925F38-F4AB-44B4-A4AC-C37CF7EA6A37}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
76 changes: 48 additions & 28 deletions Ninject.include
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,14 @@
<property name="build.platform" value="net-4.5" overwrite="true"/>
</target>

<target name="config-platform-net-4.5_medium_trust">
<property name="nant.settings.currentframework" value="net-4.5"/>
<property name="build.defines" value="${global.build.defines},NET,NET_45,MEDIUM_TRUST,NO_PARTIAL_TRUST"/>
<property name="path.tools.xunit.console" value="${path.tools.xunit}/xunit.console.clr4.exe"/>
<property name="nuget.add" value="false"/>
<property name="build.platform" value="net-4.5_medium_trust" overwrite="true"/>
</target>

<target name="config-platform-net-4.5">
<property name="nant.settings.currentframework" value="net-4.5"/>
<property name="build.defines" value="${global.build.defines},NET,NET_45,NO_PARTIAL_TRUST"/>
Expand Down Expand Up @@ -403,17 +411,21 @@

<target name="buildServerPlatforms" depends="InitializeBuildSystem">
<foreach item="String" in="${product.buildserverPlatforms}" delim="," property="platform">
<property name="build.target" value="${platform}"/>
<call target="package-bin"/>
<if test="${not(property::exists('skip.' + platform))}">
<property name="build.target" value="${platform}"/>
<call target="package-bin"/>
</if>
</foreach>
<call target="package-source"/>
</target>

<target name="allPlatforms" depends="InitializeBuildSystem">
<call target="csproj"/>
<foreach item="String" in="${product.platforms}" delim="," property="platform">
<property name="build.target" value="${platform}"/>
<call target="package-bin"/>
<if test="${not(property::exists('skip.' + platform))}">
<property name="build.target" value="${platform}"/>
<call target="package-bin"/>
</if>
</foreach>
<call target="package-source"/>
<call target="nuget-all"/>
Expand Down Expand Up @@ -445,6 +457,7 @@
</target>

<target name="csproj">
<property name="nant.settings.currentframework" value="net-4.5"/>
<msbuild project="${path.src}/${product.name}/${product.name}.csproj" />
</target>

Expand Down Expand Up @@ -490,22 +503,27 @@

<target name="nuget-run" depends="get-git-revision" description="Copies the nuget output to the top bin directory">
<delete dir="${nuget.basedir}"/>
<delete dir="${nuget.symbol.basedir}"/>
<if test="${not(nuget.symbol.basedir == '')}"> <!-- unless does not work on delete -->
<delete dir="${nuget.symbol.basedir}"/>
</if>

<property name="nuget.platform" value=""/>
<property name="nuget.version" value="${build.version}" if="${product.additionalVersionTag == ''}"/>
<property name="nuget.version" value="${version.major}.${version.minor}.${version.build}${product.additionalVersionTag}" unless="${product.additionalVersionTag == ''}"/>

<call target="config-build-${build.config}"/>
<foreach item="String" in="${nuget.platforms}" delim="," property="platform">
<call target="config-platform-${platform}"/>
<copy overwrite="false" todir="${nuget.basedir}\lib\${nuget.platform}" flatten="true" if="${nuget.add}">
<fileset basedir="${nuget.releaseDirectory}">
<include name="${nuget.name}.dll" />
<include name="${nuget.name}.xml" />
<include name="${nuget.name}.pdb" />
<include name="${nuget.additionalFiles}" unless="${nuget.additionalFiles == '-'}"/>
</fileset>
</copy>
<if test="${not(property::exists('skip.' + platform))}">
<call target="config-platform-${platform}"/>
<copy overwrite="false" todir="${nuget.basedir}\lib\${nuget.platform}" flatten="true" if="${nuget.add}">
<fileset basedir="${nuget.releaseDirectory}">
<include name="${nuget.name}.dll" />
<include name="${nuget.name}.xml" />
<include name="${nuget.name}.pdb" />
<include name="${nuget.additionalFiles}" unless="${nuget.additionalFiles == '-'}"/>
</fileset>
</copy>
</if>
</foreach>

<copy overwrite="false" todir="${nuget.basedir}">
Expand Down Expand Up @@ -583,20 +601,22 @@
</fileset>
</move>

<exec program="${path.tools.nuget}" workingdir="${nuget.basedir}" commandline="pack ${nuget.project} -symbols" />
<unzip zipfile="${path.dist}\NuGet\${nuget.packageName}.${nuget.version}.nupkg" todir="${nuget.symbol.basedir}/target"/>
<unzip zipfile="${nuget.basedir}\${nuget.name}.${version.major}.${version.minor}.0.0.symbols.nupkg" todir="${nuget.symbol.basedir}/source"/>
<copy overwrite="false" todir="${nuget.symbol.basedir}/target">
<fileset basedir="${nuget.symbol.basedir}/source">
<include name="[Content_Types].xml" />
<include name="src/**" />
</fileset>
</copy>
<zip zipfile="${path.dist}\NuGet\${nuget.packageName}.${nuget.version}.symbols.nupkg">
<fileset basedir="${nuget.symbol.basedir}/target">
<include name="**"/>
</fileset>
</zip>
<if test="${not(nuget.project == '')}">
<exec program="${path.tools.nuget}" workingdir="${nuget.basedir}" commandline="pack ${nuget.project} -symbols" />
<unzip zipfile="${path.dist}\NuGet\${nuget.packageName}.${nuget.version}.nupkg" todir="${nuget.symbol.basedir}/target"/>
<unzip zipfile="${nuget.basedir}\${nuget.name}.${version.major}.${version.minor}.0.0.symbols.nupkg" todir="${nuget.symbol.basedir}/source"/>
<copy overwrite="false" todir="${nuget.symbol.basedir}/target">
<fileset basedir="${nuget.symbol.basedir}/source">
<include name="[Content_Types].xml" />
<include name="src/**" />
</fileset>
</copy>
<zip zipfile="${path.dist}\NuGet\${nuget.packageName}.${nuget.version}.symbols.nupkg">
<fileset basedir="${nuget.symbol.basedir}/target">
<include name="**"/>
</fileset>
</zip>
</if>
</target>

<target name="CopyDefaultTestInfrastructureAssemblies">
Expand Down
16 changes: 0 additions & 16 deletions SampleApplication/packages.config

This file was deleted.

Binary file added lib/WebApi/System.Net.Http.WebRequest.dll
Binary file not shown.
Loading