Skip to content

Commit

Permalink
Update WinGetUtilInterop project (microsoft#4045)
Browse files Browse the repository at this point in the history
This PR fulfills my lifelong dream of updating the `WinGetUtilInterop`
to include most of the APIs from `WinGetUtil`. Internally we have a
project with all this code, so I just copy them here with some minor
changes. Because of that, some of them are not included. The idea would
be that any new APIs added into WinGetUtil should have their
corresponding C# interop implementation in the same PR.

APIs included:
- WinGetLoggingInit
- WinGetLoggingTerm
- WinGetSQLiteIndexCreate
- WinGetSQLiteIndexOpen
- WinGetSQLiteIndexClose
- WinGetSQLiteIndexAddManifest
- WinGetSQLiteIndexUpdateManifest
- WinGetSQLiteIndexRemoveManifest
- WinGetSQLiteIndexPrepareForPackaging
- WinGetSQLiteIndexCheckConsistency
- WinGetCreateManifest
- WinGetCloseManifest
- WinGetValidateManifestV3
- WinGetDownload
- WinGetCompareVersions
- WinGetBeginInstallerMetadataCollection
- WinGetCompleteInstallerMetadataCollection

Missing ones:
- WinGetValidateManifest
- WinGetValidateManifestV2
- WinGetValidateManifestDependencies
- WinGetMergeInstallerMetadata

In that project we just have SQLite tests, so I port them too. I also
added the same stylecops convention so you will see some header changes.
  • Loading branch information
msftrubengu authored Jan 10, 2024
1 parent 6cd7b86 commit b4d8c96
Show file tree
Hide file tree
Showing 55 changed files with 2,072 additions and 577 deletions.
13 changes: 11 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -291,20 +291,29 @@ jobs:
- task: CopyFiles@2
displayName: 'Copy Files: WinGetUtilInterop.UnitTests'
inputs:
SourceFolder: '$(Build.SourcesDirectory)\src\WinGetUtilInterop.UnitTests\bin\$(BuildConfiguration)\net6.0'
SourceFolder: '$(Build.SourcesDirectory)\src\WinGetUtilInterop.UnitTests\bin\$(buildPlatform)\$(BuildConfiguration)\net6.0'
TargetFolder: '$(Build.ArtifactStagingDirectory)\WinGetUtilInterop.UnitTests\'
CleanTargetFolder: true
OverWrite: true
condition: succeededOrFailed()

- task: CopyFiles@2
displayName: 'Copy WinGetUtil to WinGetUtilInterop.UnitTests folder'
inputs:
Contents: |
$(buildOutDir)\WinGetUtil\WinGetUtil.dll
TargetFolder: '$(Build.ArtifactStagingDirectory)\WinGetUtilInterop.UnitTests\'
flattenFolders: true
condition: succeededOrFailed()

- task: VSTest@2
displayName: 'Run tests: WinGetUtilInterop.UnitTests'
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: 'WinGetUtilInterop.UnitTests.dll'
searchFolder: '$(Build.ArtifactStagingDirectory)\WinGetUtilInterop.UnitTests'
codeCoverageEnabled: true
platform: 'Any CPU'
platform: '$(buildPlatform)'
configuration: '$(BuildConfiguration)'
condition: succeededOrFailed()

Expand Down
31 changes: 13 additions & 18 deletions src/AppInstallerCLI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -769,34 +769,29 @@ Global
{846FB88B-BF1B-4F33-9883-E589CEC99739}.TestRelease|x64.ActiveCfg = Release|Any CPU
{846FB88B-BF1B-4F33-9883-E589CEC99739}.TestRelease|x86.ActiveCfg = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Debug|ARM64.Build.0 = Debug|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Debug|x64.ActiveCfg = Debug|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Debug|x64.Build.0 = Debug|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Debug|x86.ActiveCfg = Debug|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Debug|x86.Build.0 = Debug|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Debug|ARM64.ActiveCfg = Debug|ARM64
{68808357-902B-406C-8C19-E8E26A69DE8A}.Debug|x64.ActiveCfg = Debug|x64
{68808357-902B-406C-8C19-E8E26A69DE8A}.Debug|x64.Build.0 = Debug|x64
{68808357-902B-406C-8C19-E8E26A69DE8A}.Debug|x86.ActiveCfg = Debug|x86
{68808357-902B-406C-8C19-E8E26A69DE8A}.Debug|x86.Build.0 = Debug|x86
{68808357-902B-406C-8C19-E8E26A69DE8A}.Fuzzing|Any CPU.ActiveCfg = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Fuzzing|ARM64.ActiveCfg = Debug|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Fuzzing|ARM64.Build.0 = Debug|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Fuzzing|x64.ActiveCfg = Debug|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Fuzzing|x64.Build.0 = Debug|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Fuzzing|x86.ActiveCfg = Debug|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Fuzzing|x86.Build.0 = Debug|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.PowerShell|Any CPU.ActiveCfg = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.PowerShell|ARM64.ActiveCfg = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.PowerShell|x64.ActiveCfg = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.PowerShell|x86.ActiveCfg = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Release|ARM64.ActiveCfg = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Release|ARM64.Build.0 = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Release|x64.ActiveCfg = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Release|x64.Build.0 = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Release|x86.ActiveCfg = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Release|x86.Build.0 = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.Release|ARM64.ActiveCfg = Release|ARM64
{68808357-902B-406C-8C19-E8E26A69DE8A}.Release|x64.ActiveCfg = Release|x64
{68808357-902B-406C-8C19-E8E26A69DE8A}.Release|x64.Build.0 = Release|x64
{68808357-902B-406C-8C19-E8E26A69DE8A}.Release|x86.ActiveCfg = Release|x86
{68808357-902B-406C-8C19-E8E26A69DE8A}.Release|x86.Build.0 = Release|x86
{68808357-902B-406C-8C19-E8E26A69DE8A}.TestRelease|Any CPU.ActiveCfg = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.TestRelease|ARM64.ActiveCfg = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.TestRelease|x64.ActiveCfg = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.TestRelease|x86.ActiveCfg = Release|Any CPU
{68808357-902B-406C-8C19-E8E26A69DE8A}.TestRelease|ARM64.ActiveCfg = Release|ARM64
{68808357-902B-406C-8C19-E8E26A69DE8A}.TestRelease|x64.ActiveCfg = Release|x64
{68808357-902B-406C-8C19-E8E26A69DE8A}.TestRelease|x86.ActiveCfg = Release|x86
{2046B5AF-666D-4CE8-8D3E-C32C57908A56}.Debug|Any CPU.ActiveCfg = Debug|x64
{2046B5AF-666D-4CE8-8D3E-C32C57908A56}.Debug|ARM64.ActiveCfg = Debug|ARM64
{2046B5AF-666D-4CE8-8D3E-C32C57908A56}.Debug|ARM64.Build.0 = Debug|ARM64
Expand Down
4 changes: 2 additions & 2 deletions src/WinGetSourceCreator/WinGetLocalSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Microsoft.WinGetSourceCreator
using global::WinGetSourceCreator.Model;
using System.Text.Json.Serialization;
using System.Text.Json;
using WinGetUtilInterop.Helpers;
using Microsoft.WinGetUtil.Api;

public class WinGetLocalSource
{
Expand Down Expand Up @@ -113,7 +113,7 @@ public void PrepareManifest(string input)
public string CreateIndex(string indexName)
{
string fullPath = Path.Combine(this.workingDirectory, indexName);
using var indexHelper = WinGetUtilIndex.CreateLatestVersion(fullPath);
using var indexHelper = new WinGetFactory().SQLiteIndexCreateLatestVersion(fullPath);

Queue<string> filesQueue = new(Directory.EnumerateFiles(this.workingDirectory, "*.yaml", SearchOption.AllDirectories));
while (filesQueue.Count > 0)
Expand Down
Loading

0 comments on commit b4d8c96

Please sign in to comment.