-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for installing packages as optional
Delivers #2439 Added a new method to IInstaller to support marking some packages as optional. Added a new property bool IsPartOfAnOptionalWorkload to IInstallUnityDescriptor. Updated IInstallUnitDescriptorFactory to pipe the additional data during template installation. Updated all the implementations of the above interfaces to comply with the changes. Updated the tests that were broken because of the changes.
- Loading branch information
Showing
16 changed files
with
194 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System; | ||
|
||
namespace Microsoft.TemplateEngine.Cli | ||
{ | ||
public struct InstallationRequest : IEquatable<InstallationRequest> | ||
{ | ||
public InstallationRequest(string installString, bool isPartOfAnOptionalWorkload = false) | ||
{ | ||
InstallString = installString; | ||
IsPartOfAnOptionalWorkload = isPartOfAnOptionalWorkload; | ||
} | ||
|
||
/// <summary> | ||
/// String to identify the package/directory/archive containing the templates | ||
/// </summary> | ||
public string InstallString { get; set; } | ||
|
||
/// <summary> | ||
/// Is this package being installed as part of an optional workload? | ||
/// </summary> | ||
public bool IsPartOfAnOptionalWorkload { get; set; } | ||
|
||
public bool Equals(InstallationRequest other) | ||
{ | ||
return InstallString == other.InstallString && | ||
IsPartOfAnOptionalWorkload == other.IsPartOfAnOptionalWorkload; | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (!(obj is InstallationRequest other)) | ||
{ | ||
return false; | ||
} | ||
|
||
return Equals(other); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return $"{(IsPartOfAnOptionalWorkload ? "[OW]" : string.Empty)}{InstallString}"; | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return unchecked((InstallString?.GetHashCode() ?? 0) + 13 * IsPartOfAnOptionalWorkload.GetHashCode()); | ||
} | ||
|
||
public static bool operator ==(InstallationRequest x, InstallationRequest y) | ||
{ | ||
return x.Equals(y); | ||
} | ||
|
||
public static bool operator !=(InstallationRequest x, InstallationRequest y) | ||
{ | ||
return !(x == y); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.