winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit b1278ab4e65b9aa8964d6028690b34b08b327237
parent f66a2775274832dbcb3487e61d226b141571625e
Author: JohnMcPMS <johnmcp@microsoft.com>
Date:   Tue,  3 Dec 2019 12:33:13 -0800

Populate with initial solution and basic application (#1)

* Initial commit of barebones CLI handling infrastructure and beginnings of repo ABI.

* Add code owners

* Rename some things based on PR feedback.

* Update CODEOWNERS to be the admin team.

Diffstat:
ACODEOWNERS | 1+
Asrc/AppInstallerCLI/AppInstallerCLI.vcxproj | 196+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/AppInstallerCLI/AppInstallerCLI.vcxproj.filters | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/AppInstallerCLI/Command.cpp | 194+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/AppInstallerCLI/Command.h | 128+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/AppInstallerCLI/Commands/DescribeCommand.cpp | 28++++++++++++++++++++++++++++
Asrc/AppInstallerCLI/Commands/DescribeCommand.h | 17+++++++++++++++++
Asrc/AppInstallerCLI/Commands/InstallCommand.cpp | 27+++++++++++++++++++++++++++
Asrc/AppInstallerCLI/Commands/InstallCommand.h | 17+++++++++++++++++
Asrc/AppInstallerCLI/Commands/RootCommand.cpp | 32++++++++++++++++++++++++++++++++
Asrc/AppInstallerCLI/Commands/RootCommand.h | 19+++++++++++++++++++
Asrc/AppInstallerCLI/Common.h | 9+++++++++
Asrc/AppInstallerCLI/Invocation.h | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/AppInstallerCLI/Localization.h | 6++++++
Asrc/AppInstallerCLI/PropertySheet.props | 17+++++++++++++++++
Asrc/AppInstallerCLI/Search/Search.h | 101+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/AppInstallerCLI/main.cpp | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/AppInstallerCLI/packages.config | 5+++++
Asrc/AppInstallerCLI/pch.cpp | 3+++
Asrc/AppInstallerCLI/pch.h | 8++++++++
Asrc/AppInstallerClient.sln | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/AppInstallerClientPackage/AppInstallerClientPackage.wapproj | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/AppInstallerClientPackage/Images/LockScreenLogo.scale-200.png | 0
Asrc/AppInstallerClientPackage/Images/SplashScreen.scale-200.png | 0
Asrc/AppInstallerClientPackage/Images/Square150x150Logo.scale-200.png | 0
Asrc/AppInstallerClientPackage/Images/Square44x44Logo.scale-200.png | 0
Asrc/AppInstallerClientPackage/Images/Square44x44Logo.targetsize-24_altform-unplated.png | 0
Asrc/AppInstallerClientPackage/Images/StoreLogo.png | 0
Asrc/AppInstallerClientPackage/Images/Wide310x150Logo.scale-200.png | 0
Asrc/AppInstallerClientPackage/Package.appxmanifest | 41+++++++++++++++++++++++++++++++++++++++++
30 files changed, 1207 insertions(+), 0 deletions(-)

diff --git a/CODEOWNERS b/CODEOWNERS @@ -0,0 +1 @@ +* @microsoft/windows-package-manager-admins diff --git a/src/AppInstallerCLI/AppInstallerCLI.vcxproj b/src/AppInstallerCLI/AppInstallerCLI.vcxproj @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.191111.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.191111.2\build\native\Microsoft.Windows.CppWinRT.props')" /> + <PropertyGroup Label="Globals"> + <CppWinRTOptimized>true</CppWinRTOptimized> + <CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge> + <MinimalCoreWin>true</MinimalCoreWin> + <VCProjectVersion>15.0</VCProjectVersion> + <ProjectGuid>{5b6f90df-fd19-4bae-83d9-24dad128e777}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>AppInstallerCLI</RootNamespace> + <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion> + <WindowsTargetPlatformMinVersion>10.0.16299.0</WindowsTargetPlatformMinVersion> + <WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport> + <WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|ARM"> + <Configuration>Debug</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|ARM64"> + <Configuration>Debug</Configuration> + <Platform>ARM64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|ARM"> + <Configuration>Release</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|ARM64"> + <Configuration>Release</Configuration> + <Platform>ARM64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset> + <PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v141</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> + <UseDebugLibraries>true</UseDebugLibraries> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + </ImportGroup> + <ImportGroup Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets"> + <Import Project="PropertySheet.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(SolutionDir)x86\$(Configuration)\$(ProjectName)\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(SolutionDir)x86\$(Configuration)\$(ProjectName)\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + </PropertyGroup> + <ItemDefinitionGroup> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> + <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile> + <PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <WarningLevel>Level4</WarningLevel> + <AdditionalOptions>%(AdditionalOptions) /permissive- /bigobj</AdditionalOptions> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateWindowsMetadata>false</GenerateWindowsMetadata> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Platform)'=='Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <GenerateWindowsMetadata>false</GenerateWindowsMetadata> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="Command.h" /> + <ClInclude Include="Commands\DescribeCommand.h" /> + <ClInclude Include="Commands\InstallCommand.h" /> + <ClInclude Include="Commands\RootCommand.h" /> + <ClInclude Include="Common.h" /> + <ClInclude Include="Invocation.h" /> + <ClInclude Include="Localization.h" /> + <ClInclude Include="pch.h" /> + <ClInclude Include="Search\Search.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="Command.cpp" /> + <ClCompile Include="Commands\DescribeCommand.cpp" /> + <ClCompile Include="Commands\InstallCommand.cpp" /> + <ClCompile Include="Commands\RootCommand.cpp" /> + <ClCompile Include="main.cpp" /> + <ClCompile Include="pch.cpp"> + <PrecompiledHeader>Create</PrecompiledHeader> + </ClCompile> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + <None Include="PropertySheet.props" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + <Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.191111.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.191111.2\build\native\Microsoft.Windows.CppWinRT.targets')" /> + </ImportGroup> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.191111.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.191111.2\build\native\Microsoft.Windows.CppWinRT.props'))" /> + <Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.191111.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.191111.2\build\native\Microsoft.Windows.CppWinRT.targets'))" /> + </Target> +</Project>+ \ No newline at end of file diff --git a/src/AppInstallerCLI/AppInstallerCLI.vcxproj.filters b/src/AppInstallerCLI/AppInstallerCLI.vcxproj.filters @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + </Filter> + <Filter Include="Commands"> + <UniqueIdentifier>{4b0dcf8b-b4a1-47e5-9c28-e8a3440178e6}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="pch.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="Commands\RootCommand.h"> + <Filter>Commands</Filter> + </ClInclude> + <ClInclude Include="Localization.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="Commands\InstallCommand.h"> + <Filter>Commands</Filter> + </ClInclude> + <ClInclude Include="Commands\DescribeCommand.h"> + <Filter>Commands</Filter> + </ClInclude> + <ClInclude Include="Command.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="Invocation.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="Common.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="Search\Search.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="pch.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="main.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="Commands\RootCommand.cpp"> + <Filter>Commands</Filter> + </ClCompile> + <ClCompile Include="Commands\InstallCommand.cpp"> + <Filter>Commands</Filter> + </ClCompile> + <ClCompile Include="Commands\DescribeCommand.cpp"> + <Filter>Commands</Filter> + </ClCompile> + <ClCompile Include="Command.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <None Include="PropertySheet.props" /> + <None Include="packages.config" /> + </ItemGroup> +</Project>+ \ No newline at end of file diff --git a/src/AppInstallerCLI/Command.cpp b/src/AppInstallerCLI/Command.cpp @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#include "pch.h" +#include "Command.h" +#include "Localization.h" + +namespace AppInstaller::CLI +{ + void Command::OutputIntroHeader(std::wostream& out) const + { + out << L"AppInstaller Command Line" << std::endl; + out << L"(c) 2019 Microsoft Corporation" << std::endl; + } + + void Command::OutputHelp(std::wostream& out, const CommandException* exception) const + { + OutputIntroHeader(out); + out << std::endl; + + if (exception) + { + out << exception->Message() << L" : " << exception->Param() << std::endl; + out << std::endl; + } + + for (const auto& line : GetLongDescription()) + { + out << line << std::endl; + } + out << std::endl; + + auto commands = GetCommands(); + if (!commands.empty()) + { + out << LOCME(L"The following commands are available:") << std::endl; + out << std::endl; + + for (const auto& command : commands) + { + out << L" " << command->Name() << std::endl; + out << L" " << command->ShortDescription() << std::endl; + } + + out << std::endl; + out << LOCME(L"For more details on a specific command, pass it the help argument.") << L" [" << APPINSTALLER_CLI_HELP_ARGUMENT << L"]" << std::endl; + } + else + { + out << LOCME(L"The following arguments are available:") << std::endl; + out << std::endl; + + for (const auto& arg : GetArguments()) + { + out << L" " << arg.Name() << std::endl; + out << L" " << arg.Description() << std::endl; + } + } + } + + std::unique_ptr<Command> Command::FindInvokedCommand(Invocation& inv) const + { + auto itr = inv.begin(); + if (itr == inv.end() || **itr == APPINSTALLER_CLI_ARGUMENT_IDENTIFIER_CHAR) + { + // No more command arguments to check, so no command to find + return {}; + } + + auto commands = GetCommands(); + if (commands.empty()) + { + // No more subcommands + return {}; + } + + std::wstring arg = *itr; + + for (auto& command : commands) + { + if (arg == command->Name()) + { + inv.consume(itr); + std::unique_ptr<Command> subcommand = command->FindInvokedCommand(inv); + // If we found a subcommand, return it. Otherwise, this is the one. + return (subcommand ? std::move(subcommand) : std::move(command)); + } + } + + throw CommandException(LOCME(L"Unrecognized command"), arg); + } + + void Command::ParseArguments(Invocation& inv) const + { + auto definedArgs = GetArguments(); + auto positionalSearchItr = definedArgs.begin(); + + for (auto incomingArgsItr = inv.begin(); incomingArgsItr != inv.end(); ++incomingArgsItr) + { + if (**incomingArgsItr != APPINSTALLER_CLI_ARGUMENT_IDENTIFIER_CHAR) + { + // Positional argument, find the next appropriate one if the current itr isn't one or has hit its limit. + if (positionalSearchItr != definedArgs.end() && + (positionalSearchItr->Type() != ArgumentType::Positional || inv.GetCount(positionalSearchItr->Name()) == positionalSearchItr->Limit())) + { + for (++positionalSearchItr; positionalSearchItr != definedArgs.end() && positionalSearchItr->Type() != ArgumentType::Positional; ++positionalSearchItr); + } + + if (positionalSearchItr == definedArgs.end()) + { + throw CommandException(LOCME(L"Found a positional argument when none was expected"), *incomingArgsItr); + } + + inv.AddArg(positionalSearchItr->Name(), *incomingArgsItr); + } + else + { + // This is an arg name, find it and process its value if needed. + // Skip the name identifier char. + std::wstring argName = *incomingArgsItr + 1; + bool argFound = false; + + for (const auto& arg : definedArgs) + { + if (argName == arg.Name()) + { + if (arg.Type() == ArgumentType::Flag) + { + inv.AddArg(arg.Name()); + } + else + { + ++incomingArgsItr; + if (incomingArgsItr == inv.end()) + { + throw CommandException(LOCME(L"Argument value required, but none found"), *incomingArgsItr); + } + inv.AddArg(arg.Name(), *incomingArgsItr); + } + argFound = true; + break; + } + } + + if (argName == APPINSTALLER_CLI_HELP_ARGUMENT_TEXT_STRING) + { + inv.AddArg(APPINSTALLER_CLI_HELP_ARGUMENT_TEXT_STRING); + } + else if (!argFound) + { + throw CommandException(LOCME(L"Argument name was not recognized for the current command"), *incomingArgsItr); + } + } + } + } + + void Command::ValidateArguments(Invocation& inv) const + { + // If help is asked for, don't bother validating anything else + if (inv.Contains(APPINSTALLER_CLI_HELP_ARGUMENT_TEXT_STRING)) + { + return; + } + + for (const auto& arg : GetArguments()) + { + if (arg.Required() && !inv.Contains(arg.Name())) + { + throw CommandException(LOCME(L"Required argument not provided"), arg.Name()); + } + + if (arg.Limit() < inv.GetCount(arg.Name())) + { + throw CommandException(LOCME(L"Argument provided more times than allowed"), arg.Name()); + } + } + } + + void Command::Execute(Invocation& inv, std::wostream& out) const + { + if (inv.Contains(APPINSTALLER_CLI_HELP_ARGUMENT_TEXT_STRING)) + { + OutputHelp(out); + } + else + { + ExecuteInternal(inv, out); + } + } + + void Command::ExecuteInternal(Invocation&, std::wostream& out) const + { + out << LOCME(L"Oops, we forgot to do this...") << std::endl; + } +} diff --git a/src/AppInstallerCLI/Command.h b/src/AppInstallerCLI/Command.h @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#pragma once +#include <initializer_list> +#include <memory> +#include <ostream> +#include <string> +#include <type_traits> +#include <vector> + +#include "Common.h" +#include "Invocation.h" + +#define APPINSTALLER_CLI_ARGUMENT_IDENTIFIER_CHAR L'-' +#define APPINSTALLER_CLI_ARGUMENT_IDENTIFIER_STRING L"-" +#define APPINSTALLER_CLI_HELP_ARGUMENT_TEXT_CHAR L'?' +#define APPINSTALLER_CLI_HELP_ARGUMENT_TEXT_STRING L"?" +#define APPINSTALLER_CLI_HELP_ARGUMENT APPINSTALLER_CLI_ARGUMENT_IDENTIFIER_STRING APPINSTALLER_CLI_HELP_ARGUMENT_TEXT_STRING + +namespace AppInstaller::CLI +{ + struct CommandException + { + CommandException(std::wstring message, std::wstring param) : m_message(message), m_param(param) {} + + const std::wstring& Message() const { return m_message; } + const std::wstring& Param() const { return m_param; } + + private: + std::wstring m_message; + std::wstring m_param; + }; + + enum class ArgumentType + { + // Argument requires specifying the name before the value. + Standard, + // Argument value can be specified alone; position indicates argument name. + Positional, + // Only argument name can be specified and indicates a bool value. + Flag, + }; + + struct Argument + { + Argument(StringLiteralPtr name, std::wstring desc) : + m_name(name), m_desc(std::move(desc)) {} + + Argument(StringLiteralPtr name, std::wstring desc, bool required) : + m_name(name), m_desc(std::move(desc)), m_required(required) {} + + Argument(StringLiteralPtr name, std::wstring desc, ArgumentType type) : + m_name(name), m_desc(std::move(desc)), m_type(type) {} + + Argument(StringLiteralPtr name, std::wstring desc, ArgumentType type, bool required) : + m_name(name), m_desc(std::move(desc)), m_type(type), m_required(required) {} + + ~Argument() = default; + + Argument(const Argument&) = default; + Argument& operator=(const Argument&) = default; + + Argument(Argument&&) = default; + Argument& operator=(Argument&&) = default; + + StringLiteralPtrRef Name() const { return m_name; } + std::wstring Description() const { return m_desc; } + bool Required() const { return m_required; } + ArgumentType Type() const { return m_type; } + size_t Limit() const { return m_countLimit; } + + private: + StringLiteralPtrRef m_name; + std::wstring m_desc; + bool m_required = false; + ArgumentType m_type = ArgumentType::Standard; + size_t m_countLimit = 1; + }; + + struct Command + { + Command(StringLiteralPtr name) : m_name(name) {} + virtual ~Command() = default; + + Command(const Command&) = default; + Command& operator=(const Command&) = default; + + Command(Command&&) = default; + Command& operator=(Command&&) = default; + + StringLiteralPtrRef Name() const { return m_name; } + + virtual std::vector<std::unique_ptr<Command>> GetCommands() const { return {}; } + virtual std::vector<Argument> GetArguments() const { return {}; } + + virtual std::wstring ShortDescription() const { return {}; } + virtual std::vector<std::wstring> GetLongDescription() const { return {}; } + + virtual void OutputIntroHeader(std::wostream& out) const; + virtual void OutputHelp(std::wostream& out, const CommandException* exception = nullptr) const; + + virtual std::unique_ptr<Command> FindInvokedCommand(Invocation& inv) const; + virtual void ParseArguments(Invocation& inv) const; + virtual void ValidateArguments(Invocation& inv) const; + + virtual void Execute(Invocation& inv, std::wostream& out) const; + + protected: + virtual void ExecuteInternal(Invocation& inv, std::wostream& out) const; + + private: + StringLiteralPtrRef m_name; + }; + + template <typename Container> + Container InitializeFromMoveOnly(std::initializer_list<typename Container::value_type> il) + { + using Value = typename Container::value_type; + Container result; + + for (const auto& v : il) + { + result.emplace_back(std::move(*const_cast<Value*>(&v))); + } + + return result; + } +} diff --git a/src/AppInstallerCLI/Commands/DescribeCommand.cpp b/src/AppInstallerCLI/Commands/DescribeCommand.cpp @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#include "pch.h" +#include "DescribeCommand.h" +#include "Localization.h" + +namespace AppInstaller::CLI +{ + std::vector<Argument> DescribeCommand::GetArguments() const + { + return { + Argument{ L"application", LOCME(L"The name of the application to install"), ArgumentType::Positional, true }, + Argument{ L"manifest", LOCME(L"If specified, output the full manifest file"), ArgumentType::Flag }, + }; + } + + std::wstring DescribeCommand::ShortDescription() const + { + return LOCME(L"Describes the given application"); + } + + std::vector<std::wstring> DescribeCommand::GetLongDescription() const + { + return { + LOCME(L"Describes the given application"), + }; + } +} diff --git a/src/AppInstallerCLI/Commands/DescribeCommand.h b/src/AppInstallerCLI/Commands/DescribeCommand.h @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#pragma once +#include "Command.h" + +namespace AppInstaller::CLI +{ + struct DescribeCommand final : public Command + { + DescribeCommand() : Command(L"describe") {} + + virtual std::vector<Argument> GetArguments() const override; + + virtual std::wstring ShortDescription() const override; + virtual std::vector<std::wstring> GetLongDescription() const override; + }; +} diff --git a/src/AppInstallerCLI/Commands/InstallCommand.cpp b/src/AppInstallerCLI/Commands/InstallCommand.cpp @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#include "pch.h" +#include "InstallCommand.h" +#include "Localization.h" + +namespace AppInstaller::CLI +{ + std::vector<Argument> InstallCommand::GetArguments() const + { + return { + Argument{ L"application", LOCME(L"The name of the application to install"), ArgumentType::Positional, true }, + }; + } + + std::wstring InstallCommand::ShortDescription() const + { + return LOCME(L"Installs the given application"); + } + + std::vector<std::wstring> InstallCommand::GetLongDescription() const + { + return { + LOCME(L"Installs the given application"), + }; + } +} diff --git a/src/AppInstallerCLI/Commands/InstallCommand.h b/src/AppInstallerCLI/Commands/InstallCommand.h @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#pragma once +#include "Command.h" + +namespace AppInstaller::CLI +{ + struct InstallCommand final : public Command + { + InstallCommand() : Command(L"install") {} + + virtual std::vector<Argument> GetArguments() const override; + + virtual std::wstring ShortDescription() const override; + virtual std::vector<std::wstring> GetLongDescription() const override; + }; +} diff --git a/src/AppInstallerCLI/Commands/RootCommand.cpp b/src/AppInstallerCLI/Commands/RootCommand.cpp @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#include "pch.h" +#include "RootCommand.h" +#include "Localization.h" + +#include "InstallCommand.h" +#include "DescribeCommand.h" + +namespace AppInstaller::CLI +{ + std::vector<std::unique_ptr<Command>> RootCommand::GetCommands() const + { + return InitializeFromMoveOnly<std::vector<std::unique_ptr<Command>>>({ + std::make_unique<InstallCommand>(), + std::make_unique<DescribeCommand>(), + }); + } + + std::vector<std::wstring> RootCommand::GetLongDescription() const + { + return { + LOCME(L"AppInstaller command line utility enables installing applications from the"), + LOCME(L"command line."), + }; + } + + void RootCommand::ExecuteInternal(Invocation&, std::wostream& out) const + { + OutputHelp(out); + } +} diff --git a/src/AppInstallerCLI/Commands/RootCommand.h b/src/AppInstallerCLI/Commands/RootCommand.h @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#pragma once +#include "Command.h" + +namespace AppInstaller::CLI +{ + struct RootCommand final : public Command + { + RootCommand() : Command(L"root") {} + + virtual std::vector<std::unique_ptr<Command>> GetCommands() const override; + + virtual std::vector<std::wstring> GetLongDescription() const override; + + protected: + virtual void ExecuteInternal(Invocation& inv, std::wostream& out) const; + }; +} diff --git a/src/AppInstallerCLI/Common.h b/src/AppInstallerCLI/Common.h @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#pragma once + +namespace AppInstaller::CLI +{ + using StringLiteralPtr = wchar_t const* const; + using StringLiteralPtrRef = wchar_t const*; +} diff --git a/src/AppInstallerCLI/Invocation.h b/src/AppInstallerCLI/Invocation.h @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#pragma once +#include <map> + +#include "Common.h" + +namespace AppInstaller::CLI +{ + struct Invocation + { + using ArgString = wchar_t const*; + + Invocation(int argc, ArgString* argv) : m_argc(argc), m_argv(argv) {} + + struct iterator + { + iterator(int arg, ArgString* argv) : m_arg(arg), m_argv(argv) {} + + iterator(const iterator&) = default; + iterator& operator=(const iterator&) = default; + + iterator operator++() { return { ++m_arg, m_argv }; } + iterator operator++(int) { return { m_arg++, m_argv }; } + iterator operator--() { return { --m_arg, m_argv }; } + iterator operator--(int) { return { m_arg--, m_argv }; } + + bool operator==(const iterator& other) { return m_arg == other.m_arg; } + bool operator!=(const iterator& other) { return m_arg != other.m_arg; } + + ArgString operator*() const { return m_argv[m_arg]; } + + int index() const { return m_arg; } + + private: + int m_arg; + ArgString* m_argv; + }; + + iterator begin() { return { m_currentFirstArg, m_argv }; } + iterator end() { return { m_argc, m_argv }; } + void consume(const iterator& i) { m_currentFirstArg = i.index() + 1; } + + bool Contains(StringLiteralPtrRef name) const { return (m_parsedArgs.count(name) != 0); } + const std::vector<std::wstring>* GetArgs(StringLiteralPtrRef name) const + { + auto itr = m_parsedArgs.find(name); + return (itr == m_parsedArgs.end() ? nullptr : &(itr->second)); + } + size_t GetCount(StringLiteralPtrRef name) const + { + auto args = GetArgs(name); + return (args ? args->size() : 0); + } + + bool AddArg(StringLiteralPtrRef name) { return m_parsedArgs[name].empty(); } + void AddArg(StringLiteralPtrRef name, std::wstring value) { m_parsedArgs[name].emplace_back(std::move(value)); } + + private: + int m_argc; + ArgString* m_argv; + int m_currentFirstArg = 1; + + std::map<std::wstring, std::vector<std::wstring>> m_parsedArgs; + }; +} diff --git a/src/AppInstallerCLI/Localization.h b/src/AppInstallerCLI/Localization.h @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#pragma once + +#define LOCME(x) x +#define MOVEME(x) x diff --git a/src/AppInstallerCLI/PropertySheet.props b/src/AppInstallerCLI/PropertySheet.props @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros" /> + <!-- + To customize common C++/WinRT project properties: + * right-click the project node + * expand the Common Properties item + * select the C++/WinRT property page + + For more advanced scenarios, and complete documentation, please see: + https://github.com/Microsoft/xlang/tree/master/src/package/cppwinrt/nuget + --> + <PropertyGroup /> + <ItemDefinitionGroup /> +</Project>+ \ No newline at end of file diff --git a/src/AppInstallerCLI/Search/Search.h b/src/AppInstallerCLI/Search/Search.h @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#pragma once +#include <memory> +#include <type_traits> +#include <winrt/base.h> + +// TODO: This code is expected to eventually be placed into it's own DLL to support the CLI +// and OOP COM server for use by OS integration points. +// For now we will just maintain the ABI with helper C++ wrappers for client use. + +// "C" ABI + +using AICLIString = wchar_t*; +using AICLICString = wchar_t const*; +using RepositoryHandle = void*; +using ApplicationHandle = void*; +using ManifestHandle = void*; + +winrt::hresult aicliGetApplicationById(RepositoryHandle repo, AICLICString id, ApplicationHandle* app); + +winrt::hresult aicliGetManifestByVersion(ApplicationHandle app, AICLICString version, ManifestHandle* man); + +winrt::hresult aicliGetManifestContents(ManifestHandle man, AICLICString* contents); + +void aicliFreeRepository(RepositoryHandle repo); +void aicliFreeApplication(ApplicationHandle app); +void aicliFreeManifest(ManifestHandle manifest); + +// C++ wrapper + +namespace AppInstaller::CLI +{ + namespace details + { + struct RepositoryDeleter + { + void operator()(RepositoryHandle repo) { aicliFreeRepository(repo); } + }; + + struct ApplicationDeleter + { + void operator()(ApplicationHandle app) { aicliFreeApplication(app); } + }; + + struct ManifestDeleter + { + void operator()(ManifestHandle manifest) { aicliFreeManifest(manifest); } + }; + + using unique_repository = std::unique_ptr<std::remove_pointer_t<RepositoryHandle>, RepositoryDeleter>; + using unique_application = std::unique_ptr<std::remove_pointer_t<ApplicationHandle>, ApplicationDeleter>; + using unique_manifest = std::unique_ptr<std::remove_pointer_t<ManifestHandle>, ManifestDeleter>; + + template <typename Result, typename Func, typename... Args> + Result CallABIFunc(Func&& f, Args&&... args) + { + Result result{}; + winrt::check_hresult(f(std::forward(args)..., &result)); + return result; + } + } + + struct Manifest + { + Manifest() = default; + Manifest(ManifestHandle mh) : m_man(mh) {} + ~Manifest() = default; + + Manifest(const Manifest&) = delete; + Manifest& operator=(const Manifest&) = delete; + + Manifest(Manifest&&) = default; + Manifest& operator=(Manifest&&) = default; + + AICLICString GetManifestContents() const { return details::CallABIFunc<AICLICString>(aicliGetManifestContents, m_man.get()); } + + private: + details::unique_manifest m_man; + }; + + struct Application + { + Application() = default; + Application(ApplicationHandle ah) : m_app(ah) {} + ~Application() = default; + + Application(const Application&) = delete; + Application& operator=(const Application&) = delete; + + Application(Application&&) = default; + Application& operator=(Application&&) = default; + + static Application GetById(AICLICString id) { return details::CallABIFunc<ApplicationHandle>(aicliGetApplicationById, nullptr, id); } + + Manifest GetManifestByVersion(AICLICString version) const { return details::CallABIFunc<ManifestHandle>(aicliGetManifestByVersion, m_app.get(), version); } + + private: + details::unique_application m_app; + }; +} diff --git a/src/AppInstallerCLI/main.cpp b/src/AppInstallerCLI/main.cpp @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#include "pch.h" +#include "Commands/RootCommand.h" + +using namespace winrt; +using namespace Windows::Foundation; +using namespace AppInstaller::CLI; + +int wmain(int argc, wchar_t const** argv) try +{ + init_apartment(); + + RootCommand root; + Invocation invocation{ argc, argv }; + + // The root command is our fallback in the event of very bad or very little input + Command* commandToExecute = &root; + std::unique_ptr<Command> foundCommand; + + try + { + foundCommand = root.FindInvokedCommand(invocation); + if (foundCommand) + { + commandToExecute = foundCommand.get(); + } + commandToExecute->ParseArguments(invocation); + commandToExecute->ValidateArguments(invocation); + } + // Exceptions specific to parsing the arguments of a command + catch (const CommandException& ce) + { + commandToExecute->OutputHelp(std::wcout, &ce); + return 1; + } + + try + { + commandToExecute->Execute(invocation, std::wcout); + } + // Exceptions that may occur in the process of executing an arbitrary command + catch (const winrt::hresult_error&) + { + + } + catch (const std::exception&) + { + + } +} +// End of the line exceptions that are not ever expected +catch (const winrt::hresult_error&) +{ + +} +catch (const std::exception&) +{ + +} diff --git a/src/AppInstallerCLI/packages.config b/src/AppInstallerCLI/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Microsoft.Windows.CppWinRT" version="2.0.191111.2" targetFramework="native" /> +</packages>+ \ No newline at end of file diff --git a/src/AppInstallerCLI/pch.cpp b/src/AppInstallerCLI/pch.cpp @@ -0,0 +1,3 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#include "pch.h" diff --git a/src/AppInstallerCLI/pch.h b/src/AppInstallerCLI/pch.h @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#pragma once +#include <winrt/Windows.Foundation.h> +#include <winrt/Windows.Foundation.Collections.h> + +#include <iostream> +#include <memory> diff --git a/src/AppInstallerClient.sln b/src/AppInstallerClient.sln @@ -0,0 +1,79 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29409.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "AppInstallerClientPackage", "AppInstallerClientPackage\AppInstallerClientPackage.wapproj", "{6AA3791A-0713-4548-A357-87A323E7AC3A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AppInstallerCLI", "AppInstallerCLI\AppInstallerCLI.vcxproj", "{5B6F90DF-FD19-4BAE-83D9-24DAD128E777}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Debug|ARM.ActiveCfg = Debug|ARM + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Debug|ARM.Build.0 = Debug|ARM + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Debug|ARM.Deploy.0 = Debug|ARM + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Debug|ARM64.Build.0 = Debug|ARM64 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Debug|x64.ActiveCfg = Debug|x64 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Debug|x64.Build.0 = Debug|x64 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Debug|x64.Deploy.0 = Debug|x64 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Debug|x86.ActiveCfg = Debug|x86 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Debug|x86.Build.0 = Debug|x86 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Debug|x86.Deploy.0 = Debug|x86 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Release|Any CPU.Build.0 = Release|Any CPU + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Release|Any CPU.Deploy.0 = Release|Any CPU + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Release|ARM.ActiveCfg = Release|ARM + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Release|ARM.Build.0 = Release|ARM + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Release|ARM.Deploy.0 = Release|ARM + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Release|ARM64.ActiveCfg = Release|ARM64 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Release|ARM64.Build.0 = Release|ARM64 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Release|ARM64.Deploy.0 = Release|ARM64 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Release|x64.ActiveCfg = Release|x64 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Release|x64.Build.0 = Release|x64 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Release|x64.Deploy.0 = Release|x64 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Release|x86.ActiveCfg = Release|x86 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Release|x86.Build.0 = Release|x86 + {6AA3791A-0713-4548-A357-87A323E7AC3A}.Release|x86.Deploy.0 = Release|x86 + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Debug|ARM.ActiveCfg = Debug|ARM + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Debug|ARM.Build.0 = Debug|ARM + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Debug|ARM64.Build.0 = Debug|ARM64 + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Debug|x64.ActiveCfg = Debug|x64 + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Debug|x64.Build.0 = Debug|x64 + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Debug|x86.ActiveCfg = Debug|Win32 + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Debug|x86.Build.0 = Debug|Win32 + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Release|Any CPU.ActiveCfg = Release|Win32 + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Release|ARM.ActiveCfg = Release|ARM + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Release|ARM.Build.0 = Release|ARM + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Release|ARM64.ActiveCfg = Release|ARM64 + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Release|ARM64.Build.0 = Release|ARM64 + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Release|x64.ActiveCfg = Release|x64 + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Release|x64.Build.0 = Release|x64 + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Release|x86.ActiveCfg = Release|Win32 + {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B6FDB70C-A751-422C-ACD1-E35419495857} + EndGlobalSection +EndGlobal diff --git a/src/AppInstallerClientPackage/AppInstallerClientPackage.wapproj b/src/AppInstallerClientPackage/AppInstallerClientPackage.wapproj @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '15.0'"> + <VisualStudioVersion>15.0</VisualStudioVersion> + </PropertyGroup> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|x86"> + <Configuration>Debug</Configuration> + <Platform>x86</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x86"> + <Configuration>Release</Configuration> + <Platform>x86</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|ARM"> + <Configuration>Debug</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|ARM"> + <Configuration>Release</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|ARM64"> + <Configuration>Debug</Configuration> + <Platform>ARM64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|ARM64"> + <Configuration>Release</Configuration> + <Platform>ARM64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|AnyCPU"> + <Configuration>Debug</Configuration> + <Platform>AnyCPU</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|AnyCPU"> + <Configuration>Release</Configuration> + <Platform>AnyCPU</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup> + <WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath> + </PropertyGroup> + <Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" /> + <PropertyGroup> + <ProjectGuid>6aa3791a-0713-4548-a357-87a323e7ac3a</ProjectGuid> + <TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion> + <TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion> + <DefaultLanguage>en-US</DefaultLanguage> + <AppxPackageSigningEnabled>false</AppxPackageSigningEnabled> + <EntryPointProjectUniqueName>..\AppInstallerCLI\AppInstallerCLI.vcxproj</EntryPointProjectUniqueName> + </PropertyGroup> + <ItemGroup> + <AppxManifest Include="Package.appxmanifest"> + <SubType>Designer</SubType> + </AppxManifest> + </ItemGroup> + <ItemGroup> + <Content Include="Images\SplashScreen.scale-200.png" /> + <Content Include="Images\LockScreenLogo.scale-200.png" /> + <Content Include="Images\Square150x150Logo.scale-200.png" /> + <Content Include="Images\Square44x44Logo.scale-200.png" /> + <Content Include="Images\Square44x44Logo.targetsize-24_altform-unplated.png" /> + <Content Include="Images\StoreLogo.png" /> + <Content Include="Images\Wide310x150Logo.scale-200.png" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\AppInstallerCLI\AppInstallerCLI.vcxproj" /> + </ItemGroup> + <Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" /> +</Project>+ \ No newline at end of file diff --git a/src/AppInstallerClientPackage/Images/LockScreenLogo.scale-200.png b/src/AppInstallerClientPackage/Images/LockScreenLogo.scale-200.png Binary files differ. diff --git a/src/AppInstallerClientPackage/Images/SplashScreen.scale-200.png b/src/AppInstallerClientPackage/Images/SplashScreen.scale-200.png Binary files differ. diff --git a/src/AppInstallerClientPackage/Images/Square150x150Logo.scale-200.png b/src/AppInstallerClientPackage/Images/Square150x150Logo.scale-200.png Binary files differ. diff --git a/src/AppInstallerClientPackage/Images/Square44x44Logo.scale-200.png b/src/AppInstallerClientPackage/Images/Square44x44Logo.scale-200.png Binary files differ. diff --git a/src/AppInstallerClientPackage/Images/Square44x44Logo.targetsize-24_altform-unplated.png b/src/AppInstallerClientPackage/Images/Square44x44Logo.targetsize-24_altform-unplated.png Binary files differ. diff --git a/src/AppInstallerClientPackage/Images/StoreLogo.png b/src/AppInstallerClientPackage/Images/StoreLogo.png Binary files differ. diff --git a/src/AppInstallerClientPackage/Images/Wide310x150Logo.scale-200.png b/src/AppInstallerClientPackage/Images/Wide310x150Logo.scale-200.png Binary files differ. diff --git a/src/AppInstallerClientPackage/Package.appxmanifest b/src/AppInstallerClientPackage/Package.appxmanifest @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<Package + xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" + xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" + xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" + xmlns:uap8="http://schemas.microsoft.com/appx/manifest/uap/windows10/8" + xmlns:wincap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/windowscapabilities" + xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" + xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" + IgnorableNamespaces="uap uap5 uap8 wincap rescap desktop"> + <Identity Name="AppInstallerClient" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" Version="0.0.0.1" /> + <Properties> + <DisplayName>App Installer Client</DisplayName> + <PublisherDisplayName>Microsoft Corporation</PublisherDisplayName> + <Logo>Images\StoreLogo.png</Logo> + </Properties> + <Dependencies> + <!-- Minimum supported version is 1709 (Fall Creators Update, aka RS3) --> + <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.16299.0" MaxVersionTested="10.0.19033.0" /> + <PackageDependency Name="Microsoft.VCLibs.140.00.UWPDesktop" MinVersion="14.0.25426.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" /> + </Dependencies> + <Resources> + <Resource Language="x-generate" /> + </Resources> + <Applications> + <Application Id="AppInst" Executable="AppInstallerCLI\AppInstallerCLI.exe" EntryPoint="Windows.FullTrustApplication"> + <uap:VisualElements DisplayName="App Installer Client" Square150x150Logo="Images\Square150x150Logo.png" Square44x44Logo="Images\Square44x44Logo.png" Description="The App Installer client application." BackgroundColor="#0078d7" AppListEntry="none" /> + <Extensions> + <uap5:Extension Category="windows.appExecutionAlias"> + <uap5:AppExecutionAlias> + <uap8:ExecutionAlias Alias="AppInst.exe" /> + </uap5:AppExecutionAlias> + </uap5:Extension> + </Extensions> + </Application> + </Applications> + <Capabilities> + <rescap:Capability Name="runFullTrust" /> + </Capabilities> +</Package>+ \ No newline at end of file