diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-02-16 09:04:11 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-02-16 09:04:11 -0800 |
commit | 8564a69eea659f225f30b5e21fa8fbe6888dfda6 (patch) | |
tree | e040df0f8a937faaf8d28c124135a9ac80621b45 /samples/Samples.proj | |
parent | 8be14608f4c8321eefa7f77dadfc1346d426f02d (diff) | |
download | DotNetOpenAuth-8564a69eea659f225f30b5e21fa8fbe6888dfda6.zip DotNetOpenAuth-8564a69eea659f225f30b5e21fa8fbe6888dfda6.tar.gz DotNetOpenAuth-8564a69eea659f225f30b5e21fa8fbe6888dfda6.tar.bz2 |
Split out the doc and sample publishing targets.
Diffstat (limited to 'samples/Samples.proj')
-rw-r--r-- | samples/Samples.proj | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/samples/Samples.proj b/samples/Samples.proj index b8fe558..c79a0a4 100644 --- a/samples/Samples.proj +++ b/samples/Samples.proj @@ -1,5 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <!-- Properties that must be set for these targets to function: + $(BranchName): The name of the branch being built. Used to determine the web subdirectory for publishing. + + For creating web sites: + $(PublishSamplesWebSiteName): The name of the web site under which the sample web applications will be created/deleted. + + For creating or publishing to web sites: + $(SampleWebRoot): the full physical path to where samples should be copied to, excluding $(BranchName) + --> <Import Project="$(MSBuildProjectDirectory)\..\tools\DotNetOpenAuth.automated.props"/> <ItemGroup> @@ -17,5 +26,81 @@ <MSBuild Projects="$(SolutionPath)" Targets="@(SampleSites)" BuildInParallel="$(BuildInParallel)" /> </Target> + <Target Name="Prepare"> + <Error Text="The BranchName property must be set." Condition=" '$(BranchName)' == '' " /> + <Error Text="The SampleWebRoot property must be set." Condition=" '$(SampleWebRoot)' == '' " /> + <PropertyGroup> + <PublishSamplesWebSiteVirtualPath>/$(BranchName)</PublishSamplesWebSiteVirtualPath> + </PropertyGroup> + <ItemGroup> + <_SampleWebConfigs Include="$(ProjectRoot)samples\*\web.config" /> + <PublishableWebSamples Include="@(_SampleWebConfigs->'%(RootDir)%(Directory)')" /> + </ItemGroup> + + <!-- Trim the trailing slash on the web sample paths so we can just get the leaf directory name. --> + <Trim + Inputs="@(PublishableWebSamples)" + EndCharacters="\"> + <Output TaskParameter="Outputs" ItemName="_PublishableWebSamplesNoTrailingSlash" /> + </Trim> + + <ItemGroup> + <PublishableWebSamplesVirtualPaths Include="@(_PublishableWebSamplesNoTrailingSlash->'$(PublishSamplesWebSiteVirtualPath)/%(Filename)')" /> + <PublishableWebSamplesPhysicalPaths Include="@(_PublishableWebSamplesNoTrailingSlash->'$(SampleWebRoot)\$(BranchName)\%(Filename)')" /> + </ItemGroup> + </Target> + + <Target Name="PrepareForPublish" DependsOnTargets="Prepare;Build"> + <ItemGroup> + <SampleSources Include="$(ProjectRoot)samples\**\*" /> + <SampleSources> + <PublishedLocation>$(SampleWebRoot)\$(BranchName)\%(RecursiveDir)%(Filename)%(Extension)</PublishedLocation> + </SampleSources> + </ItemGroup> + + <FilterItems + InputItems="@(SampleSources)" + StartsWithAny="@(PublishableWebSamples)"> + <Output TaskParameter="FilteredItems" ItemName="PublishableWebSampleSources" /> + </FilterItems> + + <ItemGroup> + <PublishableWebSampleTargets Include="@(PublishableWebSampleSources->'%(PublishedLocation)')" /> + </ItemGroup> + </Target> + + <Target Name="Publish" + DependsOnTargets="PrepareForPublish" + Inputs="@(PublishableWebSampleSources)" + Outputs="@(PublishableWebSampleTargets)" + Condition=" '$(SampleWebRoot)' != '' "> + <RemoveDir Directories="$(SampleWebRoot)\$(BranchName)" /> + <MakeDir Directories="$(SampleWebRoot)\$(BranchName)" /> + <Copy SourceFiles="@(PublishableWebSampleSources)" DestinationFiles="@(PublishableWebSampleTargets)" SkipUnchangedFiles="true" /> + </Target> + + <Target Name="Unpublish" + DependsOnTargets="DeleteSitesOnIis" + Condition=" '$(SampleWebRoot)' != '' "> + </Target> + + <Target Name="CreateSitesOnIis" DependsOnTargets="Prepare"> + <Error Text="The PublishSamplesWebSiteName property must be set." Condition=" '$(PublishSamplesWebSiteName)' == '' "/> + <Error Text="The SampleWebRoot property must be set." Condition=" '$(SampleWebRoot)' == '' " /> + <CreateWebApplication + WebSiteName="$(PublishSamplesWebSiteName)" + PhysicalPaths="@(PublishableWebSamplesPhysicalPaths)" + VirtualPaths="@(PublishableWebSamplesVirtualPaths)" + /> + </Target> + + <Target Name="DeleteSitesOnIis" DependsOnTargets="Prepare"> + <Error Text="The PublishSamplesWebSiteName property must be set." Condition=" '$(PublishSamplesWebSiteName)' == '' "/> + <DeleteWebApplication + WebSiteName="$(PublishSamplesWebSiteName)" + VirtualPaths="@(PublishableWebSamplesVirtualPaths)" + /> + </Target> + <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.automated.targets"/> </Project> |