Build with PS
This commit is contained in:
34
.gitignore
vendored
34
.gitignore
vendored
@@ -4,26 +4,33 @@
|
|||||||
*.aps
|
*.aps
|
||||||
*.pch
|
*.pch
|
||||||
*.vspscc
|
*.vspscc
|
||||||
|
*.orig
|
||||||
|
*.suo
|
||||||
|
*.vs10x
|
||||||
|
*.ndproj
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
._.DS_Store
|
._.DS_Store
|
||||||
|
|
||||||
[Bb]in
|
[Bb]in
|
||||||
[Db]ebug*/
|
[Db]ebug*/
|
||||||
obj/
|
obj/
|
||||||
[Rr]elease*/
|
[Rr]elease*/
|
||||||
|
|
||||||
_ReSharper*/
|
_ReSharper*/
|
||||||
|
|
||||||
_NCrunch_*/
|
_NCrunch_*/
|
||||||
*.ncrunchsolution
|
*.ncrunchsolution
|
||||||
*.ncrunchsolution.user
|
*.ncrunchsolution.user
|
||||||
*.ncrunchproject
|
*.ncrunchproject
|
||||||
*.crunchsolution.cache
|
*.crunchsolution.cache
|
||||||
|
|
||||||
[Tt]est[Rr]esult*
|
[Tt]est[Rr]esult*
|
||||||
[Bb]uild[Ll]og.*
|
[Bb]uild[Ll]og.*
|
||||||
*.[Pp]ublish.xml
|
*.[Pp]ublish.xml
|
||||||
*.suo
|
|
||||||
[sS]ource
|
[sS]ource
|
||||||
[sS]andbox
|
[sS]andbox
|
||||||
umbraco.config
|
umbraco.config
|
||||||
*.vs10x
|
|
||||||
App_Data/TEMP/*
|
App_Data/TEMP/*
|
||||||
[Uu]mbraco/[Pp]resentation/[Uu]mbraco/[Pp]lugins/*
|
[Uu]mbraco/[Pp]resentation/[Uu]mbraco/[Pp]lugins/*
|
||||||
[Uu]mbraco/[Pp]resentation/[Uu]ser[Cc]ontrols/*
|
[Uu]mbraco/[Pp]resentation/[Uu]ser[Cc]ontrols/*
|
||||||
@@ -46,18 +53,11 @@ src/Umbraco.Web.UI/Web.*.config.transformed
|
|||||||
|
|
||||||
umbraco/presentation/umbraco/plugins/uComponents/uComponentsInstaller.ascx
|
umbraco/presentation/umbraco/plugins/uComponents/uComponentsInstaller.ascx
|
||||||
umbraco/presentation/packages/uComponents/MultiNodePicker/CustomTreeService.asmx
|
umbraco/presentation/packages/uComponents/MultiNodePicker/CustomTreeService.asmx
|
||||||
_BuildOutput/*
|
|
||||||
*.ncrunchsolution
|
|
||||||
build/UmbracoCms.AllBinaries*zip
|
|
||||||
build/UmbracoCms.WebPI*zip
|
|
||||||
build/UmbracoCms*zip
|
|
||||||
build/UmbracoExamine.PDF*zip
|
|
||||||
build/*.nupkg
|
|
||||||
src/Umbraco.Tests/config/applications.config
|
src/Umbraco.Tests/config/applications.config
|
||||||
src/Umbraco.Tests/config/trees.config
|
src/Umbraco.Tests/config/trees.config
|
||||||
src/Umbraco.Web.UI/web.config
|
src/Umbraco.Web.UI/web.config
|
||||||
src/Umbraco.Web.UI/Config/ClientDependency.config
|
src/Umbraco.Web.UI/Config/ClientDependency.config
|
||||||
*.orig
|
|
||||||
src/Umbraco.Tests/config/404handlers.config
|
src/Umbraco.Tests/config/404handlers.config
|
||||||
src/Umbraco.Web.UI/[Vv]iews/*.cshtml
|
src/Umbraco.Web.UI/[Vv]iews/*.cshtml
|
||||||
src/Umbraco.Web.UI/[Vv]iews/*.vbhtml
|
src/Umbraco.Web.UI/[Vv]iews/*.vbhtml
|
||||||
@@ -68,7 +68,6 @@ src/packages/repositories.config
|
|||||||
|
|
||||||
src/Umbraco.Web.UI/[Ww]eb.config
|
src/Umbraco.Web.UI/[Ww]eb.config
|
||||||
*.transformed
|
*.transformed
|
||||||
webpihash.txt
|
|
||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
@@ -95,7 +94,7 @@ src/Umbraco.Web.UI/[Uu]mbraco/[Aa]ssets/*
|
|||||||
src/Umbraco.Web.UI.Client/[Bb]uild/*
|
src/Umbraco.Web.UI.Client/[Bb]uild/*
|
||||||
src/Umbraco.Web.UI.Client/[Bb]uild/[Bb]elle/
|
src/Umbraco.Web.UI.Client/[Bb]uild/[Bb]elle/
|
||||||
src/Umbraco.Web.UI/[Uu]ser[Cc]ontrols/
|
src/Umbraco.Web.UI/[Uu]ser[Cc]ontrols/
|
||||||
build/_BuildOutput/
|
|
||||||
src/Umbraco.Web.UI.Client/src/[Ll]ess/*.css
|
src/Umbraco.Web.UI.Client/src/[Ll]ess/*.css
|
||||||
tools/NDepend/
|
tools/NDepend/
|
||||||
|
|
||||||
@@ -104,9 +103,8 @@ src/*.psess
|
|||||||
src/*.vspx
|
src/*.vspx
|
||||||
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js.*
|
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js.*
|
||||||
NDependOut/*
|
NDependOut/*
|
||||||
*.ndproj
|
|
||||||
QueryResult.htm
|
QueryResult.htm
|
||||||
*.ndproj
|
|
||||||
src/Umbraco.Web.UI/[Uu]mbraco/[Aa]ssets/*
|
src/Umbraco.Web.UI/[Uu]mbraco/[Aa]ssets/*
|
||||||
src/Umbraco.Web.UI/[Uu]mbraco/[Ll]ib/*
|
src/Umbraco.Web.UI/[Uu]mbraco/[Ll]ib/*
|
||||||
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.html
|
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.html
|
||||||
@@ -130,7 +128,6 @@ src/*.boltdata/
|
|||||||
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.config.js
|
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.config.js
|
||||||
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.front.js
|
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.front.js
|
||||||
src/umbraco.sln.ide/*
|
src/umbraco.sln.ide/*
|
||||||
build/UmbracoCms.*/
|
|
||||||
src/.vs/
|
src/.vs/
|
||||||
src/Umbraco.Web.UI/umbraco/js/install.loader.js
|
src/Umbraco.Web.UI/umbraco/js/install.loader.js
|
||||||
src/Umbraco.Web.UI/js/*
|
src/Umbraco.Web.UI/js/*
|
||||||
@@ -143,8 +140,11 @@ apidocs/api/*
|
|||||||
build/docs.zip
|
build/docs.zip
|
||||||
build/ui-docs.zip
|
build/ui-docs.zip
|
||||||
build/csharp-docs.zip
|
build/csharp-docs.zip
|
||||||
build/msbuild.log
|
|
||||||
.vs/
|
.vs/
|
||||||
src/packages/
|
src/packages/
|
||||||
build/tools/
|
|
||||||
src/PrecompiledWeb/*
|
src/PrecompiledWeb/*
|
||||||
|
|
||||||
|
# build
|
||||||
|
build.out/
|
||||||
|
build.tmp/
|
||||||
|
build/Modules/*/temp/
|
||||||
273
build/Build.bat
273
build/Build.bat
@@ -1,273 +0,0 @@
|
|||||||
@ECHO OFF
|
|
||||||
|
|
||||||
:: UMBRACO CORE BUILD FILE
|
|
||||||
::
|
|
||||||
:: usage:
|
|
||||||
:: build [-release:release] [-comment:comment] [-build:number] [-integration]
|
|
||||||
:: [-nugetpkg] [-nugetfolder:folder] [-tests]
|
|
||||||
:: release: the release version eg -release:1.2.0
|
|
||||||
:: comment: the release comment eg -comment:alpha002
|
|
||||||
:: build: the build number (for continuous integration) eg -build:6689
|
|
||||||
:: nugetfolder: the folder where to restore packages eg -nugetpkg:"path\to\packages"
|
|
||||||
:: integration: don't pause on errors eg -integration
|
|
||||||
:: nugetpkg: create nuget package eg -nugetpkg
|
|
||||||
:: tests: build the tests eg -tests
|
|
||||||
::
|
|
||||||
:: the script tries to read from UmbracoVersion.txt
|
|
||||||
:: but release and comment can be overriden by args
|
|
||||||
:: and in any case, the script updates UmbracoVersion.txt
|
|
||||||
::
|
|
||||||
|
|
||||||
SET RELEASE=
|
|
||||||
SET COMMENT=
|
|
||||||
SET BUILD=
|
|
||||||
|
|
||||||
:: Try to get the version and comment from UmbracoVersion.txt lines 2 and 3
|
|
||||||
IF EXIST UmbracoVersion.txt (
|
|
||||||
FOR /F "skip=1 delims=" %%i IN (UmbracoVersion.txt) DO IF NOT DEFINED RELEASE SET RELEASE=%%i
|
|
||||||
FOR /F "skip=2 delims=" %%i IN (UmbracoVersion.txt) DO IF NOT DEFINED COMMENT SET COMMENT=%%i
|
|
||||||
)
|
|
||||||
|
|
||||||
:: process args
|
|
||||||
|
|
||||||
SET INTEGRATION=0
|
|
||||||
SET nuGetFolder=%CD%\..\src\packages
|
|
||||||
SET NUPKG=0
|
|
||||||
SET BUILD=
|
|
||||||
SET TESTS=
|
|
||||||
|
|
||||||
:processArgs
|
|
||||||
|
|
||||||
:: grab the first parameter as a whole eg "/action:start"
|
|
||||||
:: end if no more parameter
|
|
||||||
SET SWITCHPARSE=%1
|
|
||||||
IF [%SWITCHPARSE%] == [] goto endProcessArgs
|
|
||||||
|
|
||||||
:: get switch and value
|
|
||||||
SET SWITCH=
|
|
||||||
SET VALUE=
|
|
||||||
FOR /F "tokens=1,* delims=: " %%a IN ("%SWITCHPARSE%") DO SET SWITCH=%%a& SET VALUE=%%b
|
|
||||||
|
|
||||||
:: route arg
|
|
||||||
IF '%SWITCH%'=='/release' GOTO argRelease
|
|
||||||
IF '%SWITCH%'=='-release' GOTO argRelease
|
|
||||||
IF '%SWITCH%'=='/comment' GOTO argComment
|
|
||||||
IF '%SWITCH%'=='-comment' GOTO argComment
|
|
||||||
IF '%SWITCH%'=='/build' GOTO argBuild
|
|
||||||
IF '%SWITCH%'=='-build' GOTO argBuild
|
|
||||||
IF '%SWITCH%'=='/integration' GOTO argIntegration
|
|
||||||
IF '%SWITCH%'=='-integration' GOTO argIntegration
|
|
||||||
IF '%SWITCH%'=='/nugetfolder' GOTO argNugetFolder
|
|
||||||
IF '%SWITCH%'=='-nugetfolder' GOTO argNugetFolder
|
|
||||||
IF '%SWITCH%'=='/nugetpkg' GOTO argNugetPkg
|
|
||||||
IF '%SWITCH%'=='-nugetpkg' GOTO argNugetPkg
|
|
||||||
IF '%SWITCH%'=='/tests' GOTO argTests
|
|
||||||
IF '%SWITCH%'=='-tests' GOTO argTests
|
|
||||||
ECHO "Invalid switch %SWITCH%"
|
|
||||||
GOTO error
|
|
||||||
|
|
||||||
:: handle each arg
|
|
||||||
|
|
||||||
:argRelease
|
|
||||||
set RELEASE=%VALUE%
|
|
||||||
SHIFT
|
|
||||||
goto processArgs
|
|
||||||
|
|
||||||
:argComment
|
|
||||||
SET COMMENT=%VALUE%
|
|
||||||
SHIFT
|
|
||||||
GOTO processArgs
|
|
||||||
|
|
||||||
:argBuild
|
|
||||||
SET BUILD=%VALUE%
|
|
||||||
SHIFT
|
|
||||||
GOTO processArgs
|
|
||||||
|
|
||||||
:argIntegration
|
|
||||||
SET INTEGRATION=1
|
|
||||||
SHIFT
|
|
||||||
GOTO processArgs
|
|
||||||
|
|
||||||
:argNugetFolder
|
|
||||||
SET nuGetFolder=%VALUE%
|
|
||||||
SHIFT
|
|
||||||
GOTO processArgs
|
|
||||||
|
|
||||||
:argNugetPkg
|
|
||||||
SET NUPKG=1
|
|
||||||
SHIFT
|
|
||||||
GOTO processArgs
|
|
||||||
|
|
||||||
:argTests
|
|
||||||
SET TESTS=true
|
|
||||||
SHIFT
|
|
||||||
GOTO processArgs
|
|
||||||
|
|
||||||
:endProcessArgs
|
|
||||||
|
|
||||||
|
|
||||||
:: validate
|
|
||||||
|
|
||||||
IF [%RELEASE%] EQU [] (
|
|
||||||
ECHO Could not determine release
|
|
||||||
ECHO Release is determined by the 'release' arg, or the UmbracoVersion.txt file
|
|
||||||
GOTO error
|
|
||||||
)
|
|
||||||
|
|
||||||
ECHO # Usage: on line 2 put the release version, on line 3 put the version comment (example: beta)> UmbracoVersion.txt
|
|
||||||
ECHO %release%>> UmbracoVersion.txt
|
|
||||||
ECHO %comment%>> UmbracoVersion.txt
|
|
||||||
|
|
||||||
|
|
||||||
:: run
|
|
||||||
|
|
||||||
SET VERSION=%RELEASE%
|
|
||||||
IF [%COMMENT%] NEQ [] (SET VERSION=%VERSION%-%COMMENT%)
|
|
||||||
IF [%BUILD%] NEQ [] (SET VERSION=%VERSION%+%BUILD%)
|
|
||||||
|
|
||||||
ECHO ################################################################
|
|
||||||
ECHO Building Umbraco %VERSION%
|
|
||||||
ECHO ################################################################
|
|
||||||
|
|
||||||
SET MSBUILDPATH=C:\Program Files (x86)\MSBuild\14.0\Bin
|
|
||||||
SET MSBUILD="%MSBUILDPATH%\MsBuild.exe"
|
|
||||||
SET PATH="%MSBUILDPATH%";%PATH%
|
|
||||||
|
|
||||||
ReplaceIISExpressPortNumber.exe ..\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj %RELEASE%
|
|
||||||
|
|
||||||
ECHO.
|
|
||||||
ECHO First make sure everything is clean as a whistle
|
|
||||||
|
|
||||||
ECHO.
|
|
||||||
ECHO Removing the belle build folder and bower_components folder
|
|
||||||
RD ..\src\Umbraco.Web.UI.Client\build /Q /S
|
|
||||||
RD ..\src\Umbraco.Web.UI.Client\bower_components /Q /S
|
|
||||||
|
|
||||||
ECHO.
|
|
||||||
ECHO Removing existing built files
|
|
||||||
RMDIR /Q /S _BuildOutput
|
|
||||||
DEL /F /Q UmbracoCms.*.zip 2>NUL
|
|
||||||
DEL /F /Q UmbracoExamine.*.zip 2>NUL
|
|
||||||
DEL /F /Q UmbracoCms.*.nupkg 2>NUL
|
|
||||||
DEL /F /Q webpihash.txt 2>NUL
|
|
||||||
|
|
||||||
ECHO.
|
|
||||||
ECHO Making sure Git is in the path so that the build can succeed
|
|
||||||
CALL InstallGit.cmd
|
|
||||||
|
|
||||||
:: Adding the default Git path so that if it's installed it can actually be found
|
|
||||||
:: This is necessary because SETLOCAL is on in InstallGit.cmd so that one might find Git,
|
|
||||||
:: but the path setting is lost due to SETLOCAL
|
|
||||||
SET PATH="C:\Program Files (x86)\Git\cmd";"C:\Program Files\Git\cmd";%PATH%
|
|
||||||
|
|
||||||
SET toolsFolder=%CD%\tools\
|
|
||||||
IF NOT EXIST "%toolsFolder%" (
|
|
||||||
MD tools
|
|
||||||
)
|
|
||||||
|
|
||||||
SET nuGetExecutable=%CD%\tools\nuget.exe
|
|
||||||
IF NOT EXIST "%nuGetExecutable%" (
|
|
||||||
ECHO Getting NuGet so we can fetch some tools
|
|
||||||
ECHO Downloading https://dist.nuget.org/win-x86-commandline/latest/nuget.exe to %nuGetExecutable%
|
|
||||||
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '%nuGetExecutable%')"
|
|
||||||
)
|
|
||||||
|
|
||||||
:: We need 7za.exe for BuildBelle.bat
|
|
||||||
IF NOT EXIST "%toolsFolder%7za.exe" (
|
|
||||||
ECHO 7zip not found - fetching now
|
|
||||||
"%nuGetExecutable%" install 7-Zip.CommandLine -OutputDirectory tools -Verbosity quiet
|
|
||||||
)
|
|
||||||
|
|
||||||
:: We need vswhere.exe for VS2017+
|
|
||||||
IF NOT EXIST "%toolsFolder%vswhere.exe" (
|
|
||||||
ECHO vswhere not found - fetching now
|
|
||||||
"%nuGetExecutable%" install vswhere -OutputDirectory tools -Verbosity quiet
|
|
||||||
)
|
|
||||||
|
|
||||||
:: Put 7za.exe and vswhere.exe in a predictable path (not version specific)
|
|
||||||
FOR /f "delims=" %%A in ('dir "%toolsFolder%7-Zip.CommandLine.*" /b') DO SET "sevenZipExePath=%toolsFolder%%%A\"
|
|
||||||
MOVE "%sevenZipExePath%tools\7za.exe" "%toolsFolder%7za.exe"
|
|
||||||
|
|
||||||
FOR /f "delims=" %%A in ('dir "%toolsFolder%vswhere.*" /b') DO SET "vswhereExePath=%toolsFolder%%%A\"
|
|
||||||
MOVE "%vswhereExePath%tools\vswhere.exe" "%toolsFolder%vswhere.exe"
|
|
||||||
|
|
||||||
ECHO.
|
|
||||||
ECHO Making sure we have a web.config
|
|
||||||
IF NOT EXIST "%CD%\..\src\Umbraco.Web.UI\web.config" COPY "%CD%\..\src\Umbraco.Web.UI\web.Template.config" "%CD%\..\src\Umbraco.Web.UI\web.config"
|
|
||||||
|
|
||||||
for /f "usebackq tokens=1* delims=: " %%i in (`"%CD%\tools\vswhere.exe" -latest -requires Microsoft.Component.MSBuild`) do (
|
|
||||||
if /i "%%i"=="installationPath" set InstallDir=%%j
|
|
||||||
)
|
|
||||||
|
|
||||||
SET VSWherePath="%InstallDir%\MSBuild"
|
|
||||||
|
|
||||||
ECHO.
|
|
||||||
ECHO Visual Studio is installed in: %InstallDir%
|
|
||||||
|
|
||||||
SET MSBUILDPATH=C:\Program Files (x86)\MSBuild\14.0\Bin
|
|
||||||
SET MSBUILD="%MSBUILDPATH%\MsBuild.exe"
|
|
||||||
|
|
||||||
ECHO.
|
|
||||||
ECHO Reporting NuGet version
|
|
||||||
"%nuGetExecutable%" help | findstr "^NuGet Version:"
|
|
||||||
|
|
||||||
ECHO.
|
|
||||||
ECHO Restoring NuGet packages
|
|
||||||
ECHO Into %nuGetFolder%
|
|
||||||
"%nuGetExecutable%" restore "%CD%\..\src\umbraco.sln" -Verbosity Quiet -NonInteractive -PackagesDirectory "%nuGetFolder%"
|
|
||||||
IF ERRORLEVEL 1 GOTO :error
|
|
||||||
|
|
||||||
ECHO.
|
|
||||||
ECHO.
|
|
||||||
ECHO Performing MSBuild and producing Umbraco binaries zip files
|
|
||||||
ECHO This takes a few minutes and logging is set to report warnings
|
|
||||||
ECHO and errors only so it might seems like nothing is happening for a while.
|
|
||||||
ECHO You can check the msbuild.log file for progress.
|
|
||||||
ECHO.
|
|
||||||
%MSBUILD% "Build.proj" ^
|
|
||||||
/p:BUILD_RELEASE=%RELEASE% ^
|
|
||||||
/p:BUILD_COMMENT=%COMMENT% ^
|
|
||||||
/p:BUILD_NUMBER=%BUILD% ^
|
|
||||||
/p:BUILD_TESTS=%TESTS% ^
|
|
||||||
/p:NugetPackagesDirectory="%nuGetFolder%" ^
|
|
||||||
/p:VSWherePath="%VSWherePath%" ^
|
|
||||||
/consoleloggerparameters:Summary;ErrorsOnly ^
|
|
||||||
/fileLogger
|
|
||||||
IF ERRORLEVEL 1 GOTO error
|
|
||||||
|
|
||||||
ECHO.
|
|
||||||
ECHO Setting node_modules folder to hidden to prevent VS13 from
|
|
||||||
ECHO crashing on it while loading the websites project
|
|
||||||
attrib +h ..\src\Umbraco.Web.UI.Client\node_modules
|
|
||||||
|
|
||||||
IF %NUPKG% EQU 0 GOTO success
|
|
||||||
|
|
||||||
ECHO.
|
|
||||||
ECHO Adding Web.config transform files to the NuGet package
|
|
||||||
REN .\_BuildOutput\WebApp\Views\Web.config Web.config.transform
|
|
||||||
|
|
||||||
ECHO.
|
|
||||||
ECHO Packing the NuGet release files
|
|
||||||
..\src\.nuget\NuGet.exe Pack NuSpecs\UmbracoCms.Core.nuspec -Version %VERSION% -Symbols -Verbosity quiet
|
|
||||||
..\src\.nuget\NuGet.exe Pack NuSpecs\UmbracoCms.Compat7.nuspec -Version %VERSION% -Symbols -Verbosity quiet
|
|
||||||
..\src\.nuget\NuGet.exe Pack NuSpecs\UmbracoCms.nuspec -Version %VERSION% -Verbosity quiet
|
|
||||||
IF ERRORLEVEL 1 GOTO error
|
|
||||||
|
|
||||||
:success
|
|
||||||
ECHO.
|
|
||||||
ECHO No errors were detected!
|
|
||||||
ECHO There may still be some in the output, which you would need to investigate.
|
|
||||||
ECHO Warnings are usually normal.
|
|
||||||
ECHO.
|
|
||||||
ECHO.
|
|
||||||
GOTO :EOF
|
|
||||||
|
|
||||||
:error
|
|
||||||
|
|
||||||
ECHO.
|
|
||||||
ECHO Errors were detected!
|
|
||||||
ECHO.
|
|
||||||
|
|
||||||
:: don't pause if continuous integration else the build server waits forever
|
|
||||||
:: before cancelling the build (and, there is noone to read the output anyways)
|
|
||||||
IF %INTEGRATION% NEQ 1 PAUSE
|
|
||||||
350
build/Build.proj
350
build/Build.proj
@@ -1,350 +0,0 @@
|
|||||||
<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>
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
@ECHO OFF
|
|
||||||
SETLOCAL
|
|
||||||
:: SETLOCAL is on, so changes to the path not persist to the actual user's path
|
|
||||||
|
|
||||||
SET toolsFolder=%CD%\tools\
|
|
||||||
ECHO Current folder: %CD%
|
|
||||||
|
|
||||||
SET nodeFileName=node-v6.9.1-win-x86.7z
|
|
||||||
SET nodeExtractFolder=%toolsFolder%node.js.691
|
|
||||||
|
|
||||||
IF NOT EXIST "%nodeExtractFolder%" (
|
|
||||||
ECHO Downloading http://nodejs.org/dist/v6.9.1/%nodeFileName% to %toolsFolder%%nodeFileName%
|
|
||||||
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://nodejs.org/dist/v6.9.1/%nodeFileName%', '%toolsFolder%%nodeFileName%')"
|
|
||||||
ECHO Extracting %nodeFileName% to %nodeExtractFolder%
|
|
||||||
"%toolsFolder%\7za.exe" x "%toolsFolder%\%nodeFileName%" -o"%nodeExtractFolder%" -aos > nul
|
|
||||||
)
|
|
||||||
FOR /f "delims=" %%A in ('dir "%nodeExtractFolder%\node*" /b') DO SET "nodePath=%nodeExtractFolder%\%%A"
|
|
||||||
|
|
||||||
|
|
||||||
SET nuGetExecutable=%CD%\tools\nuget.exe
|
|
||||||
IF NOT EXIST "%nuGetExecutable%" (
|
|
||||||
ECHO Downloading https://dist.nuget.org/win-x86-commandline/latest/nuget.exe to %nuGetExecutable%
|
|
||||||
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '%nuGetExecutable%')"
|
|
||||||
)
|
|
||||||
|
|
||||||
SET drive=%CD:~0,2%
|
|
||||||
SET nuGetFolder=%drive%\packages\
|
|
||||||
FOR /f "delims=" %%A in ('dir "%nuGetFolder%npm.*" /b') DO SET "npmPath=%nuGetFolder%%%A\"
|
|
||||||
|
|
||||||
IF [%npmPath%] == [] GOTO :installnpm
|
|
||||||
IF NOT [%npmPath%] == [] GOTO :build
|
|
||||||
|
|
||||||
:installnpm
|
|
||||||
ECHO Downloading npm
|
|
||||||
ECHO Configured packages folder: %nuGetFolder%
|
|
||||||
ECHO Installing Npm NuGet Package
|
|
||||||
"%nuGetExecutable%" install Npm -OutputDirectory %nuGetFolder% -Verbosity detailed
|
|
||||||
REM Ensures that we look for the just downloaded NPM, not whatever the user has installed on their machine
|
|
||||||
FOR /f "delims=" %%A in ('dir %nuGetFolder%npm.* /b') DO SET "npmPath=%nuGetFolder%%%A\"
|
|
||||||
GOTO :build
|
|
||||||
|
|
||||||
:build
|
|
||||||
ECHO Adding Npm and Node to path
|
|
||||||
REM SETLOCAL is on, so changes to the path not persist to the actual user's path
|
|
||||||
PATH="%npmPath%";"%nodePath%";%PATH%
|
|
||||||
SET buildFolder=%CD%
|
|
||||||
|
|
||||||
ECHO Change directory to %CD%\..\src\Umbraco.Web.UI.Client\
|
|
||||||
CD %CD%\..\src\Umbraco.Web.UI.Client\
|
|
||||||
|
|
||||||
ECHO Do npm install and the grunt build of Belle
|
|
||||||
call npm cache clean --quiet
|
|
||||||
call npm install --quiet
|
|
||||||
call npm install -g grunt-cli --quiet
|
|
||||||
call npm install -g bower --quiet
|
|
||||||
call grunt build --buildversion=%release%
|
|
||||||
|
|
||||||
ECHO Move back to the build folder
|
|
||||||
CD "%buildFolder%"
|
|
||||||
171
build/Modules/Umbraco.Build/Get-UmbracoBuildEnv.ps1
Normal file
171
build/Modules/Umbraco.Build/Get-UmbracoBuildEnv.ps1
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
#
|
||||||
|
# Get-UmbracoBuildEnv
|
||||||
|
# Gets the Umbraco build environment
|
||||||
|
# Downloads tools if necessary
|
||||||
|
#
|
||||||
|
function Get-UmbracoBuildEnv
|
||||||
|
{
|
||||||
|
# store tools in the module's directory
|
||||||
|
# and cache them for two days
|
||||||
|
$path = "$PSScriptRoot\temp"
|
||||||
|
$cache = 2
|
||||||
|
|
||||||
|
if (-not (test-path $path))
|
||||||
|
{
|
||||||
|
mkdir $path > $null
|
||||||
|
}
|
||||||
|
|
||||||
|
# ensure we have NuGet
|
||||||
|
$nuget = "$path\nuget.exe"
|
||||||
|
$source = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
|
||||||
|
if ((test-path $nuget) -and ((ls $nuget).CreationTime -lt [DateTime]::Now.AddDays(-$cache)))
|
||||||
|
{
|
||||||
|
Remove-File $nuget
|
||||||
|
}
|
||||||
|
if (-not (test-path $nuget))
|
||||||
|
{
|
||||||
|
Write-Host "Download NuGet..."
|
||||||
|
$client = new-object Net.WebClient
|
||||||
|
$client.DownloadFile($source, $nuget)
|
||||||
|
}
|
||||||
|
|
||||||
|
# ensure we have 7-Zip
|
||||||
|
$sevenZip = "$path\7za.exe"
|
||||||
|
if ((test-path $sevenZip) -and ((ls $sevenZip).CreationTime -lt [DateTime]::Now.AddDays(-$cache)))
|
||||||
|
{
|
||||||
|
Remove-File $sevenZip
|
||||||
|
}
|
||||||
|
if (-not (test-path $sevenZip))
|
||||||
|
{
|
||||||
|
Write-Host "Download 7-Zip..."
|
||||||
|
&$nuget install 7-Zip.CommandLine -OutputDirectory $path -Verbosity quiet
|
||||||
|
$dir = ls "$path\7-Zip.CommandLine.*" | sort -property Name -descending | select -first 1
|
||||||
|
$file = ls -path "$dir" -name 7za.exe -recurse
|
||||||
|
mv "$dir\$file" $sevenZip
|
||||||
|
Remove-Directory $dir
|
||||||
|
}
|
||||||
|
|
||||||
|
# ensure we have vswhere
|
||||||
|
$vswhere = "$path\vswhere.exe"
|
||||||
|
if ((test-path $vswhere) -and ((ls $vswhere).CreationTime -lt [DateTime]::Now.AddDays(-$cache)))
|
||||||
|
{
|
||||||
|
Remove-File $vswhere
|
||||||
|
}
|
||||||
|
if (-not (test-path $vswhere))
|
||||||
|
{
|
||||||
|
Write-Host "Download VsWhere..."
|
||||||
|
&$nuget install vswhere -OutputDirectory $path -Verbosity quiet
|
||||||
|
$dir = ls "$path\vswhere.*" | sort -property Name -descending | select -first 1
|
||||||
|
$file = ls -path "$dir" -name vswhere.exe -recurse
|
||||||
|
mv "$dir\$file" $vswhere
|
||||||
|
Remove-Directory $dir
|
||||||
|
}
|
||||||
|
|
||||||
|
# ensure we have semver
|
||||||
|
$semver = "$path\Semver.dll"
|
||||||
|
if ((test-path $semver) -and ((ls $semver).CreationTime -lt [DateTime]::Now.AddDays(-$cache)))
|
||||||
|
{
|
||||||
|
Remove-File $semver
|
||||||
|
}
|
||||||
|
if (-not (test-path $semver))
|
||||||
|
{
|
||||||
|
Write-Host "Download Semver..."
|
||||||
|
&$nuget install semver -OutputDirectory $path -Verbosity quiet
|
||||||
|
$dir = ls "$path\semver.*" | sort -property Name -descending | select -first 1
|
||||||
|
$file = "$dir\lib\net452\Semver.dll"
|
||||||
|
if (-not (test-path $file))
|
||||||
|
{
|
||||||
|
Write-Error "Failed to file $file"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
mv "$file" $semver
|
||||||
|
Remove-Directory $dir
|
||||||
|
}
|
||||||
|
|
||||||
|
# ensure we have node
|
||||||
|
$node = "$path\node-v6.9.1-win-x86"
|
||||||
|
$source = "http://nodejs.org/dist/v6.9.1/node-v6.9.1-win-x86.7z"
|
||||||
|
if (-not (test-path $node))
|
||||||
|
{
|
||||||
|
Write-Host "Download Node..."
|
||||||
|
$client = new-object Net.WebClient
|
||||||
|
$client.DownloadFile($source, "$path\node-v6.9.1-win-x86.7z")
|
||||||
|
&$sevenZip x "$path\node-v6.9.1-win-x86.7z" -o"$path" -aos > $nul
|
||||||
|
Remove-File "$path\node-v6.9.1-win-x86.7z"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ensure we have npm
|
||||||
|
$npm = "$path\npm.*"
|
||||||
|
$getNpm = $true
|
||||||
|
if (test-path $npm)
|
||||||
|
{
|
||||||
|
$getNpm = $false
|
||||||
|
$tmpNpm = ls "$path\npm.*" | sort -property Name -descending | select -first 1
|
||||||
|
if ($tmpNpm.CreationTime -lt [DateTime]::Now.AddDays(-$cache))
|
||||||
|
{
|
||||||
|
$getNpm = $true
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$npm = $tmpNpm.ToString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($getNpm)
|
||||||
|
{
|
||||||
|
Write-Host "Download Npm..."
|
||||||
|
&$nuget install npm -OutputDirectory $path -Verbosity quiet
|
||||||
|
$npm = ls "$path\npm.*" | sort -property Name -descending | select -first 1
|
||||||
|
$npm.CreationTime = [DateTime]::Now
|
||||||
|
$npm = $npm.ToString()
|
||||||
|
}
|
||||||
|
|
||||||
|
# find visual studio
|
||||||
|
# will not work on VSO but VSO does not need it
|
||||||
|
$vsPath = ""
|
||||||
|
$vsVer = ""
|
||||||
|
$msBuild = $null
|
||||||
|
&$vswhere | foreach {
|
||||||
|
if ($_.StartsWith("installationPath:")) { $vsPath = $_.SubString("installationPath:".Length).Trim() }
|
||||||
|
if ($_.StartsWith("installationVersion:")) { $vsVer = $_.SubString("installationVersion:".Length).Trim() }
|
||||||
|
}
|
||||||
|
if ($vsPath -ne "")
|
||||||
|
{
|
||||||
|
$vsVerParts = $vsVer.Split('.')
|
||||||
|
$vsMajor = [int]::Parse($vsVerParts[0])
|
||||||
|
$vsMinor = [int]::Parse($vsVerParts[1])
|
||||||
|
if ($vsMajor -eq 15) {
|
||||||
|
$msBuild = "$vsPath\MSBuild\$vsMajor.$vsMinor\Bin"
|
||||||
|
}
|
||||||
|
elseif ($vsMajor -eq 14) {
|
||||||
|
$msBuild = "c:\Program Files (x86)\MSBuild\$vsMajor\Bin"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$msBuild = $null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$vs = $null
|
||||||
|
if ($msBuild)
|
||||||
|
{
|
||||||
|
$vs = new-object -typeName PsObject
|
||||||
|
$vs | add-member -memberType NoteProperty -name Path -value $vsPath
|
||||||
|
$vs | add-member -memberType NoteProperty -name Major -value $vsMajor
|
||||||
|
$vs | add-member -memberType NoteProperty -name Minor -value $vsMinor
|
||||||
|
$vs | add-member -memberType NoteProperty -name MsBuild -value "$msBuild\MsBuild.exe"
|
||||||
|
}
|
||||||
|
|
||||||
|
$solutionRoot = Get-FullPath "$PSScriptRoot\..\..\.."
|
||||||
|
|
||||||
|
$uenv = new-object -typeName PsObject
|
||||||
|
$uenv | add-member -memberType NoteProperty -name SolutionRoot -value $solutionRoot
|
||||||
|
$uenv | add-member -memberType NoteProperty -name VisualStudio -value $vs
|
||||||
|
$uenv | add-member -memberType NoteProperty -name NuGet -value $nuget
|
||||||
|
$uenv | add-member -memberType NoteProperty -name Zip -value $sevenZip
|
||||||
|
$uenv | add-member -memberType NoteProperty -name VsWhere -value $vswhere
|
||||||
|
$uenv | add-member -memberType NoteProperty -name Semver -value $semver
|
||||||
|
$uenv | add-member -memberType NoteProperty -name NodePath -value $node
|
||||||
|
$uenv | add-member -memberType NoteProperty -name NpmPath -value $npm
|
||||||
|
|
||||||
|
return $uenv
|
||||||
|
}
|
||||||
36
build/Modules/Umbraco.Build/Get-UmbracoVersion.ps1
Normal file
36
build/Modules/Umbraco.Build/Get-UmbracoVersion.ps1
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#
|
||||||
|
# Get-UmbracoVersion
|
||||||
|
# Gets the Umbraco version
|
||||||
|
#
|
||||||
|
function Get-UmbracoVersion
|
||||||
|
{
|
||||||
|
$uenv = Get-UmbracoBuildEnv
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
[Reflection.Assembly]::LoadFile($uenv.Semver) > $null
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Write-Error -Exception $_.Exception -Message "Failed to load $uenv.Semver"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
# parse SolutionInfo and retrieve the version string
|
||||||
|
$filepath = "$($uenv.SolutionRoot)\src\SolutionInfo.cs"
|
||||||
|
$text = [System.IO.File]::ReadAllText($filepath)
|
||||||
|
$match = [System.Text.RegularExpressions.Regex]::Matches($text, "AssemblyInformationalVersion\(`"(.+)?`"\)")
|
||||||
|
$version = $match.Groups[1]
|
||||||
|
|
||||||
|
# semver-parse the version string
|
||||||
|
$semver = [SemVer.SemVersion]::Parse($version)
|
||||||
|
$release = "" + $semver.Major + "." + $semver.Minor + "." + $semver.Patch
|
||||||
|
|
||||||
|
$versions = new-object -typeName PsObject
|
||||||
|
$versions | add-member -memberType NoteProperty -name Semver -value $semver
|
||||||
|
$versions | add-member -memberType NoteProperty -name Release -value $release
|
||||||
|
$versions | add-member -memberType NoteProperty -name Comment -value $semver.PreRelease
|
||||||
|
$versions | add-member -memberType NoteProperty -name Build -value $semver.Build
|
||||||
|
|
||||||
|
return $versions
|
||||||
|
}
|
||||||
30
build/Modules/Umbraco.Build/Get-VisualStudio.ps1
Normal file
30
build/Modules/Umbraco.Build/Get-VisualStudio.ps1
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# finds msbuild
|
||||||
|
function Get-VisualStudio($vswhere)
|
||||||
|
{
|
||||||
|
$vsPath = ""
|
||||||
|
$vsVer = ""
|
||||||
|
&$vswhere | foreach {
|
||||||
|
if ($_.StartsWith("installationPath:")) { $vsPath = $_.SubString("installationPath:".Length).Trim() }
|
||||||
|
if ($_.StartsWith("installationVersion:")) { $vsVer = $_.SubString("installationVersion:".Length).Trim() }
|
||||||
|
}
|
||||||
|
if ($vsPath -eq "") { return $null }
|
||||||
|
|
||||||
|
$vsVerParts = $vsVer.Split('.')
|
||||||
|
$vsMajor = [int]::Parse($vsVerParts[0])
|
||||||
|
$vsMinor = [int]::Parse($vsVerParts[1])
|
||||||
|
if ($vsMajor -eq 15) {
|
||||||
|
$msBuild = "$vsPath\MSBuild\$vsMajor.$vsMinor\Bin"
|
||||||
|
}
|
||||||
|
elseif ($vsMajor -eq 14) {
|
||||||
|
$msBuild = "c:\Program Files (x86)\MSBuild\$vsMajor\Bin"
|
||||||
|
}
|
||||||
|
else { return $null }
|
||||||
|
$msBuild = "$msBuild\MsBuild.exe"
|
||||||
|
|
||||||
|
$vs = new-object -typeName PsObject
|
||||||
|
$vs | add-member -memberType NoteProperty -name Path -value $vsPath
|
||||||
|
$vs | add-member -memberType NoteProperty -name Major -value $vsMajor
|
||||||
|
$vs | add-member -memberType NoteProperty -name Minor -value $vsMinor
|
||||||
|
$vs | add-member -memberType NoteProperty -name MsBuild -value $msBuild
|
||||||
|
return $vs
|
||||||
|
}
|
||||||
117
build/Modules/Umbraco.Build/Set-UmbracoVersion.ps1
Normal file
117
build/Modules/Umbraco.Build/Set-UmbracoVersion.ps1
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
#
|
||||||
|
# Set-UmbracoVersion
|
||||||
|
# Sets the Umbraco version
|
||||||
|
#
|
||||||
|
# -Version <version>
|
||||||
|
# where <version> is a Semver valid version
|
||||||
|
# eg 1.2.3, 1.2.3-alpha, 1.2.3-alpha+456
|
||||||
|
#
|
||||||
|
function Set-UmbracoVersion
|
||||||
|
{
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]
|
||||||
|
$version
|
||||||
|
)
|
||||||
|
|
||||||
|
$uenv = Get-UmbracoBuildEnv
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
[Reflection.Assembly]::LoadFile($uenv.Semver) > $null
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Write-Error "Failed to load $uenv.Semver"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
# validate input
|
||||||
|
$ok = [Regex]::Match($version, "^[0-9]+\.[0-9]+\.[0-9]+(\-[a-z0-9]+)?(\+[0-9]+)?$")
|
||||||
|
if (-not $ok.Success)
|
||||||
|
{
|
||||||
|
Write-Error "Invalid version $version"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
# parse input
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$semver = [SemVer.SemVersion]::Parse($version)
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Write-Error "Invalid version $version"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
$release = "" + $semver.Major + "." + $semver.Minor + "." + $semver.Patch
|
||||||
|
|
||||||
|
# edit files and set the proper versions and dates
|
||||||
|
Write-Host "Update UmbracoVersion.cs"
|
||||||
|
Replace-FileText "$($uenv.SolutionRoot)\src\Umbraco.Core\Configuration\UmbracoVersion.cs" `
|
||||||
|
"(\d+)\.(\d+)\.(\d+)(.(\d+))?" `
|
||||||
|
"$release"
|
||||||
|
Replace-FileText "$($uenv.SolutionRoot)\src\Umbraco.Core\Configuration\UmbracoVersion.cs" `
|
||||||
|
"CurrentComment => `"(.+)`"" `
|
||||||
|
"CurrentComment => `"$($semver.PreRelease)`""
|
||||||
|
Write-Host "Update SolutionInfo.cs"
|
||||||
|
Replace-FileText "$($uenv.SolutionRoot)\src\SolutionInfo.cs" `
|
||||||
|
"AssemblyFileVersion\(`"(.+)?`"\)" `
|
||||||
|
"AssemblyFileVersion(`"$release`")"
|
||||||
|
Replace-FileText "$($uenv.SolutionRoot)\src\SolutionInfo.cs" `
|
||||||
|
"AssemblyInformationalVersion\(`"(.+)?`"\)" `
|
||||||
|
"AssemblyInformationalVersion(`"$semver`")"
|
||||||
|
$year = [System.DateTime]::Now.ToString("yyyy")
|
||||||
|
Replace-FileText "$($uenv.SolutionRoot)\src\SolutionInfo.cs" `
|
||||||
|
"AssemblyCopyright\(`"Copyright © Umbraco (\d{4})`"\)" `
|
||||||
|
"AssemblyCopyright(`"Copyright © Umbraco $year`")"
|
||||||
|
|
||||||
|
# edit csproj and set IIS Express port number
|
||||||
|
# this is a raw copy of ReplaceIISExpressPortNumber.exe
|
||||||
|
# it probably can be achieved in a much nicer way - l8tr
|
||||||
|
$source = @"
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace Umbraco
|
||||||
|
{
|
||||||
|
public static class PortUpdater
|
||||||
|
{
|
||||||
|
public static void Update(string path, string release)
|
||||||
|
{
|
||||||
|
XmlDocument xmlDocument = new XmlDocument();
|
||||||
|
string fullPath = Path.GetFullPath(path);
|
||||||
|
xmlDocument.Load(fullPath);
|
||||||
|
int result = 1;
|
||||||
|
int.TryParse(release.Replace(`".`", `"`"), out result);
|
||||||
|
while (result < 1024)
|
||||||
|
result *= 10;
|
||||||
|
XmlNode xmlNode1 = xmlDocument.GetElementsByTagName(`"IISUrl`").Item(0);
|
||||||
|
if (xmlNode1 != null)
|
||||||
|
xmlNode1.InnerText = `"http://localhost:`" + (object) result;
|
||||||
|
XmlNode xmlNode2 = xmlDocument.GetElementsByTagName(`"DevelopmentServerPort`").Item(0);
|
||||||
|
if (xmlNode2 != null)
|
||||||
|
xmlNode2.InnerText = result.ToString((IFormatProvider) CultureInfo.InvariantCulture);
|
||||||
|
xmlDocument.Save(fullPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"@
|
||||||
|
|
||||||
|
$assem = (
|
||||||
|
"System.Xml",
|
||||||
|
"System.IO",
|
||||||
|
"System.Globalization"
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Host "Update Umbraco.Web.UI.csproj"
|
||||||
|
add-type -referencedAssemblies $assem -typeDefinition $source -language CSharp
|
||||||
|
$csproj = "$($uenv.SolutionRoot)\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj"
|
||||||
|
[Umbraco.PortUpdater]::Update($csproj, $release)
|
||||||
|
|
||||||
|
return $semver
|
||||||
|
}
|
||||||
524
build/Modules/Umbraco.Build/Umbraco.Build.psm1
Normal file
524
build/Modules/Umbraco.Build/Umbraco.Build.psm1
Normal file
@@ -0,0 +1,524 @@
|
|||||||
|
|
||||||
|
# Umbraco.Build.psm1
|
||||||
|
#
|
||||||
|
# $env:PSModulePath = "$pwd\build\Modules\;$env:PSModulePath"
|
||||||
|
# Import-Module Umbraco.Build -Force -DisableNameChecking
|
||||||
|
#
|
||||||
|
# PowerShell Modules:
|
||||||
|
# https://msdn.microsoft.com/en-us/library/dd878324%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
|
||||||
|
#
|
||||||
|
# PowerShell Module Manifest:
|
||||||
|
# https://msdn.microsoft.com/en-us/library/dd878337%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
|
||||||
|
#
|
||||||
|
# See also
|
||||||
|
# http://www.powershellmagazine.com/2014/08/15/pstip-taking-control-of-verbose-and-debug-output-part-5/
|
||||||
|
|
||||||
|
|
||||||
|
. "$PSScriptRoot\Utilities.ps1"
|
||||||
|
. "$PSScriptRoot\Get-VisualStudio.ps1"
|
||||||
|
|
||||||
|
. "$PSScriptRoot\Get-UmbracoBuildEnv.ps1"
|
||||||
|
. "$PSScriptRoot\Set-UmbracoVersion.ps1"
|
||||||
|
. "$PSScriptRoot\Get-UmbracoVersion.ps1"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Prepares the build
|
||||||
|
#
|
||||||
|
function Prepare-Build
|
||||||
|
{
|
||||||
|
param (
|
||||||
|
$uenv # an Umbraco build environment (see Get-UmbracoBuildEnv)
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Host ">> Prepare Build"
|
||||||
|
|
||||||
|
$src = "$($uenv.SolutionRoot)\src"
|
||||||
|
$tmp = "$($uenv.SolutionRoot)\build.tmp"
|
||||||
|
$out = "$($uenv.SolutionRoot)\build.out"
|
||||||
|
|
||||||
|
# clear
|
||||||
|
Write-Host "Clear folders and files"
|
||||||
|
|
||||||
|
Remove-Directory "$src\Umbraco.Web.UI.Client\build"
|
||||||
|
Remove-Directory "$src\Umbraco.Web.UI.Client\bower_components"
|
||||||
|
|
||||||
|
Remove-Directory "$tmp"
|
||||||
|
mkdir "$tmp" > $null
|
||||||
|
|
||||||
|
Remove-Directory "$out"
|
||||||
|
mkdir "$out" > $null
|
||||||
|
|
||||||
|
# prepare web.config
|
||||||
|
$webUi = "$src\Umbraco.Web.UI"
|
||||||
|
if (test-path "$webUi\web.config")
|
||||||
|
{
|
||||||
|
if (test-path "$webUi\web.config.temp-build")
|
||||||
|
{
|
||||||
|
Write-Host "Found existing web.config.temp-build"
|
||||||
|
$i = 0
|
||||||
|
while (test-path "$webUi\web.config.temp-build.$i")
|
||||||
|
{
|
||||||
|
$i = $i + 1
|
||||||
|
}
|
||||||
|
Write-Host "Save existing web.config as web.config.temp-build.$i"
|
||||||
|
Write-Host "(WARN: the original web.config.temp-build will be restored during post-build)"
|
||||||
|
mv "$webUi\web.config" "$webUi\web.config.temp-build.$i"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Host "Save existing web.config as web.config.temp-build"
|
||||||
|
Write-Host "(will be restored during post-build)"
|
||||||
|
mv "$webUi\web.config" "$webUi\web.config.temp-build"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Host "Create clean web.config"
|
||||||
|
Copy-File "$webUi\web.Template.config" "$webUi\web.config"
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Builds the Belle UI project
|
||||||
|
#
|
||||||
|
function Compile-Belle
|
||||||
|
{
|
||||||
|
param (
|
||||||
|
$uenv, # an Umbraco build environment (see Get-UmbracoBuildEnv)
|
||||||
|
$version # an Umbraco version object (see Get-UmbracoVersion)
|
||||||
|
)
|
||||||
|
|
||||||
|
$tmp = "$($uenv.SolutionRoot)\build.tmp"
|
||||||
|
$src = "$($uenv.SolutionRoot)\src"
|
||||||
|
|
||||||
|
Write-Host ">> Compile Belle"
|
||||||
|
Write-Host "Logging to $tmp\belle.log"
|
||||||
|
|
||||||
|
push-location "$($uenv.SolutionRoot)\src\Umbraco.Web.UI.Client"
|
||||||
|
$p = $env:path
|
||||||
|
$env:path = $uenv.NpmPath + ";" + $uenv.NodePath + ";" + $env:path
|
||||||
|
|
||||||
|
write "cache clean" > $tmp\belle.log
|
||||||
|
&npm cache clean --quiet >> $tmp\belle.log 2>&1
|
||||||
|
&npm install --quiet >> $tmp\belle.log 2>&1
|
||||||
|
&npm install -g grunt-cli --quiet >> $tmp\belle.log 2>&1
|
||||||
|
&npm install -g bower --quiet >> $tmp\belle.log 2>&1
|
||||||
|
&grunt build --buildversion=$version.Release >> $tmp\belle.log 2>&1
|
||||||
|
|
||||||
|
# fixme - should we filter the log to find errors?
|
||||||
|
#get-content .\build.tmp\belle.log | %{ if ($_ -match "build") { write $_}}
|
||||||
|
|
||||||
|
pop-location
|
||||||
|
$env:path = $p
|
||||||
|
|
||||||
|
|
||||||
|
# setting node_modules folder to hidden
|
||||||
|
# used to prevent VS13 from crashing on it while loading the websites project
|
||||||
|
# also makes sure aspnet compiler does not try to handle rogue files and chokes
|
||||||
|
# in VSO with Microsoft.VisualC.CppCodeProvider -related errors
|
||||||
|
# use get-item -force 'cos it might be hidden already
|
||||||
|
write "Set hidden attribute on node_modules"
|
||||||
|
$dir = get-item -force "$src\Umbraco.Web.UI.Client\node_modules"
|
||||||
|
$dir.Attributes = $dir.Attributes -bor ([System.IO.FileAttributes]::Hidden)
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Compiles Umbraco
|
||||||
|
#
|
||||||
|
function Compile-Umbraco
|
||||||
|
{
|
||||||
|
param (
|
||||||
|
$uenv # an Umbraco build environment (see Get-UmbracoBuildEnv)
|
||||||
|
)
|
||||||
|
|
||||||
|
$src = "$($uenv.SolutionRoot)\src"
|
||||||
|
$tmp = "$($uenv.SolutionRoot)\build.tmp"
|
||||||
|
$out = "$($uenv.SolutionRoot)\build.out"
|
||||||
|
|
||||||
|
$buildConfiguration = "Release"
|
||||||
|
|
||||||
|
if ($uenv.VisualStudio -eq $null)
|
||||||
|
{
|
||||||
|
Write-Error "Build environment does not provide VisualStudio."
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
$toolsVersion = "4.0"
|
||||||
|
if ($uenv.VisualStudio.Major -eq 15)
|
||||||
|
{
|
||||||
|
$toolsVersion = "15.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host ">> Compile Umbraco"
|
||||||
|
Write-Host "Logging to $tmp\msbuild.umbraco.log"
|
||||||
|
|
||||||
|
# beware of the weird double \\ at the end of paths
|
||||||
|
# see http://edgylogic.com/blog/powershell-and-external-commands-done-right/
|
||||||
|
&$uenv.VisualStudio.MsBuild "$src\Umbraco.Web.UI\Umbraco.Web.UI.csproj" `
|
||||||
|
/p:WarningLevel=0 `
|
||||||
|
/p:Configuration=$buildConfiguration `
|
||||||
|
/p:UseWPP_CopyWebApplication=True `
|
||||||
|
/p:PipelineDependsOnBuild=False `
|
||||||
|
/p:OutDir=$tmp\bin\\ `
|
||||||
|
/p:WebProjectOutputDir=$tmp\WebApp\\ `
|
||||||
|
/p:Verbosity=minimal `
|
||||||
|
/t:Clean`;Rebuild `
|
||||||
|
/tv:$toolsVersion `
|
||||||
|
/p:UmbracoBuild=True `
|
||||||
|
> $tmp\msbuild.umbraco.log
|
||||||
|
|
||||||
|
# /p:UmbracoBuild tells the csproj that we are building from PS
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Prepare Tests
|
||||||
|
#
|
||||||
|
function Prepare-Tests
|
||||||
|
{
|
||||||
|
param (
|
||||||
|
$uenv # an Umbraco build environment (see Get-UmbracoBuildEnv)
|
||||||
|
)
|
||||||
|
|
||||||
|
$src = "$($uenv.SolutionRoot)\src"
|
||||||
|
$tmp = "$($uenv.SolutionRoot)\build.tmp"
|
||||||
|
|
||||||
|
Write-Host ">> Prepare Tests"
|
||||||
|
|
||||||
|
# fixme - idea is to avoid rebuilding everything for tests
|
||||||
|
# but because of our weird assembly versioning (with .* stuff)
|
||||||
|
# everything gets rebuilt all the time...
|
||||||
|
#Copy-Files "$tmp\bin" "." "$tmp\tests"
|
||||||
|
|
||||||
|
# data
|
||||||
|
Write-Host "Copy data files"
|
||||||
|
mkdir "$tmp\tests\Packaging" > $null
|
||||||
|
Copy-Files "$src\Umbraco.Tests\Packaging\Packages" "*" "$tmp\tests\Packaging\Packages"
|
||||||
|
|
||||||
|
# required for package install tests
|
||||||
|
Write-Host "Create bin directory"
|
||||||
|
mkdir "$tmp\tests\bin" > $null
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Compiles Tests
|
||||||
|
#
|
||||||
|
function Compile-Tests
|
||||||
|
{
|
||||||
|
param (
|
||||||
|
$uenv # an Umbraco build environment (see Get-UmbracoBuildEnv)
|
||||||
|
)
|
||||||
|
|
||||||
|
$src = "$($uenv.SolutionRoot)\src"
|
||||||
|
$tmp = "$($uenv.SolutionRoot)\build.tmp"
|
||||||
|
$out = "$tmp\tests"
|
||||||
|
|
||||||
|
$buildConfiguration = "Release"
|
||||||
|
|
||||||
|
if ($uenv.VisualStudio -eq $null)
|
||||||
|
{
|
||||||
|
Write-Error "Build environment does not provide VisualStudio."
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
$toolsVersion = "4.0"
|
||||||
|
if ($uenv.VisualStudio.Major -eq 15)
|
||||||
|
{
|
||||||
|
$toolsVersion = "15.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host ">> Compile Tests (logging to $tmp\msbuild.tests.log)"
|
||||||
|
|
||||||
|
# beware of the weird double \\ at the end of paths
|
||||||
|
# see http://edgylogic.com/blog/powershell-and-external-commands-done-right/
|
||||||
|
&$uenv.VisualStudio.MsBuild "$src\Umbraco.Tests\Umbraco.Tests.csproj" `
|
||||||
|
/p:WarningLevel=0 `
|
||||||
|
/p:Configuration=$buildConfiguration `
|
||||||
|
/p:UseWPP_CopyWebApplication=True `
|
||||||
|
/p:PipelineDependsOnBuild=False `
|
||||||
|
/p:OutDir=$out\\ `
|
||||||
|
/p:Verbosity=minimal `
|
||||||
|
/t:Build `
|
||||||
|
/tv:$toolsVersion `
|
||||||
|
/p:UmbracoBuild=True `
|
||||||
|
> $tmp\msbuild.tests.log
|
||||||
|
|
||||||
|
# /p:UmbracoBuild tells the csproj that we are building from PS
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Cleans things up and prepare files after compilation
|
||||||
|
#
|
||||||
|
function Prepare-Packages
|
||||||
|
{
|
||||||
|
param (
|
||||||
|
$uenv # an Umbraco build environment (see Get-UmbracoBuildEnv)
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Host ">> Prepare Packages"
|
||||||
|
|
||||||
|
$src = "$($uenv.SolutionRoot)\src"
|
||||||
|
$tmp = "$($uenv.SolutionRoot)\build.tmp"
|
||||||
|
$out = "$($uenv.SolutionRoot)\build.out"
|
||||||
|
|
||||||
|
$buildConfiguration = "Release"
|
||||||
|
|
||||||
|
# restore web.config
|
||||||
|
$webUi = "$src\Umbraco.Web.UI"
|
||||||
|
if (test-path "$webUi\web.config.temp-build")
|
||||||
|
{
|
||||||
|
Write-Host "Restoring existing web.config"
|
||||||
|
Remove-File "$webUi\web.config"
|
||||||
|
mv "$webUi\web.config.temp-build" "$webUi\web.config"
|
||||||
|
}
|
||||||
|
|
||||||
|
# cleanup build
|
||||||
|
Write-Host "Clean build"
|
||||||
|
Remove-File "$tmp\bin\*.dll.config"
|
||||||
|
Remove-File "$tmp\WebApp\bin\*.dll.config"
|
||||||
|
|
||||||
|
# cleanup presentation
|
||||||
|
Write-Host "Cleanup presentation"
|
||||||
|
Remove-Directory "$tmp\WebApp\umbraco.presentation"
|
||||||
|
|
||||||
|
# create directories
|
||||||
|
Write-Host "Create directories"
|
||||||
|
mkdir "$tmp\Configs" > $null
|
||||||
|
mkdir "$tmp\Configs\Lang" > $null
|
||||||
|
mkdir "$tmp\WebApp\App_Data" > $null
|
||||||
|
#mkdir "$tmp\WebApp\Media" > $null
|
||||||
|
#mkdir "$tmp\WebApp\Views" > $null
|
||||||
|
|
||||||
|
# copy various files
|
||||||
|
Write-Host "Copy xml documentation"
|
||||||
|
cp -force "$tmp\bin\*.xml" "$tmp\WebApp\bin"
|
||||||
|
|
||||||
|
Write-Host "Copy transformed configs and langs"
|
||||||
|
# note: exclude imageprocessor/*.config as imageprocessor pkg installs them
|
||||||
|
Copy-Files "$tmp\WebApp\config" "*.config" "$tmp\Configs" `
|
||||||
|
{ -not $_.RelativeName.StartsWith("imageprocessor") }
|
||||||
|
Copy-Files "$tmp\WebApp\config" "*.js" "$tmp\Configs"
|
||||||
|
Copy-Files "$tmp\WebApp\config\lang" "*.xml" "$tmp\Configs\Lang"
|
||||||
|
Copy-File "$tmp\WebApp\web.config" "$tmp\Configs\web.config.transform"
|
||||||
|
|
||||||
|
Write-Host "Copy transformed web.config"
|
||||||
|
Copy-File "$src\Umbraco.Web.UI\web.$buildConfiguration.Config.transformed" "$tmp\WebApp\web.config"
|
||||||
|
|
||||||
|
# offset the modified timestamps on all umbraco dlls, as WebResources
|
||||||
|
# break if date is in the future, which, due to timezone offsets can happen.
|
||||||
|
Write-Host "Offset dlls timestamps"
|
||||||
|
ls -r "$tmp\*.dll" | foreach {
|
||||||
|
$_.CreationTime = $_.CreationTime.AddHours(-11)
|
||||||
|
$_.LastWriteTime = $_.LastWriteTime.AddHours(-11)
|
||||||
|
}
|
||||||
|
|
||||||
|
# copy libs
|
||||||
|
Write-Host "Copy SqlCE libraries"
|
||||||
|
Copy-Files "$src\packages\SqlServerCE.4.0.0.1" "*.*" "$tmp\bin" `
|
||||||
|
{ -not $_.Extension.StartsWith(".nu") -and -not $_.RelativeName.StartsWith("lib\") }
|
||||||
|
Copy-Files "$src\packages\SqlServerCE.4.0.0.1" "*.*" "$tmp\WebApp\bin" `
|
||||||
|
{ -not $_.Extension.StartsWith(".nu") -and -not $_.RelativeName.StartsWith("lib\") }
|
||||||
|
|
||||||
|
# copy Belle
|
||||||
|
Write-Host "Copy Belle"
|
||||||
|
Copy-Files "$src\Umbraco.Web.UI.Client\build\belle" "*" "$tmp\WebApp\umbraco" `
|
||||||
|
{ -not ($_.RelativeName -eq "index.html") }
|
||||||
|
|
||||||
|
# prepare WebPI
|
||||||
|
Write-Host "Prepare WebPI"
|
||||||
|
Remove-Directory "$tmp\WebPi"
|
||||||
|
mkdir "$tmp\WebPi" > $null
|
||||||
|
mkdir "$tmp\WebPi\umbraco" > $null
|
||||||
|
Copy-Files "$tmp\WebApp" "*" "$tmp\WebPi\umbraco"
|
||||||
|
Copy-Files "$src\WebPi" "*" "$tmp\WebPi"
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Creates the Zip packages
|
||||||
|
#
|
||||||
|
function Package-Zip
|
||||||
|
{
|
||||||
|
param (
|
||||||
|
$uenv # an Umbraco build environment (see Get-UmbracoBuildEnv)
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Host ">> Create Zip packages"
|
||||||
|
|
||||||
|
$src = "$($uenv.SolutionRoot)\src"
|
||||||
|
$tmp = "$($uenv.SolutionRoot)\build.tmp"
|
||||||
|
$out = "$($uenv.SolutionRoot)\build.out"
|
||||||
|
|
||||||
|
Write-Host "Zip all binaries"
|
||||||
|
&$uenv.Zip a -r "$out\UmbracoCms.AllBinaries.$($version.Semver).zip" `
|
||||||
|
"$tmp\bin\*" `
|
||||||
|
"-x!dotless.Core.*" `
|
||||||
|
> $null
|
||||||
|
|
||||||
|
Write-Host "Zip cms"
|
||||||
|
&$uenv.Zip a -r "$out\UmbracoCms.$($version.Semver).zip" `
|
||||||
|
"$tmp\WebApp\*" `
|
||||||
|
"-x!dotless.Core.*" "-x!Content_Types.xml" `
|
||||||
|
> $null
|
||||||
|
|
||||||
|
Write-Host "Zip WebPI"
|
||||||
|
&$uenv.Zip a -r "$out\UmbracoCms.WebPI.$($version.Semver).zip" `
|
||||||
|
"$tmp\WebPi\*" `
|
||||||
|
"-x!dotless.Core.*" `
|
||||||
|
> $null
|
||||||
|
|
||||||
|
# hash the webpi file
|
||||||
|
Write-Host "Hash WebPI"
|
||||||
|
$hash = Get-FileHash "$out\UmbracoCms.WebPI.$($version.Semver).zip"
|
||||||
|
Write $hash | out-file "$out\webpihash.txt" -encoding ascii
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Prepares NuGet
|
||||||
|
#
|
||||||
|
function Prepare-NuGet
|
||||||
|
{
|
||||||
|
param (
|
||||||
|
$uenv # an Umbraco build environment (see Get-UmbracoBuildEnv)
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Host ">> Prepare NuGet"
|
||||||
|
|
||||||
|
$src = "$($uenv.SolutionRoot)\src"
|
||||||
|
$tmp = "$($uenv.SolutionRoot)\build.tmp"
|
||||||
|
$out = "$($uenv.SolutionRoot)\build.out"
|
||||||
|
|
||||||
|
# add Web.config transform files to the NuGet package
|
||||||
|
Write-Host "Add web.config transforms to NuGet package"
|
||||||
|
mv "$tmp\WebApp\Views\Web.config" "$tmp\WebApp\Views\Web.config.transform"
|
||||||
|
|
||||||
|
# fixme - that one does not exist in .bat build either?
|
||||||
|
#mv "$tmp\WebApp\Xslt\Web.config" "$tmp\WebApp\Xslt\Web.config.transform"
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Creates the NuGet packages
|
||||||
|
#
|
||||||
|
function Package-NuGet
|
||||||
|
{
|
||||||
|
param (
|
||||||
|
$uenv, # an Umbraco build environment (see Get-UmbracoBuildEnv)
|
||||||
|
$version # an Umbraco version object (see Get-UmbracoVersion)
|
||||||
|
)
|
||||||
|
|
||||||
|
$src = "$($uenv.SolutionRoot)\src"
|
||||||
|
$tmp = "$($uenv.SolutionRoot)\build.tmp"
|
||||||
|
$out = "$($uenv.SolutionRoot)\build.out"
|
||||||
|
$nuspecs = "$($uenv.SolutionRoot)\build\NuSpecs"
|
||||||
|
|
||||||
|
Write-Host ">> Create NuGet packages"
|
||||||
|
|
||||||
|
# see https://docs.microsoft.com/en-us/nuget/schema/nuspec
|
||||||
|
# note - warnings about SqlCE native libs being outside of 'lib' folder,
|
||||||
|
# nothing much we can do about it as it's intentional yet there does not
|
||||||
|
# seem to be a way to disable the warning
|
||||||
|
|
||||||
|
&$uenv.NuGet Pack "$nuspecs\UmbracoCms.Core.nuspec" `
|
||||||
|
-Properties BuildTmp="$tmp" `
|
||||||
|
-Version $version.Semver.ToString() `
|
||||||
|
-Symbols -Verbosity quiet -outputDirectory $out
|
||||||
|
|
||||||
|
&$uenv.NuGet Pack "$nuspecs\UmbracoCms.nuspec" `
|
||||||
|
-Properties BuildTmp="$tmp" `
|
||||||
|
-Version $version.Semver.ToString() `
|
||||||
|
-Verbosity quiet -outputDirectory $out
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Builds Umbraco
|
||||||
|
#
|
||||||
|
function Build-Umbraco
|
||||||
|
{
|
||||||
|
[CmdletBinding()]
|
||||||
|
param (
|
||||||
|
[string]
|
||||||
|
$target = "all"
|
||||||
|
)
|
||||||
|
|
||||||
|
$target = $target.ToLowerInvariant()
|
||||||
|
Write-Host ">> Build-Umbraco <$target>"
|
||||||
|
|
||||||
|
Write-Host "Get Build Environment"
|
||||||
|
$uenv = Get-UmbracoBuildEnv
|
||||||
|
|
||||||
|
Write-Host "Get Version"
|
||||||
|
$version = Get-UmbracoVersion
|
||||||
|
Write-Host "Version $($version.Semver)"
|
||||||
|
|
||||||
|
if ($target -eq "pre-build")
|
||||||
|
{
|
||||||
|
Prepare-Build $uenv
|
||||||
|
Compile-Belle $uenv $version
|
||||||
|
|
||||||
|
# set environment variables
|
||||||
|
$env:UMBRACO_VERSION=$version.Semver.ToString()
|
||||||
|
$env:UMBRACO_RELEASE=$version.Release
|
||||||
|
$env:UMBRACO_COMMENT=$version.Comment
|
||||||
|
$env:UMBRACO_BUILD=$version.Build
|
||||||
|
|
||||||
|
# set environment variable for VSO
|
||||||
|
# https://github.com/Microsoft/vsts-tasks/issues/375
|
||||||
|
# https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md
|
||||||
|
Write-Host ("##vso[task.setvariable variable=UMBRACO_VERSION;]$($version.Semver.ToString())")
|
||||||
|
Write-Host ("##vso[task.setvariable variable=UMBRACO_RELEASE;]$($version.Release)")
|
||||||
|
Write-Host ("##vso[task.setvariable variable=UMBRACO_COMMENT;]$($version.Comment)")
|
||||||
|
Write-Host ("##vso[task.setvariable variable=UMBRACO_BUILD;]$($version.Build)")
|
||||||
|
|
||||||
|
Write-Host ("##vso[task.setvariable variable=UMBRACO_TMP;]$($uenv.SolutionRoot)\build.tmp")
|
||||||
|
}
|
||||||
|
elseif ($target -eq "pre-tests")
|
||||||
|
{
|
||||||
|
Prepare-Tests $uenv
|
||||||
|
}
|
||||||
|
elseif ($target -eq "compile-tests")
|
||||||
|
{
|
||||||
|
Compile-Tests $uenv
|
||||||
|
}
|
||||||
|
elseif ($target -eq "compile-umbraco")
|
||||||
|
{
|
||||||
|
Compile-Umbraco $uenv
|
||||||
|
}
|
||||||
|
elseif ($target -eq "pre-packages")
|
||||||
|
{
|
||||||
|
Prepare-Packages $uenv
|
||||||
|
}
|
||||||
|
elseif ($target -eq "pre-nuget")
|
||||||
|
{
|
||||||
|
Prepare-NuGet $uenv
|
||||||
|
}
|
||||||
|
elseif ($target -eq "pkg-zip")
|
||||||
|
{
|
||||||
|
Package-Zip $uenv
|
||||||
|
}
|
||||||
|
elseif ($target -eq "compile-belle")
|
||||||
|
{
|
||||||
|
Compile-Belle $uenv $version
|
||||||
|
}
|
||||||
|
elseif ($target -eq "all")
|
||||||
|
{
|
||||||
|
Prepare-Build $uenv
|
||||||
|
Compile-Belle $uenv $version
|
||||||
|
Compile-Umbraco $uenv
|
||||||
|
Prepare-Tests $uenv
|
||||||
|
Compile-Tests $uenv
|
||||||
|
# not running tests...
|
||||||
|
Prepare-Packages $uenv
|
||||||
|
Package-Zip $uenv
|
||||||
|
Prepare-NuGet $uenv
|
||||||
|
Package-NuGet $uenv $version
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Error "Unsupported target `"$target`"."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# export functions
|
||||||
|
#
|
||||||
|
Export-ModuleMember -function Get-UmbracoBuildEnv
|
||||||
|
Export-ModuleMember -function Set-UmbracoVersion
|
||||||
|
Export-ModuleMember -function Get-UmbracoVersion
|
||||||
|
Export-ModuleMember -function Build-Umbraco
|
||||||
|
|
||||||
|
#eof
|
||||||
83
build/Modules/Umbraco.Build/Utilities.ps1
Normal file
83
build/Modules/Umbraco.Build/Utilities.ps1
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
# returns a string containing the hash of $file
|
||||||
|
function Get-FileHash($file)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$crypto = new-object System.Security.Cryptography.SHA1CryptoServiceProvider
|
||||||
|
$stream = [System.IO.File]::OpenRead($file)
|
||||||
|
$hash = $crypto.ComputeHash($stream)
|
||||||
|
$text = ""
|
||||||
|
$hash | foreach `
|
||||||
|
{
|
||||||
|
$text = $text + $_.ToString("x2")
|
||||||
|
}
|
||||||
|
return $text
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if ($stream)
|
||||||
|
{
|
||||||
|
$stream.Dispose()
|
||||||
|
}
|
||||||
|
$crypto.Dispose()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# returns the full path if $file is relative to $pwd
|
||||||
|
function Get-FullPath($file)
|
||||||
|
{
|
||||||
|
$path = [System.IO.Path]::Combine($pwd, $file)
|
||||||
|
$path = [System.IO.Path]::GetFullPath($path)
|
||||||
|
return $path
|
||||||
|
}
|
||||||
|
|
||||||
|
# removes a directory, doesn't complain if it does not exist
|
||||||
|
function Remove-Directory($dir)
|
||||||
|
{
|
||||||
|
remove-item $dir -force -recurse -errorAction SilentlyContinue > $null
|
||||||
|
}
|
||||||
|
|
||||||
|
# removes a file, doesn't complain if it does not exist
|
||||||
|
function Remove-File($file)
|
||||||
|
{
|
||||||
|
remove-item $file -force -errorAction SilentlyContinue > $null
|
||||||
|
}
|
||||||
|
|
||||||
|
# copies a file, creates target dir if needed
|
||||||
|
function Copy-File($source, $target)
|
||||||
|
{
|
||||||
|
$ignore = new-item -itemType file -path $target -force
|
||||||
|
cp -force $source $target
|
||||||
|
}
|
||||||
|
|
||||||
|
# copies files to a directory
|
||||||
|
function Copy-Files($source, $select, $target, $filter)
|
||||||
|
{
|
||||||
|
$files = ls -r "$source\$select"
|
||||||
|
$files | foreach {
|
||||||
|
$relative = $_.FullName.SubString($source.Length+1)
|
||||||
|
$_ | add-member -memberType NoteProperty -name RelativeName -value $relative
|
||||||
|
}
|
||||||
|
if ($filter -ne $null) {
|
||||||
|
$files = $files | where $filter
|
||||||
|
}
|
||||||
|
$files |
|
||||||
|
foreach {
|
||||||
|
if ($_.PsIsContainer) {
|
||||||
|
$ignore = new-item -itemType directory -path "$target\$($_.RelativeName)" -force
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Copy-File $_.FullName "$target\$($_.RelativeName)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# regex-replaces content in a file
|
||||||
|
function Replace-FileText($filename, $source, $replacement)
|
||||||
|
{
|
||||||
|
$filepath = Get-FullPath $filename
|
||||||
|
$text = [System.IO.File]::ReadAllText($filepath)
|
||||||
|
$text = [System.Text.RegularExpressions.Regex]::Replace($text, $source, $replacement)
|
||||||
|
$utf8bom = New-Object System.Text.UTF8Encoding $true
|
||||||
|
[System.IO.File]::WriteAllText($filepath, $text, $utf8bom)
|
||||||
|
}
|
||||||
@@ -19,13 +19,13 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
<file src="..\_BuildOutput\bin\Umbraco.Compat7.dll" target="lib\Umbraco.Compat7.dll" />
|
<file src="$BuildTmp$\bin\Umbraco.Compat7.dll" target="lib\Umbraco.Compat7.dll" />
|
||||||
<!--
|
<!--
|
||||||
<file src="..\_BuildOutput\bin\Umbraco.Compat7.xml" target="lib\Umbraco.Compat7.xml" />
|
<file src="..\_BuildOutput\bin\Umbraco.Compat7.xml" target="lib\Umbraco.Compat7.xml" />
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- Added to be able to produce a symbols package -->
|
<!-- produce symbols package -->
|
||||||
<file src="..\_BuildOutput\bin\Umbraco.Compat7.pdb" target="lib" />
|
<file src="$BuildTmp$\bin\Umbraco.Compat7.pdb" target="lib" />
|
||||||
<file src="..\..\src\Umbraco.Compat7\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\Umbraco.Compat7" />
|
<file src="$BuildTmp$\..\src\Umbraco.Compat7\**\*.cs" exclude="$BuildTmp$\..\src\**\TemporaryGeneratedFile*.cs" target="src\Umbraco.Compat7" />
|
||||||
</files>
|
</files>
|
||||||
</package>
|
</package>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata minClientVersion="3.4.4">
|
<metadata minClientVersion="3.4.4">
|
||||||
<id>UmbracoCms.Core</id>
|
<id>UmbracoCms.Core</id>
|
||||||
<version>7.0.0</version>
|
<version>8.0.0</version>
|
||||||
<title>Umbraco Cms Core Binaries</title>
|
<title>Umbraco Cms Core Binaries</title>
|
||||||
<authors>Umbraco HQ</authors>
|
<authors>Umbraco HQ</authors>
|
||||||
<owners>Umbraco HQ</owners>
|
<owners>Umbraco HQ</owners>
|
||||||
@@ -47,44 +47,30 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
<file src="..\_BuildOutput\WebApp\bin\cms.dll" target="lib\cms.dll" />
|
<file src="$BuildTmp$\WebApp\bin\Microsoft.ApplicationBlocks.Data.dll" target="lib\Microsoft.ApplicationBlocks.Data.dll" />
|
||||||
<file src="..\_BuildOutput\WebApp\bin\cms.xml" target="lib\cms.xml" />
|
<file src="$BuildTmp$\WebApp\bin\System.Data.SqlServerCe.dll" target="lib\System.Data.SqlServerCe.dll" />
|
||||||
<file src="..\_BuildOutput\WebApp\bin\controls.dll" target="lib\controls.dll" />
|
<file src="$BuildTmp$\WebApp\bin\System.Data.SqlServerCe.Entity.dll" target="lib\System.Data.SqlServerCe.Entity.dll" />
|
||||||
<file src="..\_BuildOutput\WebApp\bin\controls.xml" target="lib\controls.xml" />
|
<file src="$BuildTmp$\WebApp\bin\Umbraco.Core.dll" target="lib\Umbraco.Core.dll" />
|
||||||
<file src="..\_BuildOutput\WebApp\bin\log4net.dll" target="lib\log4net.dll" />
|
<file src="$BuildTmp$\WebApp\bin\Umbraco.Core.xml" target="lib\Umbraco.Core.xml" />
|
||||||
<file src="..\_BuildOutput\WebApp\bin\Microsoft.ApplicationBlocks.Data.dll" target="lib\Microsoft.ApplicationBlocks.Data.dll" />
|
<file src="$BuildTmp$\WebApp\bin\umbraco.DataLayer.dll" target="lib\umbraco.DataLayer.dll" />
|
||||||
<file src="..\_BuildOutput\WebApp\bin\SQLCE4Umbraco.dll" target="lib\SQLCE4Umbraco.dll" />
|
<file src="$BuildTmp$\WebApp\bin\umbraco.DataLayer.xml" target="lib\umbraco.DataLayer.xml" />
|
||||||
<file src="..\_BuildOutput\WebApp\bin\SQLCE4Umbraco.xml" target="lib\SQLCE4Umbraco.xml" />
|
<file src="$BuildTmp$\WebApp\bin\Umbraco.Web.dll" target="lib\Umbraco.Web.dll" />
|
||||||
<file src="..\_BuildOutput\WebApp\bin\System.Data.SqlServerCe.dll" target="lib\System.Data.SqlServerCe.dll" />
|
<file src="$BuildTmp$\WebApp\bin\Umbraco.Web.xml" target="lib\Umbraco.Web.xml" />
|
||||||
<file src="..\_BuildOutput\WebApp\bin\System.Data.SqlServerCe.Entity.dll" target="lib\System.Data.SqlServerCe.Entity.dll" />
|
<file src="$BuildTmp$\WebApp\bin\Umbraco.Web.UI.dll" target="lib\Umbraco.Web.UI.dll" />
|
||||||
<file src="..\_BuildOutput\WebApp\bin\Umbraco.Core.dll" target="lib\Umbraco.Core.dll" />
|
<file src="$BuildTmp$\WebApp\bin\Umbraco.Web.UI.xml" target="lib\Umbraco.Web.UI.xml" />
|
||||||
<file src="..\_BuildOutput\WebApp\bin\Umbraco.Core.xml" target="lib\Umbraco.Core.xml" />
|
<file src="$BuildTmp$\WebApp\bin\UmbracoExamine.dll" target="lib\UmbracoExamine.dll" />
|
||||||
<file src="..\_BuildOutput\WebApp\bin\umbraco.DataLayer.dll" target="lib\umbraco.DataLayer.dll" />
|
<file src="$BuildTmp$\WebApp\bin\UmbracoExamine.xml" target="lib\UmbracoExamine.xml" />
|
||||||
<file src="..\_BuildOutput\WebApp\bin\umbraco.DataLayer.xml" target="lib\umbraco.DataLayer.xml" />
|
|
||||||
<file src="..\_BuildOutput\WebApp\bin\umbraco.dll" target="lib\umbraco.dll" />
|
|
||||||
<file src="..\_BuildOutput\WebApp\bin\umbraco.xml" target="lib\umbraco.xml" />
|
|
||||||
<file src="..\_BuildOutput\WebApp\bin\Umbraco.Web.UI.dll" target="lib\Umbraco.Web.UI.dll" />
|
|
||||||
<file src="..\_BuildOutput\WebApp\bin\Umbraco.Web.UI.xml" target="lib\Umbraco.Web.UI.xml" />
|
|
||||||
<file src="..\_BuildOutput\WebApp\bin\UmbracoExamine.dll" target="lib\UmbracoExamine.dll" />
|
|
||||||
<file src="..\_BuildOutput\WebApp\bin\UmbracoExamine.xml" target="lib\UmbracoExamine.xml" />
|
|
||||||
<file src="tools\install.core.ps1" target="tools\install.ps1" />
|
<file src="tools\install.core.ps1" target="tools\install.ps1" />
|
||||||
|
|
||||||
<!-- Added to be able to produce a symbols package -->
|
<!-- produce symbols package -->
|
||||||
<file src="..\_BuildOutput\bin\SQLCE4Umbraco.pdb" target="lib" />
|
<file src="$BuildTmp$\bin\Umbraco.Core.pdb" target="lib" />
|
||||||
<file src="..\..\src\SQLCE4Umbraco\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\SQLCE4Umbraco" />
|
<file src="$BuildTmp$\..\src\Umbraco.Core\**\*.cs" exclude="$BuildTmp$\..\src\**\TemporaryGeneratedFile*.cs" target="src\Umbraco.Core" />
|
||||||
<file src="..\_BuildOutput\bin\cms.pdb" target="lib" />
|
<file src="$BuildTmp$\bin\Umbraco.Web.pdb" target="lib" />
|
||||||
<file src="..\..\src\umbraco.cms\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.cms" />
|
<file src="$BuildTmp$\..\src\Umbraco.Web\**\*.cs" exclude="$BuildTmp$\..\src\**\TemporaryGeneratedFile*.cs" target="src\Umbraco.Web" />
|
||||||
<file src="..\_BuildOutput\bin\controls.pdb" target="lib" />
|
<file src="$BuildTmp$\bin\Umbraco.Web.UI.pdb" target="lib" />
|
||||||
<file src="..\..\src\umbraco.controls\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.controls" />
|
<file src="$BuildTmp$\..\src\Umbraco.Web.UI\**\*.cs" exclude="$BuildTmp$\..\src\**\TemporaryGeneratedFile*.cs" target="src\Umbraco.Web.UI" />
|
||||||
<file src="..\_BuildOutput\bin\Umbraco.Core.pdb" target="lib" />
|
<file src="$BuildTmp$\bin\UmbracoExamine.pdb" target="lib" />
|
||||||
<file src="..\..\src\Umbraco.Core\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\Umbraco.Core" />
|
<file src="$BuildTmp$\..\src\UmbracoExamine\**\*.cs" exclude="$BuildTmp$\..\src\**\TemporaryGeneratedFile*.cs" target="src\UmbracoExamine" />
|
||||||
<file src="..\_BuildOutput\bin\umbraco.DataLayer.pdb" target="lib" />
|
|
||||||
<file src="..\..\src\umbraco.datalayer\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.datalayer" />
|
|
||||||
<file src="..\_BuildOutput\bin\umbraco.pdb" target="lib" />
|
|
||||||
<file src="..\..\src\Umbraco.Web\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\Umbraco.Web" />
|
|
||||||
<file src="..\_BuildOutput\bin\Umbraco.Web.UI.pdb" target="lib" />
|
|
||||||
<file src="..\..\src\Umbraco.Web.UI\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\Umbraco.Web.UI" />
|
|
||||||
<file src="..\_BuildOutput\bin\UmbracoExamine.pdb" target="lib" />
|
|
||||||
<file src="..\..\src\UmbracoExamine\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\UmbracoExamine" />
|
|
||||||
</files>
|
</files>
|
||||||
</package>
|
</package>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata minClientVersion="3.4.4">
|
<metadata minClientVersion="3.4.4">
|
||||||
<id>UmbracoCms</id>
|
<id>UmbracoCms</id>
|
||||||
<version>7.0.0</version>
|
<version>8.0.0</version>
|
||||||
<title>Umbraco Cms</title>
|
<title>Umbraco Cms</title>
|
||||||
<authors>Umbraco HQ</authors>
|
<authors>Umbraco HQ</authors>
|
||||||
<owners>Umbraco HQ</owners>
|
<owners>Umbraco HQ</owners>
|
||||||
@@ -22,19 +22,20 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
<file src="..\_BuildOutput\Configs\**" target="Content\Config" exclude="..\_BuildOutput\Configs\Web.config.transform" />
|
<file src="$BuildTmp$\Configs\**" target="Content\Config" exclude="$BuildTmp$\Configs\Web.config.transform" />
|
||||||
<file src="..\_BuildOutput\WebApp\Views\**" target="Content\Views" exclude="..\_BuildOutput\WebApp\Views\Web.config" />
|
<file src="$BuildTmp$\WebApp\Views\**" target="Content\Views" exclude="$BuildTmp$\WebApp\Views\Web.config" />
|
||||||
<file src="..\_BuildOutput\WebApp\Scripts\**" target="Content\Scripts" exclude="..\_BuildOutput\WebApp\Scripts\dummy.txt" />
|
<file src="$BuildTmp$\WebApp\Scripts\**" target="Content\Scripts" exclude="$BuildTmp$\WebApp\Scripts\dummy.txt" />
|
||||||
<file src="..\_BuildOutput\WebApp\default.aspx" target="Content\default.aspx" />
|
<file src="$BuildTmp$\WebApp\default.aspx" target="Content\default.aspx" />
|
||||||
<file src="..\_BuildOutput\WebApp\Global.asax" target="Content\Global.asax" />
|
<file src="$BuildTmp$\WebApp\Global.asax" target="Content\Global.asax" />
|
||||||
<file src="..\_BuildOutput\WebApp\Web.config" target="UmbracoFiles\Web.config" />
|
<file src="$BuildTmp$\WebApp\Web.config" target="UmbracoFiles\Web.config" />
|
||||||
<file src="..\_BuildOutput\WebApp\App_Browsers\**" target="UmbracoFiles\App_Browsers" />
|
<file src="$BuildTmp$\WebApp\App_Browsers\**" target="UmbracoFiles\App_Browsers" />
|
||||||
<file src="..\_BuildOutput\WebApp\bin\amd64\**" target="UmbracoFiles\bin\amd64" />
|
<file src="$BuildTmp$\WebApp\bin\amd64\**" target="UmbracoFiles\bin\amd64" />
|
||||||
<file src="..\_BuildOutput\WebApp\bin\x86\**" target="UmbracoFiles\bin\x86" />
|
<file src="$BuildTmp$\WebApp\bin\x86\**" target="UmbracoFiles\bin\x86" />
|
||||||
<file src="..\_BuildOutput\WebApp\config\splashes\**" target="UmbracoFiles\Config\splashes" />
|
<file src="$BuildTmp$\WebApp\config\splashes\**" target="UmbracoFiles\Config\splashes" />
|
||||||
<file src="..\_BuildOutput\WebApp\umbraco\**" target="UmbracoFiles\umbraco" />
|
<file src="$BuildTmp$\WebApp\umbraco\**" target="UmbracoFiles\umbraco" />
|
||||||
<file src="..\_BuildOutput\WebApp\umbraco_client\**" target="UmbracoFiles\umbraco_client" />
|
<file src="$BuildTmp$\WebApp\umbraco_client\**" target="UmbracoFiles\umbraco_client" />
|
||||||
<file src="..\_BuildOutput\WebApp\Media\Web.config" target="Content\Media\Web.config" />
|
<file src="$BuildTmp$\WebApp\Media\Web.config" target="Content\Media\Web.config" />
|
||||||
|
|
||||||
<file src="tools\install.ps1" target="tools\install.ps1" />
|
<file src="tools\install.ps1" target="tools\install.ps1" />
|
||||||
<file src="tools\Readme.txt" target="tools\Readme.txt" />
|
<file src="tools\Readme.txt" target="tools\Readme.txt" />
|
||||||
<file src="tools\ReadmeUpgrade.txt" target="tools\ReadmeUpgrade.txt" />
|
<file src="tools\ReadmeUpgrade.txt" target="tools\ReadmeUpgrade.txt" />
|
||||||
@@ -45,6 +46,7 @@
|
|||||||
<file src="tools\trees.config.install.xdt" target="Content\config\trees.config.install.xdt" />
|
<file src="tools\trees.config.install.xdt" target="Content\config\trees.config.install.xdt" />
|
||||||
<file src="tools\umbracoSettings.config.install.xdt" target="Content\config\umbracoSettings.config.install.xdt" />
|
<file src="tools\umbracoSettings.config.install.xdt" target="Content\config\umbracoSettings.config.install.xdt" />
|
||||||
<file src="tools\Views.Web.config.install.xdt" target="Views\Web.config.install.xdt" />
|
<file src="tools\Views.Web.config.install.xdt" target="Views\Web.config.install.xdt" />
|
||||||
|
|
||||||
<file src="build\**" target="build" />
|
<file src="build\**" target="build" />
|
||||||
</files>
|
</files>
|
||||||
</package>
|
</package>
|
||||||
Binary file not shown.
@@ -1,3 +0,0 @@
|
|||||||
# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta)
|
|
||||||
8.0.0
|
|
||||||
alpha0000
|
|
||||||
116
build/build.md
Normal file
116
build/build.md
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
Umbraco Cms Build
|
||||||
|
--
|
||||||
|
----
|
||||||
|
|
||||||
|
# Build
|
||||||
|
|
||||||
|
The Umbraco Build solution relies on a PowerShell module. The module needs to be imported into PowerShell. From within the solution directory:
|
||||||
|
|
||||||
|
$env:PSModulePath = "$pwd\build\Modules\;$env:PSModulePath"
|
||||||
|
Import-Module Umbraco.Build -Force -DisableNameChecking
|
||||||
|
|
||||||
|
Once the module has been imported, a set of commands are added to PowerShell, and detailed below.
|
||||||
|
|
||||||
|
## Get-UmbracoBuildEnv
|
||||||
|
|
||||||
|
Gets the Umbraco build environment ie NuGet, Semver, Visual Studio, etc. Downloads things that can be downloaded such as NuGet. Examples:
|
||||||
|
|
||||||
|
$uenv = Get-UmbracoBuildEnv
|
||||||
|
Write-Host $uenv.SolutionRoot
|
||||||
|
&$uenv.NuGet help
|
||||||
|
|
||||||
|
The object exposes the following properties:
|
||||||
|
|
||||||
|
* `SolutionRoot`: the absolute path to the solution root
|
||||||
|
* `VisualStudio`: a Visual Studio object (see below)
|
||||||
|
* `NuGet`: the absolute path to the NuGet executable
|
||||||
|
* `Zip`: the absolute path to the 7Zip executable
|
||||||
|
* `VsWhere`: the absolute path to the VsWhere executable
|
||||||
|
* `NodePath`: the absolute path to the Node install
|
||||||
|
* `NpmPath`: the absolute path to the Npm install
|
||||||
|
|
||||||
|
The Visual Studio object is `null` when Visual Studio has not been detected (eg on VSTS). When not null, the object exposes the following properties:
|
||||||
|
|
||||||
|
* `Path`: Visual Studio installation path (eg some place under `Program Files`)
|
||||||
|
* `Major`: Visual Studio major version (eg `15` for VS 2017)
|
||||||
|
* `Minor`: Visual Studio minor version
|
||||||
|
* `MsBUild`: the absolute path to the MsBuild executable
|
||||||
|
|
||||||
|
## Get-UmbracoVersion
|
||||||
|
|
||||||
|
Gets an object representing the current Umbraco version. Example:
|
||||||
|
|
||||||
|
$v = Get-UmbracoVersion
|
||||||
|
Write-Host $v.Semver
|
||||||
|
|
||||||
|
The object exposes the following properties:
|
||||||
|
|
||||||
|
* `Semver`: the semver object representing the version
|
||||||
|
* `Release`: the main part of the version (eg `7.6.33`)
|
||||||
|
* `Comment`: the pre release part of the version (eg `alpha02`)
|
||||||
|
* `Build`: the build number part of the version (eg `1234`)
|
||||||
|
|
||||||
|
## Set-UmbracoVersion
|
||||||
|
|
||||||
|
Modifies Umbraco files with the new version.
|
||||||
|
|
||||||
|
>This entirely replaces the legacy `UmbracoVersion.txt` file.
|
||||||
|
|
||||||
|
The version must be a valid semver version. It can include a *pre release* part (eg `alpha02`) and/or a *build number* (eg `1234`). Examples:
|
||||||
|
|
||||||
|
Set-UmbracoVersion 7.6.33
|
||||||
|
Set-UmbracoVersion 7.6.33-alpha02
|
||||||
|
Set-UmbracoVersion 7.6.33+1234
|
||||||
|
Set-UmbracoVersion 7.6.33-beta05+5678
|
||||||
|
|
||||||
|
Note that `Set-UmbracoVersion` enforces a slightly more restrictive naming scheme than what semver would tolerate. The pre release part can only be composed of a-z and 0-9, therefore `alpha033` is considered valid but not `alpha.033` nor `alpha033-preview` nor `RC2` (would need to be lowercased `rc2`).
|
||||||
|
|
||||||
|
>It is considered best to add trailing zeroes to pre releases, else NuGet gets the order of versions wrong. So if you plan to have more than 10, but no more that 100 alpha versions, number the versions `alpha00`, `alpha01`, etc.
|
||||||
|
|
||||||
|
## Build-Umbraco
|
||||||
|
|
||||||
|
Builds Umbraco. Temporary files are generated in `build.tmp` while the actual artifacts (zip files, NuGet packages...) are produced in `build.out`. Example:
|
||||||
|
|
||||||
|
Build-Umbraco
|
||||||
|
|
||||||
|
Some log files, such as MsBuild logs, are produced in `build.tmp` too. The `build` directory should remain clean during a build.
|
||||||
|
|
||||||
|
### web.config
|
||||||
|
|
||||||
|
Building Umbraco requires a clean `web.config` file in the `Umbraco.Web.UI` project. If a `web.config` file already exists, the `pre-build` task (see below) will save it as `web.config.temp-build` and replace it with a clean copy of `web.Template.config`. The original file is replaced once it is safe to do so, by the `pre-packages` task.
|
||||||
|
|
||||||
|
# VSTS
|
||||||
|
|
||||||
|
Continuous integration, nightly builds and release builds run on VSTS.
|
||||||
|
|
||||||
|
VSTS uses the `Build-Umbraco` command several times, each time passing a different *target* parameter. The supported targets are:
|
||||||
|
|
||||||
|
* `pre-build`: prepares the build
|
||||||
|
* `compile-belle`: compiles Belle
|
||||||
|
* `compile-umbraco`: compiles Umbraco
|
||||||
|
* `pre-tests`: prepares the tests
|
||||||
|
* `compile-tests`: compiles the tests
|
||||||
|
* `pre-packages`: prepares the packages
|
||||||
|
* `pkg-zip`: creates the zip files
|
||||||
|
* `pre-nuget`: prepares NuGet packages
|
||||||
|
* `pkg-nuget`: creates NuGet packages
|
||||||
|
|
||||||
|
All these targets are executed when `Build-Umbraco` is invoked without a parameter (or with the `all` parameter). On VSTS, compilations (of Umbraco and tests) are performed by dedicated VSTS tasks. Similarly, creating the NuGet packages is also performed by dedicated VSTS tasks.
|
||||||
|
|
||||||
|
Finally, the produced artifacts are published in two containers that can be downloaded from VSTS: `zips` contains the zip files while `nuget` contains the NuGet packages.
|
||||||
|
|
||||||
|
>During a VSTS build, some environment `UMBRACO_*` variables are exported by the `pre-build` target and can be reused in other targets *and* in VSTS tasks. The `UMBRACO_TMP` environment variable is used in `Umbraco.Tests` to disable some tests that have issues with VSTS at the moment.
|
||||||
|
|
||||||
|
# Notes
|
||||||
|
|
||||||
|
*This part needs to be cleaned up*
|
||||||
|
|
||||||
|
Nightlies should use some sort of build number.
|
||||||
|
|
||||||
|
We should increment versions as soon as a version is released. Ie, as soon as `7.6.33` is released, we should `Set-UmbracoVersion 7.6.34-alpha` and push.
|
||||||
|
|
||||||
|
NuGet / NuSpec consistency checks are performed in tests. We should move it so it is done as part of the PowerShell script even before we try to compile and run the tests.
|
||||||
|
|
||||||
|
There are still a few commands in `build` (to build docs, install Git or cleanup the install) that will need to be migrated to PowerShell.
|
||||||
|
|
||||||
|
/eof
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<solution>
|
|
||||||
<add key="disableSourceControlIntegration" value="true" />
|
|
||||||
</solution>
|
|
||||||
</configuration>
|
|
||||||
Binary file not shown.
@@ -1,138 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
|
|
||||||
|
|
||||||
<!-- Enable the restore command to run before builds -->
|
|
||||||
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
|
|
||||||
|
|
||||||
<!-- Property that enables building a package from a project -->
|
|
||||||
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
|
|
||||||
|
|
||||||
<!-- Determines if package restore consent is required to restore packages -->
|
|
||||||
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
|
|
||||||
|
|
||||||
<!-- Download NuGet.exe if it does not already exist -->
|
|
||||||
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup Condition=" '$(PackageSources)' == '' ">
|
|
||||||
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
|
|
||||||
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
|
|
||||||
<!--
|
|
||||||
<PackageSource Include="https://www.nuget.org/api/v2/" />
|
|
||||||
<PackageSource Include="https://my-nuget-source/nuget/" />
|
|
||||||
-->
|
|
||||||
<PackageSource Include="https://nuget.org/api/v2/" />
|
|
||||||
<PackageSource Include="http://www.myget.org/F/umbracocore/" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
|
|
||||||
<!-- Windows specific commands -->
|
|
||||||
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
|
|
||||||
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
|
|
||||||
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
|
|
||||||
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
|
|
||||||
<PackagesConfig>packages.config</PackagesConfig>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<!-- NuGet command -->
|
|
||||||
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
|
|
||||||
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
|
|
||||||
|
|
||||||
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
|
|
||||||
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
|
|
||||||
|
|
||||||
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
|
|
||||||
|
|
||||||
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
|
|
||||||
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
|
|
||||||
|
|
||||||
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
|
|
||||||
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
|
|
||||||
|
|
||||||
<!-- Commands -->
|
|
||||||
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
|
|
||||||
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
|
|
||||||
|
|
||||||
<!-- We need to ensure packages are restored prior to assembly resolve -->
|
|
||||||
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
|
|
||||||
RestorePackages;
|
|
||||||
$(BuildDependsOn);
|
|
||||||
</BuildDependsOn>
|
|
||||||
|
|
||||||
<!-- Make the build depend on restore packages -->
|
|
||||||
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
|
|
||||||
$(BuildDependsOn);
|
|
||||||
BuildPackage;
|
|
||||||
</BuildDependsOn>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<Target Name="CheckPrerequisites">
|
|
||||||
<!-- Raise an error if we're unable to locate nuget.exe -->
|
|
||||||
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
|
|
||||||
<!--
|
|
||||||
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
|
|
||||||
This effectively acts as a lock that makes sure that the download operation will only happen once and all
|
|
||||||
parallel builds will have to wait for it to complete.
|
|
||||||
-->
|
|
||||||
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<Target Name="_DownloadNuGet">
|
|
||||||
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
|
|
||||||
<Exec Command="$(RestoreCommand)"
|
|
||||||
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
|
|
||||||
|
|
||||||
<Exec Command="$(RestoreCommand)"
|
|
||||||
LogStandardErrorAsError="true"
|
|
||||||
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
|
|
||||||
<Exec Command="$(BuildCommand)"
|
|
||||||
Condition=" '$(OS)' != 'Windows_NT' " />
|
|
||||||
|
|
||||||
<Exec Command="$(BuildCommand)"
|
|
||||||
LogStandardErrorAsError="true"
|
|
||||||
Condition=" '$(OS)' == 'Windows_NT' " />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
|
|
||||||
<ParameterGroup>
|
|
||||||
<OutputFilename ParameterType="System.String" Required="true" />
|
|
||||||
</ParameterGroup>
|
|
||||||
<Task>
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Using Namespace="System" />
|
|
||||||
<Using Namespace="System.IO" />
|
|
||||||
<Using Namespace="System.Net" />
|
|
||||||
<Using Namespace="Microsoft.Build.Framework" />
|
|
||||||
<Using Namespace="Microsoft.Build.Utilities" />
|
|
||||||
<Code Type="Fragment" Language="cs">
|
|
||||||
<![CDATA[
|
|
||||||
try {
|
|
||||||
OutputFilename = Path.GetFullPath(OutputFilename);
|
|
||||||
|
|
||||||
Log.LogMessage("Downloading latest version of NuGet.exe...");
|
|
||||||
WebClient webClient = new WebClient();
|
|
||||||
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception ex) {
|
|
||||||
Log.LogErrorFromException(ex);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
]]>
|
|
||||||
</Code>
|
|
||||||
</Task>
|
|
||||||
</UsingTask>
|
|
||||||
</Project>
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.26430.13
|
VisualStudioVersion = 15.0.26430.14
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Web.UI", "Umbraco.Web.UI\Umbraco.Web.UI.csproj", "{4C4C194C-B5E4-4991-8F87-4373E24CC19F}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Web.UI", "Umbraco.Web.UI\Umbraco.Web.UI.csproj", "{4C4C194C-B5E4-4991-8F87-4373E24CC19F}"
|
||||||
EndProject
|
EndProject
|
||||||
@@ -68,13 +68,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Tests", "Umbraco.Te
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UmbracoExamine", "UmbracoExamine\UmbracoExamine.csproj", "{07FBC26B-2927-4A22-8D96-D644C667FECC}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UmbracoExamine", "UmbracoExamine\UmbracoExamine.csproj", "{07FBC26B-2927-4A22-8D96-D644C667FECC}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{D24664A0-49B7-44A8-B2A5-5E5B1CCB7A58}"
|
|
||||||
ProjectSection(SolutionItems) = preProject
|
|
||||||
.nuget\NuGet.Config = .nuget\NuGet.Config
|
|
||||||
.nuget\NuGet.exe = .nuget\NuGet.exe
|
|
||||||
.nuget\NuGet.targets = .nuget\NuGet.targets
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{E3F9F378-AFE1-40A5-90BD-82833375DBFE}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{E3F9F378-AFE1-40A5-90BD-82833375DBFE}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
..\build\NuSpecs\tools\applications.config.install.xdt = ..\build\NuSpecs\tools\applications.config.install.xdt
|
..\build\NuSpecs\tools\applications.config.install.xdt = ..\build\NuSpecs\tools\applications.config.install.xdt
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user