-
Notifications
You must be signed in to change notification settings - Fork 41
/
cassandra-sharp.targets
181 lines (146 loc) · 9.82 KB
/
cassandra-sharp.targets
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<Project ToolsVersion="4.0" DefaultTargets="Compile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="ThirdParties\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<Target Name="ReadVersions">
<XSLTransformation XslInputPath="Changes.xslt" XmlInputPaths="Version.xml" OutputPaths="CHANGES.txt" />
<XmlQuery XmlFileName="Version.xml" XPath="/version/cassandra-sharp-interfaces/@version">
<Output TaskParameter="Values" PropertyName="ApiVersion" />
</XmlQuery>
<XmlQuery XmlFileName="Version.xml" XPath="/version/cassandra-sharp-interfaces/@status">
<Output TaskParameter="Values" PropertyName="ApiStatus" />
</XmlQuery>
<XmlQuery XmlFileName="Version.xml" XPath="/version/cassandra-sharp/@version">
<Output TaskParameter="Values" PropertyName="CoreVersion" />
</XmlQuery>
<XmlQuery XmlFileName="Version.xml" XPath="/version/cassandra-sharp/@state">
<Output TaskParameter="Values" PropertyName="CoreStatus" />
</XmlQuery>
<XmlQuery XmlFileName="CassandraSharp/packages.config" XPath="/packages/package[@id='System.Reactive.Core']/@version">
<Output TaskParameter="Values" PropertyName="RxCoreVersion" />
</XmlQuery>
<XmlQuery XmlFileName="CassandraSharp/packages.config" XPath="/packages/package[@id='System.Reactive.Interfaces']/@version">
<Output TaskParameter="Values" PropertyName="RxInterfacesVersion" />
</XmlQuery>
<XmlQuery XmlFileName="CassandraSharp/packages.config" XPath="/packages/package[@id='System.Reactive.Linq']/@version">
<Output TaskParameter="Values" PropertyName="RxLinqVersion" />
</XmlQuery>
<XmlQuery XmlFileName="CassandraSharp/packages.config" XPath="/packages/package[@id='System.Reactive']/@version">
<Output TaskParameter="Values" PropertyName="RxMainVersion" />
</XmlQuery>
<XmlQuery XmlFileName="CassandraSharp/packages.config" XPath="/packages/package[@id='System.Reactive.PlatformServices']/@version">
<Output TaskParameter="Values" PropertyName="RxPlatformServicesVersion" />
</XmlQuery>
<XmlPeek XmlInputPath="Version.xml" Query="/version/changes/change[@id='$(CoreVersion)']/text()">
<Output TaskParameter="Result" PropertyName="ReleaseNotes" />
</XmlPeek>
<Message Text="BEGIN" />
<Message Text="ReleaseNotes: $(ReleaseNotes)" />
<Message Text="System.Reactive.Core: $(RxCoreVersion)" />
<Message Text="System.Reactive.Interfaces: $(RxInterfacesVersion)" />
<Message Text="System.Reactive.Linq: $(RxLinqVersion)" />
<Message Text="System.Reactive: $(RxMainVersion)" />
<Message Text="System.Reactive.PlatformServices: $(RxPlatformServicesVersion)" />
<Message Text="END" />
</Target>
<PropertyGroup>
<BinDir>bin</BinDir>
<ObjDir>obj</ObjDir>
<OutDir>OutDir</OutDir>
<ZipDir>$(OutDir)\Zip</ZipDir>
</PropertyGroup>
<PropertyGroup>
<NuGet>.nuget\NuGet.exe</NuGet>
<ApiProjectName>cassandra-sharp-interfaces</ApiProjectName>
<CoreProjectName>cassandra-sharp-core</CoreProjectName>
<MainProjectName>cassandra-sharp</MainProjectName>
<ToolsProjectName>cassandra-sharp-tools</ToolsProjectName>
<NuGetRootDir>$(OutDir)\NuGet</NuGetRootDir>
<NuGetApiPackageDir>$(NuGetRootDir)\$(ApiProjectName)</NuGetApiPackageDir>
<NuGetCorePackageDir>$(NuGetRootDir)\$(CoreProjectName)</NuGetCorePackageDir>
<NuGetMainPackageDir>$(NuGetRootDir)\$(MainProjectName)</NuGetMainPackageDir>
<NuGetToolsPackageDir>$(NuGetRootDir)\$(ToolsProjectName)</NuGetToolsPackageDir>
</PropertyGroup>
<PropertyGroup>
<Thrift>ThirdParties\Thrift\thrift-0.9.0.exe</Thrift>
<ThriftInput>Apache.Cassandra\cassandra.thrift</ThriftInput>
<ThriftOutput>Apache.Cassandra</ThriftOutput>
</PropertyGroup>
<ItemGroup>
<ApiFiles-net45 Include="bin\net45\$(Configuration)\CassandraSharp.Interfaces.dll" />
<ApiFiles-net45 Include="bin\net45\$(Configuration)\CassandraSharp.Interfaces.pdb" />
</ItemGroup>
<ItemGroup>
<CoreFiles-net45 Include="bin\net45\$(Configuration)\CassandraSharp.dll" />
<CoreFiles-net45 Include="bin\net45\$(Configuration)\CassandraSharp.pdb" />
</ItemGroup>
<ItemGroup>
<ToolsFiles-net45 Include="bin\net45\$(Configuration)\cqlplus.exe" />
<ToolsFiles-net45 Include="bin\net45\$(Configuration)\cqlplus.pdb" />
</ItemGroup>
<Target Name="Clean">
<Exec Command="rmdir /q /s $(ThriftOutput)\gen-csharp" />
<Exec Command="rmdir /q /s $(OutDir)" />
<Exec Command="rmdir /q /s $(BinDir)" />
<Exec Command="rmdir /q /s $(ObjDir)" />
<MakeDir Directories="$(OutDir)" />
</Target>
<Target Name="GenerateAssemblyInfo">
<AssemblyInfo CodeLanguage="CS"
AssemblyVersion="$(ApiVersion)"
OutputFile="$(ApiProjectName)-AssemblyInfo.cs" />
<AssemblyInfo CodeLanguage="CS"
AssemblyVersion="$(CoreVersion)"
OutputFile="$(MainProjectName)-AssemblyInfo.cs" />
</Target>
<Target Name="GenerateThrift">
<Exec Command="$(Thrift) -o $(ThriftOutput) --gen csharp $(ThriftInput)" />
</Target>
<Target Name="Compile" DependsOnTargets="GenerateAssemblyInfo;GenerateThrift">
<MSBuild Projects="$(MainProjectName).sln" />
</Target>
<Target Name="BuildNuGetPackages" DependsOnTargets="Clean;Compile">
<ItemGroup>
<RxFiles-net45 Include="packages\System.Reactive.Core.$(RxCoreVersion)\lib\Net45\System.Reactive.Core.dll" />
<RxFiles-net45 Include="packages\System.Reactive.Interfaces.$(RxInterfacesVersion)\lib\Net45\System.Reactive.Interfaces.dll" />
<RxFiles-net45 Include="packages\System.Reactive.Linq.$(RxLinqVersion)\lib\Net45\System.Reactive.Linq.dll" />
<RxFiles-net45 Include="packages\System.Reactive.PlatformServices.$(RxPlatformServicesVersion)\lib\Net45\System.Reactive.PlatformServices.dll" />
</ItemGroup>
<Copy SourceFiles="@(ApiFiles-net45)" DestinationFolder="$(NuGetApiPackageDir)\lib\net45" />
<Copy SourceFiles="CHANGES.txt" DestinationFolder="$(NuGetApiPackageDir)" />
<Copy SourceFiles="$(ApiProjectName).nuspec" DestinationFolder="$(NuGetApiPackageDir)" />
<XmlPoke XmlInputPath="$(NuGetApiPackageDir)\$(ApiProjectName).nuspec" Query="/package/metadata/version" Value="$(ApiVersion)$(ApiStatus)" />
<XmlPoke XmlInputPath="$(NuGetApiPackageDir)\$(ApiProjectName).nuspec" Query="/package/metadata/releaseNotes" Value="$(ReleaseNotes)" />
<Exec Command="$(NuGet) pack $(NuGetApiPackageDir)\$(ApiProjectName).nuspec -OutputDirectory $(OutDir)" />
<Copy SourceFiles="@(CoreFiles-net45)" DestinationFolder="$(NuGetCorePackageDir)\lib\net45" />
<Copy SourceFiles="CHANGES.txt" DestinationFolder="$(NuGetCorePackageDir)" />
<Copy SourceFiles="$(CoreProjectName).nuspec" DestinationFolder="$(NuGetCorePackageDir)" />
<XmlPoke XmlInputPath="$(NuGetCorePackageDir)\$(CoreProjectName).nuspec" Query="/package/metadata/version" Value="$(CoreVersion)$(CoreStatus)" />
<XmlPoke XmlInputPath="$(NuGetCorePackageDir)\$(CoreProjectName).nuspec" Query="/package/metadata/dependencies/dependency[@id='System.Reactive']/@version" Value="$(RxMainVersion).0" />
<XmlPoke XmlInputPath="$(NuGetCorePackageDir)\$(CoreProjectName).nuspec" Query="/package/metadata/releaseNotes" Value="$(ReleaseNotes)" />
<Exec Command="$(NuGet) pack $(NuGetCorePackageDir)\$(CoreProjectName).nuspec -OutputDirectory $(OutDir)" />
<Copy SourceFiles="CHANGES.txt" DestinationFolder="$(NuGetMainPackageDir)" />
<Copy SourceFiles="InstallationDummyFile.txt" DestinationFolder="$(NuGetMainPackageDir)\content" />
<Copy SourceFiles="Install.ps1" DestinationFolder="$(NuGetMainPackageDir)\tools" />
<Copy SourceFiles="$(MainProjectName).nuspec" DestinationFolder="$(NuGetMainPackageDir)" />
<XmlPoke XmlInputPath="$(NuGetMainPackageDir)\$(MainProjectName).nuspec" Query="/package/metadata/version" Value="$(CoreVersion)$(CoreStatus)" />
<XmlPoke XmlInputPath="$(NuGetMainPackageDir)\$(MainProjectName).nuspec" Query="/package/metadata/dependencies/dependency[@id='cassandra-sharp-interfaces']/@version" Value="$(ApiVersion)$(ApiStatus)" />
<XmlPoke XmlInputPath="$(NuGetMainPackageDir)\$(MainProjectName).nuspec" Query="/package/metadata/dependencies/dependency[@id='cassandra-sharp-core']/@version" Value="$(CoreVersion)$(CoreStatus)" />
<XmlPoke XmlInputPath="$(NuGetMainPackageDir)\$(MainProjectName).nuspec" Query="/package/metadata/releaseNotes" Value="$(ReleaseNotes)" />
<Exec Command="$(NuGet) pack $(NuGetMainPackageDir)\$(MainProjectName).nuspec -OutputDirectory $(OutDir)" />
<Copy SourceFiles="@(CoreFiles-net45)" DestinationFolder="$(NuGetToolsPackageDir)\lib\net45" />
<Copy SourceFiles="@(ToolsFiles-net45)" DestinationFolder="$(NuGetToolsPackageDir)\lib\net45" />
<Copy SourceFiles="@(RxFiles-net45)" DestinationFolder="$(NuGetToolsPackageDir)\lib\net45" />
<Copy SourceFiles="CHANGES.txt" DestinationFolder="$(NuGetToolsPackageDir)" />
<Copy SourceFiles="$(ToolsProjectName).nuspec" DestinationFolder="$(NuGetToolsPackageDir)" />
<XmlPoke XmlInputPath="$(NuGetToolsPackageDir)\$(ToolsProjectName).nuspec" Query="/package/metadata/version" Value="$(CoreVersion)$(CoreStatus)" />
<XmlPoke XmlInputPath="$(NuGetToolsPackageDir)\$(ToolsProjectName).nuspec" Query="/package/metadata/releaseNotes" Value="$(ReleaseNotes)" />
<Exec Command="$(NuGet) pack $(NuGetToolsPackageDir)\$(ToolsProjectName).nuspec -OutputDirectory $(OutDir)" />
</Target>
<Target Name="GenerateVersion" DependsOnTargets="ReadVersions;BuildNuGetPackages">
</Target>
<Target Name="Publish" DependsOnTargets="ReadVersions">
<Exec Command="$(NuGet) push $(OutDir)\$(ApiProjectName).$(ApiVersion)$(ApiStatus).nupkg" ContinueOnError="true" />
<Exec Command="$(NuGet) push $(OutDir)\$(CoreProjectName).$(CoreVersion)$(CoreStatus).nupkg" ContinueOnError="true" />
<Exec Command="$(NuGet) push $(OutDir)\$(MainProjectName).$(CoreVersion)$(CoreStatus).nupkg" ContinueOnError="true" />
<Exec Command="$(NuGet) push $(OutDir)\$(ToolsProjectName).$(CoreVersion)$(CoreStatus).nupkg" ContinueOnError="true" />
</Target>
</Project>