Skip to content

Commit 304f947

Browse files
committed
Remove unused members from components build
1 parent 8caf1c7 commit 304f947

File tree

5 files changed

+86
-131
lines changed

5 files changed

+86
-131
lines changed

src/Components/Components/src/Microsoft.AspNetCore.Components.csproj

Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,61 +24,40 @@
2424
</ItemGroup>
2525

2626
<ItemGroup Label="Routing">
27+
<!-- Abstractions -->
2728
<Compile Include="$(HttpAbstractionsSourceRoot)Routing\RouteValueDictionary.cs" LinkBase="Routing" />
2829
<Compile Include="$(RoutingAbstractionsSourceRoot)IRouteConstraint.cs" LinkBase="Routing" />
2930
<Compile Include="$(RoutingAbstractionsSourceRoot)IParameterPolicy.cs" LinkBase="Routing" />
30-
31+
32+
<!-- Abstractions -->
3133
<Compile Include="$(SharedSourceRoot)RouteValueDictionaryTrimmerWarning.cs" LinkBase="Reflection" />
3234
<Compile Include="$(SharedSourceRoot)UrlDecoder\UrlDecoder.cs" LinkBase="Routing" />
3335
<Compile Include="$(SharedSourceRoot)PropertyHelper\**\*.cs" LinkBase="Reflection" />
34-
35-
<Compile Include="$(RoutingSourceRoot)RouteOptions.cs" LinkBase="Routing" />
36-
<Compile Include="$(RoutingSourceRoot)PathTokenizer.cs" LinkBase="Routing" />
37-
<Compile Include="$(RoutingSourceRoot)IInlineConstraintResolver.cs" LinkBase="Routing" />
36+
37+
<!-- Infrastructure -->
3838
<Compile Include="$(RoutingSourceRoot)RouteValueEqualityComparer.cs" LinkBase="Routing" />
39-
<Compile Include="$(RoutingSourceRoot)ArrayBuilder.cs" LinkBase="Routing" />
40-
<Compile Include="$(RoutingSourceRoot)RouteConstraintBuilder.cs" LinkBase="Routing" />
41-
<Compile Include="$(RoutingSourceRoot)RouteConstraintMatcher.cs" LinkBase="Routing" />
4239
<Compile Include="$(RoutingSourceRoot)RouteCreationException.cs" LinkBase="Routing" />
4340
<!-- Tree router for matching -->
44-
<Compile Include="$(RoutingSourceRoot)Tree\TreeRouteBuilder.cs" LinkBase="Routing\Tree" />
45-
<Compile Include="$(RoutingSourceRoot)Tree\TreeRouter.cs" LinkBase="Routing\Tree" />
46-
<Compile Include="$(RoutingSourceRoot)Tree\TreeEnumerator.cs" LinkBase="Routing\Tree" />
47-
<Compile Include="$(RoutingSourceRoot)Tree\UrlMatchingTree.cs" LinkBase="Routing\Tree" />
48-
<Compile Include="$(RoutingSourceRoot)Tree\UrlMatchingNode.cs" LinkBase="Routing\Tree" />
49-
<Compile Include="$(RoutingSourceRoot)Tree\InboundMatch.cs" LinkBase="Routing\Tree" />
50-
<Compile Include="$(RoutingSourceRoot)Tree\InboundRouteEntry.cs" LinkBase="Routing\Tree" />
51-
<!-- Template parser -->
52-
<!--<Compile Include="$(RoutingSourceRoot)Template\TemplateParser.cs" LinkBase="Routing\Template" />
53-
<Compile Include="$(RoutingSourceRoot)Template\TemplateMatcher.cs" LinkBase="Routing\Template" />
54-
<Compile Include="$(RoutingSourceRoot)Template\InlineConstraint.cs" LinkBase="Routing\Template" />
55-
<Compile Include="$(RoutingSourceRoot)Template\TemplatePart.cs" LinkBase="Routing\Template" />
56-
<Compile Include="$(RoutingSourceRoot)Template\TemplateSegment.cs" LinkBase="Routing\Template" />
57-
<Compile Include="$(RoutingSourceRoot)Template\RouteTemplate.cs" LinkBase="Routing\Template" />-->
58-
<Compile Include="$(RoutingSourceRoot)Template\RoutePrecedence.cs" LinkBase="Routing\Template" />
41+
<Compile Include="$(RoutingSourceRoot)PathTokenizer.cs" LinkBase="Routing" />
42+
<Compile Include="$(RoutingSourceRoot)Tree\*.cs" LinkBase="Routing\Tree" />
43+
<Compile Remove="$(RoutingSourceRoot)Tree\Outbound*.cs" LinkBase="Routing\Tree" />
44+
<Compile Remove="$(RoutingSourceRoot)Tree\LinkGeneration*.cs" LinkBase="Routing\Tree" />
5945
<!-- Route patterns -->
60-
<Compile Include="$(RoutingSourceRoot)Patterns\RoutePatternMatcher.cs" LinkBase="Routing\Patterns" />
61-
<Compile Include="$(RoutingSourceRoot)Patterns\RouteParameterParser.cs" LinkBase="Routing" />
62-
<Compile Include="$(RoutingSourceRoot)Patterns\RoutePatternException.cs" LinkBase="Routing\Patterns" />
63-
<Compile Include="$(RoutingSourceRoot)Patterns\RoutePatternFactory.cs" LinkBase="Routing\Patterns" />
64-
<Compile Include="$(RoutingSourceRoot)Patterns\RoutePattern.cs" LinkBase="Routing\Patterns" />
65-
<Compile Include="$(RoutingSourceRoot)Patterns\RoutePatternParser.cs" LinkBase="Routing\Patterns" />
66-
<Compile Include="$(RoutingSourceRoot)Patterns\RoutePatternPart.cs" LinkBase="Routing\Patterns" />
67-
<Compile Include="$(RoutingSourceRoot)Patterns\RoutePatternPartKind.cs" LinkBase="Routing\Patterns" />
68-
<Compile Include="$(RoutingSourceRoot)Patterns\RoutePatternLiteralPart.cs" LinkBase="Routing\Patterns" />
69-
<Compile Include="$(RoutingSourceRoot)Patterns\RoutePatternSeparatorPart.cs" LinkBase="Routing\Patterns" />
70-
<Compile Include="$(RoutingSourceRoot)Patterns\RoutePatternParameterPart.cs" LinkBase="Routing\Patterns" />
71-
<Compile Include="$(RoutingSourceRoot)Patterns\RoutePatternPathSegment.cs" LinkBase="Routing\Patterns" />
72-
<Compile Include="$(RoutingSourceRoot)Patterns\RoutePatternParameterKind.cs" LinkBase="Routing\Patterns" />
73-
<Compile Include="$(RoutingSourceRoot)Patterns\RoutePatternParameterPolicyReference.cs" LinkBase="Routing\Patterns" />
46+
<Compile Include="$(RoutingSourceRoot)Template\RoutePrecedence.cs" LinkBase="Routing\Patterns" />
47+
<Compile Include="$(RoutingSourceRoot)Patterns\*.cs" LinkBase="Routing\Patterns" />
48+
<Compile Remove="$(RoutingSourceRoot)Patterns\*RoutePatternTransformer.cs" />
7449
<!-- Route constraints -->
7550
<Compile Include="$(RoutingSourceRoot)DefaultInlineConstraintResolver.cs" LinkBase="Routing" />
51+
<Compile Include="$(RoutingSourceRoot)ParameterPolicyActivator.cs" LinkBase="Routing" />
52+
<Compile Include="$(RoutingSourceRoot)RouteConstraintBuilder.cs" LinkBase="Routing" />
53+
<Compile Include="$(RoutingSourceRoot)RouteConstraintMatcher.cs" LinkBase="Routing" />
54+
<Compile Include="$(RoutingSourceRoot)RouteOptions.cs" LinkBase="Routing" />
55+
<Compile Include="$(RoutingSourceRoot)IInlineConstraintResolver.cs" LinkBase="Routing" />
7656
<Compile Include="$(RoutingSourceRoot)Constraints\**\*.cs" LinkBase="Routing\Constraints" />
7757
<Compile Remove="$(RoutingSourceRoot)Constraints\HttpMethodRouteConstraint.cs" />
7858
<Compile Remove="$(RoutingSourceRoot)Constraints\RegexErrorStubRouteConstraint.cs" />
7959
<Compile Remove="$(RoutingSourceRoot)Constraints\RequiredRouteConstraint.cs" />
8060
<Compile Remove="$(RoutingSourceRoot)Constraints\StringRouteConstraint.cs" />
81-
<Compile Include="$(RoutingSourceRoot)ParameterPolicyActivator.cs" LinkBase="Routing" />
8261

8362
</ItemGroup>
8463

src/Components/Components/src/Routing/Resources.resx

Lines changed: 45 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,9 @@
117117
<resheader name="writer">
118118
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120-
<data name="ArgumentMustBeGreaterThanOrEqualTo" xml:space="preserve">
121-
<value>Value must be greater than or equal to {0}.</value>
122-
</data>
123120
<data name="RangeConstraint_MinShouldBeLessThanOrEqualToMax" xml:space="preserve">
124121
<value>The value for argument '{0}' should be less than or equal to the value for the argument '{1}'.</value>
125122
</data>
126-
<data name="PropertyOfTypeCannotBeNull" xml:space="preserve">
127-
<value>The '{0}' property of '{1}' must not be null.</value>
128-
</data>
129-
<data name="NamedRoutes_AmbiguousRoutesFound" xml:space="preserve">
130-
<value>The supplied route name '{0}' is ambiguous and matched more than one route.</value>
131-
</data>
132-
<data name="DefaultHandler_MustBeSet" xml:space="preserve">
133-
<value>A default handler must be set on the {0}.</value>
134-
</data>
135123
<data name="DefaultInlineConstraintResolver_AmbiguousCtors" xml:space="preserve">
136124
<value>The constructor to use for activating the constraint type '{0}' is ambiguous. Multiple constructors were found with the following number of parameters: {1}.</value>
137125
</data>
@@ -141,27 +129,60 @@
141129
<data name="DefaultInlineConstraintResolver_TypeNotConstraint" xml:space="preserve">
142130
<value>The constraint type '{0}' which is mapped to constraint key '{1}' must implement the '{2}' interface.</value>
143131
</data>
132+
<data name="RouteConstraintBuilder_ValidationMustBeStringOrCustomConstraint" xml:space="preserve">
133+
<value>The constraint entry '{0}' - '{1}' on the route '{2}' must have a string value or be of a type which implements '{3}'.</value>
134+
</data>
135+
<data name="RouteConstraintBuilder_CouldNotResolveConstraint" xml:space="preserve">
136+
<value>The constraint entry '{0}' - '{1}' on the route '{2}' could not be resolved by the constraint resolver of type '{3}'.</value>
137+
</data>
138+
<data name="RoutePatternBuilder_CollectionCannotBeEmpty" xml:space="preserve">
139+
<value>The collection cannot be empty.</value>
140+
</data>
141+
<data name="ConstraintMustBeStringOrConstraint" xml:space="preserve">
142+
<value>The constraint entry '{0}' - '{1}' must have a string value or be of a type which implements '{2}'.</value>
143+
</data>
144+
<data name="RoutePattern_InvalidConstraintReference" xml:space="preserve">
145+
<value>Invalid constraint '{0}'. A constraint must be of type 'string' or '{1}'.</value>
146+
</data>
147+
<data name="RoutePattern_InvalidParameterConstraintReference" xml:space="preserve">
148+
<value>Invalid constraint '{0}' for parameter '{1}'. A constraint must be of type 'string', '{2}', or '{3}'.</value>
149+
</data>
150+
<data name="RoutePattern_ConstraintReferenceNotFound" xml:space="preserve">
151+
<value>The constraint reference '{0}' could not be resolved to a type. Register the constraint type with '{1}.{2}'.</value>
152+
</data>
153+
<data name="RoutePattern_InvalidStringConstraintReference" xml:space="preserve">
154+
<value>Invalid constraint type '{0}' registered as '{1}'. A constraint type must either implement '{2}', or inherit from '{3}'.</value>
155+
</data>
156+
<data name="RegexRouteContraint_NotConfigured" xml:space="preserve">
157+
<value>A route parameter uses the regex constraint, which isn't registered. If this application was configured using CreateSlimBuilder(...) or AddRoutingCore(...) then this constraint is not registered by default. To use the regex constraint, configure route options at app startup: services.Configure&lt;RouteOptions&gt;(options =&gt; options.SetParameterPolicy&lt;RegexInlineRouteConstraint&gt;("regex"));</value>
158+
</data>
159+
<data name="ArgumentMustBeGreaterThanOrEqualTo" xml:space="preserve">
160+
<value>Value must be greater than or equal to {0}.</value>
161+
</data>
162+
<data name="Argument_NullOrEmpty" xml:space="preserve">
163+
<value>Value cannot be null or empty.</value>
164+
</data>
144165
<data name="TemplateRoute_CannotHaveCatchAllInMultiSegment" xml:space="preserve">
145166
<value>A path segment that contains more than one section, such as a literal section or a parameter, cannot contain a catch-all parameter.</value>
146167
</data>
147-
<data name="TemplateRoute_CannotHaveDefaultValueSpecifiedInlineAndExplicitly" xml:space="preserve">
148-
<value>The route parameter '{0}' has both an inline default value and an explicit default value specified. A route parameter cannot contain an inline default value when a default value is specified explicitly. Consider removing one of them.</value>
149-
</data>
150168
<data name="TemplateRoute_CannotHaveConsecutiveParameters" xml:space="preserve">
151169
<value>A path segment cannot contain two consecutive parameters. They must be separated by a '/' or by a literal string.</value>
152170
</data>
153171
<data name="TemplateRoute_CannotHaveConsecutiveSeparators" xml:space="preserve">
154172
<value>The route template separator character '/' cannot appear consecutively. It must be separated by either a parameter or a literal value.</value>
155173
</data>
174+
<data name="TemplateRoute_CannotHaveDefaultValueSpecifiedInlineAndExplicitly" xml:space="preserve">
175+
<value>The route parameter '{0}' has both an inline default value and an explicit default value specified. A route parameter cannot contain an inline default value when a default value is specified explicitly. Consider removing one of them.</value>
176+
</data>
156177
<data name="TemplateRoute_CatchAllCannotBeOptional" xml:space="preserve">
157178
<value>A catch-all parameter cannot be marked optional.</value>
158179
</data>
159-
<data name="TemplateRoute_OptionalCannotHaveDefaultValue" xml:space="preserve">
160-
<value>An optional parameter cannot have default value.</value>
161-
</data>
162180
<data name="TemplateRoute_CatchAllMustBeLast" xml:space="preserve">
163181
<value>A catch-all parameter can only appear as the last segment of the route template.</value>
164182
</data>
183+
<data name="TemplateRoute_Exception" xml:space="preserve">
184+
<value>An error occurred while creating the route with name '{0}' and template '{1}'.</value>
185+
</data>
165186
<data name="TemplateRoute_InvalidLiteral" xml:space="preserve">
166187
<value>The literal section '{0}' is invalid. Literal sections cannot contain the '?' character.</value>
167188
</data>
@@ -174,82 +195,19 @@
174195
<data name="TemplateRoute_MismatchedParameter" xml:space="preserve">
175196
<value>There is an incomplete parameter in the route template. Check that each '{' character has a matching '}' character.</value>
176197
</data>
177-
<data name="TemplateRoute_RepeatedParameter" xml:space="preserve">
178-
<value>The route parameter name '{0}' appears more than one time in the route template.</value>
179-
</data>
180-
<data name="RouteConstraintBuilder_ValidationMustBeStringOrCustomConstraint" xml:space="preserve">
181-
<value>The constraint entry '{0}' - '{1}' on the route '{2}' must have a string value or be of a type which implements '{3}'.</value>
182-
</data>
183-
<data name="RouteConstraintBuilder_CouldNotResolveConstraint" xml:space="preserve">
184-
<value>The constraint entry '{0}' - '{1}' on the route '{2}' could not be resolved by the constraint resolver of type '{3}'.</value>
185-
</data>
186-
<data name="TemplateRoute_UnescapedBrace" xml:space="preserve">
187-
<value>In a route parameter, '{' and '}' must be escaped with '{{' and '}}'.</value>
198+
<data name="TemplateRoute_OptionalCannotHaveDefaultValue" xml:space="preserve">
199+
<value>An optional parameter cannot have default value.</value>
188200
</data>
189201
<data name="TemplateRoute_OptionalParameterCanbBePrecededByPeriod" xml:space="preserve">
190202
<value>In the segment '{0}', the optional parameter '{1}' is preceded by an invalid segment '{2}'. Only a period (.) can precede an optional parameter.</value>
191203
</data>
192204
<data name="TemplateRoute_OptionalParameterHasTobeTheLast" xml:space="preserve">
193205
<value>An optional parameter must be at the end of the segment. In the segment '{0}', optional parameter '{1}' is followed by '{2}'.</value>
194206
</data>
195-
<data name="AttributeRoute_DifferentLinkGenerationEntries_SameName" xml:space="preserve">
196-
<value>Two or more routes named '{0}' have different templates.</value>
197-
</data>
198-
<data name="UnableToFindServices" xml:space="preserve">
199-
<value>Unable to find the required services. Please add all the required services by calling '{0}.{1}' inside the call to '{2}' in the application startup code.</value>
200-
</data>
201-
<data name="TemplateRoute_Exception" xml:space="preserve">
202-
<value>An error occurred while creating the route with name '{0}' and template '{1}'.</value>
203-
</data>
204-
<data name="AmbiguousEndpoints" xml:space="preserve">
205-
<value>The request matched multiple endpoints. Matches: {0}{0}{1}</value>
206-
</data>
207-
<data name="Argument_NullOrEmpty" xml:space="preserve">
208-
<value>Value cannot be null or empty.</value>
209-
</data>
210-
<data name="RoutePatternBuilder_CollectionCannotBeEmpty" xml:space="preserve">
211-
<value>The collection cannot be empty.</value>
212-
</data>
213-
<data name="ConstraintMustBeStringOrConstraint" xml:space="preserve">
214-
<value>The constraint entry '{0}' - '{1}' must have a string value or be of a type which implements '{2}'.</value>
215-
</data>
216-
<data name="RoutePattern_InvalidConstraintReference" xml:space="preserve">
217-
<value>Invalid constraint '{0}'. A constraint must be of type 'string' or '{1}'.</value>
218-
</data>
219-
<data name="RoutePattern_InvalidParameterConstraintReference" xml:space="preserve">
220-
<value>Invalid constraint '{0}' for parameter '{1}'. A constraint must be of type 'string', '{2}', or '{3}'.</value>
221-
</data>
222-
<data name="RoutePattern_ConstraintReferenceNotFound" xml:space="preserve">
223-
<value>The constraint reference '{0}' could not be resolved to a type. Register the constraint type with '{1}.{2}'.</value>
224-
</data>
225-
<data name="RoutePattern_InvalidStringConstraintReference" xml:space="preserve">
226-
<value>Invalid constraint type '{0}' registered as '{1}'. A constraint type must either implement '{2}', or inherit from '{3}'.</value>
227-
</data>
228-
<data name="DuplicateEndpointNameEntry" xml:space="preserve">
229-
<value>Endpoints with endpoint name '{0}':</value>
230-
</data>
231-
<data name="DuplicateEndpointNameHeader" xml:space="preserve">
232-
<value>The following endpoints with a duplicate endpoint name were found.</value>
233-
</data>
234-
<data name="FormatterMapping_MediaTypeInvalid" xml:space="preserve">
235-
<value>No media type found for format '{0}'.</value>
236-
</data>
237-
<data name="MapGroup_ChangingRoutePatternUnsupported" xml:space="preserve">
238-
<value>MapGroup does not support mutating RouteEndpointBuilder.RoutePattern from '{0}' to '{1}' via conventions.</value>
239-
</data>
240-
<data name="MapGroup_CustomEndpointUnsupported" xml:space="preserve">
241-
<value>MapGroup does not support custom Endpoint type '{0}'. Only RouteEndpoints can be grouped.</value>
242-
</data>
243-
<data name="MapGroup_RepeatedDictionaryEntry" xml:space="preserve">
244-
<value>MapGroup cannot build a pattern for '{0}' because the 'RoutePattern.{1}' dictionary key '{2}' has multiple values.</value>
245-
</data>
246-
<data name="RouteEndpointDataSource_ConventionsCannotBeModifiedAfterBuild" xml:space="preserve">
247-
<value>Conventions cannot be added after building the endpoint.</value>
248-
</data>
249-
<data name="RouteEndpointDataSource_RequestDelegateCannotBeCalledBeforeBuild" xml:space="preserve">
250-
<value>This RequestDelegate cannot be called before the final endpoint is built.</value>
207+
<data name="TemplateRoute_RepeatedParameter" xml:space="preserve">
208+
<value>The route parameter name '{0}' appears more than one time in the route template.</value>
251209
</data>
252-
<data name="RegexRouteContraint_NotConfigured" xml:space="preserve">
253-
<value>A route parameter uses the regex constraint, which isn't registered. If this application was configured using CreateSlimBuilder(...) or AddRoutingCore(...) then this constraint is not registered by default. To use the regex constraint, configure route options at app startup: services.Configure&lt;RouteOptions&gt;(options =&gt; options.SetParameterPolicy&lt;RegexInlineRouteConstraint&gt;("regex"));</value>
210+
<data name="TemplateRoute_UnescapedBrace" xml:space="preserve">
211+
<value>In a route parameter, '{' and '}' must be escaped with '{{' and '}}'.</value>
254212
</data>
255213
</root>

src/Http/Http.Abstractions/src/Routing/RouteValueDictionary.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ internal class RouteValueDictionary : IDictionary<string, object?>, IReadOnlyDic
5050
internal PropertyStorage? _propertyStorage;
5151
private int _count;
5252

53+
#if !COMPONENTS
5354
/// <summary>
5455
/// Creates a new <see cref="RouteValueDictionary"/> from the provided array.
5556
/// The new instance will take ownership of the array, and may mutate it.
@@ -97,6 +98,7 @@ public static RouteValueDictionary FromArray(KeyValuePair<string, object?>[] ite
9798
_count = start,
9899
};
99100
}
101+
#endif
100102

101103
/// <summary>
102104
/// Creates an empty <see cref="RouteValueDictionary"/>.
@@ -106,6 +108,7 @@ public RouteValueDictionary()
106108
_arrayStorage = Array.Empty<KeyValuePair<string, object?>>();
107109
}
108110

111+
#if !COMPONENTS
109112
/// <summary>
110113
/// Creates a <see cref="RouteValueDictionary"/> initialized with the specified <paramref name="values"/>.
111114
/// </summary>
@@ -203,7 +206,7 @@ public RouteValueDictionary(RouteValueDictionary? dictionary)
203206
_arrayStorage = Array.Empty<KeyValuePair<string, object?>>();
204207
}
205208
}
206-
209+
#endif
207210
[MemberNotNull(nameof(_arrayStorage))]
208211
private void Initialize(IEnumerable<KeyValuePair<string, string?>> stringValueEnumerable)
209212
{

src/Http/Routing/src/Patterns/RouteParameterParser.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ private static ParameterPolicyParseResults ParseConstraints(
9797
int currentIndex,
9898
int endIndex)
9999
{
100+
#if !COMPONENTS
100101
var constraints = new ArrayBuilder<RoutePatternParameterPolicyReference>(0);
102+
#else
103+
var constraints = new List<RoutePatternParameterPolicyReference>();
104+
#endif
101105
var state = ParseState.Start;
102106
var startIndex = currentIndex;
103107
do

0 commit comments

Comments
 (0)