blob: 842f2de6180b15d0e7f810515633bf1bf545a62a [file] [log] [blame]
Jens Geyera7da4882013-07-18 00:33:05 +02001#
2# Licensed to the Apache Software Foundation (ASF) under one
3# or more contributor license agreements. See the NOTICE file
4# distributed with this work for additional information
5# regarding copyright ownership. The ASF licenses this file
6# to you under the Apache License, Version 2.0 (the
7# "License"); you may not use this file except in compliance
8# with the License. You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing,
13# software distributed under the License is distributed on an
14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15# KIND, either express or implied. See the License for the
16# specific language governing permissions and limitations
17# under the License.
18#
19
taozle5c302e02017-07-23 15:21:44 +020020if GOVERSION_LT_17
21COMPILER_EXTRAFLAG=",legacy_context"
22endif
23
taozle5c302e02017-07-23 15:21:44 +020024THRIFTARGS = -out gopath/src/ --gen go:thrift_import=thrift$(COMPILER_EXTRAFLAG)
Jens Geyera7da4882013-07-18 00:33:05 +020025THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift
26
27# Thrift for GO has problems with complex map keys: THRIFT-2063
Roger Meier41ad4342015-03-24 22:30:40 +010028gopath: $(THRIFT) $(THRIFTTEST) \
Jens Geyer79f988c2014-10-03 20:42:54 +020029 IncludesTest.thrift \
30 NamespacedTest.thrift \
31 MultiplexedProtocolTest.thrift \
32 OnewayTest.thrift \
33 OptionalFieldsTest.thrift \
34 ServicesTest.thrift \
35 GoTagTest.thrift \
36 TypedefFieldTest.thrift \
Jens Geyer527b6d92014-11-30 15:07:18 +010037 RefAnnotationFieldsTest.thrift \
Jens Geyer0f17e152015-09-15 21:22:42 +020038 UnionDefaultValueTest.thrift \
Jens Geyer28c1c192015-03-07 14:18:01 +010039 ErrorTest.thrift \
Jens Geyer1d1bca22015-03-14 16:28:27 +020040 NamesTest.thrift \
Jens Geyer70219e12015-05-20 22:00:25 +020041 InitialismsTest.thrift \
42 DontExportRWTest.thrift \
Jens Geyer86a51e72015-06-01 20:41:41 +020043 dontexportrwtest/compile_test.go \
44 IgnoreInitialismsTest.thrift
Jens Geyer79f988c2014-10-03 20:42:54 +020045 mkdir -p gopath/src
46 grep -v list.*map.*list.*map $(THRIFTTEST) | grep -v 'set<Insanity>' > ThriftTest.thrift
Jens Geyer9f74f322015-04-17 23:33:48 +020047 $(THRIFT) $(THRIFTARGS) -r IncludesTest.thrift
48 $(THRIFT) $(THRIFTARGS) BinaryKeyTest.thrift
49 $(THRIFT) $(THRIFTARGS) MultiplexedProtocolTest.thrift
50 $(THRIFT) $(THRIFTARGS) OnewayTest.thrift
51 $(THRIFT) $(THRIFTARGS) OptionalFieldsTest.thrift
52 $(THRIFT) $(THRIFTARGS) ServicesTest.thrift
53 $(THRIFT) $(THRIFTARGS) GoTagTest.thrift
54 $(THRIFT) $(THRIFTARGS) TypedefFieldTest.thrift
55 $(THRIFT) $(THRIFTARGS) RefAnnotationFieldsTest.thrift
Jens Geyer0f17e152015-09-15 21:22:42 +020056 $(THRIFT) $(THRIFTARGS) UnionDefaultValueTest.thrift
Jens Geyer9f74f322015-04-17 23:33:48 +020057 $(THRIFT) $(THRIFTARGS) ErrorTest.thrift
58 $(THRIFT) $(THRIFTARGS) NamesTest.thrift
59 $(THRIFT) $(THRIFTARGS) InitialismsTest.thrift
Jens Geyer70219e12015-05-20 22:00:25 +020060 $(THRIFT) $(THRIFTARGS),read_write_private DontExportRWTest.thrift
Jens Geyer86a51e72015-06-01 20:41:41 +020061 $(THRIFT) $(THRIFTARGS),ignore_initialisms IgnoreInitialismsTest.thrift
taozlec0d384a2017-07-17 18:40:42 +020062 GOPATH=`pwd`/gopath $(GO) get golang.org/x/net/context
James E. King, III0ad20bd2017-09-30 15:44:16 -070063 GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock || true
64 sed -i 's/\"context\"/\"golang.org\/x\/net\/context\"/g' gopath/src/github.com/golang/mock/gomock/controller.go || true
65 GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock
Jens Geyer79f988c2014-10-03 20:42:54 +020066 ln -nfs ../../../thrift gopath/src/thrift
67 ln -nfs ../../tests gopath/src/tests
Jens Geyer70219e12015-05-20 22:00:25 +020068 cp -r ./dontexportrwtest gopath/src
Jens Geyer79f988c2014-10-03 20:42:54 +020069 touch gopath
Jens Geyera7da4882013-07-18 00:33:05 +020070
71check: gopath
Jens Geyer79f988c2014-10-03 20:42:54 +020072 GOPATH=`pwd`/gopath $(GO) build \
73 includestest \
74 binarykeytest \
75 servicestest \
76 typedeffieldtest \
Jens Geyer527b6d92014-11-30 15:07:18 +010077 refannotationfieldstest \
Jens Geyer28c1c192015-03-07 14:18:01 +010078 errortest \
Jens Geyer1d1bca22015-03-14 16:28:27 +020079 namestest \
Jens Geyer70219e12015-05-20 22:00:25 +020080 initialismstest \
Jens Geyer86a51e72015-06-01 20:41:41 +020081 dontexportrwtest \
82 ignoreinitialismstest
Jens Geyer70219e12015-05-20 22:00:25 +020083 GOPATH=`pwd`/gopath $(GO) test thrift tests dontexportrwtest
Jens Geyera7da4882013-07-18 00:33:05 +020084
85clean-local:
Jens Geyer79f988c2014-10-03 20:42:54 +020086 $(RM) -r gopath ThriftTest.thrift gen-go
Jens Geyera7da4882013-07-18 00:33:05 +020087
88client: stubs
Jens Geyer79f988c2014-10-03 20:42:54 +020089 $(GO) run TestClient.go
jfarrell32d323e2013-08-15 20:39:58 -040090
91EXTRA_DIST = \
jfarrellf13e4312015-08-25 00:39:29 -040092 dontexportrwtest \
Jens Geyer79f988c2014-10-03 20:42:54 +020093 tests \
94 BinaryKeyTest.thrift \
95 GoTagTest.thrift \
96 IncludesTest.thrift \
97 MultiplexedProtocolTest.thrift \
98 NamespacedTest.thrift \
99 OnewayTest.thrift \
100 OptionalFieldsTest.thrift \
101 RefAnnotationFieldsTest.thrift \
Jens Geyer0f17e152015-09-15 21:22:42 +0200102 UnionDefaultValueTest.thrift \
Jens Geyer79f988c2014-10-03 20:42:54 +0200103 ServicesTest.thrift \
Jens Geyer527b6d92014-11-30 15:07:18 +0100104 TypedefFieldTest.thrift \
Jens Geyer28c1c192015-03-07 14:18:01 +0100105 ErrorTest.thrift \
Jens Geyer1d1bca22015-03-14 16:28:27 +0200106 NamesTest.thrift \
Jens Geyer70219e12015-05-20 22:00:25 +0200107 InitialismsTest.thrift \
Jens Geyer86a51e72015-06-01 20:41:41 +0200108 DontExportRWTest.thrift \
109 IgnoreInitialismsTest.thrift