-
Notifications
You must be signed in to change notification settings - Fork 33
/
Makefile
99 lines (87 loc) · 3.74 KB
/
Makefile
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# 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.
UNAME_S := $(shell uname -s)
UNAME_P := $(shell uname -p)
ifeq ($(UNAME_S),Linux)
ifeq ($(UNAME_P),x86_64)
OS_CLASSIFIER := linux-x86_64
THRIFT_EXEC := thrift/bin/thrift
endif
ifeq ($(UNAME_P),aarch64)
OS_CLASSIFIER := linux-aarch64
THRIFT_EXEC := thrift/bin/thrift
endif
endif
ifeq ($(UNAME_S),Darwin)
ifeq ($(UNAME_P),x86_64)
OS_CLASSIFIER := mac-x86_64
THRIFT_EXEC := thrift/bin/thrift
endif
ifeq ($(UNAME_P),arm)
OS_CLASSIFIER := mac-aarch64
THRIFT_EXEC := thrift/bin/thrift
endif
endif
ifneq ($(UNAME_S),Linux)
ifneq ($(UNAME_S),Darwin)
OS_CLASSIFIER := windows-x86_64
THRIFT_EXEC := thrift/bin/Release/thrift.exe
endif
endif
all: generate
generate:
@if [ -f "../../iotdb-protocol/thrift-commons/src/main/thrift/common.thrift" ]; then \
cd ../..; \
mvn clean package -pl iotdb-protocol/thrift-datanode -am; \
cd iotdb-client/client-go; \
cp -r ../../iotdb-protocol/thrift-commons/target/generated-sources-go/common common; \
cp -r ../../iotdb-protocol/thrift-datanode/target/generated-sources-go/rpc rpc; \
else \
echo "Downloading and unpacking iotdb-tools-thrift-0.14.1.0-$(OS_CLASSIFIER).zip"; \
rm -rf thrift; \
mkdir -p thrift; \
curl -L -o thrift/iotdb-tools-thrift.zip https://repo1.maven.org/maven2/org/apache/iotdb/tools/iotdb-tools-thrift/0.14.1.0/iotdb-tools-thrift-0.14.1.0-$(OS_CLASSIFIER).zip; \
unzip -o thrift/iotdb-tools-thrift.zip -d thrift; \
curl -o common.thrift https://raw.githubusercontent.com/apache/iotdb/master/iotdb-protocol/thrift-commons/src/main/thrift/common.thrift; \
$(THRIFT_EXEC) -out . -gen go:package_prefix=github.com/apache/iotdb-client-go/ common.thrift; \
curl -o client.thrift https://raw.githubusercontent.com/apache/iotdb/master/iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift; \
$(THRIFT_EXEC) -out . -gen go:package_prefix=github.com/apache/iotdb-client-go/ client.thrift; \
rm -f common.thrift; \
rm -f client.thrift; \
fi
@rm -rf rpc/i_client_r_p_c_service-remote
.PHONY: generate all test e2e_test e2e_test_clean
test:
go test -v ./client/...
e2e_test:
sh -c "cd /tmp/ && rm -rf iotdb && git clone https://github.com/apache/iotdb.git && cd iotdb && mvn clean package -pl distribution -am -DskipTests"
mkdir -p target/iotdb
unzip -o -q /tmp/iotdb/distribution/target/apache-iotdb-*-all-bin.zip -d target
mv target/*/* target/iotdb
docker compose -f test/e2e/docker-compose.yml up --build --abort-on-container-exit --remove-orphans
e2e_test_clean:
rm -rf /tmp/iotdb target
docker compose -f test/e2e/docker-compose.yml down
#only used for project structure that the iotdb main project is in the parent folder of this project.
e2e_test_for_parent_git_repo:
mkdir -p target/iotdb
unzip -o -q ../../distribution/target/apache-iotdb-*-all-bin.zip -d target
mv target/*/* target/iotdb
docker compose -f test/e2e/docker-compose.yml up --build --abort-on-container-exit --remove-orphans
e2e_test_clean_for_parent_git_repo:
rm -rf target
docker compose -f test/e2e/docker-compose.yml down