blob: d34c60afe3dd2942dcf6de128211dc4ddb68ab83 [file] [log] [blame]
Jens Geyeraa0c8b32019-01-28 23:27:45 +01001<Project Sdk="Microsoft.NET.Sdk">
2 <!--
3 Licensed to the Apache Software Foundation(ASF) under one
4 or more contributor license agreements.See the NOTICE file
5 distributed with this work for additional information
6 regarding copyright ownership.The ASF licenses this file
7 to you under the Apache License, Version 2.0 (the
8 "License"); you may not use this file except in compliance
9 with the License. You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing,
14 software distributed under the License is distributed on an
15 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 KIND, either express or implied. See the License for the
17 specific language governing permissions and limitations
18 under the License.
19 -->
20
21 <PropertyGroup>
Thomas638ffbc2021-03-26 22:06:05 +090022 <ThriftVersion>0.15.0</ThriftVersion>
23 <ThriftVersionOutput>Thrift version $(ThriftVersion)</ThriftVersionOutput>
Jens Geyer526a1ac2021-02-13 13:58:09 +010024 <TargetFramework>net5.0</TargetFramework>
Thomas638ffbc2021-03-26 22:06:05 +090025 <Version>$(ThriftVersion).0</Version>
Jens Geyeraa0c8b32019-01-28 23:27:45 +010026 <AssemblyName>Thrift.PublicInterfaces.Compile.Tests</AssemblyName>
27 <PackageId>Thrift.PublicInterfaces.Compile.Tests</PackageId>
28 <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
29 <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
30 <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
31 <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
32 </PropertyGroup>
33
34 <ItemGroup>
35 <ProjectReference Include="../../Thrift/Thrift.csproj" />
36 </ItemGroup>
37
38 <ItemGroup>
Jens Geyer526a1ac2021-02-13 13:58:09 +010039 <PackageReference Include="System.ServiceModel.Primitives" Version="4.8.1" />
Jens Geyeraa0c8b32019-01-28 23:27:45 +010040 </ItemGroup>
41
42 <Target Name="PreBuild" BeforeTargets="_GenerateRestoreProjectSpec;Restore;Compile">
Thomas638ffbc2021-03-26 22:06:05 +090043 <!-- Check on the path -->
Jens Geyeraa0c8b32019-01-28 23:27:45 +010044 <Exec Condition="'$(OS)' == 'Windows_NT'" Command="where thrift" ConsoleToMSBuild="true">
45 <Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" />
46 </Exec>
Thomas638ffbc2021-03-26 22:06:05 +090047 <Exec Condition="'$(OS)' != 'Windows_NT'" Command="which thrift || true" ConsoleToMSBuild="true">
48 <Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" />
49 </Exec>
50 <!-- Check in the current directory -->
51 <CreateProperty Condition="Exists('thrift')" Value="thrift">
52 <Output TaskParameter="Value" PropertyName="PathToThrift" />
53 </CreateProperty>
54 <!-- Check for the root projects output -->
55 <CreateProperty Condition="Exists('$(ProjectDir)/../../../../compiler/cpp/thrift')" Value="$(ProjectDir)/../../../../compiler/cpp/thrift">
56 <Output TaskParameter="Value" PropertyName="PathToThrift" />
57 </CreateProperty>
58 <Error
59 Condition="!Exists('$(PathToThrift)')"
60 Text="Thrift executable could not be found."
61 />
62 <!-- Make sure the thrift version found is the same as the projects version -->
63 <Exec Command="$(PathToThrift) -version" ConsoleToMSBuild="true">
64 <Output TaskParameter="ConsoleOutput" PropertyName="ThriftBinaryVersion" />
65 </Exec>
66 <Error
67 Condition="$('$(ThriftBinaryVersion)'::StartsWith('$(ThriftVersionOutput)')) == true"
68 Text="Thrift version returned: '$(ThriftBinaryVersion)' is not equal to the projects version '$(ThriftVersionOutput)'."
69 />
70 <Message
71 Importance="high"
72 Text="Generating tests with thrift binary: '$(PathToThrift)'"
73 />
74 <!-- Generate the thrift test files -->
75 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./CassandraTest.thrift" />
76 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./optional_required_default.thrift" />
77 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./../../../../test/ThriftTest.thrift" />
78 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./../../../../contrib/fb303/if/fb303.thrift" />
79 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./Thrift5253.thrift" />
80 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./Thrift5320.thrift" />
Thomasfafcea72021-03-27 16:07:13 +090081 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./Thrift5382.thrift" />
Jens Geyeraa0c8b32019-01-28 23:27:45 +010082 </Target>
83
84</Project>