Skip to content

Commit

Permalink
chocolatey-visualstudio.extension: read manifests from layout, if pre…
Browse files Browse the repository at this point in the history
…sent

GitHub-Issue: GH-7 GH-8 GH-10 GH-26
  • Loading branch information
jberezanski committed May 15, 2018
1 parent ede5e01 commit c84ad06
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,8 @@ function Get-VSChannelManifest
Write-Debug "Fallback: using hardcoded channel manifest URI: '$manifestUri'"
}

# TODO: if bootstrapperPath present, check for existence of ChannelManifest.json instead of downloading the VS component manifest
# TODO: same for installLayoutPath

# TODO: pass -LayoutPath
$manifest = Get-VSManifest -Description 'channel manifest' -Url $manifestUri -LayoutFileName 'ChannelManifest.json'
$layoutPath = Resolve-VSLayoutPath -PackageParameters $PackageParameters
$manifest = Get-VSManifest -Description 'channel manifest' -Url $manifestUri -LayoutFileName 'ChannelManifest.json' -LayoutPath $layoutPath

return $manifest
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ function Get-VSComponentManifest
[System.Collections.IDictionary] $ChannelManifest
)

$layoutPath = Resolve-VSLayoutPath -PackageParameters $PackageParameters

if ($ChannelManifest -eq $null)
{
Write-Debug 'Obtaining the channel manifest'
$ChannelManifest = Get-VSChannelManifest -PackageParameters $PackageParameters -ProductReference $ProductReference
$ChannelManifest = Get-VSChannelManifest -PackageParameters $PackageParameters -ProductReference $ProductReference -LayoutPath $layoutPath
}

Write-Debug 'Parsing the channel manifest'
Expand All @@ -23,12 +25,8 @@ function Get-VSComponentManifest
return $null
}

# TODO: if bootstrapperPath present, check for existence of Catalog.json instead of downloading the VS component manifest
# TODO: same for installLayoutPath

# TODO: pass -LayoutPath
# TODO: pass -Checksum and -ChecksumType
$catalogManifest = Get-VSManifest -Description 'catalog manifest' -Url $url -LayoutFileName 'Catalog.json'
$catalogManifest = Get-VSManifest -Description 'catalog manifest' -Url $url -LayoutFileName 'Catalog.json' -LayoutPath $layoutPath

return $catalogManifest
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
function Resolve-VSLayoutPath
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory = $true)] [hashtable] $PackageParameters
)

Write-Debug 'Detecting if a layout path was provided via package parameters'

if ($PackageParameters.ContainsKey('installLayoutPath'))
{
$installLayoutPath = $PackageParameters['installLayoutPath']
if (-not [string]::IsNullOrEmpty($installLayoutPath))
{
Write-Debug "Using installLayoutPath provided via package parameters: $installLayoutPath"
return $installLayoutPath
}
else
{
Write-Debug 'Package parameters contain installLayoutPath, but it is empty - ignoring'
}
}

if ($PackageParameters.ContainsKey('bootstrapperPath'))
{
$bootstrapperPath = $PackageParameters['bootstrapperPath']
if (-not [string]::IsNullOrEmpty($bootstrapperPath))
{
$installLayoutPath = Split-Path -Path $bootstrapperPath
Write-Debug "Using installLayoutPath computed from bootstrapperPath provided via package parameters: $installLayoutPath"
return $installLayoutPath
}
else
{
Write-Debug 'Package parameters contain $bootstrapperPath, but it is empty - ignoring'
}
}

Write-Debug 'A layout path was not provided via package parameters'
return $null
}

0 comments on commit c84ad06

Please sign in to comment.