blob: e96d2fe3ac82014f2f91962c4140acad389c841b [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>
Jens Geyer75cf93e2024-02-04 14:50:37 +010022 <ThriftVersion>0.21.0</ThriftVersion>
Thomas638ffbc2021-03-26 22:06:05 +090023 <ThriftVersionOutput>Thrift version $(ThriftVersion)</ThriftVersionOutput>
Jens Geyer4115e952023-11-21 23:00:01 +010024 <TargetFramework>net8.0</TargetFramework>
25 <LangVersion>latestMajor</LangVersion>
Thomas638ffbc2021-03-26 22:06:05 +090026 <Version>$(ThriftVersion).0</Version>
Jens Geyeraa0c8b32019-01-28 23:27:45 +010027 <AssemblyName>Thrift.PublicInterfaces.Compile.Tests</AssemblyName>
28 <PackageId>Thrift.PublicInterfaces.Compile.Tests</PackageId>
29 <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
30 <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
31 <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
32 <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
Jens Geyer98a23252022-01-09 16:50:52 +010033 <Nullable>enable</Nullable>
Jens Geyeraa0c8b32019-01-28 23:27:45 +010034 </PropertyGroup>
35
36 <ItemGroup>
37 <ProjectReference Include="../../Thrift/Thrift.csproj" />
38 </ItemGroup>
39
40 <ItemGroup>
Jens Geyer03413232024-05-01 18:49:15 +020041 <PackageReference Include="System.ServiceModel.Primitives" Version="8.0.0" />
Jens Geyer4c7b9fd2021-12-04 22:48:37 +010042 </ItemGroup>
43
44 <ItemGroup>
Jens Geyer51fc54f2023-02-14 23:51:16 +010045 <PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
Jens Geyeraa0c8b32019-01-28 23:27:45 +010046 </ItemGroup>
47
48 <Target Name="PreBuild" BeforeTargets="_GenerateRestoreProjectSpec;Restore;Compile">
Thomas638ffbc2021-03-26 22:06:05 +090049 <!-- Check on the path -->
Jens Geyeraa0c8b32019-01-28 23:27:45 +010050 <Exec Condition="'$(OS)' == 'Windows_NT'" Command="where thrift" ConsoleToMSBuild="true">
51 <Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" />
52 </Exec>
Thomas638ffbc2021-03-26 22:06:05 +090053 <Exec Condition="'$(OS)' != 'Windows_NT'" Command="which thrift || true" ConsoleToMSBuild="true">
54 <Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" />
55 </Exec>
56 <!-- Check in the current directory -->
57 <CreateProperty Condition="Exists('thrift')" Value="thrift">
58 <Output TaskParameter="Value" PropertyName="PathToThrift" />
59 </CreateProperty>
60 <!-- Check for the root projects output -->
61 <CreateProperty Condition="Exists('$(ProjectDir)/../../../../compiler/cpp/thrift')" Value="$(ProjectDir)/../../../../compiler/cpp/thrift">
62 <Output TaskParameter="Value" PropertyName="PathToThrift" />
63 </CreateProperty>
Jens Geyer4c7b9fd2021-12-04 22:48:37 +010064 <Error Condition="!Exists('$(PathToThrift)')" Text="Thrift executable could not be found." />
Thomas638ffbc2021-03-26 22:06:05 +090065 <!-- Make sure the thrift version found is the same as the projects version -->
66 <Exec Command="$(PathToThrift) -version" ConsoleToMSBuild="true">
67 <Output TaskParameter="ConsoleOutput" PropertyName="ThriftBinaryVersion" />
68 </Exec>
Jens Geyer4c7b9fd2021-12-04 22:48:37 +010069 <Error Condition="$('$(ThriftBinaryVersion)'::StartsWith('$(ThriftVersionOutput)')) == true" Text="Thrift version returned: '$(ThriftBinaryVersion)' is not equal to the projects version '$(ThriftVersionOutput)'." />
70 <Message Importance="high" Text="Generating tests with thrift binary: '$(PathToThrift)'" />
Thomas638ffbc2021-03-26 22:06:05 +090071 <!-- Generate the thrift test files -->
Jens Geyer4115e952023-11-21 23:00:01 +010072 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./CassandraTest.thrift" />
73 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./optional_required_default.thrift" />
74 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./name_conflicts.thrift" />
75 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./../../../../test/ThriftTest.thrift" />
76 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./../../../../contrib/fb303/if/fb303.thrift" />
77 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./Thrift5253.thrift" />
78 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./Thrift5320.thrift" />
79 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./Thrift5382.thrift" />
Jens Geyeraa0c8b32019-01-28 23:27:45 +010080 </Target>
81
82</Project>