Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 1 | <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> |
Thomas | 638ffbc | 2021-03-26 22:06:05 +0900 | [diff] [blame] | 22 | <ThriftVersion>0.15.0</ThriftVersion> |
| 23 | <ThriftVersionOutput>Thrift version $(ThriftVersion)</ThriftVersionOutput> |
Jens Geyer | 526a1ac | 2021-02-13 13:58:09 +0100 | [diff] [blame] | 24 | <TargetFramework>net5.0</TargetFramework> |
Thomas | 638ffbc | 2021-03-26 22:06:05 +0900 | [diff] [blame] | 25 | <Version>$(ThriftVersion).0</Version> |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 26 | <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 Geyer | 526a1ac | 2021-02-13 13:58:09 +0100 | [diff] [blame] | 39 | <PackageReference Include="System.ServiceModel.Primitives" Version="4.8.1" /> |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 40 | </ItemGroup> |
| 41 | |
| 42 | <Target Name="PreBuild" BeforeTargets="_GenerateRestoreProjectSpec;Restore;Compile"> |
Thomas | 638ffbc | 2021-03-26 22:06:05 +0900 | [diff] [blame] | 43 | <!-- Check on the path --> |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 44 | <Exec Condition="'$(OS)' == 'Windows_NT'" Command="where thrift" ConsoleToMSBuild="true"> |
| 45 | <Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" /> |
| 46 | </Exec> |
Thomas | 638ffbc | 2021-03-26 22:06:05 +0900 | [diff] [blame] | 47 | <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" /> |
Thomas | fafcea7 | 2021-03-27 16:07:13 +0900 | [diff] [blame^] | 81 | <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./Thrift5382.thrift" /> |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 82 | </Target> |
| 83 | |
| 84 | </Project> |