Build - fixes from v7

This commit is contained in:
Stephan
2017-07-14 20:25:57 +02:00
parent ea72b0a7b6
commit 6d02ad3ce8
5 changed files with 69 additions and 47 deletions

View File

@@ -24,17 +24,22 @@ function Build-UmbracoDocs
Write-Host "Build UI documentation"
push-location "$src\Umbraco.Web.UI.Client"
# get a temp clean path (will be restored)
$p = $env:path
$env:path = $uenv.NpmPath + ";" + $uenv.NodePath + ";" + $env:path
write "cache clean" > $tmp\belle-docs.log
$nodePath = $uenv.NodePath
$gitExe = (get-command git).Source
$gitPath = [System.IO.Path]::GetDirectoryName($gitExe)
$env:path = "$nodePath;$gitPath"
push-location "$src\Umbraco.Web.UI.Client"
write "" > $tmp\belle-docs.log
&npm cache clean --quiet >> $tmp\belle-docs.log 2>&1
&npm install --quiet >> $tmp\belle-docs.log 2>&1
&npm install -g grunt-cli --quiet >> $tmp\belle-docs.log 2>&1
#&npm install -g bower --quiet >> $tmp\belle.log 2>&1
#&grunt build --buildversion=$version.Release >> $tmp\belle.log 2>&1
&grunt --gruntfile "$src/Umbraco.Web.UI.Client/gruntfile.js" docs >> $tmp\belle-docs.log 2>&1
pop-location
# fixme - should we filter the log to find errors?
#get-content .\build.tmp\belle-docs.log | %{ if ($_ -match "build") { write $_}}
@@ -45,7 +50,6 @@ function Build-UmbracoDocs
(Get-Content $indexPath).Replace("location.href.replace(rUrl, indexFile)", "'$baseUrl'") `
| Set-Content $indexPath
pop-location
$env:path = $p
# zip
@@ -100,8 +104,7 @@ function Get-DocFx($uenv, $buildTemp)
{
Write-Host "Download DocFx..."
$source = "https://github.com/dotnet/docfx/releases/download/v2.19.2/docfx.zip"
$client = new-object Net.WebClient
$client.DownloadFile($source, "$buildTemp\docfx.zip")
Invoke-WebRequest $source -OutFile "$buildTemp\docfx.zip"
&$uenv.Zip x "$buildTemp\docfx.zip" -o"$buildTemp\docfx" -aos > $nul
Remove-File "$buildTemp\docfx.zip"

View File

@@ -25,8 +25,7 @@ function Get-UmbracoBuildEnv
if (-not (test-path $nuget))
{
Write-Host "Download NuGet..."
$client = new-object Net.WebClient
$client.DownloadFile($source, $nuget)
Invoke-WebRequest $source -OutFile $nuget
}
# ensure we have 7-Zip
@@ -98,36 +97,36 @@ function Get-UmbracoBuildEnv
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")
Invoke-WebRequest $source -OutFile "$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()
}
# note: why? node already brings everything we need!
## 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
@@ -175,7 +174,7 @@ function Get-UmbracoBuildEnv
$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
#$uenv | add-member -memberType NoteProperty -name NpmPath -value $npm
return $uenv
}

View File

@@ -80,24 +80,28 @@ function Compile-Belle
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
# get a temp clean path (will be restored)
$p = $env:path
$nodePath = $uenv.NodePath
$gitExe = (get-command git).Source
$gitPath = [System.IO.Path]::GetDirectoryName($gitExe)
$env:path = "$nodePath;$gitPath"
push-location "$($uenv.SolutionRoot)\src\Umbraco.Web.UI.Client"
write "" > $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
pop-location
# fixme - should we filter the log to find errors?
#get-content .\build.tmp\belle.log | %{ if ($_ -match "build") { write $_}}
pop-location
$env:path = $p
# restore path
$env:path = $p
# setting node_modules folder to hidden
# used to prevent VS13 from crashing on it while loading the websites project
@@ -462,7 +466,7 @@ function Build-Umbraco
)
$target = $target.ToLowerInvariant()
Write-Host ">> Build-Umbraco <$target> <$configuration>"
Write-Host ">> Build-Umbraco <$target> <$buildConfiguration>"
Write-Host "Get Build Environment"
$uenv = Get-UmbracoBuildEnv

View File

@@ -345,7 +345,7 @@ function Verify-NuGet
"@
Write-Host "Verify NuGet consistency"
Write-Host ">> Verify NuGet consistency"
$assem = (
"System.Xml",
@@ -357,7 +357,19 @@ function Verify-NuGet
$uenv.Semver
)
add-type -referencedAssemblies $assem -typeDefinition $source -language CSharp
try
{
# as long as the code hasn't changed it's fine to re-add, but if the code
# has changed this will throw - better warn the dev that we have an issue
add-type -referencedAssemblies $assem -typeDefinition $source -language CSharp
}
catch
{
if ($_.FullyQualifiedErrorId.StartsWith("TYPE_ALREADY_EXISTS,"))
{ Write-Error "Failed to add type, did you change the code?" }
else
{ Write-Error $_ }
}
if (-not $?) { break }
$nuspecs = (

View File

@@ -14,6 +14,10 @@ By default, this builds the current version. It is possible to specify a differe
Valid version strings are defined in the `Set-UmbracoVersion` documentation below.
## Notes
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).
# Build
The Umbraco Build solution relies on a PowerShell module. The module needs to be imported into PowerShell. From within Umbraco's repository root: