@@ -20,20 +20,22 @@ public partial class Deployment
20
20
/// to registerResource.
21
21
/// </summary>
22
22
private static Task < SerializationResult > SerializeResourcePropertiesAsync (
23
- string label , IDictionary < string , object ? > args , bool keepResources , bool keepOutputValues )
23
+ string label , IDictionary < string , object ? > args , bool keepResources , bool keepOutputValues ,
24
+ bool excludeResourceReferencesFromDependencies = false )
24
25
{
25
26
return SerializeFilteredPropertiesAsync (
26
27
label , args ,
27
28
key => key != Constants . IdPropertyName && key != Constants . UrnPropertyName ,
28
- keepResources , keepOutputValues : keepOutputValues ) ;
29
+ keepResources , keepOutputValues , excludeResourceReferencesFromDependencies ) ;
29
30
}
30
31
31
32
private static async Task < Struct > SerializeAllPropertiesAsync (
32
- string label , IDictionary < string , object ? > args , bool keepResources , bool keepOutputValues = false )
33
+ string label , IDictionary < string , object ? > args , bool keepResources , bool keepOutputValues = false ,
34
+ bool excludeResourceReferencesFromDependencies = false )
33
35
{
34
36
var result = await SerializeFilteredPropertiesAsync (
35
37
label , args , _ => true ,
36
- keepResources , keepOutputValues ) . ConfigureAwait ( false ) ;
38
+ keepResources , keepOutputValues , excludeResourceReferencesFromDependencies ) . ConfigureAwait ( false ) ;
37
39
return result . Serialized ;
38
40
}
39
41
@@ -52,10 +54,18 @@ private static async Task<Struct> SerializeAllPropertiesAsync(
52
54
/// responsibility to ensure that the monitor supports the OutputValues
53
55
/// feature.
54
56
/// </param>
57
+ /// <param name="excludeResourceReferencesFromDependencies">
58
+ /// Specifies if we should exclude resource references from the resulting
59
+ /// <see cref="SerializationResult.PropertyToDependentResources"/>. This is useful for remote
60
+ /// components (i.e. multi-lang components, or MLCs) where we want property dependencies to be
61
+ /// empty for a property that only contains resource references.
62
+ /// </param>
55
63
private static async Task < SerializationResult > SerializeFilteredPropertiesAsync (
56
- string label , IDictionary < string , object ? > args , Predicate < string > acceptKey , bool keepResources , bool keepOutputValues )
64
+ string label , IDictionary < string , object ? > args , Predicate < string > acceptKey , bool keepResources , bool keepOutputValues ,
65
+ bool excludeResourceReferencesFromDependencies = false )
57
66
{
58
- var result = await SerializeFilteredPropertiesRawAsync ( label , args , acceptKey , keepResources , keepOutputValues ) ;
67
+ var result = await SerializeFilteredPropertiesRawAsync ( label , args , acceptKey , keepResources , keepOutputValues ,
68
+ excludeResourceReferencesFromDependencies ) ;
59
69
return result . ToSerializationResult ( ) ;
60
70
}
61
71
@@ -64,7 +74,8 @@ private static async Task<SerializationResult> SerializeFilteredPropertiesAsync(
64
74
/// last step of encoding the value into a Protobuf form.
65
75
/// </summary>
66
76
private static async Task < RawSerializationResult > SerializeFilteredPropertiesRawAsync (
67
- string label , IDictionary < string , object ? > args , Predicate < string > acceptKey , bool keepResources , bool keepOutputValues )
77
+ string label , IDictionary < string , object ? > args , Predicate < string > acceptKey , bool keepResources , bool keepOutputValues ,
78
+ bool excludeResourceReferencesFromDependencies = false )
68
79
{
69
80
var propertyToDependentResources = ImmutableDictionary . CreateBuilder < string , HashSet < Resource > > ( ) ;
70
81
var result = ImmutableDictionary . CreateBuilder < string , object > ( ) ;
@@ -75,7 +86,8 @@ private static async Task<RawSerializationResult> SerializeFilteredPropertiesRaw
75
86
{
76
87
// We treat properties with null values as if they do not exist.
77
88
var serializer = new Serializer ( _excessiveDebugOutput ) ;
78
- var v = await serializer . SerializeAsync ( $ "{ label } .{ key } ", val , keepResources , keepOutputValues ) . ConfigureAwait ( false ) ;
89
+ var v = await serializer . SerializeAsync ( $ "{ label } .{ key } ", val , keepResources , keepOutputValues ,
90
+ excludeResourceReferencesFromDependencies ) . ConfigureAwait ( false ) ;
79
91
if ( v != null )
80
92
{
81
93
result [ key ] = v ;
0 commit comments