blob: 79224233bc809e61eb0229ada2587f0611be454b [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
Sven Roederer3caf9632024-07-16 14:46:18 +020010
Jens Geyeraa0c8b32019-01-28 23:27:45 +010011 http://www.apache.org/licenses/LICENSE-2.0
Sven Roederer3caf9632024-07-16 14:46:18 +020012
Jens Geyeraa0c8b32019-01-28 23:27:45 +010013 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">
Sven Roederer3caf9632024-07-16 14:46:18 +020049 <CreateProperty Condition="'$(OS)' == 'Windows_NT'" Value=".exe">
50 <Output TaskParameter="Value" PropertyName="EXECUTABLE_SUFFIX" />
51 </CreateProperty>
Thomas638ffbc2021-03-26 22:06:05 +090052 <!-- Check on the path -->
Sven Roederer3caf9632024-07-16 14:46:18 +020053 <Exec Condition="'$(OS)' == 'Windows_NT'" Command="where thrift" ConsoleToMSBuild="true" IgnoreExitCode="true">
Jens Geyeraa0c8b32019-01-28 23:27:45 +010054 <Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" />
55 </Exec>
Sven Roederer3caf9632024-07-16 14:46:18 +020056 <Exec Condition="'$(OS)' != 'Windows_NT'" Command="which thrift" ConsoleToMSBuild="true" IgnoreExitCode="true">
Thomas638ffbc2021-03-26 22:06:05 +090057 <Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" />
58 </Exec>
59 <!-- Check in the current directory -->
Sven Roederer3caf9632024-07-16 14:46:18 +020060 <CreateProperty Condition="Exists('thrift$(EXECUTABLE_SUFFIX)')" Value="thrift$(EXECUTABLE_SUFFIX)">
Thomas638ffbc2021-03-26 22:06:05 +090061 <Output TaskParameter="Value" PropertyName="PathToThrift" />
62 </CreateProperty>
63 <!-- Check for the root projects output -->
Sven Roederer3caf9632024-07-16 14:46:18 +020064 <CreateProperty Condition="Exists('$(ProjectDir)/../../../../compiler/cpp/thrift$(EXECUTABLE_SUFFIX)')" Value="$(ProjectDir)/../../../../compiler/cpp/thrift$(EXECUTABLE_SUFFIX)">
Thomas638ffbc2021-03-26 22:06:05 +090065 <Output TaskParameter="Value" PropertyName="PathToThrift" />
66 </CreateProperty>
Jens Geyer4c7b9fd2021-12-04 22:48:37 +010067 <Error Condition="!Exists('$(PathToThrift)')" Text="Thrift executable could not be found." />
Thomas638ffbc2021-03-26 22:06:05 +090068 <!-- Make sure the thrift version found is the same as the projects version -->
69 <Exec Command="$(PathToThrift) -version" ConsoleToMSBuild="true">
70 <Output TaskParameter="ConsoleOutput" PropertyName="ThriftBinaryVersion" />
71 </Exec>
Jens Geyer4c7b9fd2021-12-04 22:48:37 +010072 <Error Condition="$('$(ThriftBinaryVersion)'::StartsWith('$(ThriftVersionOutput)')) == true" Text="Thrift version returned: '$(ThriftBinaryVersion)' is not equal to the projects version '$(ThriftVersionOutput)'." />
73 <Message Importance="high" Text="Generating tests with thrift binary: '$(PathToThrift)'" />
Thomas638ffbc2021-03-26 22:06:05 +090074 <!-- Generate the thrift test files -->
Jens Geyer4115e952023-11-21 23:00:01 +010075 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./CassandraTest.thrift" />
76 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./optional_required_default.thrift" />
77 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./name_conflicts.thrift" />
78 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./../../../../test/ThriftTest.thrift" />
79 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./../../../../contrib/fb303/if/fb303.thrift" />
80 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./Thrift5253.thrift" />
81 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./Thrift5320.thrift" />
82 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./Thrift5382.thrift" />
Jens Geyer5b9ae5e2024-07-18 03:20:40 +020083 <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./Thrift5795.thrift" />
Sven Roederer3caf9632024-07-16 14:46:18 +020084 <!-- special options (see ticket) -->
85 <Exec Command="$(PathToThrift) -gen netstd -r ./Thrift5794-netstd.thrift" />
86 <Exec Command="$(PathToThrift) -gen netstd:net6 -r ./Thrift5794-net6.thrift" />
87 <Exec Command="$(PathToThrift) -gen netstd:net8 -r ./Thrift5794-net8.thrift" />
Jens Geyeraa0c8b32019-01-28 23:27:45 +010088 </Target>
89
90</Project>