forked from googleapis/google-api-dotnet-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeneratedLibraries.proj
More file actions
136 lines (108 loc) · 5.12 KB
/
GeneratedLibraries.proj
File metadata and controls
136 lines (108 loc) · 5.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<Project ToolsVersion="12.0" DefaultTargets="Package" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
This project file requires that 'nuget' and 'python' (version 2)
be in the user's %PATH%.
Targets other than 'Build' support very primitive incrementality: if the
folder they're going to create is already there, they are skipped.
To build libraries and create packages from existing code:
msbuild GeneratedLibraries.proj
To update discovery documents and generate new code:
msbuild GeneratedLibraries.proj /t:GenerateFromScratch
To update discovery documents, code, and packages:
msbuild GeneratedLibraries.proj /t:PackageFromScratch
-->
<!-- Download discovery documents used as input to code generation. -->
<Target Name="DownloadDiscoveryDocuments"
Condition="!Exists('DiscoveryJson')">
<MakeDir Directories="DiscoveryJson" />
<!-- 'python -u' turns off buffering so status is printed line-by-line. -->
<Exec Command="python -u get_discovery_documents.py --destination_dir .\DiscoveryJson" />
</Target>
<!-- Generate library projects from discovery documents. -->
<Target Name="Generate" DependsOnTargets="DownloadDiscoveryDocuments"
Condition="!Exists('Src\Generated')">
<PropertyGroup>
<_GenerateLibraryTool>ClientGenerator\generate_library.cmd</_GenerateLibraryTool>
</PropertyGroup>
<ItemGroup>
<_DiscoveryDocument Include="DiscoveryJson\*.json" />
</ItemGroup>
<MakeDir Directories="Src\Generated" />
<Exec Command=""$(_GenerateLibraryTool)" --input="%(_DiscoveryDocument.FullPath)" --language=csharp --output_dir=Src\Generated" />
</Target>
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">ReleaseSigned</Configuration>
</PropertyGroup>
<!-- Warnings to disable -->
<PropertyGroup>
<!-- XML comment on 'construct' has badly formed XML — 'reason' -->
<NoWarn>$(NoWarn);1570</NoWarn>
<!-- XML comment is not placed on a valid language element -->
<NoWarn>$(NoWarn);1587</NoWarn>
<!-- Missing XML comment for publicly visible type or member 'Type_or_Member' -->
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
<!--
Create a list of generated projects. This has to be done in a target,
rather than at toplevel, because these projects don't exist until
the Generate target has run.
-->
<Target Name="BuildProjectList">
<!-- Generated libraries that don't compile -->
<ItemGroup>
<!-- Last released May 2015 (1.9.0.1030) -->
<BrokenProject Include="Src\Generated\Google.Apis.Games.v1\**" />
<!-- Last released April 2014 (1.8.1.1750) -->
<BrokenProject Include="Src\Generated\Google.Apis.IdentityToolkit.v3\**" />
<!-- Last released Jan 2015 (1.9.0.860) -->
<BrokenProject Include="Src\Generated\Google.Apis.Oauth2.v1\**" />
</ItemGroup>
<!-- All generated libraries except the broken ones listed above -->
<ItemGroup>
<Project Include="Src\Generated\**\*.csproj" Exclude="@(BrokenProject)">
<!--
TODO(mmdriley): Maybe we should add this metadata in the Build target?
-->
<AdditionalProperties>
Configuration=$(Configuration);
NoWarn=$(NoWarn)
</AdditionalProperties>
</Project>
</ItemGroup>
</Target>
<!--
Build generated projects.
This target isn't gated by a !Exists condition; instead we rely on C#'s
incremental build.
-->
<Target Name="Build" DependsOnTargets="Generate;BuildProjectList">
<!--
We only need to restore packages for one API, since they have identical
packages.config. The choice of the discovery API is mostly arbitrary;
it's an API that's always likely to be there.
-->
<Exec Command="nuget restore Src\Generated\Google.Apis.Discovery.v1\Profile259\packages.config -PackagesDirectory Src\Generated\packages" />
<Exec Command="nuget restore Src\Generated\Google.Apis.Discovery.v1\Profile328\packages.config -PackagesDirectory Src\Generated\packages" />
<MSBuild Projects="@(Project)" BuildInParallel="True" Targets="Build" />
</Target>
<!-- Create NuGet packages with binaries built from generated projects. -->
<Target Name="Package" DependsOnTargets="Build;BuildProjectList"
Condition="!Exists('NuPkgs\Generated')">
<MakeDir Directories="NuPkgs\Generated" />
<ItemGroup>
<NuSpec Include="Src\Generated\*\*.nuspec" Exclude="@(BrokenProject)" />
</ItemGroup>
<Exec Command="nuget pack "%(NuSpec.FullPath)" -OutputDirectory NuPkgs\Generated" />
</Target>
<!-- Remove all downloaded and generated artifacts. -->
<Target Name="Reset">
<RemoveDir Directories="DiscoveryJson;Src\Generated;NuPkgs\Generated" />
</Target>
<Target Name="CleanGenerated">
<RemoveDir Directories="Src\Generated;NuPkgs\Generated" />
</Target>
<Target Name="Regenerate" DependsOnTargets="CleanGenerated;Generate" />
<!-- Some common bundled targets. -->
<Target Name="GenerateFromScratch" DependsOnTargets="Reset;Generate" />
<Target Name="PackageFromScratch" DependsOnTargets="Reset;Package" />
</Project>