Skip to content

Commit

Permalink
Omitting resource type packages, and prompting for architecture in so…
Browse files Browse the repository at this point in the history
…me cases (#14)
  • Loading branch information
palenshus authored May 13, 2021
1 parent e9b8b12 commit 2fcf879
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pipelines/azure-pipelines.release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
dependsOn: GetVersion
variables:
majorMinorBuildVersion: $[dependencies.GetVersion.outputs['GetVersionStep.majorMinorBuildVersion']]
revision: $[counter(format('{0}.{1}', '2', variables['majorMinorBuildVersion']), 1)]
revision: $[counter(format('{0}.{1}', '3', variables['majorMinorBuildVersion']), 1)]

version: "$(majorMinorBuildVersion).$(revision)"
appxBundleFile: "Microsoft.WindowsPackageManagerManifestCreator_$(version)_8wekyb3d8bbwe.msixbundle"
Expand Down Expand Up @@ -211,5 +211,5 @@ jobs:
# https://aka.ms/wingetcreate/preview points to latest preview version of wingetcreate.exe
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
wingetcreate.exe update -i Microsoft.WingetCreate -u $(packageUrl) -v $(manifestVersion) -t $(GITHUB_PAT)
wingetcreate.exe update -i Microsoft.WingetCreate -u $(packageUrl) -v $(manifestVersion) -t $(GITHUB_PAT) --submit
displayName: Update package manifest in the OWC
15 changes: 11 additions & 4 deletions src/WingetCreateCLI/Commands/NewCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ public class NewCommand : BaseCommand
/// <summary>
/// The url path to the manifest documentation site.
/// </summary>
public const string ManifestDocumentationUrl = "https://github.com/microsoft/winget-cli/blob/master/doc/ManifestSpecv1.0.md";
private const string ManifestDocumentationUrl = "https://github.com/microsoft/winget-cli/blob/master/doc/ManifestSpecv1.0.md";

/// <summary>
/// Installer types for which we can trust that the detected architecture is correct, so don't need to prompt the user to confirm.
/// </summary>
private static readonly InstallerType[] ReliableArchitectureInstallerTypes = new[] { InstallerType.Msi, InstallerType.Msix, InstallerType.Appx };

/// <summary>
/// Gets the usage examples for the New command.
Expand Down Expand Up @@ -78,7 +83,7 @@ public override async Task<bool> Execute()
{
CommandExecutedEvent commandEvent = new CommandExecutedEvent
{
Command = "new",
Command = nameof(NewCommand),
InstallerUrl = this.InstallerUrl,
HasGitHubToken = !string.IsNullOrEmpty(this.GitHubToken),
};
Expand Down Expand Up @@ -219,10 +224,12 @@ private static void PromptInstallerProperties<T>(T manifest, PropertyInfo proper
{
var currentValue = requiredProperty.GetValue(singleInstaller);

if (currentValue == null)
// Only prompt if the value isn't already set, or if it's the Architecture property and we don't trust the parser to have gotten it correct for this InstallerType.
if (currentValue == null ||
(requiredProperty.Name == nameof(Installer.Architecture) && !ReliableArchitectureInstallerTypes.Contains(singleInstaller.InstallerType.Value)))
{
var result = PromptProperty(singleInstaller, currentValue, requiredProperty.Name);
requiredProperty.SetValue(requiredProperty, result);
requiredProperty.SetValue(singleInstaller, result);
}

// If we know the installertype is EXE, prompt the user for installer switches (silent and silentwithprogress)
Expand Down
2 changes: 1 addition & 1 deletion src/WingetCreateCLI/Commands/SubmitCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public override async Task<bool> Execute()
{
CommandExecutedEvent commandEvent = new CommandExecutedEvent
{
Command = "Submit",
Command = nameof(SubmitCommand),
HasGitHubToken = !string.IsNullOrEmpty(this.GitHubToken),
};

Expand Down
2 changes: 1 addition & 1 deletion src/WingetCreateCLI/Commands/TokenCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public override async Task<bool> Execute()
{
CommandExecutedEvent commandEvent = new CommandExecutedEvent
{
Command = "Token",
Command = nameof(TokenCommand),
HasGitHubToken = !string.IsNullOrEmpty(this.GitHubToken),
};

Expand Down
2 changes: 1 addition & 1 deletion src/WingetCreateCLI/Commands/UpdateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public override async Task<bool> Execute()
{
CommandExecutedEvent commandEvent = new CommandExecutedEvent
{
Command = "update",
Command = nameof(UpdateCommand),
InstallerUrl = this.InstallerUrl,
Id = this.Id,
Version = this.Version,
Expand Down
5 changes: 3 additions & 2 deletions src/WingetCreateCore/Common/PackageParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,10 @@ private static AppxMetadata GetAppxMetadataAndSetInstallerProperties(string path
IAppxFile signatureFile = bundle.AppxBundleReader.GetFootprintFile(APPX_BUNDLE_FOOTPRINT_FILE_TYPE.APPX_BUNDLE_FOOTPRINT_FILE_TYPE_SIGNATURE);
signatureSha256 = HashAppxFile(signatureFile);

foreach (var appxName in bundle.InternalAppxPackagesRelativePaths)
// Only create installer nodes for non-resource packages
foreach (var childPackage in bundle.ChildAppxPackages.Where(p => p.PackageType == PackageType.Application))
{
var appxFile = bundle.AppxBundleReader.GetPayloadPackage(appxName);
var appxFile = bundle.AppxBundleReader.GetPayloadPackage(childPackage.RelativeFilePath);
appxMetadatas.Add(new AppxMetadata(appxFile.GetStream()));
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/WingetCreateCore/WingetCreateCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
<ItemGroup>
<PackageReference Include="jose-jwt" Version="3.1.1" />
<PackageReference Include="Microsoft.CorrelationVector" Version="1.0.42" />
<PackageReference Include="Microsoft.Msix.Utils" Version="2.0.3" />
<PackageReference Include="Microsoft.Msix.Utils" Version="2.1.0" />
<!--https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#generatepathproperty-->
<PackageReference Include="Microsoft.WindowsPackageManager.Utils" Version="0.2.8" GeneratePathProperty="true" />
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.14" />
<PackageReference Include="NLog" Version="4.7.9" />
<PackageReference Include="NSwag.MSBuild" Version="13.10.9">
<PackageReference Include="NSwag.MSBuild" Version="13.11.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit 2fcf879

Please sign in to comment.