|
5 | 5 | using System.IO; |
6 | 6 | using System.IO.Compression; |
7 | 7 | using System.Linq; |
| 8 | +using System.Resources; |
8 | 9 | using System.Security.Cryptography; |
9 | 10 | using System.Text; |
10 | 11 |
|
@@ -96,6 +97,7 @@ public override bool Execute() |
96 | 97 | { |
97 | 98 | writer.Write(dependency.Id); |
98 | 99 | writer.Write(dependency.Version); |
| 100 | + writer.Write(dependency.Required); |
99 | 101 | } |
100 | 102 |
|
101 | 103 | var hashAndSignatureStartPos = fs.Position; |
@@ -183,13 +185,16 @@ private PluginDependency[] BuildDependencies() |
183 | 185 | var id = dependency.GetMetadata("Id"); |
184 | 186 | var version = dependency.GetMetadata("Version"); |
185 | 187 |
|
| 188 | + var requiredMetadata = dependency.GetMetadata("Required"); |
| 189 | + var required = !string.IsNullOrEmpty(requiredMetadata) && bool.Parse(requiredMetadata); |
| 190 | + |
186 | 191 | if (string.IsNullOrEmpty(id)) |
187 | 192 | { |
188 | 193 | this.Log.LogWarning("Id is required when defining a dependency."); |
189 | 194 | continue; |
190 | 195 | } |
191 | 196 |
|
192 | | - dependencies[i] = new PluginDependency(id, version ?? ">=1.0"); |
| 197 | + dependencies[i] = new PluginDependency(id, version ?? ">=1.0", required); |
193 | 198 | } |
194 | 199 |
|
195 | 200 | return dependencies; |
@@ -230,11 +235,13 @@ private void Add(List<Entry> entries, FileInfo file) |
230 | 235 | }); |
231 | 236 | } |
232 | 237 |
|
233 | | - private readonly struct PluginDependency(string id, string version) |
| 238 | + private readonly struct PluginDependency(string id, string version, bool required) |
234 | 239 | { |
235 | 240 | public string Id { get; } = id; |
236 | 241 |
|
237 | 242 | public string Version { get; } = version; |
| 243 | + |
| 244 | + public bool Required { get; } = required; |
238 | 245 | } |
239 | 246 |
|
240 | 247 | private sealed class Entry |
|
0 commit comments