Skip to content

Commit b563bb1

Browse files
authored
Introduce c# helper library for powershell module to process yaml and json files (microsoft#72)
* Create Helper dll * Update to public nuget * Create Helper dll * Update to public nuget * Fix build after rebase on latest main * More merges
1 parent bd6a47d commit b563bb1

158 files changed

Lines changed: 9649 additions & 584 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Template helper to copy powershell dependency files and publish them as an artifact
2+
parameters:
3+
name: ''
4+
source: ''
5+
TargetPlatform: ''
6+
7+
steps:
8+
- task: CopyFiles@2
9+
displayName: 'Copy Files: ${{ parameters.name }}'
10+
inputs:
11+
Contents: |
12+
${{ parameters.source }}\Microsoft.Extensions.Logging.Abstractions.dll
13+
${{ parameters.source }}\Microsoft.WinGet.PowershellSupport.dll
14+
${{ parameters.source }}\Microsoft.WinGet.RestSource.Util.dll
15+
${{ parameters.source }}\Newtonsoft.Json.dll
16+
${{ parameters.source }}\System.ComponentModel.Annotations.dll
17+
${{ parameters.source }}\YamlDotNet.dll
18+
${{ parameters.source }}\runtimes\win-${{TargetPlatform}}\native\WinGetUtil.dll
19+
TargetFolder: '$(build.artifactstagingdirectory)\${{ parameters.name }}'
20+
CleanTargetFolder: true
21+
OverWrite: true
22+
23+
- task: PublishBuildArtifacts@1
24+
displayName: 'Publish Artifact: WinGet.RestSource-${{ parameters.name }}'
25+
inputs:
26+
PathtoPublish: '$(Build.ArtifactStagingDirectory)\${{ parameters.name }}'
27+
ArtifactName: 'WinGet.RestSource-${{ parameters.name }}'
Lines changed: 63 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,64 @@
1-
# Template helper to restore, build, and publish
2-
3-
steps:
4-
## Restore
5-
- task: DotNetCoreCLI@2
6-
displayName: 'Restore'
7-
inputs:
8-
command: 'restore'
9-
projects: '**/*.csproj'
10-
feedsToUse: 'config'
11-
nugetConfigPath: '$(Build.SourcesDirectory)\src\NuGEt.config'
12-
restoreDirectory: '$(Build.SourcesDirectory)\src\packages'
13-
14-
## Build
15-
- task: VSBuild@1
16-
displayName: Build
17-
inputs:
18-
platform: '$(BuildPlatform)'
19-
configuration: '$(BuildConfiguration)'
20-
clean: true
21-
22-
## Publish
23-
# Publish ARM Templates
24-
- template: copy-and-publish.yml
25-
parameters:
26-
name: WinGet.Restsource.Infrastructure
27-
source: '$(Build.SourcesDirectory)\src\WinGet.RestSource.Infrastructure\bin\$(BuildConfiguration)'
28-
29-
# Publish Rest Function App
30-
- template: package-and-publish.yml
31-
parameters:
32-
name: WinGet.RestSource.Functions
33-
projects: '$(Build.SourcesDirectory)\src\WinGet.RestSource.Functions\WinGet.RestSource.Functions.csproj'
34-
buildconfig: '$(BuildConfiguration)'
35-
zipAfterPublish: True
36-
37-
## Run Unit Tests
38-
- template: run-unittests.yml
39-
parameters:
40-
name: WinGet.RestSource.UnitTest
41-
source: '$(Build.SourcesDirectory)\src\WinGet.RestSource.UnitTest\bin\$(BuildConfiguration)\netcoreapp3.1'
42-
dll: Microsoft.WinGet.RestSource.UnitTest.dll
43-
44-
## Component Governance
45-
- task: ComponentGovernanceComponentDetection@0
46-
displayName: Component Governance
47-
inputs:
48-
scanType: 'Register'
49-
verbosity: 'Verbose'
50-
alertWarningLevel: 'High'
1+
# Template helper to restore, build, and publish
2+
3+
steps:
4+
## Restore
5+
- task: DotNetCoreCLI@2
6+
displayName: 'Restore'
7+
inputs:
8+
command: 'restore'
9+
projects: '**/*.csproj'
10+
feedsToUse: 'config'
11+
nugetConfigPath: '$(Build.SourcesDirectory)\src\NuGEt.config'
12+
restoreDirectory: '$(Build.SourcesDirectory)\src\packages'
13+
14+
## Build
15+
- task: VSBuild@1
16+
displayName: Build
17+
inputs:
18+
platform: '$(BuildPlatform)'
19+
configuration: '$(BuildConfiguration)'
20+
clean: true
21+
22+
## Publish
23+
# Publish ARM Templates
24+
- template: copy-and-publish.yml
25+
parameters:
26+
name: WinGet.Restsource.Infrastructure
27+
source: '$(Build.SourcesDirectory)\src\WinGet.RestSource.Infrastructure\bin\$(BuildConfiguration)'
28+
29+
# Publish Rest Function App
30+
- template: package-and-publish.yml
31+
parameters:
32+
name: WinGet.RestSource.Functions
33+
projects: '$(Build.SourcesDirectory)\src\WinGet.RestSource.Functions\WinGet.RestSource.Functions.csproj'
34+
buildconfig: '$(BuildConfiguration)'
35+
zipAfterPublish: True
36+
37+
# Publish x86 powershell binaries
38+
- template: copy-and-publish-powershell.yml
39+
parameters:
40+
name: WinGet.Restsource.x86PowershellSupport
41+
source: '$(Build.SourcesDirectory)\src\WinGet.RestSource.PowershellSupport\bin\$(BuildConfiguration)\netstandard2.0'
42+
BuildPlatform: 'x86'
43+
44+
- template: copy-and-publish-powershell.yml
45+
parameters:
46+
name: WinGet.Restsource.x64PowershellSupport
47+
source: '$(Build.SourcesDirectory)\src\WinGet.RestSource.PowershellSupport\bin\$(BuildConfiguration)\netstandard2.0'
48+
BuildPlatform: 'x64'
49+
50+
## Run Unit Tests
51+
- template: run-unittests.yml
52+
parameters:
53+
name: WinGet.RestSource.UnitTest
54+
source: '$(Build.SourcesDirectory)\src\WinGet.RestSource.UnitTest\bin\$(BuildConfiguration)\netcoreapp3.1'
55+
dll: Microsoft.WinGet.RestSource.UnitTest.dll
56+
57+
## Component Governance
58+
- task: ComponentGovernanceComponentDetection@0
59+
displayName: Component Governance
60+
inputs:
61+
scanType: 'Register'
62+
verbosity: 'Verbose'
63+
alertWarningLevel: 'High'
5164
failOnAlert: true

src/NuGet.config

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<configuration>
3-
<packageSources>
4-
<clear />
5-
<add key="winget" value="https://pkgs.dev.azure.com/ms/winget-cli-restsource/_packaging/winget/nuget/v3/index.json" />
6-
</packageSources>
7-
<packageRestore>
8-
<add key="enabled" value="True" />
9-
<add key="automatic" value="True" />
10-
</packageRestore>
11-
<bindingRedirects>
12-
<add key="skip" value="False" />
13-
</bindingRedirects>
14-
<packageManagement>
15-
<add key="format" value="1" />
16-
<add key="disabled" value="False" />
17-
</packageManagement>
18-
<config>
19-
<add key="dependencyversion" value="Highest" />
20-
<add key="globalPackagesFolder" value="packages" />
21-
</config>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<add key="winget" value="https://pkgs.dev.azure.com/ms/winget-cli-restsource/_packaging/winget/nuget/v3/index.json" />
6+
</packageSources>
7+
<packageRestore>
8+
<add key="enabled" value="True" />
9+
<add key="automatic" value="True" />
10+
</packageRestore>
11+
<bindingRedirects>
12+
<add key="skip" value="False" />
13+
</bindingRedirects>
14+
<packageManagement>
15+
<add key="format" value="1" />
16+
<add key="disabled" value="False" />
17+
</packageManagement>
18+
<config>
19+
<add key="dependencyversion" value="Highest" />
20+
<add key="globalPackagesFolder" value="packages" />
21+
</config>
2222
</configuration>

src/WinGet.RestSource.Functions/Common/ActionResultHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ namespace Microsoft.WinGet.RestSource.Functions.Common
88
{
99
using System;
1010
using System.Net;
11-
using Microsoft.WinGet.RestSource.Constants;
12-
using Microsoft.WinGet.RestSource.Models.Errors;
11+
using Microsoft.WinGet.RestSource.Utils.Constants;
12+
using Microsoft.WinGet.RestSource.Utils.Models.Errors;
1313

1414
/// <summary>
1515
/// This Creates Action Results.

src/WinGet.RestSource.Functions/InstallerFunctions.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ namespace Microsoft.WinGet.RestSource.Functions
1515
using Microsoft.Azure.WebJobs;
1616
using Microsoft.Azure.WebJobs.Extensions.Http;
1717
using Microsoft.Extensions.Logging;
18-
using Microsoft.WinGet.RestSource.Common;
19-
using Microsoft.WinGet.RestSource.Constants;
20-
using Microsoft.WinGet.RestSource.Exceptions;
2118
using Microsoft.WinGet.RestSource.Functions.Common;
22-
using Microsoft.WinGet.RestSource.Models;
23-
using Microsoft.WinGet.RestSource.Models.Errors;
24-
using Microsoft.WinGet.RestSource.Models.Schemas;
25-
using Microsoft.WinGet.RestSource.Validators;
19+
using Microsoft.WinGet.RestSource.Utils.Common;
20+
using Microsoft.WinGet.RestSource.Utils.Constants;
21+
using Microsoft.WinGet.RestSource.Utils.Exceptions;
22+
using Microsoft.WinGet.RestSource.Utils.Models;
23+
using Microsoft.WinGet.RestSource.Utils.Models.Errors;
24+
using Microsoft.WinGet.RestSource.Utils.Models.Schemas;
25+
using Microsoft.WinGet.RestSource.Utils.Validators;
2626

2727
/// <summary>
2828
/// This class contains the functions for interacting with installers.

src/WinGet.RestSource.Functions/LocaleFunctions.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ namespace Microsoft.WinGet.RestSource.Functions
1515
using Microsoft.Azure.WebJobs;
1616
using Microsoft.Azure.WebJobs.Extensions.Http;
1717
using Microsoft.Extensions.Logging;
18-
using Microsoft.WinGet.RestSource.Common;
19-
using Microsoft.WinGet.RestSource.Constants;
20-
using Microsoft.WinGet.RestSource.Exceptions;
2118
using Microsoft.WinGet.RestSource.Functions.Common;
22-
using Microsoft.WinGet.RestSource.Models;
23-
using Microsoft.WinGet.RestSource.Models.Errors;
24-
using Microsoft.WinGet.RestSource.Models.Schemas;
25-
using Microsoft.WinGet.RestSource.Validators;
19+
using Microsoft.WinGet.RestSource.Utils.Common;
20+
using Microsoft.WinGet.RestSource.Utils.Constants;
21+
using Microsoft.WinGet.RestSource.Utils.Exceptions;
22+
using Microsoft.WinGet.RestSource.Utils.Models;
23+
using Microsoft.WinGet.RestSource.Utils.Models.Errors;
24+
using Microsoft.WinGet.RestSource.Utils.Models.Schemas;
25+
using Microsoft.WinGet.RestSource.Utils.Validators;
2626

2727
/// <summary>
2828
/// This class contains the functions for interacting with locales.

src/WinGet.RestSource.Functions/ManifestSearchFunctions.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ namespace Microsoft.WinGet.RestSource.Functions
1515
using Microsoft.Azure.WebJobs;
1616
using Microsoft.Azure.WebJobs.Extensions.Http;
1717
using Microsoft.Extensions.Logging;
18-
using Microsoft.WinGet.RestSource.Common;
19-
using Microsoft.WinGet.RestSource.Constants;
20-
using Microsoft.WinGet.RestSource.Exceptions;
2118
using Microsoft.WinGet.RestSource.Functions.Common;
22-
using Microsoft.WinGet.RestSource.Models;
23-
using Microsoft.WinGet.RestSource.Models.Arrays;
24-
using Microsoft.WinGet.RestSource.Models.Schemas;
25-
using Microsoft.WinGet.RestSource.Validators;
19+
using Microsoft.WinGet.RestSource.Utils.Common;
20+
using Microsoft.WinGet.RestSource.Utils.Constants;
21+
using Microsoft.WinGet.RestSource.Utils.Exceptions;
22+
using Microsoft.WinGet.RestSource.Utils.Models;
23+
using Microsoft.WinGet.RestSource.Utils.Models.Arrays;
24+
using Microsoft.WinGet.RestSource.Utils.Models.Schemas;
25+
using Microsoft.WinGet.RestSource.Utils.Validators;
2626

2727
/// <summary>
2828
/// This class contains the functions for searching manifests.

src/WinGet.RestSource.Functions/PackageFunctions.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ namespace Microsoft.WinGet.RestSource.Functions
1616
using Microsoft.Azure.WebJobs.Extensions.Http;
1717
using Microsoft.Extensions.Logging;
1818
using Microsoft.Extensions.Primitives;
19-
using Microsoft.WinGet.RestSource.Common;
20-
using Microsoft.WinGet.RestSource.Constants;
21-
using Microsoft.WinGet.RestSource.Exceptions;
2219
using Microsoft.WinGet.RestSource.Functions.Common;
23-
using Microsoft.WinGet.RestSource.Models;
24-
using Microsoft.WinGet.RestSource.Models.Errors;
25-
using Microsoft.WinGet.RestSource.Models.Schemas;
26-
using Microsoft.WinGet.RestSource.Validators;
20+
using Microsoft.WinGet.RestSource.Utils.Common;
21+
using Microsoft.WinGet.RestSource.Utils.Constants;
22+
using Microsoft.WinGet.RestSource.Utils.Exceptions;
23+
using Microsoft.WinGet.RestSource.Utils.Models;
24+
using Microsoft.WinGet.RestSource.Utils.Models.Errors;
25+
using Microsoft.WinGet.RestSource.Utils.Models.Schemas;
26+
using Microsoft.WinGet.RestSource.Utils.Validators;
2727

2828
/// <summary>
2929
/// This class contains the functions for interacting with packages.

src/WinGet.RestSource.Functions/PackageManifestFunctions.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ namespace Microsoft.WinGet.RestSource.Functions
1515
using Microsoft.Azure.WebJobs;
1616
using Microsoft.Azure.WebJobs.Extensions.Http;
1717
using Microsoft.Extensions.Logging;
18-
using Microsoft.WinGet.RestSource.Common;
19-
using Microsoft.WinGet.RestSource.Constants;
20-
using Microsoft.WinGet.RestSource.Exceptions;
2118
using Microsoft.WinGet.RestSource.Functions.Common;
22-
using Microsoft.WinGet.RestSource.Models;
23-
using Microsoft.WinGet.RestSource.Models.Arrays;
24-
using Microsoft.WinGet.RestSource.Models.Errors;
25-
using Microsoft.WinGet.RestSource.Models.Schemas;
26-
using Microsoft.WinGet.RestSource.Validators;
19+
using Microsoft.WinGet.RestSource.Utils.Common;
20+
using Microsoft.WinGet.RestSource.Utils.Constants;
21+
using Microsoft.WinGet.RestSource.Utils.Exceptions;
22+
using Microsoft.WinGet.RestSource.Utils.Models;
23+
using Microsoft.WinGet.RestSource.Utils.Models.Arrays;
24+
using Microsoft.WinGet.RestSource.Utils.Models.Errors;
25+
using Microsoft.WinGet.RestSource.Utils.Models.Schemas;
26+
using Microsoft.WinGet.RestSource.Utils.Validators;
2727

2828
/// <summary>
2929
/// This class contains the functions for interacting with manifests.

src/WinGet.RestSource.Functions/ServerFunctions.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ namespace Microsoft.WinGet.RestSource.Functions
1212
using Microsoft.Azure.WebJobs;
1313
using Microsoft.Azure.WebJobs.Extensions.Http;
1414
using Microsoft.Extensions.Logging;
15-
using Microsoft.WinGet.RestSource.Constants;
16-
using Microsoft.WinGet.RestSource.Exceptions;
15+
using Microsoft.WinGet.RestSource.Cosmos;
1716
using Microsoft.WinGet.RestSource.Functions.Common;
18-
using Microsoft.WinGet.RestSource.Models;
19-
using Microsoft.WinGet.RestSource.Models.Schemas;
17+
using Microsoft.WinGet.RestSource.Utils.Constants;
18+
using Microsoft.WinGet.RestSource.Utils.Exceptions;
19+
using Microsoft.WinGet.RestSource.Utils.Models;
20+
using Microsoft.WinGet.RestSource.Utils.Models.Schemas;
2021

2122
/// <summary>
2223
/// This class contains the functions for interacting with packages.

0 commit comments

Comments
 (0)