diff --git a/BUILD.md b/BUILD.md index 30ea950778..a2406c58bd 100644 --- a/BUILD.md +++ b/BUILD.md @@ -6,19 +6,13 @@ Umbraco Cms Build To build Umbraco, fire PowerShell and move to Umbraco's repository root (the directory that contains `src`, `build`, `README.md`...). There, trigger the build with the following command: - build\build.ps1 + build/build.ps1 -By default, this builds the current version. It is possible to specify a different version as a parameter to the build script: - - build\build.ps1 7.6.44 - -Valid version strings are defined in the `Set-UmbracoVersion` documentation below. - ## PowerShell Quirks There is a good chance that running `build.ps1` ends up in error, with messages such as ->The file ...\build\build.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies. +>The file ...\build.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies. PowerShell has *Execution Policies* that may prevent the script from running. You can check the current policies with: @@ -42,7 +36,7 @@ Alternatively, you can do it at machine level, from within an elevated PowerShel And *then* the script should run. It *might* however still complain about executing scripts, with messages such as: ->Security warning - Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning message. Do you want to run ...\build\build.ps1? +>Security warning - Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning message. Do you want to run ...\build.ps1? [D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"): This is usually caused by the scripts being *blocked*. And that usually happens when the source code has been downloaded as a Zip file. When Windows downloads Zip files, they are marked as *blocked* (technically, they have a Zone.Identifier alternate data stream, with a value of "3" to indicate that they were downloaded from the Internet). And when such a Zip file is un-zipped, each and every single file is also marked as blocked. @@ -51,34 +45,20 @@ The best solution is to unblock the Zip file before un-zipping: right-click the PS> Get-ChildItem -Recurse *.* | Unblock-File -## Notes +## Git Quirks Git might have issues dealing with long file paths during build. You may want/need to enable `core.longpaths` support (see [this page](https://github.com/msysgit/msysgit/wiki/Git-cannot-create-a-file-or-directory-with-a-long-path) for details). -If PowerShell does not execute the script due to a security error, you may have to run the following command from an administrator prompt: +# Build Infrastructure - Set-ExecutionPolicy -ExecutionPolicy RemoteSigned +The Umbraco Build infrastructure relies on a PowerShell object. The object can be retrieved with: -# Build + $ubuild = build/build.ps1 -get -The Umbraco Build solution relies on a PowerShell module. The module needs to be imported into PowerShell. From within Umbraco's repository root: - - build\build.ps1 -ModuleOnly - -Or the abbreviated form: - - build\build.ps1 -mo - -Once the module has been imported, a set of commands are added to PowerShell. - -## 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 various properties and methods that can be used to fine-grain build Umbraco. Some, but not all, of them are detailed below. +## Properties + The object exposes the following properties: * `SolutionRoot`: the absolute path to the solution root @@ -96,11 +76,11 @@ The Visual Studio object is `null` when Visual Studio has not been detected (eg * `Minor`: Visual Studio minor version * `MsBUild`: the absolute path to the MsBuild executable -## Get-UmbracoVersion +## GetUmbracoVersion Gets an object representing the current Umbraco version. Example: - $v = Get-UmbracoVersion + $v = $ubuild.GetUmbracoVersion() Write-Host $v.Semver The object exposes the following properties: @@ -110,28 +90,24 @@ The object exposes the following properties: * `Comment`: the pre release part of the version (eg `alpha02`) * `Build`: the build number part of the version (eg `1234`) -## Set-UmbracoVersion +## SetUmbracoVersion Modifies Umbraco files with the new version. ->This entirely replaces the legacy `UmbracoVersion.txt` file. +>This entirely replaces the legacy `UmbracoVersion.txt` file. Do *not* edit version infos in files. 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 + $ubuild.SetUmbracoVersion("7.6.33") + $ubuild.SetUmbracoVersion("7.6.33-alpha.2") + $ubuild.SetUmbracoVersion("7.6.33+1234") + $ubuild.SetUmbracoVersion("7.6.33-beta.5+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 +## Build 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 + $ubuild.Build() Some log files, such as MsBuild logs, are produced in `build.tmp` too. The `build` directory should remain clean during a build. @@ -185,6 +161,4 @@ We should increment versions as soon as a version is released. Ie, as soon as `7 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 \ No newline at end of file diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 0000000000..7d786702f4 --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/build/build-bootstrap.ps1 b/build/build-bootstrap.ps1 index c1b2cb0fbe..71a25bfd7e 100644 --- a/build/build-bootstrap.ps1 +++ b/build/build-bootstrap.ps1 @@ -5,7 +5,7 @@ # . "$PSScriptRoot\build-bootstrap.ps1" # THIS FILE IS DISTRIBUTED AS PART OF UMBRACO.BUILD - # DO NOT MODIFY IT - ALWAYS USED THE COMMON VERSION + # DO NOT MODIFY IT - ALWAYS USED THE COMMON VERSION # ################################################################ # BOOTSTRAP @@ -41,12 +41,28 @@ throw "Failed to locate NuGet.exe." } + # NuGet notes + # As soon as we use -ConfigFile, NuGet uses that file, and only that file, and does not + # merge configuration from system level. See comments in NuGet.Client solution, class + # NuGet.Configuration.Settings, method LoadDefaultSettings. + # For NuGet to merge configurations, it needs to "find" the file in the current directory, + # or above. Which means we cannot really use -ConfigFile but instead have to have Umbraco's + # NuGet.config file at root, and always run NuGet.exe while at root or in a directory below + # root. + + $solutionRoot = "$scriptRoot\.." + $testPwd = [System.IO.Path]::GetFullPath($pwd.Path) + "\" + $testRoot = [System.IO.Path]::GetFullPath($solutionRoot) + "\" + if (-not $testPwd.ToLower().StartsWith($testRoot.ToLower())) + { + throw "Cannot run outside of the solution's root." + } + # get the build system if (-not $local) { - $solutionRoot = "$scriptRoot\.." - $nugetConfig = @{$true="$solutionRoot\src\NuGet.config.user";$false="$solutionRoot\src\NuGet.config"}[(test-path "$solutionRoot\src\NuGet.config.user")] - &$nuget install Umbraco.Build -OutputDirectory $scriptTemp -Verbosity quiet -PreRelease -ConfigFile $nugetConfig + $params = "-OutputDirectory", $scriptTemp, "-Verbosity", "quiet", "-PreRelease" + &$nuget install Umbraco.Build @params if (-not $?) { throw "Failed to download Umbraco.Build." } } @@ -63,7 +79,7 @@ # at that point the build.ps1 script must boot the build system # eg - # $ubuild.Boot($ubuildPath.FullName, [System.IO.Path]::GetFullPath("$scriptRoot\.."), + # $ubuild.Boot($ubuildPath.FullName, [System.IO.Path]::GetFullPath("$scriptRoot\.."), # @{ Local = $local; With7Zip = $false; WithNode = $false }, # @{ continue = $continue }) # if (-not $?) { throw "Failed to boot the build system." } @@ -73,4 +89,4 @@ # Write-Host "Umbraco.Whatever Build" # Write-Host "Umbraco.Build v$($ubuild.BuildVersion)" - # eof \ No newline at end of file + # eof diff --git a/build/build.ps1 b/build/build.ps1 index 1c8d429333..3bdf2ba6e1 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -342,13 +342,13 @@ $this.TempStoreFile("$($this.SolutionRoot)\src\Umbraco.Web.UI\web.config") Write-Host "Create clean web.config" $this.CopyFile("$($this.SolutionRoot)\src\Umbraco.Web.UI\web.Template.config", "$($this.SolutionRoot)\src\Umbraco.Web.UI\web.config") - + Write-host "Set environment" $env:UMBRACO_VERSION=$this.Version.Semver.ToString() $env:UMBRACO_RELEASE=$this.Version.Release $env:UMBRACO_COMMENT=$this.Version.Comment $env:UMBRACO_BUILD=$this.Version.Build - + if ($args -and $args[0] -eq "vso") { Write-host "Set VSO environment" @@ -378,7 +378,7 @@ { Write-Host "Restore NuGet" Write-Host "Logging to $($this.BuildTemp)\nuget.restore.log" - &$this.BuildEnv.NuGet restore "$($this.SolutionRoot)\src\Umbraco.sln" -ConfigFile $this.BuildEnv.NuGetConfig > "$($this.BuildTemp)\nuget.restore.log" + &$this.BuildEnv.NuGet restore "$($this.SolutionRoot)\src\Umbraco.sln" > "$($this.BuildTemp)\nuget.restore.log" if (-not $?) { throw "Failed to restore NuGet packages." } }) diff --git a/src/NuGet.Config b/src/NuGet.Config deleted file mode 100644 index 722f368692..0000000000 --- a/src/NuGet.Config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index dd503b5d62..82955491e7 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -62,7 +62,7 @@ - + diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index d26b29e4e7..5db12b7041 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -91,8 +91,8 @@ - - + + diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 5859bb8ad6..20f1cb6cfe 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -83,9 +83,7 @@ - - 4.8.0 - + @@ -1573,7 +1571,7 @@ copied from Microsoft.CSharp.targets because we have webservices, we need to SGEN but it's getting confused by us referencing System.ValueTuple which it cannot load - + Name="UmbGenerateSerializationAssemblies" Condition="'$(_SGenGenerateSerializationAssembliesConfig)' == 'On' or ('@(WebReferenceUrl)'!='' and '$(_SGenGenerateSerializationAssembliesConfig)' == 'Auto')" --> @@ -1593,4 +1591,4 @@ - \ No newline at end of file + diff --git a/src/umbraco.sln b/src/umbraco.sln index 97122e7555..9ff43571c6 100644 --- a/src/umbraco.sln +++ b/src/umbraco.sln @@ -6,9 +6,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Web.UI", "Umbraco.W EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{2849E9D4-3B4E-40A3-A309-F3CB4F0E125F}" ProjectSection(SolutionItems) = preProject + ..\build\build-bootstrap.ps1 = ..\build\build-bootstrap.ps1 ..\build\build.ps1 = ..\build\build.ps1 ..\build\BuildDocs.ps1 = ..\build\BuildDocs.ps1 NuGet.Config = NuGet.Config + ..\NuGet.Config = ..\NuGet.Config ..\build\RevertToCleanInstall.bat = ..\build\RevertToCleanInstall.bat ..\build\RevertToEmptyInstall.bat = ..\build\RevertToEmptyInstall.bat SolutionInfo.cs = SolutionInfo.cs @@ -16,13 +18,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{2849E9D4 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{FD962632-184C-4005-A5F3-E705D92FC645}" ProjectSection(SolutionItems) = preProject - ..\BUILD.md = ..\BUILD.md - ..\apidocs\docfx.filter.yml = ..\apidocs\docfx.filter.yml - ..\apidocs\docfx.json = ..\apidocs\docfx.json - ..\apidocs\index.md = ..\apidocs\index.md - ..\LICENSE.md = ..\LICENSE.md - ..\README.md = ..\README.md - ..\apidocs\toc.yml = ..\apidocs\toc.yml + ApiDocs\docfx.filter.yml = ApiDocs\docfx.filter.yml + ApiDocs\docfx.json = ApiDocs\docfx.json + ApiDocs\index.md = ApiDocs\index.md + ApiDocs\toc.yml = ApiDocs\toc.yml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{B5BD12C1-A454-435E-8A46-FF4A364C0382}"