Skip to content

Commit 96eee7d

Browse files
committed
Merge master
2 parents 9221c20 + 920c411 commit 96eee7d

File tree

79 files changed

+2775
-204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2775
-204
lines changed

.github/actions/spelling/expect.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ BFirst
5757
bigcatalog
5858
BITMAPINFOHEADER
5959
bitmask
60+
BKMG
6061
bkup
6162
blargle
6263
blockedbypolicy
@@ -124,6 +125,7 @@ DCPPREST
124125
debian
125126
decompressor
126127
dedupe
128+
defaultlib
127129
DEFT
128130
deigh
129131
deleteifnotneeded
@@ -228,6 +230,7 @@ Howto
228230
hre
229231
hresults
230232
hwnd
233+
hybridcrt
231234
Hyperlink
232235
IARP
233236
IAttachment
@@ -335,6 +338,7 @@ MINORVERSION
335338
missingdependency
336339
mkgmtime
337340
MMmmbbbb
341+
MODULEENTRY
338342
mof
339343
monicka
340344
MPNS
@@ -347,6 +351,7 @@ MSIXSTRM
347351
msstore
348352
MSZIP
349353
mszyml
354+
mta
350355
Mugiwara
351356
Multideclaration
352357
mysource
@@ -427,6 +432,7 @@ positionals
427432
posix
428433
postuninstall
429434
powershellgallery
435+
PPROCESS
430436
pri
431437
PRIMARYKEY
432438
processthreads
@@ -435,6 +441,7 @@ PRODUCTICON
435441
propkey
436442
PROPVARIANT
437443
proxystub
444+
psapi
438445
pscustomobject
439446
pseudocode
440447
PSHOST
@@ -474,6 +481,7 @@ rgp
474481
rgpsz
475482
rhs
476483
riid
484+
roapi
477485
Roblox
478486
ronomon
479487
rowid
@@ -499,6 +507,7 @@ Scm
499507
sddl
500508
secureobject
501509
securestring
510+
seekp
502511
seof
503512
servercert
504513
servercertificate
@@ -515,11 +524,14 @@ sid
515524
Sideload
516525
SIGNATUREHASH
517526
silentpreferred
527+
SINGLETHREADED
518528
Skipx
519529
sku
520530
SLAPI
521531
SMTO
522532
SNAME
533+
SNAPMODULE
534+
SNAPTHREAD
523535
sortof
524536
sourceforge
525537
SOURCESDIRECTORY
@@ -548,14 +560,18 @@ Tagit
548560
TARG
549561
taskhostw
550562
tcs
563+
tellp
551564
temppath
552565
testexampleinstaller
553566
thiscouldbeapc
567+
THREADENTRY
554568
threehundred
555569
timespan
556570
Tlg
571+
tlhelp
557572
TLSCAs
558573
tombstoned
574+
Toolhelp
559575
transitioning
560576
trimstart
561577
ttl
@@ -566,6 +582,7 @@ UCase
566582
ucasemap
567583
UChars
568584
ucnv
585+
ucrt
569586
udwgp
570587
uec
571588
ULONGLONG

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ jobs:
213213
Contents: |
214214
AppInstallerCLIE2ETests\**
215215
AppInstallerCLITests\**
216+
ComInprocTestbed\**
216217
Microsoft.Management.Configuration\**
217218
Microsoft.Management.Configuration.UnitTests\**
218219
Microsoft.Management.Configuration.OutOfProc\**

doc/Settings.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,35 @@ In addition, there are special values that cover multiple channels. `default` i
286286
},
287287
```
288288

289+
### file
290+
291+
The `file` settings control the log files generated by winget during operation. These settings apply to the automatic cleanup that happens whenever a Windows Package Manager process is run.
292+
They only apply to the default log location, which contains winget logs, AppInstaller logs (the MSIX install UI), and is the default location where installer logs are placed.
293+
The automatic cleanup happens at the beginning of the process, so the log file(s) generated by the current process will not be considered in the limits.
294+
295+
|Setting|Description|Default|Note|
296+
|---|---|---|---|
297+
|`ageLimitInDays`|The maximum age, in days, of files in the log directory; older files are deleted.|7 (days)|Set to 0 to disable this limit.|
298+
|`totalSizeLimitInMB`|The maximum size, in megabytes, of all files in the log directory; the oldest files are deleted first.|128 (MB)|Set to 0 to disable this limit.|
299+
|`countLimit`|The maximum number of files in the log directory; the oldest files are deleted first.|0|Set to 0 (the default) to disable this limit.|
300+
301+
These settings apply to the log files that winget writes, only as they are being written. They do not apply to files written by installers or the AppInstaller UI.
302+
303+
|Setting|Description|Default|Note|
304+
|---|---|---|---|
305+
|`individualSizeLimitInMB`|The maximum size, in megabytes, of an individual log file. If a file would exceed this limit, the logs will wrap. Note that this limit is approximate and the actual files may exceed it by a few bytes.|16 (MB)|Set to 0 to disable this limit.|
306+
307+
```json
308+
"logging": {
309+
"file": {
310+
"ageLimitInDays": 7,
311+
"totalSizeLimitInMB": 128,
312+
"countLimit": 0,
313+
"individualSizeLimitInMB": 16,
314+
}
315+
},
316+
```
317+
289318
## Network
290319

291320
The `network` settings influence how winget uses the network to retrieve packages and metadata.

schemas/JSON/settings/settings.schema.0.2.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,36 @@
8080
},
8181
"minItems": 0,
8282
"maxItems": 20
83+
},
84+
"file": {
85+
"description": "The file settings control the log files generated by winget during operation.",
86+
"type": "object",
87+
"properties": {
88+
"ageLimitInDays": {
89+
"description": "The maximum age, in days, of a log file before it is deleted. Set to 0 to disable automatic deletion based on age.",
90+
"type": "integer",
91+
"default": 7,
92+
"minimum": 0
93+
},
94+
"totalSizeLimitInMB": {
95+
"description": "The maximum total size, in megabytes, of all log files. If the total size exceeds this limit, the oldest files will be deleted first. Set to 0 to disable this limit.",
96+
"type": "integer",
97+
"default": 128,
98+
"minimum": 0
99+
},
100+
"countLimit": {
101+
"description": "The maximum number of log files to retain. If the number of log files exceeds this limit, the oldest files will be deleted first. Set to 0 (the default) to disable this limit.",
102+
"type": "integer",
103+
"default": 0,
104+
"minimum": 0
105+
},
106+
"individualSizeLimitInMB": {
107+
"description": "The maximum size, in megabytes, of an individual log file. If a file would exceed this limit, new log lines will overwrite the file from the beginning. Set to 0 to disable this limit.",
108+
"type": "integer",
109+
"default": 16,
110+
"minimum": 0
111+
}
112+
}
83113
}
84114
}
85115
},

src/AppInstallerCLI.sln

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{F49C
226226
PowerShell\scripts\Initialize-LocalWinGetModules.ps1 = PowerShell\scripts\Initialize-LocalWinGetModules.ps1
227227
EndProjectSection
228228
EndProject
229+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ComInprocTestbed", "ComInprocTestbed\ComInprocTestbed.vcxproj", "{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}"
230+
EndProject
229231
Global
230232
GlobalSection(SolutionConfigurationPlatforms) = preSolution
231233
Debug|ARM64 = Debug|ARM64
@@ -1022,6 +1024,30 @@ Global
10221024
{33745E4A-39E2-676F-7E23-50FB43848D25}.ReleaseStatic|x64.Build.0 = Release|x64
10231025
{33745E4A-39E2-676F-7E23-50FB43848D25}.ReleaseStatic|x86.ActiveCfg = Release|x86
10241026
{33745E4A-39E2-676F-7E23-50FB43848D25}.ReleaseStatic|x86.Build.0 = Release|x86
1027+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Debug|ARM64.ActiveCfg = Debug|ARM64
1028+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Debug|ARM64.Build.0 = Debug|ARM64
1029+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Debug|x64.ActiveCfg = Debug|x64
1030+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Debug|x64.Build.0 = Debug|x64
1031+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Debug|x86.ActiveCfg = Debug|Win32
1032+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Debug|x86.Build.0 = Debug|Win32
1033+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Fuzzing|ARM64.ActiveCfg = Release|ARM64
1034+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Fuzzing|ARM64.Build.0 = Release|ARM64
1035+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Fuzzing|x64.ActiveCfg = Release|x64
1036+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Fuzzing|x64.Build.0 = Release|x64
1037+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Fuzzing|x86.ActiveCfg = Release|Win32
1038+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Fuzzing|x86.Build.0 = Release|Win32
1039+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Release|ARM64.ActiveCfg = Release|ARM64
1040+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Release|ARM64.Build.0 = Release|ARM64
1041+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Release|x64.ActiveCfg = Release|x64
1042+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Release|x64.Build.0 = Release|x64
1043+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Release|x86.ActiveCfg = Release|Win32
1044+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Release|x86.Build.0 = Release|Win32
1045+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.ReleaseStatic|ARM64.ActiveCfg = Release|ARM64
1046+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.ReleaseStatic|ARM64.Build.0 = Release|ARM64
1047+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.ReleaseStatic|x64.ActiveCfg = Release|x64
1048+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.ReleaseStatic|x64.Build.0 = Release|x64
1049+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.ReleaseStatic|x86.ActiveCfg = Release|Win32
1050+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.ReleaseStatic|x86.Build.0 = Release|Win32
10251051
EndGlobalSection
10261052
GlobalSection(SolutionProperties) = preSolution
10271053
HideSolutionNode = FALSE
@@ -1058,6 +1084,7 @@ Global
10581084
{A33223D2-550B-4D99-A53D-488B1F68683E} = {60618CAC-2995-4DF9-9914-45C6FC02C995}
10591085
{7139ED6E-8FBC-0B61-3E3A-AA2A23CC4D6A} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
10601086
{F49C4C89-447E-4D15-B38B-5A8DCFB134AF} = {7C218A3E-9BC8-48FF-B91B-BCACD828C0C9}
1087+
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
10611088
EndGlobalSection
10621089
GlobalSection(ExtensibilityGlobals) = postSolution
10631090
SolutionGuid = {B6FDB70C-A751-422C-ACD1-E35419495857}

src/AppInstallerCLICore/ExecutionContext.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace AppInstaller::CLI::Execution
5959

6060
std::unique_ptr<Context> Context::CreateSubContext()
6161
{
62-
auto clone = std::make_unique<Context>(Reporter, m_threadGlobals);
62+
auto clone = std::make_unique<Context>(Reporter, *m_threadGlobals);
6363
clone->m_flags = m_flags;
6464
clone->m_executingCommand = m_executingCommand;
6565
// If the parent is hooked up to the CTRL signal, have the clone be as well
@@ -210,13 +210,18 @@ namespace AppInstaller::CLI::Execution
210210
}
211211

212212
AppInstaller::ThreadLocalStorage::WingetThreadGlobals& Context::GetThreadGlobals()
213+
{
214+
return *m_threadGlobals;
215+
}
216+
217+
std::shared_ptr<ThreadLocalStorage::WingetThreadGlobals> Context::GetSharedThreadGlobals()
213218
{
214219
return m_threadGlobals;
215220
}
216221

217222
std::unique_ptr<AppInstaller::ThreadLocalStorage::PreviousThreadGlobals> Context::SetForCurrentThread()
218223
{
219-
return m_threadGlobals.SetForCurrentThread();
224+
return m_threadGlobals->SetForCurrentThread();
220225
}
221226

222227
#ifndef AICLI_DISABLE_TEST_HOOKS

src/AppInstallerCLICore/ExecutionContext.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ namespace AppInstaller::CLI::Execution
100100
// Constructor for creating a sub-context.
101101
Context(Execution::Reporter& reporter, ThreadLocalStorage::WingetThreadGlobals& threadGlobals) :
102102
Reporter(reporter, Execution::Reporter::clone_t{}),
103-
m_threadGlobals(threadGlobals, ThreadLocalStorage::WingetThreadGlobals::create_sub_thread_globals_t{}) {}
103+
m_threadGlobals(std::make_shared<ThreadLocalStorage::WingetThreadGlobals>(threadGlobals, ThreadLocalStorage::WingetThreadGlobals::create_sub_thread_globals_t{})) {}
104104

105105
virtual ~Context();
106106

@@ -163,7 +163,8 @@ namespace AppInstaller::CLI::Execution
163163
virtual void SetExecutionStage(Workflow::ExecutionStage stage);
164164

165165
// Get Globals for Current Context
166-
AppInstaller::ThreadLocalStorage::WingetThreadGlobals& GetThreadGlobals();
166+
ThreadLocalStorage::WingetThreadGlobals& GetThreadGlobals();
167+
std::shared_ptr<ThreadLocalStorage::WingetThreadGlobals> GetSharedThreadGlobals();
167168

168169
std::unique_ptr<AppInstaller::ThreadLocalStorage::PreviousThreadGlobals> SetForCurrentThread();
169170

@@ -209,7 +210,7 @@ namespace AppInstaller::CLI::Execution
209210
size_t m_CtrlSignalCount = 0;
210211
ContextFlag m_flags = ContextFlag::None;
211212
Workflow::ExecutionStage m_executionStage = Workflow::ExecutionStage::Initial;
212-
AppInstaller::ThreadLocalStorage::WingetThreadGlobals m_threadGlobals;
213+
std::shared_ptr<ThreadLocalStorage::WingetThreadGlobals> m_threadGlobals = std::make_shared<ThreadLocalStorage::WingetThreadGlobals>();
213214
AppInstaller::CLI::Command* m_executingCommand = nullptr;
214215
std::unique_ptr<AppInstaller::Checkpoints::CheckpointManager> m_checkpointManager;
215216
};

src/AppInstallerCLICore/Public/ShutdownMonitoring.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ namespace AppInstaller::ShutdownMonitoring
6666
};
6767

6868
// Coordinates shutdown across server components
69-
struct ServerShutdownSynchronization : public ICancellable
69+
struct ServerShutdownSynchronization
7070
{
7171
using ShutdownCompleteCallback = void (*)();
7272

7373
// Initializes the monitoring system and sets up a callback to be invoked when shutdown is completed.
74-
static void Initialize(ShutdownCompleteCallback callback);
74+
static void Initialize(ShutdownCompleteCallback callback, bool createTerminationSignalHandler = true);
7575

7676
// "Interface" for a single component to synchronize with.
7777
struct ComponentSystem
@@ -93,18 +93,20 @@ namespace AppInstaller::ShutdownMonitoring
9393
// Waits for the shutdown to complete.
9494
static void WaitForShutdown();
9595

96-
// Listens for a termination signal.
97-
void Cancel(CancelReason reason, bool force) override;
98-
9996
private:
100-
ServerShutdownSynchronization();
97+
ServerShutdownSynchronization() = default;
10198
~ServerShutdownSynchronization();
10299

100+
friend TerminationSignalHandler;
101+
103102
static ServerShutdownSynchronization& Instance();
104103

105104
// Runs the actual shutdown process and invokes the callback.
106105
void SynchronizeShutdown(CancelReason reason);
107106

107+
// Listens for a termination signal.
108+
void Signal(CancelReason reason);
109+
108110
ShutdownCompleteCallback m_callback = nullptr;
109111
std::mutex m_componentsLock;
110112
std::vector<ComponentSystem> m_components;

0 commit comments

Comments
 (0)