Skip to content

Introduce Managed Interop and merged manifest classes to WingetUtil nuget - #1621

Merged
jamespik merged 7 commits into
microsoft:masterfrom
jamespik:user/jamespik/NugetInterop
Oct 25, 2021
Merged

jamespik merged 7 commits into
microsoft:masterfrom
jamespik:user/jamespik/NugetInterop

Conversation

@jamespik

@jamespik jamespik commented Oct 21, 2021 •

Copy link
Copy Markdown
Contributor

This change wraps the existing winget util with a managed interop layer. A Target file is provided to automatically copy the wingetutil dlls to consuming project output directories.
We also add a set of managed merged manifest object files for manipulating merged manifest representations.
The build pipeline is updated to run the new tests, sign and include the new files.

Microsoft Reviewers: Open in CodeFlow

@jamespik
jamespik requested a review from a team as a code owner October 21, 2021 22:28
@github-actions

github-actions Bot commented Oct 21, 2021 •

Copy link
Copy Markdown

check-spelling-bot Report

Unrecognized words, please review:

  • addtional
  • artifactstagingdirectory
  • contosa
  • contosainstaller
  • deserialize
  • Dlls
  • etcoreapp
  • etstandard
  • FEBAB
  • IDeserializer
  • IEquatable
  • IEquitable
  • IManifest
  • inheritdoc
  • Intaller
  • ISet
  • ITest
  • Moq
  • msixmgr
  • netstandard
  • stpkgmanvalwestustest
  • untimes
  • xunit
Previously acknowledged words that are now absent activatable Globals mytool URIs Utils
To accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:jamespik/winget-cli-1.git repository
on the user/jamespik/NugetInterop branch:

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spelling/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
  --header "Content-Type: application/json" \
  "https://api.github.com/repos/microsoft/winget-cli/issues/comments/949050184" > "$comment_json"
comment_body=$(mktemp)
jq -r .body < "$comment_json" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")
  

patch_add=$(perl -e '$/=undef;
$_=<>;
s{<details>.*}{}s;
s{^#.*}{};
s{\n##.*}{};
s{(?:^|\n)\s*\*}{}g;
s{\s+}{ }g;
print' < "$comment_body")
  
update_files
rm $comment_body
git add -u

@github-actions

github-actions Bot commented Oct 22, 2021 •

Copy link
Copy Markdown

check-spelling-bot Report

Unrecognized words, please review:

  • artifactstagingdirectory
  • contosa
  • contosainstaller
  • deserialize
  • Dlls
  • etcoreapp
  • etstandard
  • FEBAB
  • IDeserializer
  • IEquatable
  • IEquitable
  • IManifest
  • inheritdoc
  • ISet
  • ITest
  • Moq
  • msixmgr
  • netstandard
  • stpkgmanvalwestustest
  • untimes
  • xunit
Previously acknowledged words that are now absent activatable Globals mytool URIs Utils
To accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:jamespik/winget-cli-1.git repository
on the user/jamespik/NugetInterop branch:

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spelling/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
  --header "Content-Type: application/json" \
  "https://api.github.com/repos/microsoft/winget-cli/issues/comments/949109075" > "$comment_json"
comment_body=$(mktemp)
jq -r .body < "$comment_json" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")
  

patch_add=$(perl -e '$/=undef;
$_=<>;
s{<details>.*}{}s;
s{^#.*}{};
s{\n##.*}{};
s{(?:^|\n)\s*\*}{}g;
s{\s+}{ }g;
print' < "$comment_body")
  
update_files
rm $comment_body
git add -u

Comment thread .github/actions/spelling/allow.txt Resolved
Comment thread azure-pipelines.nuget.yml Outdated

# Run Interop Unit tests
- task: VSTest@2
displayName: 'Run tests: WinGetUtilInterop.UnitTests'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests should be run as part of the primary PR pipeline, or the entire binary should be split into it's own solution with it's own pipeline. We don't run any of the tests here, it is just a pipeline to publish from.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the test run to the primary pipeline. Need to validate this against the running pipeline though.

@ghost ghost added Needs-Author-Feedback Issue needs attention from issue or PR author and removed Needs-Author-Feedback Issue needs attention from issue or PR author labels Oct 22, 2021

@JohnMcPMS JohnMcPMS left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you able to verify the .nuspec builds appropriately?

@jamespik
jamespik merged commit 33bc04e into microsoft:master Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants