Skip to content

Commit 154deaa

Browse files
committed
Rename zee properties
- make it clear these properties control code generation - use "OnBuild" for consistency with properties elsewhere in ASP.NET Core - remove "Default" from a comple of property names because commaents are pretty clear - rename a few targets for consistency with the new properties - word "Reference" didn't add much
1 parent 7b76256 commit 154deaa

File tree

3 files changed

+34
-28
lines changed

3 files changed

+34
-28
lines changed

src/Mvc/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.props

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,23 @@
1919
Options added to the code generator command line by default. Provides the default %(Options) metadata of
2020
@(OpenApiReference) and @(OpenApiProjectReference) items.
2121
-->
22-
<OpenApiDefaultGeneratorOptions Condition="'$(OpenApiDefaultGeneratorOptions)' == ''"></OpenApiDefaultGeneratorOptions>
22+
<OpenApiGenerateCodeOptions Condition="'$(OpenApiGenerateCodeOptions)' == ''"></OpenApiGenerateCodeOptions>
2323

2424
<!--
2525
If 'true' (the default), generate code for @(OpenApiReference) and @(OpenApiProjectReference) items before the
2626
BeforeCompile target.
2727
28-
If 'false', the GenerateOpenApiReferenceCode target is not part of the build (by default) but can run when
29-
explicitly referenced. That is, the target may be invoked from the command line or tied in through another target.
28+
If 'false', the 'GenerateOpenApiCode' target is not part of the build (by default) but can run when explicitly
29+
referenced. That is, the target may be invoked from the command line or tied in through another target.
3030
-->
31-
<OpenApiGenerateBeforeCompile Condition="'$(OpenApiGenerateBeforeCompile)' == ''">true</OpenApiGenerateBeforeCompile>
31+
<OpenApiGenerateCodeOnBuild Condition="'$(OpenApiGenerateCodeOnBuild)' == ''">true</OpenApiGenerateCodeOnBuild>
3232

3333
<!--
3434
If 'true' (the default), generate code for @(OpenApiReference) and @(OpenApiProjectReference) items during
3535
design-time builds. Otherwise, generate code only during a full build.
3636
-->
37-
<OpenApiGenerateAtDesignTime Condition="'$(OpenApiGenerateAtDesignTime)' == ''">true</OpenApiGenerateAtDesignTime>
37+
<OpenApiGenerateCodeAtDesignTime
38+
Condition="'$(OpenApiGenerateCodeAtDesignTime)' == ''">true</OpenApiGenerateCodeAtDesignTime>
3839

3940
<!--
4041
If 'true' (the default), build projects referenced in @(OpenApiProjectReference) items before retrieving that
@@ -44,15 +45,16 @@
4445
If 'false', ensure the referenced projects build before this one in the solution or through other means. IDEs may
4546
be confused about the project dependency graph in this case.
4647
-->
47-
<OpenApiBuildReferencedProjects Condition="'$(OpenApiBuildReferencedProjects)' == ''">true</OpenApiBuildReferencedProjects>
48+
<OpenApiBuildReferencedProjects
49+
Condition="'$(OpenApiBuildReferencedProjects)' == ''">true</OpenApiBuildReferencedProjects>
4850

4951
<!--
5052
Default folder to place code generated from Open API documents. Value is interpreted relative to the project
5153
folder, unless already an absolute path. Part of the default %(OutputPath) metadata of @(OpenApiReference) and
5254
@(OpenApiProjectReference) items.
5355
-->
54-
<OpenApiDefaultOutputDirectory
55-
Condition="'$(OpenApiDefaultOutputDirectory)' == ''">$(BaseIntermediateOutputPath)</OpenApiDefaultOutputDirectory>
56+
<OpenApiCodeDirectory
57+
Condition="'$(OpenApiCodeDirectory)' == ''">$(BaseIntermediateOutputPath)</OpenApiCodeDirectory>
5658
</PropertyGroup>
5759

5860
<!--
@@ -65,24 +67,28 @@
6567
<OpenApiReference>
6668
<!-- Name of the class to generate. Defaults to match filename in %(OutputPath). -->
6769
<ClassName />
70+
6871
<!--
6972
Code generator to use. Required and must end with "CSharp" or "TypeScript" (the currently-supported target
7073
languages) unless %(OutputPath) is set. Builds will invoke a target named "Generate%(CodeGenerator)" to do
7174
actual code generation.
7275
-->
7376
<CodeGenerator>NSwagCSharp</CodeGenerator>
77+
7478
<!-- Namespace to contain generated class. Default is $(RootNamespace). -->
7579
<Namespace />
80+
7681
<!--
7782
Options to pass to the code generator target then (likely) added to a tool's command line. Value is passed
7883
along to the code generator but otherwise unused in this package.
7984
-->
80-
<Options>$(OpenApiDefaultGeneratorOptions)</Options>
85+
<Options>$(OpenApiGenerateCodeOptions)</Options>
86+
8187
<!--
8288
Path to place generated code. Code generator may interpret path as a filename or directory. Default filename or
8389
folder name is %(Filename)Client.[cs|ts]. Filenames and relative paths (if explicitly set) are combined with
84-
$(OpenApiDefaultOutputDirectory). Final value (depending on $(OpenApiDefaultOutputDirectory)) is likely to be
85-
a path relative to the client project.
90+
$(OpenApiCodeDirectory). Final value (depending on $(OpenApiCodeDirectory)) is likely to be a path relative to
91+
the client project.
8692
-->
8793
<OutputPath />
8894
</OpenApiReference>

src/Mvc/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.targets

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<Project>
33
<!-- Internal settings. Not intended for customization. -->
44
<PropertyGroup>
5-
<GenerateOpenApiReferenceCodeDependsOn>
5+
<GenerateOpenApiCodeDependsOn>
66
_GenerateErrorsForOldItems;
77
_CreateOpenApiReferenceItemsForOpenApiProjectReferences;
88
_GetMetadataForOpenApiReferences;
9-
_GenerateOpenApiReferenceCode;
9+
_GenerateOpenApiCode;
1010
_CreateCompileItemsForOpenApiReferences
11-
</GenerateOpenApiReferenceCodeDependsOn>
11+
</GenerateOpenApiCodeDependsOn>
1212
</PropertyGroup>
1313

1414
<!-- OpenApiProjectReference support. -->
@@ -56,7 +56,7 @@
5656
<GetFileReferenceMetadata Inputs="@(OpenApiReference)"
5757
Extension="$(DefaultLanguageSourceExtension)"
5858
Namespace="$(RootNamespace)"
59-
OutputDirectory="$(OpenApiDefaultOutputDirectory)">
59+
OutputDirectory="$(OpenApiCodeDirectory)">
6060
<Output TaskParameter="Outputs" ItemName="_Temporary" />
6161
</GetFileReferenceMetadata>
6262

@@ -73,16 +73,16 @@
7373
</GetCurrentItems>
7474
</Target>
7575

76-
<Target Name="_InnerGenerateOpenApiReferenceCode" DependsOnTargets="_GetCurrentOpenApiReference;$(GeneratorTarget)" />
76+
<Target Name="_InnerGenerateOpenApiCode" DependsOnTargets="_GetCurrentOpenApiReference;$(GeneratorTarget)" />
7777

78-
<Target Name="_GenerateOpenApiReferenceCode"
79-
Condition="$(OpenApiGenerateAtDesignTime) OR ('$(DesignTimeBuild)' != 'true' AND '$(BuildingProject)' == 'true')"
78+
<Target Name="_GenerateOpenApiCode"
79+
Condition="$(OpenApiGenerateCodeAtDesignTime) OR ('$(DesignTimeBuild)' != 'true' AND '$(BuildingProject)' == 'true')"
8080
Inputs="@(OpenApiReference)"
8181
Outputs="%(OutputPath)">
8282
<MSBuild Projects="$(MSBuildProjectFullPath)"
8383
BuildInParallel="$(BuildInParallel)"
8484
Properties="GeneratorTargetPath=%(OpenApiReference.OutputPath);GeneratorTarget=Generate%(CodeGenerator);GeneratorMetadata=%(SerializedMetadata)"
85-
Targets="_InnerGenerateOpenApiReferenceCode" />
85+
Targets="_InnerGenerateOpenApiCode" />
8686
</Target>
8787

8888
<Target Name="_CreateCompileItemsForOpenApiReferences" Condition="'@(OpenApiReference)' != ''">
@@ -136,12 +136,12 @@
136136

137137
<!-- Main code generation entry point. -->
138138

139-
<Target Name="GenerateOpenApiReferenceCode" DependsOnTargets="$(GenerateOpenApiReferenceCodeDependsOn)" />
139+
<Target Name="GenerateOpenApiCode" DependsOnTargets="$(GenerateOpenApiCodeDependsOn)" />
140140

141141
<!-- Unless this is an inner build or default timing is disabled, tie code generation into the build. -->
142142

143-
<Target Name="_TieInGenerateOpenApiReferenceCode"
143+
<Target Name="_TieInGenerateOpenApiCode"
144144
BeforeTargets="BeforeCompile"
145-
Condition=" '$(OpenApiGenerateBeforeCompile)' == 'true' AND ('$(TargetFramework)' == '' OR '$(TargetFrameworks)' == '') "
146-
DependsOnTargets="GenerateOpenApiReferenceCode" />
145+
Condition=" '$(OpenApiGenerateCodeOnBuild)' == 'true' AND ('$(TargetFramework)' == '' OR '$(TargetFrameworks)' == '') "
146+
DependsOnTargets="GenerateOpenApiCode" />
147147
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?xml version="1.0" encoding="utf-8" standalone="no"?>
22
<Project>
3-
<Target Name="GenerateOpenApiReferenceCode">
3+
<Target Name="GenerateOpenApiCode">
44
<MSBuild Projects="$(MSBuildProjectFile)"
5-
Targets="GenerateOpenApiReferenceCode"
5+
Targets="GenerateOpenApiCode"
66
Properties="TargetFramework=$(TargetFrameworks.Split(';')[0])"
77
RemoveProperties="RuntimeIdentifier" />
88
</Target>
99

10-
<Target Name="_TieInGenerateOpenApiReferenceCode"
10+
<Target Name="_TieInGenerateOpenApiCode"
1111
BeforeTargets="BeforeCompile"
12-
Condition=" ''$(OpenApiGenerateBeforeCompile)' == 'true' "
13-
DependsOnTargets="GenerateOpenApiReferenceCode" />
12+
Condition=" ''$(OpenApiGenerateCodeOnBuild)' == 'true' "
13+
DependsOnTargets="GenerateOpenApiCode" />
1414
</Project>

0 commit comments

Comments
 (0)