summaryrefslogtreecommitdiff
path: root/lib/netstd/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj
blob: bb93894db8f90d8d5e8860febe935ad959644264 (plain)
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
<Project Sdk="Microsoft.NET.Sdk">
  <!--
    Licensed to the Apache Software Foundation(ASF) under one
    or more contributor license agreements.See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License. You may obtain a copy of the License at
    
  	  http://www.apache.org/licenses/LICENSE-2.0
    
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied. See the License for the
    specific language governing permissions and limitations
    under the License.
  -->

  <PropertyGroup>
    <ThriftVersion>0.15.0</ThriftVersion>
    <ThriftVersionOutput>Thrift version $(ThriftVersion)</ThriftVersionOutput>
    <TargetFramework>net5.0</TargetFramework>
    <Version>$(ThriftVersion).0</Version>
    <AssemblyName>Thrift.PublicInterfaces.Compile.Tests</AssemblyName>
    <PackageId>Thrift.PublicInterfaces.Compile.Tests</PackageId>
    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
    <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="../../Thrift/Thrift.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="System.ServiceModel.Primitives" Version="4.8.1" />
  </ItemGroup>

  <Target Name="PreBuild" BeforeTargets="_GenerateRestoreProjectSpec;Restore;Compile">
    <!-- Check on the path -->
    <Exec Condition="'$(OS)' == 'Windows_NT'" Command="where thrift" ConsoleToMSBuild="true">
      <Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" />
    </Exec>
    <Exec Condition="'$(OS)' != 'Windows_NT'" Command="which thrift || true" ConsoleToMSBuild="true">
      <Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" />
    </Exec>
    <!-- Check in the current directory -->
    <CreateProperty Condition="Exists('thrift')" Value="thrift">
      <Output TaskParameter="Value" PropertyName="PathToThrift" />
    </CreateProperty>
    <!-- Check for the root projects output -->
    <CreateProperty Condition="Exists('$(ProjectDir)/../../../../compiler/cpp/thrift')" Value="$(ProjectDir)/../../../../compiler/cpp/thrift">
      <Output TaskParameter="Value" PropertyName="PathToThrift" />
    </CreateProperty>
    <Error 
      Condition="!Exists('$(PathToThrift)')"
      Text="Thrift executable could not be found."
    />
    <!-- Make sure the thrift version found is the same as the projects version -->
    <Exec Command="$(PathToThrift) -version" ConsoleToMSBuild="true">
      <Output TaskParameter="ConsoleOutput" PropertyName="ThriftBinaryVersion" />
    </Exec>
    <Error 
      Condition="$('$(ThriftBinaryVersion)'::StartsWith('$(ThriftVersionOutput)')) == true"
      Text="Thrift version returned: '$(ThriftBinaryVersion)' is not equal to the projects version '$(ThriftVersionOutput)'."
    />
    <Message
      Importance="high"
      Text="Generating tests with thrift binary: '$(PathToThrift)'"
    />
    <!-- Generate the thrift test files -->
    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./CassandraTest.thrift" />
    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./optional_required_default.thrift" />
    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./name_conflicts.thrift" />
    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./../../../../test/ThriftTest.thrift" />
    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./../../../../contrib/fb303/if/fb303.thrift" />
    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./Thrift5253.thrift" />
    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./Thrift5320.thrift" />
    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./Thrift5382.thrift" />
  </Target>

</Project>