-
Notifications
You must be signed in to change notification settings - Fork 2.9k
v13: Update deploy types (add setter to ArtifactDependency.Checksum and TryGetValue()/GetEntityTypes() to IFileTypeCollection)
#15318
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,49 +1,69 @@ | ||
| namespace Umbraco.Cms.Core.Deploy; | ||
|
|
||
| /// <summary> | ||
| /// Provides a base class to all artifacts. | ||
| /// Provides a base class for all artifacts. | ||
| /// </summary> | ||
| /// <typeparam name="TUdi">The UDI type.</typeparam> | ||
| public abstract class ArtifactBase<TUdi> : IArtifact | ||
| where TUdi : Udi | ||
| { | ||
| private IEnumerable<ArtifactDependency> _dependencies; | ||
| private readonly Lazy<string> _checksum; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="ArtifactBase{TUdi}" /> class. | ||
| /// </summary> | ||
| /// <param name="udi">The UDI.</param> | ||
| /// <param name="dependencies">The dependencies.</param> | ||
| protected ArtifactBase(TUdi udi, IEnumerable<ArtifactDependency>? dependencies = null) | ||
| { | ||
| Udi = udi ?? throw new ArgumentNullException("udi"); | ||
| Udi = udi ?? throw new ArgumentNullException(nameof(udi)); | ||
| Name = Udi.ToString(); | ||
|
|
||
| _dependencies = dependencies ?? Enumerable.Empty<ArtifactDependency>(); | ||
| _checksum = new Lazy<string>(GetChecksum); | ||
| } | ||
|
|
||
| private readonly Lazy<string> _checksum; | ||
|
|
||
| private IEnumerable<ArtifactDependency> _dependencies; | ||
|
|
||
| protected abstract string GetChecksum(); | ||
|
|
||
| /// <inheritdoc /> | ||
| Udi IArtifactSignature.Udi => Udi; | ||
|
|
||
| /// <inheritdoc /> | ||
| public TUdi Udi { get; set; } | ||
|
|
||
| /// <inheritdoc /> | ||
| public IEnumerable<ArtifactDependency> Dependencies | ||
| { | ||
| get => _dependencies; | ||
| set => _dependencies = value.OrderBy(x => x.Udi); | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public string Checksum => _checksum.Value; | ||
|
|
||
| /// <inheritdoc /> | ||
| public string Name { get; set; } | ||
|
|
||
| /// <inheritdoc /> | ||
| public string Alias { get; set; } = string.Empty; | ||
|
|
||
| /// <summary> | ||
| /// Gets the checksum. | ||
| /// </summary> | ||
| /// <returns> | ||
| /// The checksum. | ||
| /// </returns> | ||
| protected abstract string GetChecksum(); | ||
|
|
||
| /// <summary> | ||
| /// Prevents the <see cref="Checksum" /> property from being serialized. | ||
| /// </summary> | ||
| /// <returns> | ||
| /// Returns <c>false</c> to prevent the property from being serialized. | ||
| /// </returns> | ||
| /// <remarks> | ||
| /// Note that we can't use <see cref="NonSerializedAttribute"/> here as that works only on fields, not properties. And we want to avoid using [JsonIgnore] | ||
| /// Note that we can't use <see cref="NonSerializedAttribute" /> here as that works only on fields, not properties. And we want to avoid using [JsonIgnore] | ||
| /// as that would require an external dependency in Umbraco.Cms.Core. | ||
| /// So using this method of excluding properties from serialized data, documented here: https://www.newtonsoft.com/json/help/html/ConditionalProperties.htm | ||
| /// </remarks> | ||
| public bool ShouldSerializeChecksum() => false; | ||
|
|
||
| public IEnumerable<ArtifactDependency> Dependencies | ||
| { | ||
| get => _dependencies; | ||
| set => _dependencies = value.OrderBy(x => x.Udi); | ||
| } | ||
|
|
||
| public string Name { get; set; } | ||
|
|
||
| public string Alias { get; set; } = string.Empty; | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,17 +1,16 @@ | ||
| namespace Umbraco.Cms.Core.Deploy; | ||
|
|
||
| /// <summary> | ||
| /// Indicates the mode of the dependency. | ||
| /// Indicates the mode of the dependency. | ||
| /// </summary> | ||
| public enum ArtifactDependencyMode | ||
| { | ||
| /// <summary> | ||
| /// The dependency must match exactly. | ||
| /// The dependency must match exactly. | ||
| /// </summary> | ||
| Match, | ||
|
|
||
| /// <summary> | ||
| /// The dependency must exist. | ||
| /// The dependency must exist. | ||
| /// </summary> | ||
| Exist, | ||
| } |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,17 +1,27 @@ | ||
| namespace Umbraco.Cms.Core.Deploy; | ||
|
|
||
| /// <inheritdoc /> | ||
| public sealed class ArtifactSignature : IArtifactSignature | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="ArtifactSignature" /> class. | ||
| /// </summary> | ||
| /// <param name="udi">The UDI.</param> | ||
| /// <param name="checksum">The checksum.</param> | ||
| /// <param name="dependencies">The artifact dependencies.</param> | ||
| public ArtifactSignature(Udi udi, string checksum, IEnumerable<ArtifactDependency>? dependencies = null) | ||
| { | ||
| Udi = udi; | ||
| Checksum = checksum; | ||
| Dependencies = dependencies ?? Enumerable.Empty<ArtifactDependency>(); | ||
| Dependencies = dependencies ?? Array.Empty<ArtifactDependency>(); | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public Udi Udi { get; } | ||
|
|
||
| /// <inheritdoc /> | ||
| public string Checksum { get; } | ||
|
|
||
| /// <inheritdoc /> | ||
| public IEnumerable<ArtifactDependency> Dependencies { get; } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.