dubbo.apache.org/dubbo-go/v3@v3.1.1/Makefile (about)

     1  #
     2  # Licensed to the Apache Software Foundation (ASF) under one or more
     3  # contributor license agreements.  See the NOTICE file distributed with
     4  # this work for additional information regarding copyright ownership.
     5  # The ASF licenses this file to You under the Apache License, Version 2.0
     6  # (the "License"); you may not use this file except in compliance with
     7  # the License.  You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  #
    17  
    18  # DO NOT RUN
    19  # The makefile is for ci test and has dependencies. Do not run it locally.
    20  # If you want to run the unit tests, run command `go test ./...` directly.
    21  
    22  VERSION ?= latest
    23  
    24  GO = go
    25  GO_PATH = $(shell $(GO) env GOPATH)
    26  GO_OS = $(shell $(GO) env GOOS)
    27  ifeq ($(GO_OS), darwin)
    28      GO_OS = mac
    29  endif
    30  GO_BUILD = $(GO) build
    31  GO_GET = $(GO) get
    32  GO_TEST = $(GO) test
    33  GO_BUILD_FLAGS = -v
    34  GO_BUILD_LDFLAGS = -X main.version=$(VERSION)
    35  
    36  GO_LICENSE_CHECKER_DIR = license-header-checker-$(GO_OS)
    37  GO_LICENSE_CHECKER = $(GO_PATH)/bin/license-header-checker
    38  LICENSE_DIR = /tmp/tools/license
    39  
    40  ARCH = amd64
    41  # for add zookeeper fatjar
    42  ZK_TEST_LIST=config_center/zookeeper registry/zookeeper cluster/router/chain cluster/router/condition cluster/router/tag  metadata/report/zookeeper
    43  ZK_JAR_NAME=zookeeper-3.4.9-fatjar.jar
    44  ZK_FATJAR_BASE=/zookeeper-4unittest/contrib/fatjar
    45  ZK_JAR_PATH=remoting/zookeeper$(ZK_FATJAR_BASE)
    46  ZK_JAR=$(ZK_JAR_PATH)/$(ZK_JAR_NAME)
    47  
    48  SHELL = /bin/bash
    49  
    50  prepareLic:
    51  	echo 'The makefile is for ci test and has dependencies. Do not run it locally. If you want to run the unit tests, run command `go test ./...` directly.'
    52  	$(GO_LICENSE_CHECKER) -version || (wget https://github.com/lsm-dev/license-header-checker/releases/download/v1.2.0/$(GO_LICENSE_CHECKER_DIR).zip -O $(GO_LICENSE_CHECKER_DIR).zip && unzip -o $(GO_LICENSE_CHECKER_DIR).zip && mkdir -p $(GO_PATH)/bin/ && cp $(GO_LICENSE_CHECKER_DIR)/64bit/license-header-checker $(GO_PATH)/bin/)
    53  	ls /tmp/tools/license/license.txt || wget -P $(LICENSE_DIR) https://github.com/dubbogo/resources/raw/master/tools/license/license.txt
    54  
    55  prepare: prepareLic
    56  
    57  .PHONE: test
    58  test: clean
    59  	$(GO_TEST) ./... -coverprofile=coverage.txt -covermode=atomic
    60  
    61  deps: prepare
    62  	$(GO_GET) -v -t -d ./...
    63  
    64  .PHONY: license
    65  license: clean prepareLic
    66  	$(GO_LICENSE_CHECKER) -v -a -r -i vendor $(LICENSE_DIR)/license.txt . go && [[ -z `git status -s` ]]
    67  
    68  .PHONY: verify
    69  verify: clean license test
    70  
    71  .PHONE: fmt
    72  fmt:
    73  	$(GO_GET) -u github.com/dubbogo/tools/cmd/imports-formatter
    74  	imports-formatter
    75  
    76  .PHONY: clean
    77  clean: prepare
    78  	rm -rf coverage.txt
    79  	rm -rf license-header-checker*