Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Microsoft.WinGet.Client PowerShell Module files #2314

Merged
merged 28 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
092260c
Initial commit of Microsoft.WinGet.Client project files.
jontab Jul 7, 2022
ca6d781
Fixed AppInstallerCLI.sln encoding change.
jontab Jul 7, 2022
ee45b51
Fixed BaseFinderCommand.cs typo.
jontab Jul 7, 2022
b36e395
Changed expect.txt for check-spelling-bot.
jontab Jul 7, 2022
48977f0
Changed expect.txt for check-spelling-bot again.
jontab Jul 7, 2022
da7b783
Changed expect.txt for check-spelling-bot another time.
jontab Jul 7, 2022
45b4404
Changed error messages to use localized strings; build script. Integr…
jontab Jul 12, 2022
08bc0af
Changed version logic; exact behavior; and attached all results to va…
jontab Jul 12, 2022
bd0e70f
Merge remote-tracking branch 'upstream/master' into user/t-jabbott/po…
jontab Jul 13, 2022
4d650ba
Fixed configuration mapping
jontab Jul 14, 2022
61b5c79
Spelling
jontab Jul 14, 2022
13dba24
Remove PlatyPS until ready; slight tweaks. Replace command with Enabl…
jontab Jul 19, 2022
91f8a4a
Minor changes and lower minimum platform version
jontab Jul 19, 2022
b6a7ec7
Organize and enhance comments
jontab Jul 19, 2022
1289fbb
Change build script to be pipeline friendly
jontab Jul 20, 2022
c874024
Initial pipeline pass
jontab Jul 20, 2022
1965b42
Call winrtact_Initialize from type initializer
jontab Jul 20, 2022
b3b906e
Spelling
Jul 20, 2022
5c0d48e
Merge branch 'master' into user/t-jabbott/powershell
jontab Jul 20, 2022
fce3e48
Localized progress record activities
jontab Jul 21, 2022
1b0e281
Merge remote-tracking branch 'upstream/master' into user/t-jabbott/po…
jontab Jul 21, 2022
90783ee
Merge branch 'user/t-jabbott/powershell-staging' into user/t-jabbott/…
jontab Jul 21, 2022
0cd730b
Merge branch 'master' of https://github.com/microsoft/winget-cli into…
jontab Jul 21, 2022
04e93f1
Download artifacts before publishing
jontab Jul 21, 2022
8aa5a4e
Merge branch 'user/t-jabbott/powershell-staging' of https://github.co…
jontab Jul 21, 2022
d8e4fe4
Merge branch 'master' of https://github.com/microsoft/winget-cli into…
jontab Jul 21, 2022
04960da
Add event to ensure winrtact.dll is copied
jontab Jul 25, 2022
85f3a8c
Change to copy correct configuration
jontab Jul 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
abcd
accepteula
adjacents
activatable
adml
admx
affle
Expand All @@ -20,7 +19,6 @@ apicontract
apiset
appinstallertest
appname
Archs
arget
argumentlist
ARMNT
Expand Down Expand Up @@ -56,6 +54,7 @@ BOMs
boundparms
brk
Buf
buildtransitive
BUILTINS
cancelledbyuser
casemap
Expand All @@ -81,6 +80,7 @@ COMGLB
commandline
Concat
contactsupport
contentfiles
contoso
contractversion
count'th
Expand All @@ -103,20 +103,22 @@ diskfull
dllimport
dnld
Dobbeleer
dsc
Dsc
Dst
dustojnikhummer
dvinns
dw
ebug
ecfr
ecfrbrowse
efgh
EFGH
endian
enr
enums
EQU
ERANGE
errno
ESRB
estination
etest
execustom
EXEHASH
Expand All @@ -139,18 +141,16 @@ FULLMUTEX
FULLWIDTH
fundraiser
fuzzer
FWW
fzanollo
gcpi
GES
GESMBH
GHS
gitlab
gity
Globals
Google
guiddef
hackathon
Hackathon
hashtable
helplib
helplibrary
Expand All @@ -162,8 +162,8 @@ hmodule
hre
hresults
htm
IAttachment
IARP
IAttachment
IConfiguration
idx
IFACEMETHODIMP
Expand Down Expand Up @@ -214,6 +214,7 @@ learnxinyminutes
lhs
libsolv
libyaml
Lifecycle
Linq
liv
liwpx
Expand All @@ -226,7 +227,6 @@ LPWSTR
LSTATUS
LTDA
lw
lww
lz
malware
maxvalue
Expand All @@ -236,8 +236,8 @@ megamorf
memcpy
middleware
midl
minidump
minexample
minidump
minschema
missingdependency
MMmmbbbb
Expand All @@ -258,7 +258,6 @@ myinstalldir
mylog
mysilent
mysilentwithprogress
mytool
NETFX
netlify
Newtonsoft
Expand All @@ -278,12 +277,10 @@ objbase
objidl
ofile
Outptr
OSVERSION
Packagedx
packageinuse
parametermap
PARAMETERMAP
paramref
pathparts
pathpaths
Patil
pb
PCs
Expand All @@ -303,6 +300,7 @@ pri
processthreads
productcode
pscustomobject
psd
pseudocode
psm
psobject
Expand Down Expand Up @@ -361,6 +359,7 @@ standalone
startswith
streambuf
strtoull
stylecop
subdir
subkey
superstring
Expand All @@ -369,7 +368,6 @@ SUSE
swervy
SYD
SYG
symlink
sysrefcomp
Tagit
TCpp
Expand All @@ -388,6 +386,7 @@ TResult
trimstart
TState
TStatus
typeof
UCase
ucasemap
UChars
Expand All @@ -396,7 +395,7 @@ uec
uild
uintptr
ul
Uninitialize
uninitialize
uninstallation
uninstaller
uninstallprevious
Expand Down Expand Up @@ -425,13 +424,12 @@ vscode
vstest
vy
wcslen
WDAG
webpages
Webserver
website
WERSJA
wesome
whatif
Whatif
windir
windowsdeveloper
winerror
Expand All @@ -441,7 +439,6 @@ winreg
withstarts
wn
Workflows
wsb
wsl
wsv
wto
Expand Down
45 changes: 45 additions & 0 deletions src/AppInstallerCLI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "COMServer", "COMServer\COMS
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Management.Deployment.InProc", "Microsoft.Management.Deployment.InProc\Microsoft.Management.Deployment.InProc.vcxproj", "{9AC3C6A4-1875-4D3E-BF9C-C31E81EFF6B4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PowerShell", "PowerShell", "{7C218A3E-9BC8-48FF-B91B-BCACD828C0C9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.WinGet.Client", "PowerShell\Microsoft.WinGet.Client\Microsoft.WinGet.Client.csproj", "{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
ManifestSchema\ManifestSchema.vcxitems*{1622da16-914f-4f57-a259-d5169003cc8c}*SharedItemsImports = 4
Expand Down Expand Up @@ -1026,6 +1030,46 @@ Global
{9AC3C6A4-1875-4D3E-BF9C-C31E81EFF6B4}.TestRelease|x64.Build.0 = Release|x64
{9AC3C6A4-1875-4D3E-BF9C-C31E81EFF6B4}.TestRelease|x86.ActiveCfg = Release|Win32
{9AC3C6A4-1875-4D3E-BF9C-C31E81EFF6B4}.TestRelease|x86.Build.0 = Release|Win32
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|Any CPU.ActiveCfg = Debug|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|Any CPU.Build.0 = Debug|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|ARM.ActiveCfg = Debug|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|ARM.Build.0 = Debug|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|ARM64.ActiveCfg = Debug|ARM64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|ARM64.Build.0 = Debug|ARM64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|x64.ActiveCfg = Debug|x64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|x64.Build.0 = Debug|x64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|x86.ActiveCfg = Debug|x86
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|x86.Build.0 = Debug|x86
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|Any CPU.ActiveCfg = Debug|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|Any CPU.Build.0 = Debug|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|ARM.ActiveCfg = Debug|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|ARM.Build.0 = Debug|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|ARM64.ActiveCfg = Debug|ARM64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|ARM64.Build.0 = Debug|ARM64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x64.ActiveCfg = Debug|x64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x64.Build.0 = Debug|x64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x86.ActiveCfg = Debug|x86
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x86.Build.0 = Debug|x86
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|Any CPU.ActiveCfg = Release|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|Any CPU.Build.0 = Release|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|ARM.ActiveCfg = Release|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|ARM.Build.0 = Release|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|ARM64.ActiveCfg = Release|ARM64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|ARM64.Build.0 = Release|ARM64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|x64.ActiveCfg = Release|x64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|x64.Build.0 = Release|x64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|x86.ActiveCfg = Release|x86
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|x86.Build.0 = Release|x86
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|Any CPU.ActiveCfg = Debug|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|Any CPU.Build.0 = Debug|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM.ActiveCfg = Debug|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM.Build.0 = Debug|ARM
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM64.ActiveCfg = Debug|ARM64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM64.Build.0 = Debug|ARM64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x64.ActiveCfg = Debug|x64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x64.Build.0 = Debug|x64
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x86.ActiveCfg = Debug|x86
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x86.Build.0 = Debug|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -1045,6 +1089,7 @@ Global
{866C3F06-636F-4BE8-BC24-5F86ECC606A1} = {60618CAC-2995-4DF9-9914-45C6FC02C995}
{1A47951F-5C7A-4D6D-BB5F-D77484437940} = {8D53D749-D51C-46F8-A162-9371AAA6C2E7}
{409CD681-22A4-469D-88AE-CB5E4836E07A} = {8D53D749-D51C-46F8-A162-9371AAA6C2E7}
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C} = {7C218A3E-9BC8-48FF-B91B-BCACD828C0C9}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B6FDB70C-A751-422C-ACD1-E35419495857}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// -----------------------------------------------------------------------------
// <copyright file="FilterAttribute.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
// </copyright>
// -----------------------------------------------------------------------------

namespace Microsoft.WinGet.Client.Attributes
{
using System;
using Microsoft.Management.Deployment;

/// <summary>
/// Marking a property with this attribute causes it to be added to the filters list when searching for packages.
/// </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public class FilterAttribute : Attribute
{
/// <summary>
/// Gets or sets the field that the filter will be matching against.
/// </summary>
public PackageMatchField Field { get; set; }
}
}
38 changes: 38 additions & 0 deletions src/PowerShell/Microsoft.WinGet.Client/BuildModule.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (c) Microsoft Corporation. Licensed under the MIT License.

[CmdletBinding()]
param (
[Parameter()]
$In = "$PSScriptRoot\bin",

[Parameter()]
[string]
$Out = "$PSScriptRoot\build\bin",

[Parameter()]
[string]
$Configuration = 'Release'
)

$CoreFramework = 'net6.0-windows10.0.22000.0'
jontab marked this conversation as resolved.
Show resolved Hide resolved
$DesktopFramework = 'net461'

if (Test-Path $Out) {
Remove-Item $Out -Recurse
}

Get-ChildItem $In -ErrorAction SilentlyContinue -Exclude 'Debug','Release' | ForEach-Object {
Write-Verbose ($_.FullName)

$coreSrcPath = Join-Path $_.FullName $Configuration $CoreFramework
$coreDstPath = Join-Path $Out $_.Name 'Core'
$desktopSrcPath = Join-Path $_.FullName $Configuration $DesktopFramework
$desktopDstPath = Join-Path $Out $_.Name 'Desktop'

Copy-Item $coreSrcPath -Destination $coreDstPath -Recurse -Force
Copy-Item $desktopSrcPath -Destination $desktopDstPath -Recurse -Force
}

Copy-Item 'Format.ps1xml' -Destination $Out
Copy-Item 'Microsoft.WinGet.Client.psd1' -Destination $Out
Copy-Item 'Microsoft.WinGet.Client.psm1' -Destination $Out
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// -----------------------------------------------------------------------------
// <copyright file="BaseClientCommand.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
// </copyright>
// -----------------------------------------------------------------------------

namespace Microsoft.WinGet.Client.Commands
{
using System;
using System.Collections.Generic;
using System.Management.Automation;
using System.Security.Principal;
using Microsoft.Management.Deployment;
using Microsoft.WinGet.Client.Factories;

/// <summary>
/// This is the base class for all commands in this module.
/// </summary>
public class BaseClientCommand : PSCmdlet
{
/// <summary>
/// Initializes a new instance of the <see cref="BaseClientCommand"/> class.
/// </summary>
public BaseClientCommand()
: base()
{
var identity = WindowsIdentity.GetCurrent();
var principal = new WindowsPrincipal(identity);
var admin = principal.IsInRole(WindowsBuiltInRole.Administrator);
if (admin)
{
throw new Exception(@"This cmdlet is currently not available in an administrator context.");
jontab marked this conversation as resolved.
Show resolved Hide resolved
}
}

/// <summary>
/// Gets the instance of the <see cref="ComObjectFactory" /> class.
/// </summary>
protected static Lazy<ComObjectFactory> ComObjectFactory { get; } = new Lazy<ComObjectFactory>();

/// <summary>
/// Gets the instance of the <see cref="PackageManager" /> class.
/// </summary>
protected static Lazy<PackageManager> PackageManager { get; } = new Lazy<PackageManager>(() => ComObjectFactory.Value.CreatePackageManager());

/// <summary>
/// Retrieves the specified source or all sources if <paramref name="source" /> is null.
/// </summary>
/// <returns>A list of <see cref="PackageCatalogReference" /> instances.</returns>
/// <param name="source">The name of the source to retrieve. If null, then all sources are returned.</param>
/// <exception cref="ArgumentException">The source does not exist.</exception>
protected static IReadOnlyList<PackageCatalogReference> GetPackageCatalogReferences(string source)
{
if (source is null)
{
return PackageManager.Value.GetPackageCatalogs();
}
else
{
return new List<PackageCatalogReference>()
{
PackageManager.Value.GetPackageCatalogByName(source)
?? throw new ArgumentException("No sources match the given value: " + source),
};
}
}

}
}
Loading