Skip to content

Commit

Permalink
chocolatey-visualstudio.extension: use manifests and installer packag…
Browse files Browse the repository at this point in the history
…e from layout path only if --noWeb was requested

If --noWeb is not specified, the VS installer/bootstrapper will still
look to the online manifests even if invoked from layout. The extension
needs to do that, too.

GitHub-Issue: GH-7 GH-8 GH-10 GH-26
  • Loading branch information
jberezanski committed May 15, 2018
1 parent 96dcec7 commit 4d74f2f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
Expand Up @@ -5,7 +5,8 @@ function Get-VSChannelManifest
(
[Parameter(Mandatory = $true)] [hashtable] $PackageParameters,
[PSObject] $ProductReference,
[switch] $UseInstallChannelUri
[switch] $UseInstallChannelUri,
[string] $LayoutPath
)

$manifestUri = $null
Expand Down Expand Up @@ -101,9 +102,24 @@ function Get-VSChannelManifest
Write-Debug "Fallback: using hardcoded channel manifest URI: '$manifestUri'"
}

# TODO: look in LayoutPath only if --noWeb
$layoutPath = Resolve-VSLayoutPath -PackageParameters $PackageParameters
$manifest = Get-VSManifest -Description 'channel manifest' -Url $manifestUri -LayoutFileName 'ChannelManifest.json' -LayoutPath $layoutPath
if ($LayoutPath -eq '')
{
# look in LayoutPath only if --noWeb
if ($packageParameters.ContainsKey('noWeb'))
{
Write-Debug 'Not looking in LayoutPath because --noWeb was passed in package parameters'
}
else
{
$LayoutPath = Resolve-VSLayoutPath -PackageParameters $PackageParameters
}
}
else
{
Write-Debug "Using provided LayoutPath: $LayoutPath"
}

$manifest = Get-VSManifest -Description 'channel manifest' -Url $manifestUri -LayoutFileName 'ChannelManifest.json' -LayoutPath $LayoutPath

return $manifest
}
Expand Up @@ -9,7 +9,16 @@ function Get-VSComponentManifest
[switch] $UseInstallChannelUri
)

$layoutPath = Resolve-VSLayoutPath -PackageParameters $PackageParameters
# look in LayoutPath only if --noWeb
if ($packageParameters.ContainsKey('noWeb'))
{
Write-Debug 'Not looking in LayoutPath because --noWeb was passed in package parameters'
$layoutPath = $null
}
else
{
$layoutPath = Resolve-VSLayoutPath -PackageParameters $PackageParameters
}

if ($ChannelManifest -eq $null)
{
Expand All @@ -26,7 +35,6 @@ function Get-VSComponentManifest
return $null
}

# TODO: look in LayoutPath only if --noWeb
# -Checksum and -ChecksumType are not passed, because the info from the channel manifest seems bogus - does not match reality
$catalogManifest = Get-VSManifest -Description 'catalog manifest' -Url $url -LayoutFileName 'Catalog.json' -LayoutPath $layoutPath

Expand Down
Expand Up @@ -85,7 +85,6 @@ function Install-VSInstaller
}

# if installing from layout, check for existence of vs_installer.opc and auto add --offline
# TODO: only if --noWeb or if the version in layout will satisfy version requirements
if (-not $packageParameters.ContainsKey('offline'))
{
$layoutPath = Resolve-VSLayoutPath -PackageParameters $PackageParameters
Expand All @@ -94,8 +93,17 @@ function Install-VSInstaller
$installerOpcPath = Join-Path -Path $layoutPath -ChildPath 'vs_installer.opc'
if (Test-Path -Path $installerOpcPath)
{
Write-Debug "Using the VS Installer package present in the layout path: $installerOpcPath"
$packageParameters['offline'] = $installerOpcPath
Write-Debug "The VS Installer package is present in the layout path: $installerOpcPath"
# TODO: also if the version in layout will satisfy version requirements
if ($packageParameters.ContainsKey('noWeb'))
{
Write-Debug "Using the VS Installer package present in the layout path because --noWeb was passed in package parameters"
$packageParameters['offline'] = $installerOpcPath
}
else
{
Write-Debug "Not using the VS Installer package present in the layout path because --noWeb was not passed in package parameters"
}
}
}
}
Expand Down

0 comments on commit 4d74f2f

Please sign in to comment.