350 lines
16 KiB
XML
350 lines
16 KiB
XML
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
|
|
<!--
|
|
****************************************************
|
|
INCLUDES
|
|
*****************************************************
|
|
-->
|
|
|
|
<PropertyGroup>
|
|
<MSBuildCommunityTasksPath>..\MSBuildCommunityTasks</MSBuildCommunityTasksPath>
|
|
<UmbracoMSBuildTasksPath>..\UmbracoMSBuildTasks</UmbracoMSBuildTasksPath>
|
|
</PropertyGroup>
|
|
|
|
<Import Project="..\tools\UmbracoMSBuildTasks\Umbraco.MSBuild.Tasks.Targets" />
|
|
<Import Project="..\tools\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
|
|
|
|
<UsingTask TaskName="GenerateHash" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
|
|
<ParameterGroup>
|
|
<InputFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
|
|
<OutputFile ParameterType="System.String" Required="true" />
|
|
</ParameterGroup>
|
|
<Task>
|
|
<Using Namespace="System.IO" />
|
|
<Using Namespace="System.Linq" />
|
|
<Using Namespace="System.Security.Cryptography" />
|
|
<Code Type="Fragment" Language="cs">
|
|
<![CDATA[
|
|
using (var ms = new MemoryStream())
|
|
{
|
|
foreach (var item in InputFiles)
|
|
{
|
|
string path = item.ItemSpec;
|
|
|
|
using (FileStream stream = new FileStream(path, FileMode.Open))
|
|
{
|
|
using (var cryptoProvider = new SHA1CryptoServiceProvider())
|
|
{
|
|
|
|
var fileHash = cryptoProvider.ComputeHash(stream);
|
|
|
|
using (TextWriter w = new StreamWriter(OutputFile, false))
|
|
{
|
|
w.WriteLine(string.Join("", fileHash.Select(b => b.ToString("x2"))));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]]>
|
|
</Code>
|
|
</Task>
|
|
</UsingTask>
|
|
|
|
|
|
<!--
|
|
****************************************************
|
|
VARIABLES
|
|
*****************************************************
|
|
-->
|
|
|
|
<!-- NB: BUILD_NUMBER is passed in by the build server -->
|
|
<PropertyGroup Condition="'$(BUILD_NUMBER)'!=''">
|
|
<DECIMAL_BUILD_NUMBER>.$(BUILD_NUMBER)</DECIMAL_BUILD_NUMBER>
|
|
</PropertyGroup>
|
|
<PropertyGroup Condition="'$(BUILD_RELEASE)'!=''">
|
|
<DECIMAL_BUILD_NUMBER>.$(BUILD_RELEASE)</DECIMAL_BUILD_NUMBER>
|
|
</PropertyGroup>
|
|
<PropertyGroup Condition="'$(BUILD_RELEASE)'!='' AND '$(BUILD_COMMENT)'!=''">
|
|
<DECIMAL_BUILD_NUMBER>.$(BUILD_RELEASE)-$(BUILD_COMMENT)</DECIMAL_BUILD_NUMBER>
|
|
</PropertyGroup>
|
|
<PropertyGroup Condition="'$(BUILD_RELEASE)'!='' AND '$(BUILD_NIGHTLY)'!=''">
|
|
<DECIMAL_BUILD_NUMBER>.$(BUILD_RELEASE)-$(BUILD_NIGHTLY)</DECIMAL_BUILD_NUMBER>
|
|
</PropertyGroup>
|
|
<PropertyGroup Condition="'$(BUILD_RELEASE)'!='' AND '$(BUILD_COMMENT)'!='' AND '$(BUILD_NIGHTLY)'!=''">
|
|
<DECIMAL_BUILD_NUMBER>.$(BUILD_RELEASE)-$(BUILD_COMMENT)-$(BUILD_NIGHTLY)</DECIMAL_BUILD_NUMBER>
|
|
</PropertyGroup>
|
|
|
|
<PropertyGroup>
|
|
<BuildConfiguration>Release</BuildConfiguration>
|
|
<BuildFolder>_BuildOutput\</BuildFolder>
|
|
<BuildZipFileName>UmbracoCms$(DECIMAL_BUILD_NUMBER).zip</BuildZipFileName>
|
|
<BuildZipFileNameBin>UmbracoCms.AllBinaries$(DECIMAL_BUILD_NUMBER).zip</BuildZipFileNameBin>
|
|
<BuildZipFileNameWebPi>UmbracoCms.WebPI$(DECIMAL_BUILD_NUMBER).zip</BuildZipFileNameWebPi>
|
|
<IncludeSymbols>False</IncludeSymbols>
|
|
<BuildFolderRelativeToProjects>..\..\build\$(BuildFolder)</BuildFolderRelativeToProjects>
|
|
<BuildFolderAbsolutePath>$(MSBuildProjectDirectory)\$(BuildFolder)</BuildFolderAbsolutePath>
|
|
<SolutionBinFolder>$(BuildFolder)bin\</SolutionBinFolder>
|
|
<WebAppFolder>$(BuildFolder)WebApp\</WebAppFolder>
|
|
<WebPiFolder>$(BuildFolder)WebPi\</WebPiFolder>
|
|
<ConfigsFolder>$(BuildFolder)Configs\</ConfigsFolder>
|
|
<SolutionBinFolderRelativeToProjects>$(BuildFolderRelativeToProjects)bin\</SolutionBinFolderRelativeToProjects>
|
|
<SolutionBinFolderAbsolutePath>$(BuildFolderAbsolutePath)bin\</SolutionBinFolderAbsolutePath>
|
|
<WebAppFolderRelativeToProjects>$(BuildFolderRelativeToProjects)WebApp\</WebAppFolderRelativeToProjects>
|
|
<WebAppFolderAbsolutePath>$(BuildFolderAbsolutePath)WebApp\</WebAppFolderAbsolutePath>
|
|
<WebPiFolderRelativeToProjects>$(BuildFolderRelativeToProjects)WebPi\</WebPiFolderRelativeToProjects>
|
|
<WebPiFolderAbsolutePath>$(BuildFolderAbsolutePath)WebPi\</WebPiFolderAbsolutePath>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<SystemFolders Include="$(WebAppFolder)App_Data" />
|
|
<SystemFolders Include="$(WebAppFolder)Media" />
|
|
<SystemFolders Include="$(WebAppFolder)Views" />
|
|
</ItemGroup>
|
|
|
|
<!--
|
|
****************************************************
|
|
TARGETS
|
|
*****************************************************
|
|
-->
|
|
|
|
<Target Name="Build" DependsOnTargets="GenerateWebPiHash">
|
|
<Message Text="Build finished" />
|
|
</Target>
|
|
|
|
<Target Name="GenerateWebPiHash" DependsOnTargets="ZipWebPiApp">
|
|
<ItemGroup>
|
|
<WebPiFile Include="$(BuildZipFileNameWebPi)" />
|
|
</ItemGroup>
|
|
<Message Text="Calculating hash for $(BuildZipFileNameWebPi)" />
|
|
<GenerateHash InputFiles="@(WebPiFile)" OutputFile="webpihash.txt" />
|
|
</Target>
|
|
|
|
<Target Name="CleanUp" DependsOnTargets="ZipWebPiApp">
|
|
<Message Text="Deleting $(BuildFolder)" Importance="high" />
|
|
<RemoveDir Directories="$(BuildFolder)" />
|
|
<Message Text="Finished deleting $(BuildFolder)" Importance="high" />
|
|
</Target>
|
|
|
|
<Target Name="ZipWebPiApp" DependsOnTargets="ZipWebApp" >
|
|
<!-- Clean folders -->
|
|
<RemoveDir Directories="$(WebPiFolder)" />
|
|
<MakeDir Directories="$(WebPiFolder)" />
|
|
<MakeDir Directories="$(WebPiFolder)umbraco" />
|
|
|
|
<!-- Copy fresh built umbraco files -->
|
|
<Exec Command="xcopy %22$(WebAppFolderAbsolutePath)*%22 %22$(WebPiFolderAbsolutePath)umbraco%22 /S /E /Y /I" />
|
|
|
|
<!-- Copy Web Pi template files -->
|
|
<ItemGroup>
|
|
<WebPiFiles Include="..\src\WebPi\**\*.*" />
|
|
</ItemGroup>
|
|
|
|
<Copy SourceFiles="@(WebPiFiles)"
|
|
DestinationFiles="@(WebPiFiles->'$(WebPiFolder)%(RecursiveDir)%(Filename)%(Extension)')" />
|
|
|
|
<!-- Zip the files -->
|
|
<Exec Command="..\tools\7zip\7za.exe a -r %22$(BuildZipFileNameWebPi)%22 %22$(WebPiFolderAbsolutePath)*%22 -x!dotLess.Core.dll -x![Content_Types].xml >NUL" />
|
|
</Target>
|
|
|
|
<Target Name="ZipWebApp" DependsOnTargets="CreateSystemFolders" >
|
|
<Message Text="Starting to zip to $(buildDate)-$(BuildZipFileName)" Importance="high" />
|
|
|
|
<Exec Command="..\tools\7zip\7za.exe a -r %22$(BuildZipFileNameBin)%22 %22$(SolutionBinFolderAbsolutePath)*%22 -x!dotLess.Core.dll >NUL" />
|
|
<Exec Command="..\tools\7zip\7za.exe a -r %22$(BuildZipFileName)%22 %22$(WebAppFolderAbsolutePath)*%22 -x!dotLess.Core.dll -x![Content_Types].xml >NUL" />
|
|
|
|
<Message Text="Finished zipping to build\$(BuildFolder)\$(buildDate)-$(BuildZipFileName)" Importance="high" />
|
|
</Target>
|
|
|
|
<Target Name="CreateSystemFolders" DependsOnTargets="CopyBelleBuild" Inputs="@(SystemFolders)" Outputs="%(Identity).Dummy">
|
|
<MakeDir Directories="@(SystemFolders)" />
|
|
</Target>
|
|
|
|
<Target Name="CopyBelleBuild" DependsOnTargets="CopyLibraries" >
|
|
<ItemGroup>
|
|
<BelleFiles Include="..\src\Umbraco.Web.UI.Client\build\belle\**\*.*" Exclude="..\src\Umbraco.Web.UI.Client\build\belle\index.html" />
|
|
</ItemGroup>
|
|
|
|
<Copy SourceFiles="@(BelleFiles)"
|
|
DestinationFiles="@(BelleFiles->'$(WebAppFolder)umbraco\%(RecursiveDir)%(Filename)%(Extension)')"
|
|
OverwriteReadOnlyFiles="true"
|
|
SkipUnchangedFiles="false" />
|
|
</Target>
|
|
|
|
<Target Name="CopyLibraries" DependsOnTargets="OffsetTimestamps" >
|
|
<!-- Copy SQL CE -->
|
|
<ItemGroup>
|
|
<SQLCE4Files
|
|
Include="..\src\packages\SqlServerCE.4.0.0.1\**\*.*"
|
|
Exclude="..\src\packages\SqlServerCE.4.0.0.1\lib\**\*;..\src\packages\SqlServerCE.4.0.0.1\**\*.nu*"
|
|
/>
|
|
</ItemGroup>
|
|
|
|
<Copy SourceFiles="@(SQLCE4Files)"
|
|
DestinationFiles="@(SQLCE4Files->'$(SolutionBinFolder)%(RecursiveDir)%(Filename)%(Extension)')"
|
|
OverwriteReadOnlyFiles="true"
|
|
SkipUnchangedFiles="false" />
|
|
|
|
<Copy SourceFiles="@(SQLCE4Files)"
|
|
DestinationFiles="@(SQLCE4Files->'$(WebAppFolder)bin\%(RecursiveDir)%(Filename)%(Extension)')"
|
|
OverwriteReadOnlyFiles="true"
|
|
SkipUnchangedFiles="false" />
|
|
|
|
</Target>
|
|
|
|
<!-- Offset the modified timestamps on all umbraco dlls, as WebResources break if date is in the future, which, due to timezone offsets can happen. -->
|
|
<Target Name="OffsetTimestamps" DependsOnTargets="CopyTransformedWebConfig">
|
|
<CreateItem Include="$(BuildFolder)**\umbraco.*.dll">
|
|
<Output TaskParameter="Include" ItemName="FilesToOffsetTimestamp" />
|
|
</CreateItem>
|
|
<Message Text="Starting to offset timestamps" Importance="high" />
|
|
<Umbraco.MSBuild.Tasks.TimestampOffset Files="@(FilesToOffsetTimestamp)" Offset="-11" />
|
|
<Message Text="Finished offsetting timestamps" Importance="high" />
|
|
</Target>
|
|
|
|
<!-- Copy the transformed web.config file to the root -->
|
|
<Target Name="CopyTransformedWebConfig" DependsOnTargets="CopyTransformedConfig">
|
|
<ItemGroup>
|
|
<WebConfigFile Include="..\src\Umbraco.Web.UI\web.$(BuildConfiguration).Config.transformed" />
|
|
</ItemGroup>
|
|
|
|
<Copy SourceFiles="@(WebConfigFile)"
|
|
DestinationFiles="$(WebAppFolder)Web.config"
|
|
OverwriteReadOnlyFiles="true"
|
|
SkipUnchangedFiles="false" />
|
|
</Target>
|
|
|
|
<!-- Copy the config files and rename them to *.config.transform -->
|
|
<Target Name="CopyTransformedConfig" DependsOnTargets="CopyXmlDocumentation">
|
|
<ItemGroup>
|
|
<ConfigFiles Include="$(WebAppFolder)config\*.config;$(WebAppFolder)config\*.js" />
|
|
<CustomLanguageFiles Include="$(WebAppFolder)config\lang\*.xml" />
|
|
<WebConfigTransformFile Include="$(WebAppFolder)Web.config" />
|
|
</ItemGroup>
|
|
|
|
<Copy SourceFiles="@(ConfigFiles)"
|
|
DestinationFiles="@(ConfigFiles->'$(ConfigsFolder)\%(RecursiveDir)%(Filename)%(Extension)')"
|
|
OverwriteReadOnlyFiles="true"
|
|
SkipUnchangedFiles="false" />
|
|
|
|
<Copy SourceFiles="@(CustomLanguageFiles)"
|
|
DestinationFiles="@(CustomLanguageFiles->'$(ConfigsFolder)Lang\%(RecursiveDir)%(Filename)%(Extension)')"
|
|
OverwriteReadOnlyFiles="true"
|
|
SkipUnchangedFiles="false" />
|
|
|
|
<Copy SourceFiles="@(WebConfigTransformFile)"
|
|
DestinationFiles="$(ConfigsFolder)Web.config.transform"
|
|
OverwriteReadOnlyFiles="true"
|
|
SkipUnchangedFiles="false" />
|
|
</Target>
|
|
|
|
<!-- Copy the xml documentation to the bin folder -->
|
|
<Target Name="CopyXmlDocumentation" DependsOnTargets="CleanupPresentation">
|
|
<ItemGroup>
|
|
<XmlDocumentationFiles Include="$(SolutionBinFolder)*.xml" />
|
|
</ItemGroup>
|
|
|
|
<Copy SourceFiles="@(XmlDocumentationFiles)"
|
|
DestinationFiles="@(XmlDocumentationFiles->'$(WebAppFolder)bin\%(RecursiveDir)%(Filename)%(Extension)')"
|
|
OverwriteReadOnlyFiles="true"
|
|
SkipUnchangedFiles="false" />
|
|
<Message Text="CopyXmlDocumentation" />
|
|
</Target>
|
|
|
|
<!-- Unlike 2010, the VS2012 build targets file doesn't clean up the umbraco.presentation dir, do it manually -->
|
|
<Target Name="CleanupPresentation" DependsOnTargets="CompileProjects">
|
|
<ItemGroup>
|
|
<PresentationFolderToDelete Include="$(WebAppFolder)umbraco.presentation" />
|
|
</ItemGroup>
|
|
<RemoveDir Directories="@(PresentationFolderToDelete)" />
|
|
</Target>
|
|
|
|
<Target Name="CompileProjects" DependsOnTargets="SetVersionNumber">
|
|
|
|
<Message Text="Compiling web project to build\$(BuildFolder)" Importance="high" />
|
|
<!-- For UseWPP_CopyWebApplication=True see http://stackoverflow.com/questions/1983575/copywebapplication-with-web-config-transformations -->
|
|
|
|
<!-- Build the Umbraco.Web.UI project (and all dependencies) -->
|
|
<MSBuild Projects="..\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj"
|
|
Properties="WarningLevel=0;Configuration=$(BuildConfiguration);UseWPP_CopyWebApplication=True;PipelineDependsOnBuild=False;OutDir=$(SolutionBinFolderAbsolutePath);WebProjectOutputDir=$(WebAppFolderAbsolutePath);Verbosity=minimal"
|
|
Targets="Clean;Rebuild;" BuildInParallel="False" ToolsVersion="$(MSBuildToolsVersion)" UnloadProjectsOnCompletion="False" />
|
|
|
|
<!-- Build the Umbraco.Compat7 project (is not a dependency) -->
|
|
<MSBuild Projects="..\src\Umbraco.Compat7\Umbraco.Compat7.csproj"
|
|
Properties="WarningLevel=0;Configuration=$(BuildConfiguration);PipelineDependsOnBuild=False;OutDir=$(SolutionBinFolderAbsolutePath);Verbosity=minimal"
|
|
Targets="Clean;Rebuild;" BuildInParallel="False" ToolsVersion="$(MSBuildToolsVersion)" UnloadProjectsOnCompletion="False" />
|
|
|
|
<!-- Build the Umbraco.Tests project (is not a dependency) -->
|
|
<MSBuild Projects="..\src\Umbraco.Tests\Umbraco.Tests.csproj"
|
|
Condition="'$(BUILD_TESTS)'!=''"
|
|
Properties="WarningLevel=0;Configuration=Debug;PipelineDependsOnBuild=False;Verbosity=minimal"
|
|
Targets="Clean;Rebuild;" BuildInParallel="False" ToolsVersion="$(MSBuildToolsVersion)" UnloadProjectsOnCompletion="False" />
|
|
|
|
<!-- DONE -->
|
|
<Message Text="Finished compiling projects" Importance="high" />
|
|
|
|
</Target>
|
|
|
|
<Target Name="SetVersionNumber" Condition="'$(BUILD_RELEASE)'!=''">
|
|
<PropertyGroup>
|
|
|
|
<!-- eg 1.2.0 -->
|
|
<ReleaseVersion>$(BUILD_RELEASE)</ReleaseVersion>
|
|
|
|
<!-- empty, or eg .6689 -->
|
|
<DotBuild></DotBuild>
|
|
<DotBuild Condition="'$(BUILD_NUMBER)'!=''">.$(BUILD_NUMBER)</DotBuild>
|
|
|
|
<!-- eg 1.2.0, 1.2.0.6689 -->
|
|
<ReleaseFullVersion>$(ReleaseVersion)$(DotBuild)</ReleaseFullVersion>
|
|
|
|
<!-- empty, or eg -alpha002 -->
|
|
<DashComment></DashComment>
|
|
<DashComment Condition="'$(BUILD_COMMENT)'!=''">-$(BUILD_COMMENT)</DashComment>
|
|
|
|
<!-- empty, or eg +6689 -->
|
|
<PlusBuild></PlusBuild>
|
|
<PlusBuild Condition="'$(BUILD_NUMBER)'!=''">+$(BUILD_NUMBER)</PlusBuild>
|
|
|
|
<!-- eg 1.2.0, 1.2.0-alpha002, 1.2.0-alpha002+6689, 1.2.0+6689 -->
|
|
<ReleaseSemVersion>$(ReleaseVersion)$(DashComment)$(PlusBuild)</ReleaseSemVersion>
|
|
|
|
<!-- empty, or eg alpha002 -->
|
|
<ReleaseComment>$(BUILD_COMMENT)</ReleaseComment>
|
|
|
|
</PropertyGroup>
|
|
|
|
<!-- Match & replace 3 and 4 digit version numbers and -beta and +nightly (if they're there) -->
|
|
<FileUpdate
|
|
Files="..\src\Umbraco.Core\Configuration\UmbracoVersion.cs"
|
|
Regex="(\d+)\.(\d+)\.(\d+)(.(\d+))?"
|
|
ReplacementText="$(ReleaseFullVersion)"/>
|
|
|
|
<FileUpdate Files="..\src\Umbraco.Core\Configuration\UmbracoVersion.cs"
|
|
Regex="CurrentComment => "(.+)?""
|
|
ReplacementText="CurrentComment => "$(ReleaseComment)""/>
|
|
|
|
<!--This updates the AssemblyFileVersion for the solution to the umbraco version-->
|
|
<FileUpdate
|
|
Files="..\src\SolutionInfo.cs"
|
|
Regex="AssemblyFileVersion\("(.+)?"\)"
|
|
ReplacementText="AssemblyFileVersion("$(ReleaseFullVersion)")"/>
|
|
|
|
<!--This updates the AssemblyInformationalVersion for the solution to the umbraco version and comment-->
|
|
<FileUpdate
|
|
Files="..\src\SolutionInfo.cs"
|
|
Regex="AssemblyInformationalVersion\("(.+)?"\)"
|
|
ReplacementText="AssemblyInformationalVersion("$(ReleaseSemVersion)")"/>
|
|
|
|
<!--This updates the copyright year-->
|
|
<FileUpdate
|
|
Files="..\src\SolutionInfo.cs"
|
|
Regex="AssemblyCopyright\("Copyright © Umbraco (\d{4})"\)"
|
|
ReplacementText="AssemblyCopyright("Copyright © Umbraco $([System.DateTime]::Now.ToString(`yyyy`))")"/>
|
|
|
|
<XmlPoke XmlInputPath=".\NuSpecs\build\UmbracoCms.props"
|
|
Namespaces="<Namespace Prefix='x' Uri='http://schemas.microsoft.com/developer/msbuild/2003' />"
|
|
Query="//x:UmbracoVersion"
|
|
Value="$(ReleaseSemVersion)" />
|
|
</Target>
|
|
</Project> |