Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

name: Bazel

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.14.0
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: ${{ github.workflow }}
# Share repository cache between workflows.
repository-cache: true
- run: bazel build //...
- run: bazel test //...
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ dist/
*.log
node_modules/
devserver.db
.ijwb/
bazel-bin
bazel-ldcli
bazel-out
bazel-testlogs
26 changes: 26 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
load("@gazelle//:def.bzl", "gazelle")
load("@rules_go//go:def.bzl", "go_binary", "go_library")

gazelle(name = "gazelle")

go_library(
name = "ldcli_lib",
srcs = ["main.go"],
importpath = "github.com/launchdarkly/ldcli",
visibility = ["//visibility:private"],
deps = ["//cmd"],
)

go_library(
name = "tool_deps",
srcs = ["tools.go"],
importpath = "github.com/launchdarkly/ldcli",
visibility = ["//visibility:private"],
deps = ["//cmd"],
)

go_binary(
name = "ldcli",
embed = [":ldcli_lib", ":tool_deps"],
visibility = ["//visibility:public"],
)
43 changes: 43 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
module(
name = "ldcli",
version = "0.0.1",
)

bazel_dep(name = "rules_go", version = "0.54.0")
bazel_dep(name = "gazelle", version = "0.43.0")

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(
go_deps,
"com_github_adrg_xdg",
"com_github_charmbracelet_bubbles",
"com_github_charmbracelet_bubbletea",
"com_github_charmbracelet_glamour",
"com_github_charmbracelet_lipgloss",
"com_github_getkin_kin_openapi",
"com_github_google_uuid",
"com_github_gorilla_handlers",
"com_github_gorilla_mux",
"com_github_iancoleman_strcase",
"com_github_launchdarkly_api_client_go_v14",
"com_github_launchdarkly_go_sdk_common_v3",
"com_github_launchdarkly_go_server_sdk_v7",
"com_github_launchdarkly_sdk_meta_api",
"com_github_mattn_go_sqlite3",
"com_github_mitchellh_go_homedir",
"com_github_muesli_reflow",
"com_github_oapi_codegen_oapi_codegen_v2",
"com_github_oapi_codegen_runtime",
"com_github_pkg_browser",
"com_github_pkg_errors",
"com_github_samber_lo",
"com_github_spf13_cobra",
"com_github_spf13_pflag",
"com_github_spf13_viper",
"com_github_stretchr_testify",
"in_gopkg_yaml_v3",
"org_golang_x_exp",
"org_golang_x_term",
"org_uber_go_mock",
)
237 changes: 237 additions & 0 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions cmd/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "cmd",
srcs = [
"cmdtest.go",
"quickstart.go",
"root.go",
"templates.go",
],
importpath = "github.com/launchdarkly/ldcli/cmd",
visibility = ["//visibility:public"],
deps = [
"//cmd/analytics",
"//cmd/cliflags",
"//cmd/config",
"//cmd/dev_server",
"//cmd/flags",
"//cmd/login",
"//cmd/members",
"//cmd/resources",
"//cmd/validators",
"//internal/analytics",
"//internal/config",
"//internal/dev_server",
"//internal/environments",
"//internal/errors",
"//internal/flags",
"//internal/members",
"//internal/projects",
"//internal/quickstart",
"//internal/resources",
"@com_github_charmbracelet_bubbletea//:bubbletea",
"@com_github_google_uuid//:uuid",
"@com_github_spf13_cobra//:cobra",
"@com_github_spf13_pflag//:pflag",
"@com_github_spf13_viper//:viper",
"@com_github_stretchr_testify//require",
"@org_golang_x_term//:term",
],
)

go_test(
name = "cmd_test",
srcs = ["root_test.go"],
deps = [
":cmd",
"//internal/analytics",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
],
)
14 changes: 14 additions & 0 deletions cmd/analytics/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "analytics",
srcs = ["analytics.go"],
importpath = "github.com/launchdarkly/ldcli/cmd/analytics",
visibility = ["//visibility:public"],
deps = [
"//cmd/cliflags",
"@com_github_spf13_cobra//:cobra",
"@com_github_spf13_pflag//:pflag",
"@com_github_spf13_viper//:viper",
],
)
8 changes: 8 additions & 0 deletions cmd/cliflags/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "cliflags",
srcs = ["flags.go"],
importpath = "github.com/launchdarkly/ldcli/cmd/cliflags",
visibility = ["//visibility:public"],
)
31 changes: 31 additions & 0 deletions cmd/config/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "config",
srcs = ["config.go"],
importpath = "github.com/launchdarkly/ldcli/cmd/config",
visibility = ["//visibility:public"],
deps = [
"//cmd/analytics",
"//cmd/cliflags",
"//internal/analytics",
"//internal/config",
"//internal/errors",
"//internal/output",
"@com_github_spf13_cobra//:cobra",
"@com_github_spf13_viper//:viper",
"@in_gopkg_yaml_v3//:yaml_v3",
],
)

go_test(
name = "config_test",
srcs = ["config_test.go"],
data = glob(["testdata/**"]),
deps = [
"//cmd",
"//internal/analytics",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
],
)
28 changes: 28 additions & 0 deletions cmd/dev_server/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "dev_server",
srcs = [
"dev_server.go",
"flags.go",
"overrides.go",
"projects.go",
"start_server.go",
],
importpath = "github.com/launchdarkly/ldcli/cmd/dev_server",
visibility = ["//visibility:public"],
deps = [
"//cmd/analytics",
"//cmd/cliflags",
"//cmd/resources",
"//cmd/validators",
"//internal/analytics",
"//internal/dev_server",
"//internal/dev_server/model",
"//internal/output",
"//internal/resources",
"@com_github_launchdarkly_go_sdk_common_v3//ldcontext",
"@com_github_spf13_cobra//:cobra",
"@com_github_spf13_viper//:viper",
],
)
36 changes: 36 additions & 0 deletions cmd/flags/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "flags",
srcs = [
"archive.go",
"toggle.go",
],
importpath = "github.com/launchdarkly/ldcli/cmd/flags",
visibility = ["//visibility:public"],
deps = [
"//cmd/cliflags",
"//cmd/resources",
"//cmd/validators",
"//internal/errors",
"//internal/output",
"//internal/resources",
"@com_github_spf13_cobra//:cobra",
"@com_github_spf13_viper//:viper",
],
)

go_test(
name = "flags_test",
srcs = [
"archive_test.go",
"toggle_test.go",
],
deps = [
"//cmd",
"//internal/analytics",
"//internal/resources",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
],
)
18 changes: 18 additions & 0 deletions cmd/login/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "login",
srcs = ["login.go"],
importpath = "github.com/launchdarkly/ldcli/cmd/login",
visibility = ["//visibility:public"],
deps = [
"//cmd/cliflags",
"//cmd/config",
"//internal/config",
"//internal/login",
"//internal/resources",
"@com_github_pkg_browser//:browser",
"@com_github_spf13_cobra//:cobra",
"@com_github_spf13_viper//:viper",
],
)
31 changes: 31 additions & 0 deletions cmd/members/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "members",
srcs = ["invite.go"],
importpath = "github.com/launchdarkly/ldcli/cmd/members",
visibility = ["//visibility:public"],
deps = [
"//cmd/cliflags",
"//cmd/resources",
"//cmd/validators",
"//internal/errors",
"//internal/members",
"//internal/output",
"//internal/resources",
"@com_github_spf13_cobra//:cobra",
"@com_github_spf13_viper//:viper",
],
)

go_test(
name = "members_test",
srcs = ["invite_test.go"],
deps = [
"//cmd",
"//internal/analytics",
"//internal/resources",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
],
)
47 changes: 47 additions & 0 deletions cmd/resources/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "resources",
srcs = [
"resource_cmds.go",
"resource_utils.go",
"resources.go",
],
importpath = "github.com/launchdarkly/ldcli/cmd/resources",
visibility = ["//visibility:public"],
deps = [
"//cmd/analytics",
"//cmd/cliflags",
"//cmd/validators",
"//internal/analytics",
"//internal/errors",
"//internal/output",
"//internal/resources",
"@com_github_charmbracelet_glamour//:glamour",
"@com_github_getkin_kin_openapi//openapi3",
"@com_github_iancoleman_strcase//:strcase",
"@com_github_spf13_cobra//:cobra",
"@com_github_spf13_viper//:viper",
],
)

go_test(
name = "resources_test",
srcs = [
"gen_resources_test.go",
"resource_cmds_test.go",
"resources_test.go",
],
data = [
"test_data/expected_template_data.json",
"test_data/test-openapi.json"
],
deps = [
":resources",
"//cmd",
"//internal/analytics",
"@com_github_getkin_kin_openapi//openapi3",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
],
)
Loading
Loading