Skip to content

Commit

Permalink
build,cli: replace libedit with bubbline
Browse files Browse the repository at this point in the history
Release justification: n/a will not merge before stability ends

Release note (cli change): The engine used as line editor in the
interactive shell (`cockroach sql`, `demo`) has been updated. It
includes numerous bug fixes and new features.
  • Loading branch information
knz committed Aug 26, 2022
1 parent 7507e53 commit 49d9bea
Show file tree
Hide file tree
Showing 12 changed files with 402 additions and 199 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Expand Up @@ -10,9 +10,6 @@
[submodule "c-deps/krb5"]
path = c-deps/krb5
url = https://github.com/cockroachdb/krb5.git
[submodule "c-deps/libedit"]
path = c-deps/libedit
url = https://github.com/cockroachdb/libedit.git
[submodule "c-deps/geos"]
path = c-deps/geos
url = https://github.com/cockroachdb/geos.git
Expand Down
164 changes: 140 additions & 24 deletions DEPS.bzl
Expand Up @@ -330,6 +330,16 @@ def go_deps():
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/asaskevich/govalidator/com_github_asaskevich_govalidator-v0.0.0-20200907205600-7a23bdc65eef.zip",
],
)
go_repository(
name = "com_github_atotto_clipboard",
build_file_proto_mode = "disable_global",
importpath = "github.com/atotto/clipboard",
sha256 = "d67b2c36c662751309fd2ec351df3651584bea840bd27be9a90702c3a238b43f",
strip_prefix = "github.com/atotto/clipboard@v0.1.4",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/atotto/clipboard/com_github_atotto_clipboard-v0.1.4.zip",
],
)
go_repository(
name = "com_github_aws_aws_lambda_go",
build_file_proto_mode = "disable_global",
Expand Down Expand Up @@ -1124,6 +1134,46 @@ def go_deps():
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cespare/xxhash/v2/com_github_cespare_xxhash_v2-v2.1.2.zip",
],
)
go_repository(
name = "com_github_charmbracelet_bubbles",
build_file_proto_mode = "disable_global",
importpath = "github.com/charmbracelet/bubbles",
sha256 = "8b5b2b162503ac4567758a517dcd9f9d7447d175d97acadb30c95959d109659d",
strip_prefix = "github.com/charmbracelet/bubbles@v0.13.0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/charmbracelet/bubbles/com_github_charmbracelet_bubbles-v0.13.0.zip",
],
)
go_repository(
name = "com_github_charmbracelet_bubbletea",
build_file_proto_mode = "disable_global",
importpath = "github.com/charmbracelet/bubbletea",
sha256 = "cfb0bc5cb5d876fc504cdef8d7fde30d0c9bb98e4d7d7de5189ce439319f7c1b",
strip_prefix = "github.com/charmbracelet/bubbletea@v0.22.1",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/charmbracelet/bubbletea/com_github_charmbracelet_bubbletea-v0.22.1.zip",
],
)
go_repository(
name = "com_github_charmbracelet_harmonica",
build_file_proto_mode = "disable_global",
importpath = "github.com/charmbracelet/harmonica",
sha256 = "8494d728916551f0fc9a065fa854dfae2d75c7191ce839bae07de1a6290db40a",
strip_prefix = "github.com/charmbracelet/harmonica@v0.2.0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/charmbracelet/harmonica/com_github_charmbracelet_harmonica-v0.2.0.zip",
],
)
go_repository(
name = "com_github_charmbracelet_lipgloss",
build_file_proto_mode = "disable_global",
importpath = "github.com/charmbracelet/lipgloss",
sha256 = "9f48bf9e3f9f73b5d6cc6788d87dc9e1448e34bbe5f1f0179f22ce93c3060602",
strip_prefix = "github.com/charmbracelet/lipgloss@v0.5.0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/charmbracelet/lipgloss/com_github_charmbracelet_lipgloss-v0.5.0.zip",
],
)
go_repository(
name = "com_github_checkpoint_restore_go_criu_v4",
build_file_proto_mode = "disable_global",
Expand Down Expand Up @@ -5056,17 +5106,13 @@ def go_deps():
],
)
go_repository(
name = "com_github_knz_go_libedit",
name = "com_github_knz_bubbline",
build_file_proto_mode = "disable_global",
importpath = "github.com/knz/go-libedit",
patch_args = ["-p1"],
patches = [
"@com_github_cockroachdb_cockroach//build/patches:com_github_knz_go_libedit.patch",
],
sha256 = "d2ae0f8e43c49f917a2cadf52178c0efe1336fda5b8410a3d0f1270ae05d2532",
strip_prefix = "github.com/otan-cockroach/go-libedit@v1.10.2-0.20201030151939-7cced08450e7",
importpath = "github.com/knz/bubbline",
sha256 = "d935f8acbefa8658cac0d2827d37b89dd19016a7d04ebf5860620ba942da770f",
strip_prefix = "github.com/knz/bubbline@v0.0.0-20220826092326-59997f43857b",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/otan-cockroach/go-libedit/com_github_otan_cockroach_go_libedit-v1.10.2-0.20201030151939-7cced08450e7.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/knz/bubbline/com_github_knz_bubbline-v0.0.0-20220826092326-59997f43857b.zip",
],
)
go_repository(
Expand Down Expand Up @@ -5249,6 +5295,16 @@ def go_deps():
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/linode/linodego/com_github_linode_linodego-v0.32.0.zip",
],
)
go_repository(
name = "com_github_lucasb_eyer_go_colorful",
build_file_proto_mode = "disable_global",
importpath = "github.com/lucasb-eyer/go-colorful",
sha256 = "78d5d0e0737f0f54bbed77b6dfa847d8c871bed2668a9dc44328c7c3411ada10",
strip_prefix = "github.com/lucasb-eyer/go-colorful@v1.2.0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/lucasb-eyer/go-colorful/com_github_lucasb_eyer_go_colorful-v1.2.0.zip",
],
)
go_repository(
name = "com_github_lufia_iostat",
build_file_proto_mode = "disable_global",
Expand Down Expand Up @@ -5493,20 +5549,30 @@ def go_deps():
name = "com_github_mattn_go_isatty",
build_file_proto_mode = "disable_global",
importpath = "github.com/mattn/go-isatty",
sha256 = "6b8f017658d900de873fc567237548ef2054082aed64669655e51beeefee83c7",
strip_prefix = "github.com/mattn/go-isatty@v0.0.14",
sha256 = "3d5ff19c4b2a2a164feb84f5cc38af349380c0c4a03d0443dce40bbd6ec3fd2b",
strip_prefix = "github.com/mattn/go-isatty@v0.0.16",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/mattn/go-isatty/com_github_mattn_go_isatty-v0.0.16.zip",
],
)
go_repository(
name = "com_github_mattn_go_localereader",
build_file_proto_mode = "disable_global",
importpath = "github.com/mattn/go-localereader",
sha256 = "aa67306797b071ce93188fe2834f63ffd7963faf623d49229d891ef52e595b35",
strip_prefix = "github.com/mattn/go-localereader@v0.0.1",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/mattn/go-isatty/com_github_mattn_go_isatty-v0.0.14.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/mattn/go-localereader/com_github_mattn_go_localereader-v0.0.1.zip",
],
)
go_repository(
name = "com_github_mattn_go_runewidth",
build_file_proto_mode = "disable_global",
importpath = "github.com/mattn/go-runewidth",
sha256 = "030dcf3ea6cb39b34269f119ee5fe5e9d5834daf409e1f3f48c065a45326f4a6",
strip_prefix = "github.com/mattn/go-runewidth@v0.0.10",
sha256 = "c104e14c1612a6d736bd109fe5fec9749a8146e1f7d37844d8a0a1296e00d4e9",
strip_prefix = "github.com/mattn/go-runewidth@v0.0.13",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/mattn/go-runewidth/com_github_mattn_go_runewidth-v0.0.10.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/mattn/go-runewidth/com_github_mattn_go_runewidth-v0.0.13.zip",
],
)
go_repository(
Expand Down Expand Up @@ -6029,6 +6095,46 @@ def go_deps():
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/mschoch/smat/com_github_mschoch_smat-v0.0.0-20160514031455-90eadee771ae.zip",
],
)
go_repository(
name = "com_github_muesli_ansi",
build_file_proto_mode = "disable_global",
importpath = "github.com/muesli/ansi",
sha256 = "a7cd63fc6bb8565445020cd146f89d7bb53b6e5e44bd47e9142fd6c41733dee4",
strip_prefix = "github.com/muesli/ansi@v0.0.0-20211031195517-c9f0611b6c70",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/muesli/ansi/com_github_muesli_ansi-v0.0.0-20211031195517-c9f0611b6c70.zip",
],
)
go_repository(
name = "com_github_muesli_cancelreader",
build_file_proto_mode = "disable_global",
importpath = "github.com/muesli/cancelreader",
sha256 = "f0654e7f8f8a49b02ff10a75ccaa0eb08a65aaacbc45f5ba93305276e2ac7f61",
strip_prefix = "github.com/muesli/cancelreader@v0.2.2",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/muesli/cancelreader/com_github_muesli_cancelreader-v0.2.2.zip",
],
)
go_repository(
name = "com_github_muesli_reflow",
build_file_proto_mode = "disable_global",
importpath = "github.com/muesli/reflow",
sha256 = "78e2cebf5a46a9b7c7c52d55d4ac4650cabd9135f180092e3f476293bb86696e",
strip_prefix = "github.com/muesli/reflow@v0.3.0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/muesli/reflow/com_github_muesli_reflow-v0.3.0.zip",
],
)
go_repository(
name = "com_github_muesli_termenv",
build_file_proto_mode = "disable_global",
importpath = "github.com/muesli/termenv",
sha256 = "a8552b4ba6fc57b5a905dbac412bd55fb2940595ef35115a83512e448f687a5f",
strip_prefix = "github.com/muesli/termenv@v0.12.0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/muesli/termenv/com_github_muesli_termenv-v0.12.0.zip",
],
)
go_repository(
name = "com_github_munnerz_goautoneg",
build_file_proto_mode = "disable_global",
Expand Down Expand Up @@ -6960,10 +7066,10 @@ def go_deps():
name = "com_github_rivo_uniseg",
build_file_proto_mode = "disable_global",
importpath = "github.com/rivo/uniseg",
sha256 = "cb701df81f36acfbb2627a78662fdcaa150ee1ac00d0796a7f3eafbdb6218128",
strip_prefix = "github.com/rivo/uniseg@v0.1.0",
sha256 = "4b124798027190646fbaafc10ae0a31c0bfc025352f30e6b92282bcee99c0e04",
strip_prefix = "github.com/cockroachdb/uniseg@v0.3.4",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/rivo/uniseg/com_github_rivo_uniseg-v0.1.0.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/uniseg/com_github_cockroachdb_uniseg-v0.3.4.zip",
],
)
go_repository(
Expand Down Expand Up @@ -7076,6 +7182,16 @@ def go_deps():
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/safchain/ethtool/com_github_safchain_ethtool-v0.0.0-20190326074333-42ed695e3de8.zip",
],
)
go_repository(
name = "com_github_sahilm_fuzzy",
build_file_proto_mode = "disable_global",
importpath = "github.com/sahilm/fuzzy",
sha256 = "82c8b592ff10966ec1639dea6b5f925706a4901583dc15060ac00392e6693498",
strip_prefix = "github.com/sahilm/fuzzy@v0.1.0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/sahilm/fuzzy/com_github_sahilm_fuzzy-v0.1.0.zip",
],
)
go_repository(
name = "com_github_samuel_go_zookeeper",
build_file_proto_mode = "disable_global",
Expand Down Expand Up @@ -9360,20 +9476,20 @@ def go_deps():
name = "org_golang_x_sys",
build_file_proto_mode = "disable_global",
importpath = "golang.org/x/sys",
sha256 = "f4480597a942160a2aaeb761d41ee67f610287785c263f1df253a3e157c98594",
strip_prefix = "golang.org/x/sys@v0.0.0-20220722155257-8c9f86f7a55f",
sha256 = "fde041b0470174e874db66e5dce94ca6a9b0ac0b553982f21175826459b61efe",
strip_prefix = "golang.org/x/sys@v0.0.0-20220825204002-c680a09ffe64",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/sys/org_golang_x_sys-v0.0.0-20220722155257-8c9f86f7a55f.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/sys/org_golang_x_sys-v0.0.0-20220825204002-c680a09ffe64.zip",
],
)
go_repository(
name = "org_golang_x_term",
build_file_proto_mode = "disable_global",
importpath = "golang.org/x/term",
sha256 = "3adf713afa49fe26580ffe4adb1f4fb2f4921c945301aa5a9fb6d34031fa30cd",
strip_prefix = "golang.org/x/term@v0.0.0-20210927222741-03fcf44c2211",
sha256 = "56fa4c44da3c61a77a894a9d5fa5603e0d203ca1cc23ec1f42d4e9fcfbd4c53b",
strip_prefix = "golang.org/x/term@v0.0.0-20220722155259-a9ba230a4035",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/term/org_golang_x_term-v0.0.0-20210927222741-03fcf44c2211.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/term/org_golang_x_term-v0.0.0-20220722155259-a9ba230a4035.zip",
],
)
go_repository(
Expand Down
40 changes: 3 additions & 37 deletions Makefile
Expand Up @@ -474,7 +474,6 @@ C_DEPS_DIR := $(abspath c-deps)
JEMALLOC_SRC_DIR := $(C_DEPS_DIR)/jemalloc
GEOS_SRC_DIR := $(C_DEPS_DIR)/geos
PROJ_SRC_DIR := $(C_DEPS_DIR)/proj
LIBEDIT_SRC_DIR := $(C_DEPS_DIR)/libedit
KRB5_SRC_DIR := $(C_DEPS_DIR)/krb5

# Derived build variants.
Expand All @@ -494,11 +493,9 @@ endif
JEMALLOC_DIR := $(BUILD_DIR)/jemalloc
GEOS_DIR := $(BUILD_DIR)/geos
PROJ_DIR := $(BUILD_DIR)/proj
LIBEDIT_DIR := $(BUILD_DIR)/libedit
KRB5_DIR := $(BUILD_DIR)/krb5

LIBJEMALLOC := $(JEMALLOC_DIR)/lib/libjemalloc.a
LIBEDIT := $(LIBEDIT_DIR)/src/.libs/libedit.a
LIBPROJ := $(PROJ_DIR)/lib/libproj$(if $(target-is-windows),_4_9).a
LIBKRB5 := $(KRB5_DIR)/lib/libgssapi_krb5.a

Expand All @@ -515,7 +512,6 @@ LIBGEOS := $(DYN_LIB_DIR)/libgeos.$(DYN_EXT)

C_LIBS_COMMON = \
$(if $(use-stdmalloc),,$(LIBJEMALLOC)) \
$(if $(target-is-windows),,$(LIBEDIT)) \
$(LIBPROJ)
C_LIBS_SHORT = $(C_LIBS_COMMON)
C_LIBS_OSS = $(C_LIBS_COMMON)
Expand Down Expand Up @@ -561,13 +557,11 @@ CGO_PKGS := \
pkg/cli/clisqlshell \
pkg/server/status \
pkg/ccl/gssapiccl \
pkg/geo/geoproj \
vendor/github.com/knz/go-libedit/unix
vendor/github.com/knz/go-libedit/unix-package := libedit_unix
pkg/geo/geoproj
CGO_UNSUFFIXED_FLAGS_FILES := $(addprefix ./,$(addsuffix /zcgo_flags.go,$(CGO_PKGS)))
CGO_SUFFIXED_FLAGS_FILES := $(addprefix ./,$(addsuffix /zcgo_flags_$(native-tag).go,$(CGO_PKGS)))
BASE_CGO_FLAGS_FILES := $(CGO_UNSUFFIXED_FLAGS_FILES) $(CGO_SUFFIXED_FLAGS_FILES)
CGO_FLAGS_FILES := $(BASE_CGO_FLAGS_FILES) vendor/github.com/knz/go-libedit/unix/zcgo_flags_extra.go
CGO_FLAGS_FILES := $(BASE_CGO_FLAGS_FILES)

$(BASE_CGO_FLAGS_FILES): Makefile build/defs.mk.sig | bin/.submodules-initialized
@echo "regenerating $@"
Expand All @@ -579,17 +573,7 @@ $(BASE_CGO_FLAGS_FILES): Makefile build/defs.mk.sig | bin/.submodules-initialize
@echo 'package $(if $($(@D)-package),$($(@D)-package),$(notdir $(@D)))' >> $@
@echo >> $@
@echo '// #cgo CPPFLAGS: $(addprefix -I,$(JEMALLOC_DIR)/include $(KRB_CPPFLAGS))' >> $@
@echo '// #cgo LDFLAGS: $(addprefix -L,$(JEMALLOC_DIR)/lib $(LIBEDIT_DIR)/src/.libs $(KRB_DIR) $(PROJ_DIR)/lib)' >> $@
@echo 'import "C"' >> $@

vendor/github.com/knz/go-libedit/unix/zcgo_flags_extra.go: Makefile | bin/.submodules-initialized
@echo "regenerating $@"
@echo '// GENERATED FILE DO NOT EDIT' > $@
@echo >> $@
@echo 'package $($(@D)-package)' >> $@
@echo >> $@
@echo '// #cgo CPPFLAGS: -DGO_LIBEDIT_NO_BUILD' >> $@
@echo '// #cgo !windows LDFLAGS: -ledit -lncurses' >> $@
@echo '// #cgo LDFLAGS: $(addprefix -L,$(JEMALLOC_DIR)/lib $(KRB_DIR) $(PROJ_DIR)/lib)' >> $@
@echo 'import "C"' >> $@

# BUILD ARTIFACT CACHING
Expand Down Expand Up @@ -659,19 +643,6 @@ $(PROJ_DIR)/Makefile: $(C_DEPS_DIR)/proj-rebuild | bin/.submodules-initialized
rm -rf $(PROJ_DIR)
mkdir -p $(PROJ_DIR)
cd $(PROJ_DIR) && cmake $(xcmake-flags) $(PROJ_SRC_DIR) -DCMAKE_BUILD_TYPE=Release -DBUILD_LIBPROJ_SHARED=OFF

$(LIBEDIT_SRC_DIR)/configure.ac: | bin/.submodules-initialized

$(LIBEDIT_SRC_DIR)/configure: $(LIBEDIT_SRC_DIR)/configure.ac
cd $(LIBEDIT_SRC_DIR) && autoconf

$(LIBEDIT_DIR)/Makefile: $(C_DEPS_DIR)/libedit-rebuild $(LIBEDIT_SRC_DIR)/configure
rm -rf $(LIBEDIT_DIR)
mkdir -p $(LIBEDIT_DIR)
@# NOTE: If you change the configure flags below, bump the version in
@# $(C_DEPS_DIR)/libedit-rebuild. See above for rationale.
cd $(LIBEDIT_DIR) && $(LIBEDIT_SRC_DIR)/configure $(xconfigure-flags) --disable-examples --disable-shared

# Most of our C and C++ dependencies use Makefiles that are generated by CMake,
# which are rather slow, taking upwards of 500ms to determine that nothing has
# changed. The no-op case is the common case, as C and C++ code is modified
Expand Down Expand Up @@ -744,15 +715,11 @@ libgeos_inner: $(GEOS_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
$(LIBPROJ): $(PROJ_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
@uptodate $@ $(PROJ_SRC_DIR) || $(MAKE) --no-print-directory -C $(PROJ_DIR) proj

$(LIBEDIT): $(LIBEDIT_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
@uptodate $@ $(LIBEDIT_SRC_DIR) || $(MAKE) --no-print-directory -C $(LIBEDIT_DIR)/src

$(LIBKRB5): $(KRB5_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
@uptodate $@ $(KRB5_SRC_DIR)/src || $(MAKE) --no-print-directory -C $(KRB5_DIR)

# Convenient names for maintainers. Not used by other targets in the Makefile.
.PHONY: libjemalloc libgeos libproj libkrb5
libedit: $(LIBEDIT)
libjemalloc: $(LIBJEMALLOC)
libgeos: $(LIBGEOS)
libproj: $(LIBPROJ)
Expand Down Expand Up @@ -969,7 +936,6 @@ $(COCKROACHSHORT): TAGS += short
$(COCKROACHSHORT): $(C_LIBS_SHORT) | $(C_LIBS_DYNAMIC)

$(COCKROACHSQL): BUILDTARGET = ./pkg/cmd/cockroach-sql
$(COCKROACHSQL): $(if $(target-is-windows),,$(LIBEDIT))

# For test targets, add a tag (used to enable extra assertions).
$(test-targets): TAGS += crdb_test
Expand Down

0 comments on commit 49d9bea

Please sign in to comment.