diff options
author | Thomas <thomasbruggink@hotmail.com> | 2021-03-26 22:06:05 +0900 |
---|---|---|
committer | Jens Geyer <jensg@apache.org> | 2021-03-26 22:55:47 +0100 |
commit | 638ffbc5e6e4a74746ee7099f4365d85a6e1c52f (patch) | |
tree | 8dd3fd95a4e0cdc03cd53b98f3c02dea3b8f0105 /lib/netstd | |
parent | 2f158431656a59aa87fbe640562cc402da7a06d6 (diff) | |
download | thrift-638ffbc5e6e4a74746ee7099f4365d85a6e1c52f.tar.gz |
Fix netstd test lib build on non windows hosts
Client: netstd
Patch: Thomas Bruggink & Jens Geyer
This closes #2361
Diffstat (limited to 'lib/netstd')
-rw-r--r-- | lib/netstd/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj | 57 |
1 files changed, 38 insertions, 19 deletions
diff --git a/lib/netstd/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj b/lib/netstd/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj index 759c42fa8..103f315b6 100644 --- a/lib/netstd/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj +++ b/lib/netstd/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj @@ -19,8 +19,10 @@ --> <PropertyGroup> + <ThriftVersion>0.15.0</ThriftVersion> + <ThriftVersionOutput>Thrift version $(ThriftVersion)</ThriftVersionOutput> <TargetFramework>net5.0</TargetFramework> - <Version>0.15.0.0</Version> + <Version>$(ThriftVersion).0</Version> <AssemblyName>Thrift.PublicInterfaces.Compile.Tests</AssemblyName> <PackageId>Thrift.PublicInterfaces.Compile.Tests</PackageId> <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> @@ -38,27 +40,44 @@ </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="Exists('$(PathToThrift)')" Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./CassandraTest.thrift" /> - <Exec Condition="Exists('thrift')" Command="thrift -gen netstd:wcf,union,serial -r ./CassandraTest.thrift" /> - <Exec Condition="Exists('$(ProjectDir)/../../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../../compiler/cpp/thrift -gen netstd:wcf,union,serial -r ./CassandraTest.thrift" /> - <Exec Condition="Exists('$(PathToThrift)')" Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./optional_required_default.thrift" /> - <Exec Condition="Exists('thrift')" Command="thrift -gen netstd:wcf,union,serial -r ./optional_required_default.thrift" /> - <Exec Condition="Exists('$(ProjectDir)/../../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../../compiler/cpp/thrift -gen netstd:wcf,union,serial -r ./optional_required_default.thrift" /> - <Exec Condition="Exists('$(PathToThrift)')" Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./../../../../test/ThriftTest.thrift" /> - <Exec Condition="Exists('thrift')" Command="thrift -gen netstd:wcf,union,serial -r ./../../../../test/ThriftTest.thrift" /> - <Exec Condition="Exists('$(ProjectDir)/../../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../../compiler/cpp/thrift -gen netstd:wcf,union,serial -r ./../../../../test/ThriftTest.thrift" /> - <Exec Condition="Exists('$(PathToThrift)')" Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./../../../../contrib/fb303/if/fb303.thrift" /> - <Exec Condition="Exists('thrift')" Command="thrift -gen netstd:wcf,union,serial -r ./../../../../contrib/fb303/if/fb303.thrift" /> - <Exec Condition="Exists('$(ProjectDir)/../../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../../compiler/cpp/thrift -gen netstd:wcf,union,serial -r ./../../../../contrib/fb303/if/fb303.thrift" /> - <Exec Condition="Exists('$(PathToThrift)')" Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./Thrift5253.thrift" /> - <Exec Condition="Exists('thrift')" Command="thrift -gen netstd:wcf,union,serial -r ./Thrift5253.thrift" /> - <Exec Condition="Exists('$(ProjectDir)/../../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../../compiler/cpp/thrift -gen netstd:wcf,union,serial -r ./Thrift5253.thrift" /> - <Exec Condition="Exists('$(PathToThrift)')" Command="$(PathToThrift) -gen netstd:wcf,union,serial -r ./Thrift5320.thrift" /> - <Exec Condition="Exists('thrift')" Command="thrift -gen netstd:wcf,union,serial -r ./Thrift5320.thrift" /> - <Exec Condition="Exists('$(ProjectDir)/../../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../../compiler/cpp/thrift -gen netstd:wcf,union,serial -r ./Thrift5320.thrift" /> + <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 ./../../../../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" /> </Target> </Project> |