Source

NHibernate.Envers / Src / Build / default.msbuild

<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
	<PropertyGroup>
		<SourceDir>$(MSBuildProjectDirectory)\..</SourceDir>
		<NugetFolder>$([System.IO.Path]::Combine($(SourceDir), ".nuget"))</NugetFolder>
		<DeployFolder>$(MSBuildProjectDirectory)\Deploy</DeployFolder>
		<DocReferencePath>$(SourceDir)\doc\reference</DocReferencePath>
		<ClassPath>"$(DocReferencePath)\support\lib\*"</ClassPath>
		<TempDirectory>$(DeployFolder)\temp</TempDirectory>
		<TempDoc>$(TempDirectory)\doc.tmp</TempDoc>
		<OutputDoc>$(DeployFolder)\EnversUserDoc.pdf</OutputDoc>
		<DeployHtmlFolder>$(DeployFolder)\html</DeployHtmlFolder>
	</PropertyGroup>

	<Target Name="BuildRelease" DependsOnTargets="RunHtmlBuild;RunBuild;nuget">
		<RemoveDir Directories="$(TempDirectory)"/>
	</Target>
	
	<Target Name="nuget" DependsOnTargets="MakeBuildDirectory;RunBuild">
		<Exec Command="$(NugetFolder)\NuGet pack NHibernate.Envers.nuspec -o $(DeployFolder) -symbols -Prop Configuration=Release"
				  WorkingDirectory="$(MSBuildProjectDirectory)"/>
	</Target>

	<Target Name="RunBuild">
		<MSBuild Projects="$(SourceDir)\NHibernate.Envers\NHibernate.Envers.csproj" Targets="Clean;Build" />
	</Target>

	<Target Name="MakeBuildDirectory">
		<RemoveDir Directories="$(DeployHtmlFolder)"/>
		<RemoveDir Directories="$(DeployFolder)" />
		<MakeDir Directories="$(DeployFolder)" />
		<MakeDir Directories="$(TempDirectory)"/>
		<MakeDir Directories="$(DeployHtmlFolder)"/>
	</Target>

	<Target Name="BuildDocs" DependsOnTargets="RunPdfBuild;RunHtmlBuild" Condition="'$(configuration)' == 'Release'">
		<Copy SourceFiles="$(OutputDoc)" DestinationFolder="$(DeployFolder)" />
		<RemoveDir Directories="$(TempDirectory)" />
	</Target>

	<Target Name="RunPdfBuild" DependsOnTargets="MakeBuildDirectory">
		<exec command="java -classpath $(ClassPath) com.icl.saxon.StyleSheet -o $(TempDoc) master.xml styles/fopdf.xsl"
			  WorkingDirectory="$(DocReferencePath)"/>
		<exec command="java -classpath $(ClassPath) org.apache.fop.apps.Fop $(TempDoc) $(OutputDoc)"
			  WorkingDirectory="$(DocReferencePath)"/>
	</Target>
	
	<Target Name="RunHtmlBuild" DependsOnTargets="MakeBuildDirectory">
		<exec command="java -classpath $(ClassPath) com.icl.saxon.StyleSheet -o $(DeployHtmlFolder)\index.html $(DocReferencePath)\master.xml $(DocReferencePath)\styles\html.xsl"
			  WorkingDirectory="$(DeployHtmlFolder)"/>
		<ItemGroup>
			<WebFiles Include="$(DocReferencePath)\styles\**\*.css;$(DocReferencePath)\images\**\*.*" />
		</ItemGroup>
		<copy SourceFiles="@(WebFiles)" DestinationFolder="$(DeployHtmlFolder)\"/>		
	</Target>
</Project>