Skip to content

Commit

Permalink
*: move parser to a separate repository (pingcap#8036)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao authored Oct 25, 2018
1 parent d65ce86 commit 89dda9d
Show file tree
Hide file tree
Showing 445 changed files with 13,990 additions and 21,717 deletions.
240 changes: 39 additions & 201 deletions Gopkg.lock

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ required = ["github.com/golang/protobuf/jsonpb"]
version = "1.1.0"
name = "github.com/golang/protobuf"

[[constraint]]
branch = "master"
name = "github.com/cznic/parser"

[[constraint]]
branch = "master"
name = "github.com/cznic/sortutil"
Expand Down Expand Up @@ -102,3 +98,6 @@ required = ["github.com/golang/protobuf/jsonpb"]
version = "0.9.0"
source = "https://github.com/pingcap/errors.git"

[[constraint]]
branch = "master"
name = "github.com/pingcap/parser"
45 changes: 12 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ FILES := $$(find $$($(PACKAGE_DIRECTORIES)) -name "*.go" | grep -vE "vendor"
GOFAIL_ENABLE := $$(find $$PWD/ -type d | grep -vE "(\.git|vendor)" | xargs gofail enable)
GOFAIL_DISABLE := $$(find $$PWD/ -type d | grep -vE "(\.git|vendor)" | xargs gofail disable)

LDFLAGS += -X "github.com/pingcap/tidb/mysql.TiDBReleaseVersion=$(shell git describe --tags --dirty)"
LDFLAGS += -X "github.com/pingcap/parser/mysql.TiDBReleaseVersion=$(shell git describe --tags --dirty)"
LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBBuildTS=$(shell date -u '+%Y-%m-%d %I:%M:%S')"
LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBGitHash=$(shell git rev-parse HEAD)"
LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBGitBranch=$(shell git rev-parse --abbrev-ref HEAD)"
Expand All @@ -40,7 +40,7 @@ CHECK_LDFLAGS += $(LDFLAGS) ${TEST_LDFLAGS}

TARGET = ""

.PHONY: all build update parser clean todo test gotest interpreter server dev benchkv benchraw check parserlib checklist
.PHONY: all build update clean todo test gotest interpreter server dev benchkv benchraw check checklist parser

default: server buildsucc

Expand All @@ -51,35 +51,14 @@ buildsucc:

all: dev server benchkv

dev: checklist parserlib test check
parser:
@echo "remove this command later"

dev: checklist test check

build:
$(GOBUILD)

goyacc:
$(GOBUILD) -o bin/goyacc parser/goyacc/main.go

parser: goyacc
bin/goyacc -o /dev/null parser/parser.y
bin/goyacc -o parser/parser.go parser/parser.y 2>&1 | egrep "(shift|reduce)/reduce" | awk '{print} END {if (NR > 0) {print "Find conflict in parser.y. Please check y.output for more information."; exit 1;}}'
rm -f y.output

@if [ $(ARCH) = $(LINUX) ]; \
then \
sed -i -e 's|//line.*||' -e 's/yyEofCode/yyEOFCode/' parser/parser.go; \
elif [ $(ARCH) = $(MAC) ]; \
then \
/usr/bin/sed -i "" 's|//line.*||' parser/parser.go; \
/usr/bin/sed -i "" 's/yyEofCode/yyEOFCode/' parser/parser.go; \
fi

@awk 'BEGIN{print "// Code generated by goyacc"} {print $0}' parser/parser.go > tmp_parser.go && mv tmp_parser.go parser/parser.go;

parserlib: parser/parser.go

parser/parser.go: parser/parser.y
make parser

# The retool tools.json is setup from hack/retool-install.sh
check-setup:
@which retool >/dev/null 2>&1 || go get github.com/twitchtv/retool
Expand Down Expand Up @@ -134,7 +113,7 @@ test: checklist gotest explaintest
explaintest: server
@cd cmd/explaintest && ./run-tests.sh -s ../../bin/tidb-server

gotest: parserlib
gotest:
go get github.com/etcd-io/gofail
@$(GOFAIL_ENABLE)
ifeq ("$(TRAVIS_COVERAGE)", "1")
Expand All @@ -151,21 +130,21 @@ else
endif
@$(GOFAIL_DISABLE)

race: parserlib
race:
go get github.com/etcd-io/gofail
@$(GOFAIL_ENABLE)
@export log_level=debug; \
$(GOTEST) -timeout 20m -race $(PACKAGES) || { $(GOFAIL_DISABLE); exit 1; }
@$(GOFAIL_DISABLE)

leak: parserlib
leak:
go get github.com/etcd-io/gofail
@$(GOFAIL_ENABLE)
@export log_level=debug; \
$(GOTEST) -tags leak $(PACKAGES) || { $(GOFAIL_DISABLE); exit 1; }
@$(GOFAIL_DISABLE)

tikv_integration_test: parserlib
tikv_integration_test:
go get github.com/etcd-io/gofail
@$(GOFAIL_ENABLE)
$(GOTEST) ./store/tikv/. -with-tikv=true || { $(GOFAIL_DISABLE); exit 1; }
Expand All @@ -182,14 +161,14 @@ ifeq ("$(WITH_CHECK)", "1")
CHECK_FLAG = $(TEST_LDFLAGS)
endif

server: parserlib
server:
ifeq ($(TARGET), "")
$(GOBUILD) $(RACE_FLAG) -ldflags '$(LDFLAGS) $(CHECK_FLAG)' -o bin/tidb-server tidb-server/main.go
else
$(GOBUILD) $(RACE_FLAG) -ldflags '$(LDFLAGS) $(CHECK_FLAG)' -o '$(TARGET)' tidb-server/main.go
endif

server_check: parserlib
server_check:
ifeq ($(TARGET), "")
$(GOBUILD) $(RACE_FLAG) -ldflags '$(CHECK_LDFLAGS)' -o bin/tidb-server tidb-server/main.go
else
Expand Down
64 changes: 0 additions & 64 deletions ast/ddl_test.go

This file was deleted.

70 changes: 0 additions & 70 deletions ast/dml_test.go

This file was deleted.

103 changes: 0 additions & 103 deletions ast/expressions_test.go

This file was deleted.

Loading

0 comments on commit 89dda9d

Please sign in to comment.