Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add preview concept to allow build time determination #1679

Merged
merged 3 commits into from
Nov 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,13 @@ unparsable
UNSCOPED
UParse
UPSERT
URIs
uris
URLs
URLZONE
userfilesetting
userprofile
USHORT
Utils
utils
uuid
UWP
VERSI
Expand Down
2 changes: 1 addition & 1 deletion schemas/JSON/packages/packages.schema.2.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"WinGetVersion": {
"description": "Version of winget that generated this file",
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(\\-preview)?$"
},

"CreationDate": {
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace AppInstaller::CLI
void Command::OutputIntroHeader(Execution::Reporter& reporter) const
{
reporter.Info() <<
Resource::String::WindowsPackageManager << " v"_liv << Runtime::GetClientVersion() << std::endl <<
(Runtime::IsReleaseBuild() ? Resource::String::WindowsPackageManager : Resource::String::WindowsPackageManagerPreview) << " v"_liv << Runtime::GetClientVersion() << std::endl <<
Resource::String::MainCopyrightNotice << std::endl;
}

Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLICore/Resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ namespace AppInstaller::CLI::Resource
WINGET_DEFINE_RESOURCE_STRINGID(WindowsLibrariesDependencies);
WINGET_DEFINE_RESOURCE_STRINGID(WindowsStoreTerms);
WINGET_DEFINE_RESOURCE_STRINGID(WindowsPackageManager);
WINGET_DEFINE_RESOURCE_STRINGID(WindowsPackageManagerPreview);
WINGET_DEFINE_RESOURCE_STRINGID(WordArgumentDescription);
};

Expand Down
5 changes: 5 additions & 0 deletions src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw
Original file line number Diff line number Diff line change
Expand Up @@ -1229,13 +1229,18 @@ Please specify one of them using the `--source` option to proceed.</value>
</data>
<data name="WindowsPackageManager" xml:space="preserve">
<value>Windows Package Manager</value>
<comment>The product name.</comment>
</data>
<data name="ImportIgnorePackageVersionsArgumentDescription" xml:space="preserve">
<value>Ignore package versions in import file</value>
</data>
<data name="CountOutOfBoundsError" xml:space="preserve">
<value>The requested number of results must be between 1 and 1000.</value>
</data>
<data name="WindowsPackageManagerPreview" xml:space="preserve">
<value>Windows Package Manager (Preview)</value>
<comment>The product name plus an indicator that this is a pre-release version.</comment>
</data>
<data name="InstallArchitectureArgumentDescription" xml:space="preserve">
<value>Select the architecture to install</value>
</data>
Expand Down
5 changes: 5 additions & 0 deletions src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@
<PreprocessorDefinitions>WINGET_DISABLE_EXPERIMENTAL_FEATURES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(WingetEnableReleaseBuild)'=='true'">
<ClCompile>
<PreprocessorDefinitions>WINGET_ENABLE_RELEASE_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="DODownloader.h" />
<ClInclude Include="Public\winget\AdminSettings.h" />
Expand Down
3 changes: 3 additions & 0 deletions src/AppInstallerCommonCore/Public/AppInstallerRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,7 @@ namespace AppInstaller::Runtime

// Checks if the file system at path supports hard links
bool SupportsHardLinks(const std::filesystem::path& path);

// Returns true if this is a release build; false if not.
inline constexpr bool IsReleaseBuild();
}
15 changes: 15 additions & 0 deletions src/AppInstallerCommonCore/Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace AppInstaller::Runtime
#ifndef WINGET_DISABLE_FOR_FUZZING
constexpr std::string_view s_SecureSettings_Relative_Packaged = "pkg"sv;
#endif
constexpr std::string_view s_PreviewBuildSuffix = "-preview"sv;

// Gets a boolean indicating whether the current process has identity.
bool DoesCurrentProcessHaveIdentity()
Expand Down Expand Up @@ -169,6 +170,11 @@ namespace AppInstaller::Runtime
strstr << VERSION_BUILD;
}

if (!IsReleaseBuild())
{
strstr << s_PreviewBuildSuffix;
}

return LocIndString{ strstr.str() };
}

Expand Down Expand Up @@ -444,6 +450,15 @@ namespace AppInstaller::Runtime
return IsNTFS(path);
}

constexpr bool IsReleaseBuild()
{
#ifdef WINGET_ENABLE_RELEASE_BUILD
return true;
#else
return false;
#endif
}

#ifndef AICLI_DISABLE_TEST_HOOKS
void TestHook_SetPathOverride(PathName target, const std::filesystem::path& path)
{
Expand Down
2 changes: 1 addition & 1 deletion src/binver/binver/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define STRINGIZE(s) STRINGIZE2(s)

#define VERSION_MAJOR 1
#define VERSION_MINOR 0
#define VERSION_MINOR 2
#define VERSION_BUILD 0
#define VERSION_REVISION 0

Expand Down