From e02dacc4399e0c16843b67da9499a93d37e71a08 Mon Sep 17 00:00:00 2001 From: Jifeng Zhang Date: Sat, 13 Jun 2026 22:57:10 +0200 Subject: [PATCH 1/9] Add Bazel build system - MODULE.bazel with rules_go, gazelle, rules_proto, protobuf - 257 BUILD.bazel files auto-generated by Gazelle - Fixed proto BUILD files for gRPC codegen - Fixed certificate-transparency-go external dep compatibility - Added test data dependencies for 20 previously failing tests - 199/200 tests pass (git_test requires wrapper for CWD) Built and tested with Bazel 9.0.0 --- BUILD.bazel | 4 + api/BUILD.bazel | 58 +++++++++++++ cmd/gen-docs/BUILD.bazel | 31 +++++++ cmd/gh/BUILD.bazel | 15 ++++ context/BUILD.bazel | 28 +++++++ git/BUILD.bazel | 43 ++++++++++ git/git_test_wrapper.sh | 13 +++ internal/authflow/BUILD.bazel | 28 +++++++ internal/browser/BUILD.bazel | 12 +++ internal/build/BUILD.bazel | 8 ++ internal/codespaces/BUILD.bazel | 27 ++++++ internal/codespaces/api/BUILD.bazel | 27 ++++++ internal/codespaces/connection/BUILD.bazel | 29 +++++++ internal/codespaces/portforwarder/BUILD.bazel | 23 +++++ internal/codespaces/rpc/BUILD.bazel | 30 +++++++ internal/codespaces/rpc/codespace/BUILD.bazel | 28 +++++++ internal/codespaces/rpc/jupyter/BUILD.bazel | 28 +++++++ internal/codespaces/rpc/ssh/BUILD.bazel | 28 +++++++ internal/codespaces/rpc/test/BUILD.bazel | 12 +++ internal/config/BUILD.bazel | 37 +++++++++ internal/config/migration/BUILD.bazel | 25 ++++++ internal/docs/BUILD.bazel | 30 +++++++ internal/featuredetection/BUILD.bazel | 27 ++++++ internal/gh/BUILD.bazel | 12 +++ internal/gh/mock/BUILD.bazel | 16 ++++ internal/ghcmd/BUILD.bazel | 36 ++++++++ internal/ghinstance/BUILD.bazel | 16 ++++ internal/ghrepo/BUILD.bazel | 19 +++++ internal/keyring/BUILD.bazel | 9 ++ internal/prompter/BUILD.bazel | 19 +++++ internal/run/BUILD.bazel | 12 +++ internal/safepaths/BUILD.bazel | 17 ++++ internal/tableprinter/BUILD.bazel | 23 +++++ internal/text/BUILD.bazel | 20 +++++ internal/update/BUILD.bazel | 19 +++++ pkg/cmd/actions/BUILD.bazel | 14 ++++ pkg/cmd/alias/BUILD.bazel | 17 ++++ pkg/cmd/alias/delete/BUILD.bazel | 29 +++++++ pkg/cmd/alias/imports/BUILD.bazel | 35 ++++++++ pkg/cmd/alias/list/BUILD.bazel | 31 +++++++ pkg/cmd/alias/set/BUILD.bazel | 32 +++++++ pkg/cmd/alias/shared/BUILD.bazel | 22 +++++ pkg/cmd/api/BUILD.bazel | 52 ++++++++++++ pkg/cmd/attestation/BUILD.bazel | 17 ++++ pkg/cmd/attestation/api/BUILD.bazel | 36 ++++++++ pkg/cmd/attestation/artifact/BUILD.bazel | 32 +++++++ .../attestation/artifact/digest/BUILD.bazel | 18 ++++ pkg/cmd/attestation/artifact/oci/BUILD.bazel | 34 ++++++++ pkg/cmd/attestation/auth/BUILD.bazel | 19 +++++ pkg/cmd/attestation/download/BUILD.bazel | 47 +++++++++++ pkg/cmd/attestation/inspect/BUILD.bazel | 52 ++++++++++++ pkg/cmd/attestation/io/BUILD.bazel | 13 +++ pkg/cmd/attestation/test/BUILD.bazel | 8 ++ pkg/cmd/attestation/test/data/BUILD.bazel | 21 +++++ pkg/cmd/attestation/trustedroot/BUILD.bazel | 39 +++++++++ pkg/cmd/attestation/verification/BUILD.bazel | 59 +++++++++++++ pkg/cmd/attestation/verify/BUILD.bazel | 58 +++++++++++++ pkg/cmd/auth/BUILD.bazel | 20 +++++ pkg/cmd/auth/gitcredential/BUILD.bazel | 23 +++++ pkg/cmd/auth/login/BUILD.bazel | 41 +++++++++ pkg/cmd/auth/logout/BUILD.bazel | 31 +++++++ pkg/cmd/auth/refresh/BUILD.bazel | 36 ++++++++ pkg/cmd/auth/setupgit/BUILD.bazel | 30 +++++++ pkg/cmd/auth/shared/BUILD.bazel | 49 +++++++++++ pkg/cmd/auth/shared/contract/BUILD.bazel | 12 +++ .../auth/shared/gitcredentials/BUILD.bazel | 35 ++++++++ pkg/cmd/auth/status/BUILD.bazel | 35 ++++++++ pkg/cmd/auth/switch/BUILD.bazel | 32 +++++++ pkg/cmd/auth/token/BUILD.bazel | 29 +++++++ pkg/cmd/browse/BUILD.bazel | 35 ++++++++ pkg/cmd/cache/BUILD.bazel | 15 ++++ pkg/cmd/cache/delete/BUILD.bazel | 33 ++++++++ pkg/cmd/cache/list/BUILD.bazel | 35 ++++++++ pkg/cmd/cache/shared/BUILD.bazel | 27 ++++++ pkg/cmd/codespace/BUILD.bazel | 83 +++++++++++++++++++ pkg/cmd/completion/BUILD.bazel | 25 ++++++ pkg/cmd/config/BUILD.bazel | 17 ++++ pkg/cmd/config/clear-cache/BUILD.bazel | 25 ++++++ pkg/cmd/config/get/BUILD.bazel | 30 +++++++ pkg/cmd/config/list/BUILD.bazel | 30 +++++++ pkg/cmd/config/set/BUILD.bazel | 30 +++++++ pkg/cmd/extension/BUILD.bazel | 73 ++++++++++++++++ pkg/cmd/extension/browse/BUILD.bazel | 43 ++++++++++ pkg/cmd/factory/BUILD.bazel | 47 +++++++++++ pkg/cmd/gist/BUILD.bazel | 20 +++++ pkg/cmd/gist/clone/BUILD.bazel | 36 ++++++++ pkg/cmd/gist/create/BUILD.bazel | 39 +++++++++ pkg/cmd/gist/delete/BUILD.bazel | 31 +++++++ pkg/cmd/gist/edit/BUILD.bazel | 36 ++++++++ pkg/cmd/gist/list/BUILD.bazel | 34 ++++++++ pkg/cmd/gist/rename/BUILD.bazel | 33 ++++++++ pkg/cmd/gist/shared/BUILD.bazel | 28 +++++++ pkg/cmd/gist/view/BUILD.bazel | 36 ++++++++ pkg/cmd/gpg-key/BUILD.bazel | 15 ++++ pkg/cmd/gpg-key/add/BUILD.bazel | 34 ++++++++ pkg/cmd/gpg-key/delete/BUILD.bazel | 37 +++++++++ pkg/cmd/gpg-key/list/BUILD.bazel | 34 ++++++++ pkg/cmd/issue/BUILD.bazel | 27 ++++++ pkg/cmd/issue/close/BUILD.bazel | 34 ++++++++ pkg/cmd/issue/comment/BUILD.bazel | 34 ++++++++ pkg/cmd/issue/create/BUILD.bazel | 43 ++++++++++ pkg/cmd/issue/delete/BUILD.bazel | 36 ++++++++ pkg/cmd/issue/develop/BUILD.bazel | 38 +++++++++ pkg/cmd/issue/edit/BUILD.bazel | 37 +++++++++ pkg/cmd/issue/list/BUILD.bazel | 53 ++++++++++++ pkg/cmd/issue/lock/BUILD.bazel | 34 ++++++++ pkg/cmd/issue/pin/BUILD.bazel | 35 ++++++++ pkg/cmd/issue/reopen/BUILD.bazel | 36 ++++++++ pkg/cmd/issue/shared/BUILD.bazel | 33 ++++++++ pkg/cmd/issue/status/BUILD.bazel | 35 ++++++++ pkg/cmd/issue/transfer/BUILD.bazel | 35 ++++++++ pkg/cmd/issue/unpin/BUILD.bazel | 35 ++++++++ pkg/cmd/issue/view/BUILD.bazel | 47 +++++++++++ pkg/cmd/label/BUILD.bazel | 53 ++++++++++++ pkg/cmd/org/BUILD.bazel | 14 ++++ pkg/cmd/org/list/BUILD.bazel | 39 +++++++++ pkg/cmd/pr/BUILD.bazel | 29 +++++++ pkg/cmd/pr/checkout/BUILD.bazel | 41 +++++++++ pkg/cmd/pr/checks/BUILD.bazel | 46 ++++++++++ pkg/cmd/pr/close/BUILD.bazel | 37 +++++++++ pkg/cmd/pr/comment/BUILD.bazel | 33 ++++++++ pkg/cmd/pr/create/BUILD.bazel | 56 +++++++++++++ pkg/cmd/pr/diff/BUILD.bazel | 39 +++++++++ pkg/cmd/pr/edit/BUILD.bazel | 37 +++++++++ pkg/cmd/pr/list/BUILD.bazel | 48 +++++++++++ pkg/cmd/pr/merge/BUILD.bazel | 48 +++++++++++ pkg/cmd/pr/ready/BUILD.bazel | 35 ++++++++ pkg/cmd/pr/reopen/BUILD.bazel | 33 ++++++++ pkg/cmd/pr/review/BUILD.bazel | 42 ++++++++++ pkg/cmd/pr/shared/BUILD.bazel | 68 +++++++++++++++ pkg/cmd/pr/status/BUILD.bazel | 53 ++++++++++++ pkg/cmd/pr/update-branch/BUILD.bazel | 36 ++++++++ pkg/cmd/pr/view/BUILD.bazel | 42 ++++++++++ pkg/cmd/project/BUILD.bazel | 32 +++++++ pkg/cmd/project/close/BUILD.bazel | 31 +++++++ pkg/cmd/project/copy/BUILD.bazel | 31 +++++++ pkg/cmd/project/create/BUILD.bazel | 31 +++++++ pkg/cmd/project/delete/BUILD.bazel | 31 +++++++ pkg/cmd/project/edit/BUILD.bazel | 31 +++++++ pkg/cmd/project/field-create/BUILD.bazel | 31 +++++++ pkg/cmd/project/field-delete/BUILD.bazel | 30 +++++++ pkg/cmd/project/field-list/BUILD.bazel | 32 +++++++ pkg/cmd/project/item-add/BUILD.bazel | 31 +++++++ pkg/cmd/project/item-archive/BUILD.bazel | 31 +++++++ pkg/cmd/project/item-create/BUILD.bazel | 31 +++++++ pkg/cmd/project/item-delete/BUILD.bazel | 31 +++++++ pkg/cmd/project/item-edit/BUILD.bazel | 31 +++++++ pkg/cmd/project/item-list/BUILD.bazel | 32 +++++++ pkg/cmd/project/link/BUILD.bazel | 36 ++++++++ pkg/cmd/project/list/BUILD.bazel | 33 ++++++++ pkg/cmd/project/mark-template/BUILD.bazel | 31 +++++++ pkg/cmd/project/shared/client/BUILD.bazel | 12 +++ pkg/cmd/project/shared/format/BUILD.bazel | 19 +++++ pkg/cmd/project/shared/queries/BUILD.bazel | 29 +++++++ pkg/cmd/project/unlink/BUILD.bazel | 36 ++++++++ pkg/cmd/project/view/BUILD.bazel | 32 +++++++ pkg/cmd/release/BUILD.bazel | 20 +++++ pkg/cmd/release/create/BUILD.bazel | 49 +++++++++++ pkg/cmd/release/delete-asset/BUILD.bazel | 33 ++++++++ pkg/cmd/release/delete/BUILD.bazel | 38 +++++++++ pkg/cmd/release/download/BUILD.bazel | 32 +++++++ pkg/cmd/release/edit/BUILD.bazel | 38 +++++++++ pkg/cmd/release/list/BUILD.bazel | 37 +++++++++ pkg/cmd/release/shared/BUILD.bazel | 27 ++++++ pkg/cmd/release/upload/BUILD.bazel | 24 ++++++ pkg/cmd/release/view/BUILD.bazel | 37 +++++++++ pkg/cmd/repo/BUILD.bazel | 31 +++++++ pkg/cmd/repo/archive/BUILD.bazel | 37 +++++++++ pkg/cmd/repo/autolink/BUILD.bazel | 14 ++++ pkg/cmd/repo/autolink/list/BUILD.bazel | 44 ++++++++++ pkg/cmd/repo/clone/BUILD.bazel | 38 +++++++++ pkg/cmd/repo/create/BUILD.bazel | 49 +++++++++++ pkg/cmd/repo/credits/BUILD.bazel | 17 ++++ pkg/cmd/repo/delete/BUILD.bazel | 36 ++++++++ pkg/cmd/repo/deploy-key/BUILD.bazel | 15 ++++ pkg/cmd/repo/deploy-key/add/BUILD.bazel | 31 +++++++ pkg/cmd/repo/deploy-key/delete/BUILD.bazel | 31 +++++++ pkg/cmd/repo/deploy-key/list/BUILD.bazel | 32 +++++++ pkg/cmd/repo/edit/BUILD.bazel | 37 +++++++++ pkg/cmd/repo/fork/BUILD.bazel | 43 ++++++++++ pkg/cmd/repo/garden/BUILD.bazel | 22 +++++ pkg/cmd/repo/gitignore/BUILD.bazel | 14 ++++ pkg/cmd/repo/gitignore/list/BUILD.bazel | 32 +++++++ pkg/cmd/repo/gitignore/view/BUILD.bazel | 32 +++++++ pkg/cmd/repo/license/BUILD.bazel | 14 ++++ pkg/cmd/repo/license/list/BUILD.bazel | 33 ++++++++ pkg/cmd/repo/license/view/BUILD.bazel | 35 ++++++++ pkg/cmd/repo/list/BUILD.bazel | 48 +++++++++++ pkg/cmd/repo/rename/BUILD.bazel | 39 +++++++++ pkg/cmd/repo/setdefault/BUILD.bazel | 36 ++++++++ pkg/cmd/repo/shared/BUILD.bazel | 14 ++++ pkg/cmd/repo/sync/BUILD.bazel | 40 +++++++++ pkg/cmd/repo/unarchive/BUILD.bazel | 37 +++++++++ pkg/cmd/repo/view/BUILD.bazel | 46 ++++++++++ pkg/cmd/root/BUILD.bazel | 78 +++++++++++++++++ pkg/cmd/ruleset/BUILD.bazel | 16 ++++ pkg/cmd/ruleset/check/BUILD.bazel | 39 +++++++++ pkg/cmd/ruleset/list/BUILD.bazel | 40 +++++++++ pkg/cmd/ruleset/shared/BUILD.bazel | 16 ++++ pkg/cmd/ruleset/view/BUILD.bazel | 44 ++++++++++ pkg/cmd/run/BUILD.bazel | 19 +++++ pkg/cmd/run/cancel/BUILD.bazel | 33 ++++++++ pkg/cmd/run/delete/BUILD.bazel | 35 ++++++++ pkg/cmd/run/download/BUILD.bazel | 46 ++++++++++ pkg/cmd/run/list/BUILD.bazel | 36 ++++++++ pkg/cmd/run/rerun/BUILD.bazel | 34 ++++++++ pkg/cmd/run/shared/BUILD.bazel | 37 +++++++++ pkg/cmd/run/view/BUILD.bazel | 43 ++++++++++ pkg/cmd/run/watch/BUILD.bazel | 36 ++++++++ pkg/cmd/search/BUILD.bazel | 17 ++++ pkg/cmd/search/code/BUILD.bazel | 32 +++++++ pkg/cmd/search/commits/BUILD.bazel | 33 ++++++++ pkg/cmd/search/issues/BUILD.bazel | 29 +++++++ pkg/cmd/search/prs/BUILD.bazel | 29 +++++++ pkg/cmd/search/repos/BUILD.bazel | 33 ++++++++ pkg/cmd/search/shared/BUILD.bazel | 31 +++++++ pkg/cmd/secret/BUILD.bazel | 16 ++++ pkg/cmd/secret/delete/BUILD.bazel | 35 ++++++++ pkg/cmd/secret/list/BUILD.bazel | 37 +++++++++ pkg/cmd/secret/set/BUILD.bazel | 43 ++++++++++ pkg/cmd/secret/shared/BUILD.bazel | 16 ++++ pkg/cmd/ssh-key/BUILD.bazel | 15 ++++ pkg/cmd/ssh-key/add/BUILD.bazel | 33 ++++++++ pkg/cmd/ssh-key/delete/BUILD.bazel | 36 ++++++++ pkg/cmd/ssh-key/list/BUILD.bazel | 30 +++++++ pkg/cmd/ssh-key/shared/BUILD.bazel | 12 +++ pkg/cmd/status/BUILD.bazel | 38 +++++++++ pkg/cmd/variable/BUILD.bazel | 17 ++++ pkg/cmd/variable/delete/BUILD.bazel | 35 ++++++++ pkg/cmd/variable/get/BUILD.bazel | 36 ++++++++ pkg/cmd/variable/list/BUILD.bazel | 37 +++++++++ pkg/cmd/variable/set/BUILD.bazel | 42 ++++++++++ pkg/cmd/variable/shared/BUILD.bazel | 19 +++++ pkg/cmd/version/BUILD.bazel | 18 ++++ pkg/cmd/workflow/BUILD.bazel | 17 ++++ pkg/cmd/workflow/disable/BUILD.bazel | 32 +++++++ pkg/cmd/workflow/enable/BUILD.bazel | 32 +++++++ pkg/cmd/workflow/list/BUILD.bazel | 32 +++++++ pkg/cmd/workflow/run/BUILD.bazel | 35 ++++++++ pkg/cmd/workflow/shared/BUILD.bazel | 19 +++++ pkg/cmd/workflow/view/BUILD.bazel | 40 +++++++++ pkg/cmdutil/BUILD.bazel | 55 ++++++++++++ pkg/extensions/BUILD.bazel | 13 +++ pkg/findsh/BUILD.bazel | 17 ++++ pkg/githubtemplate/BUILD.bazel | 15 ++++ pkg/httpmock/BUILD.bazel | 13 +++ pkg/iostreams/BUILD.bazel | 34 ++++++++ pkg/jsoncolor/BUILD.bazel | 15 ++++ pkg/jsonfieldstest/BUILD.bazel | 14 ++++ pkg/markdown/BUILD.bazel | 12 +++ pkg/option/BUILD.bazel | 17 ++++ pkg/search/BUILD.bazel | 33 ++++++++ pkg/set/BUILD.bazel | 15 ++++ pkg/ssh/BUILD.bazel | 13 +++ pkg/surveyext/BUILD.bazel | 29 +++++++ script/BUILD.bazel | 15 ++++ test/BUILD.bazel | 8 ++ utils/BUILD.bazel | 9 ++ 258 files changed, 7981 insertions(+) create mode 100644 BUILD.bazel create mode 100644 api/BUILD.bazel create mode 100644 cmd/gen-docs/BUILD.bazel create mode 100644 cmd/gh/BUILD.bazel create mode 100644 context/BUILD.bazel create mode 100644 git/BUILD.bazel create mode 100755 git/git_test_wrapper.sh create mode 100644 internal/authflow/BUILD.bazel create mode 100644 internal/browser/BUILD.bazel create mode 100644 internal/build/BUILD.bazel create mode 100644 internal/codespaces/BUILD.bazel create mode 100644 internal/codespaces/api/BUILD.bazel create mode 100644 internal/codespaces/connection/BUILD.bazel create mode 100644 internal/codespaces/portforwarder/BUILD.bazel create mode 100644 internal/codespaces/rpc/BUILD.bazel create mode 100644 internal/codespaces/rpc/codespace/BUILD.bazel create mode 100644 internal/codespaces/rpc/jupyter/BUILD.bazel create mode 100644 internal/codespaces/rpc/ssh/BUILD.bazel create mode 100644 internal/codespaces/rpc/test/BUILD.bazel create mode 100644 internal/config/BUILD.bazel create mode 100644 internal/config/migration/BUILD.bazel create mode 100644 internal/docs/BUILD.bazel create mode 100644 internal/featuredetection/BUILD.bazel create mode 100644 internal/gh/BUILD.bazel create mode 100644 internal/gh/mock/BUILD.bazel create mode 100644 internal/ghcmd/BUILD.bazel create mode 100644 internal/ghinstance/BUILD.bazel create mode 100644 internal/ghrepo/BUILD.bazel create mode 100644 internal/keyring/BUILD.bazel create mode 100644 internal/prompter/BUILD.bazel create mode 100644 internal/run/BUILD.bazel create mode 100644 internal/safepaths/BUILD.bazel create mode 100644 internal/tableprinter/BUILD.bazel create mode 100644 internal/text/BUILD.bazel create mode 100644 internal/update/BUILD.bazel create mode 100644 pkg/cmd/actions/BUILD.bazel create mode 100644 pkg/cmd/alias/BUILD.bazel create mode 100644 pkg/cmd/alias/delete/BUILD.bazel create mode 100644 pkg/cmd/alias/imports/BUILD.bazel create mode 100644 pkg/cmd/alias/list/BUILD.bazel create mode 100644 pkg/cmd/alias/set/BUILD.bazel create mode 100644 pkg/cmd/alias/shared/BUILD.bazel create mode 100644 pkg/cmd/api/BUILD.bazel create mode 100644 pkg/cmd/attestation/BUILD.bazel create mode 100644 pkg/cmd/attestation/api/BUILD.bazel create mode 100644 pkg/cmd/attestation/artifact/BUILD.bazel create mode 100644 pkg/cmd/attestation/artifact/digest/BUILD.bazel create mode 100644 pkg/cmd/attestation/artifact/oci/BUILD.bazel create mode 100644 pkg/cmd/attestation/auth/BUILD.bazel create mode 100644 pkg/cmd/attestation/download/BUILD.bazel create mode 100644 pkg/cmd/attestation/inspect/BUILD.bazel create mode 100644 pkg/cmd/attestation/io/BUILD.bazel create mode 100644 pkg/cmd/attestation/test/BUILD.bazel create mode 100644 pkg/cmd/attestation/test/data/BUILD.bazel create mode 100644 pkg/cmd/attestation/trustedroot/BUILD.bazel create mode 100644 pkg/cmd/attestation/verification/BUILD.bazel create mode 100644 pkg/cmd/attestation/verify/BUILD.bazel create mode 100644 pkg/cmd/auth/BUILD.bazel create mode 100644 pkg/cmd/auth/gitcredential/BUILD.bazel create mode 100644 pkg/cmd/auth/login/BUILD.bazel create mode 100644 pkg/cmd/auth/logout/BUILD.bazel create mode 100644 pkg/cmd/auth/refresh/BUILD.bazel create mode 100644 pkg/cmd/auth/setupgit/BUILD.bazel create mode 100644 pkg/cmd/auth/shared/BUILD.bazel create mode 100644 pkg/cmd/auth/shared/contract/BUILD.bazel create mode 100644 pkg/cmd/auth/shared/gitcredentials/BUILD.bazel create mode 100644 pkg/cmd/auth/status/BUILD.bazel create mode 100644 pkg/cmd/auth/switch/BUILD.bazel create mode 100644 pkg/cmd/auth/token/BUILD.bazel create mode 100644 pkg/cmd/browse/BUILD.bazel create mode 100644 pkg/cmd/cache/BUILD.bazel create mode 100644 pkg/cmd/cache/delete/BUILD.bazel create mode 100644 pkg/cmd/cache/list/BUILD.bazel create mode 100644 pkg/cmd/cache/shared/BUILD.bazel create mode 100644 pkg/cmd/codespace/BUILD.bazel create mode 100644 pkg/cmd/completion/BUILD.bazel create mode 100644 pkg/cmd/config/BUILD.bazel create mode 100644 pkg/cmd/config/clear-cache/BUILD.bazel create mode 100644 pkg/cmd/config/get/BUILD.bazel create mode 100644 pkg/cmd/config/list/BUILD.bazel create mode 100644 pkg/cmd/config/set/BUILD.bazel create mode 100644 pkg/cmd/extension/BUILD.bazel create mode 100644 pkg/cmd/extension/browse/BUILD.bazel create mode 100644 pkg/cmd/factory/BUILD.bazel create mode 100644 pkg/cmd/gist/BUILD.bazel create mode 100644 pkg/cmd/gist/clone/BUILD.bazel create mode 100644 pkg/cmd/gist/create/BUILD.bazel create mode 100644 pkg/cmd/gist/delete/BUILD.bazel create mode 100644 pkg/cmd/gist/edit/BUILD.bazel create mode 100644 pkg/cmd/gist/list/BUILD.bazel create mode 100644 pkg/cmd/gist/rename/BUILD.bazel create mode 100644 pkg/cmd/gist/shared/BUILD.bazel create mode 100644 pkg/cmd/gist/view/BUILD.bazel create mode 100644 pkg/cmd/gpg-key/BUILD.bazel create mode 100644 pkg/cmd/gpg-key/add/BUILD.bazel create mode 100644 pkg/cmd/gpg-key/delete/BUILD.bazel create mode 100644 pkg/cmd/gpg-key/list/BUILD.bazel create mode 100644 pkg/cmd/issue/BUILD.bazel create mode 100644 pkg/cmd/issue/close/BUILD.bazel create mode 100644 pkg/cmd/issue/comment/BUILD.bazel create mode 100644 pkg/cmd/issue/create/BUILD.bazel create mode 100644 pkg/cmd/issue/delete/BUILD.bazel create mode 100644 pkg/cmd/issue/develop/BUILD.bazel create mode 100644 pkg/cmd/issue/edit/BUILD.bazel create mode 100644 pkg/cmd/issue/list/BUILD.bazel create mode 100644 pkg/cmd/issue/lock/BUILD.bazel create mode 100644 pkg/cmd/issue/pin/BUILD.bazel create mode 100644 pkg/cmd/issue/reopen/BUILD.bazel create mode 100644 pkg/cmd/issue/shared/BUILD.bazel create mode 100644 pkg/cmd/issue/status/BUILD.bazel create mode 100644 pkg/cmd/issue/transfer/BUILD.bazel create mode 100644 pkg/cmd/issue/unpin/BUILD.bazel create mode 100644 pkg/cmd/issue/view/BUILD.bazel create mode 100644 pkg/cmd/label/BUILD.bazel create mode 100644 pkg/cmd/org/BUILD.bazel create mode 100644 pkg/cmd/org/list/BUILD.bazel create mode 100644 pkg/cmd/pr/BUILD.bazel create mode 100644 pkg/cmd/pr/checkout/BUILD.bazel create mode 100644 pkg/cmd/pr/checks/BUILD.bazel create mode 100644 pkg/cmd/pr/close/BUILD.bazel create mode 100644 pkg/cmd/pr/comment/BUILD.bazel create mode 100644 pkg/cmd/pr/create/BUILD.bazel create mode 100644 pkg/cmd/pr/diff/BUILD.bazel create mode 100644 pkg/cmd/pr/edit/BUILD.bazel create mode 100644 pkg/cmd/pr/list/BUILD.bazel create mode 100644 pkg/cmd/pr/merge/BUILD.bazel create mode 100644 pkg/cmd/pr/ready/BUILD.bazel create mode 100644 pkg/cmd/pr/reopen/BUILD.bazel create mode 100644 pkg/cmd/pr/review/BUILD.bazel create mode 100644 pkg/cmd/pr/shared/BUILD.bazel create mode 100644 pkg/cmd/pr/status/BUILD.bazel create mode 100644 pkg/cmd/pr/update-branch/BUILD.bazel create mode 100644 pkg/cmd/pr/view/BUILD.bazel create mode 100644 pkg/cmd/project/BUILD.bazel create mode 100644 pkg/cmd/project/close/BUILD.bazel create mode 100644 pkg/cmd/project/copy/BUILD.bazel create mode 100644 pkg/cmd/project/create/BUILD.bazel create mode 100644 pkg/cmd/project/delete/BUILD.bazel create mode 100644 pkg/cmd/project/edit/BUILD.bazel create mode 100644 pkg/cmd/project/field-create/BUILD.bazel create mode 100644 pkg/cmd/project/field-delete/BUILD.bazel create mode 100644 pkg/cmd/project/field-list/BUILD.bazel create mode 100644 pkg/cmd/project/item-add/BUILD.bazel create mode 100644 pkg/cmd/project/item-archive/BUILD.bazel create mode 100644 pkg/cmd/project/item-create/BUILD.bazel create mode 100644 pkg/cmd/project/item-delete/BUILD.bazel create mode 100644 pkg/cmd/project/item-edit/BUILD.bazel create mode 100644 pkg/cmd/project/item-list/BUILD.bazel create mode 100644 pkg/cmd/project/link/BUILD.bazel create mode 100644 pkg/cmd/project/list/BUILD.bazel create mode 100644 pkg/cmd/project/mark-template/BUILD.bazel create mode 100644 pkg/cmd/project/shared/client/BUILD.bazel create mode 100644 pkg/cmd/project/shared/format/BUILD.bazel create mode 100644 pkg/cmd/project/shared/queries/BUILD.bazel create mode 100644 pkg/cmd/project/unlink/BUILD.bazel create mode 100644 pkg/cmd/project/view/BUILD.bazel create mode 100644 pkg/cmd/release/BUILD.bazel create mode 100644 pkg/cmd/release/create/BUILD.bazel create mode 100644 pkg/cmd/release/delete-asset/BUILD.bazel create mode 100644 pkg/cmd/release/delete/BUILD.bazel create mode 100644 pkg/cmd/release/download/BUILD.bazel create mode 100644 pkg/cmd/release/edit/BUILD.bazel create mode 100644 pkg/cmd/release/list/BUILD.bazel create mode 100644 pkg/cmd/release/shared/BUILD.bazel create mode 100644 pkg/cmd/release/upload/BUILD.bazel create mode 100644 pkg/cmd/release/view/BUILD.bazel create mode 100644 pkg/cmd/repo/BUILD.bazel create mode 100644 pkg/cmd/repo/archive/BUILD.bazel create mode 100644 pkg/cmd/repo/autolink/BUILD.bazel create mode 100644 pkg/cmd/repo/autolink/list/BUILD.bazel create mode 100644 pkg/cmd/repo/clone/BUILD.bazel create mode 100644 pkg/cmd/repo/create/BUILD.bazel create mode 100644 pkg/cmd/repo/credits/BUILD.bazel create mode 100644 pkg/cmd/repo/delete/BUILD.bazel create mode 100644 pkg/cmd/repo/deploy-key/BUILD.bazel create mode 100644 pkg/cmd/repo/deploy-key/add/BUILD.bazel create mode 100644 pkg/cmd/repo/deploy-key/delete/BUILD.bazel create mode 100644 pkg/cmd/repo/deploy-key/list/BUILD.bazel create mode 100644 pkg/cmd/repo/edit/BUILD.bazel create mode 100644 pkg/cmd/repo/fork/BUILD.bazel create mode 100644 pkg/cmd/repo/garden/BUILD.bazel create mode 100644 pkg/cmd/repo/gitignore/BUILD.bazel create mode 100644 pkg/cmd/repo/gitignore/list/BUILD.bazel create mode 100644 pkg/cmd/repo/gitignore/view/BUILD.bazel create mode 100644 pkg/cmd/repo/license/BUILD.bazel create mode 100644 pkg/cmd/repo/license/list/BUILD.bazel create mode 100644 pkg/cmd/repo/license/view/BUILD.bazel create mode 100644 pkg/cmd/repo/list/BUILD.bazel create mode 100644 pkg/cmd/repo/rename/BUILD.bazel create mode 100644 pkg/cmd/repo/setdefault/BUILD.bazel create mode 100644 pkg/cmd/repo/shared/BUILD.bazel create mode 100644 pkg/cmd/repo/sync/BUILD.bazel create mode 100644 pkg/cmd/repo/unarchive/BUILD.bazel create mode 100644 pkg/cmd/repo/view/BUILD.bazel create mode 100644 pkg/cmd/root/BUILD.bazel create mode 100644 pkg/cmd/ruleset/BUILD.bazel create mode 100644 pkg/cmd/ruleset/check/BUILD.bazel create mode 100644 pkg/cmd/ruleset/list/BUILD.bazel create mode 100644 pkg/cmd/ruleset/shared/BUILD.bazel create mode 100644 pkg/cmd/ruleset/view/BUILD.bazel create mode 100644 pkg/cmd/run/BUILD.bazel create mode 100644 pkg/cmd/run/cancel/BUILD.bazel create mode 100644 pkg/cmd/run/delete/BUILD.bazel create mode 100644 pkg/cmd/run/download/BUILD.bazel create mode 100644 pkg/cmd/run/list/BUILD.bazel create mode 100644 pkg/cmd/run/rerun/BUILD.bazel create mode 100644 pkg/cmd/run/shared/BUILD.bazel create mode 100644 pkg/cmd/run/view/BUILD.bazel create mode 100644 pkg/cmd/run/watch/BUILD.bazel create mode 100644 pkg/cmd/search/BUILD.bazel create mode 100644 pkg/cmd/search/code/BUILD.bazel create mode 100644 pkg/cmd/search/commits/BUILD.bazel create mode 100644 pkg/cmd/search/issues/BUILD.bazel create mode 100644 pkg/cmd/search/prs/BUILD.bazel create mode 100644 pkg/cmd/search/repos/BUILD.bazel create mode 100644 pkg/cmd/search/shared/BUILD.bazel create mode 100644 pkg/cmd/secret/BUILD.bazel create mode 100644 pkg/cmd/secret/delete/BUILD.bazel create mode 100644 pkg/cmd/secret/list/BUILD.bazel create mode 100644 pkg/cmd/secret/set/BUILD.bazel create mode 100644 pkg/cmd/secret/shared/BUILD.bazel create mode 100644 pkg/cmd/ssh-key/BUILD.bazel create mode 100644 pkg/cmd/ssh-key/add/BUILD.bazel create mode 100644 pkg/cmd/ssh-key/delete/BUILD.bazel create mode 100644 pkg/cmd/ssh-key/list/BUILD.bazel create mode 100644 pkg/cmd/ssh-key/shared/BUILD.bazel create mode 100644 pkg/cmd/status/BUILD.bazel create mode 100644 pkg/cmd/variable/BUILD.bazel create mode 100644 pkg/cmd/variable/delete/BUILD.bazel create mode 100644 pkg/cmd/variable/get/BUILD.bazel create mode 100644 pkg/cmd/variable/list/BUILD.bazel create mode 100644 pkg/cmd/variable/set/BUILD.bazel create mode 100644 pkg/cmd/variable/shared/BUILD.bazel create mode 100644 pkg/cmd/version/BUILD.bazel create mode 100644 pkg/cmd/workflow/BUILD.bazel create mode 100644 pkg/cmd/workflow/disable/BUILD.bazel create mode 100644 pkg/cmd/workflow/enable/BUILD.bazel create mode 100644 pkg/cmd/workflow/list/BUILD.bazel create mode 100644 pkg/cmd/workflow/run/BUILD.bazel create mode 100644 pkg/cmd/workflow/shared/BUILD.bazel create mode 100644 pkg/cmd/workflow/view/BUILD.bazel create mode 100644 pkg/cmdutil/BUILD.bazel create mode 100644 pkg/extensions/BUILD.bazel create mode 100644 pkg/findsh/BUILD.bazel create mode 100644 pkg/githubtemplate/BUILD.bazel create mode 100644 pkg/httpmock/BUILD.bazel create mode 100644 pkg/iostreams/BUILD.bazel create mode 100644 pkg/jsoncolor/BUILD.bazel create mode 100644 pkg/jsonfieldstest/BUILD.bazel create mode 100644 pkg/markdown/BUILD.bazel create mode 100644 pkg/option/BUILD.bazel create mode 100644 pkg/search/BUILD.bazel create mode 100644 pkg/set/BUILD.bazel create mode 100644 pkg/ssh/BUILD.bazel create mode 100644 pkg/surveyext/BUILD.bazel create mode 100644 script/BUILD.bazel create mode 100644 test/BUILD.bazel create mode 100644 utils/BUILD.bazel diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 000000000..cb2e65b5e --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,4 @@ +load("@gazelle//:def.bzl", "gazelle") + +# gazelle:prefix github.com/cli/cli/v2 +gazelle(name = "gazelle") diff --git a/api/BUILD.bazel b/api/BUILD.bazel new file mode 100644 index 000000000..34a77aea1 --- /dev/null +++ b/api/BUILD.bazel @@ -0,0 +1,58 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "api", + srcs = [ + "client.go", + "export_pr.go", + "export_repo.go", + "http_client.go", + "queries_branch_issue_reference.go", + "queries_comments.go", + "queries_issue.go", + "queries_org.go", + "queries_pr.go", + "queries_pr_review.go", + "queries_projects_v2.go", + "queries_repo.go", + "queries_user.go", + "query_builder.go", + "reaction_groups.go", + ], + importpath = "github.com/cli/cli/v2/api", + visibility = ["//visibility:public"], + deps = [ + "//internal/ghinstance", + "//internal/ghrepo", + "//pkg/set", + "//utils", + "@com_github_cli_go_gh_v2//pkg/api", + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_shurcool_githubv4//:githubv4", + "@org_golang_x_sync//errgroup", + ], +) + +go_test( + name = "api_test", + srcs = [ + "client_test.go", + "export_pr_test.go", + "http_client_test.go", + "pull_request_test.go", + "queries_pr_test.go", + "queries_projects_v2_test.go", + "queries_repo_test.go", + "query_builder_test.go", + "reaction_groups_test.go", + ], + embed = [":api"], + deps = [ + "//internal/ghrepo", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/cmd/gen-docs/BUILD.bazel b/cmd/gen-docs/BUILD.bazel new file mode 100644 index 000000000..e4bdab8d5 --- /dev/null +++ b/cmd/gen-docs/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library", "go_test") + +go_library( + name = "gen-docs_lib", + srcs = ["main.go"], + importpath = "github.com/cli/cli/v2/cmd/gen-docs", + visibility = ["//visibility:private"], + deps = [ + "//internal/config", + "//internal/docs", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/root", + "//pkg/cmdutil", + "//pkg/extensions", + "//pkg/iostreams", + "@com_github_spf13_pflag//:pflag", + ], +) + +go_binary( + name = "gen-docs", + embed = [":gen-docs_lib"], + visibility = ["//visibility:public"], +) + +go_test( + name = "gen-docs_test", + srcs = ["main_test.go"], + embed = [":gen-docs_lib"], +) diff --git a/cmd/gh/BUILD.bazel b/cmd/gh/BUILD.bazel new file mode 100644 index 000000000..414077ee8 --- /dev/null +++ b/cmd/gh/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "gh_lib", + srcs = ["main.go"], + importpath = "github.com/cli/cli/v2/cmd/gh", + visibility = ["//visibility:private"], + deps = ["//internal/ghcmd"], +) + +go_binary( + name = "gh", + embed = [":gh_lib"], + visibility = ["//visibility:public"], +) diff --git a/context/BUILD.bazel b/context/BUILD.bazel new file mode 100644 index 000000000..572bf89ad --- /dev/null +++ b/context/BUILD.bazel @@ -0,0 +1,28 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "context", + srcs = [ + "context.go", + "remote.go", + ], + importpath = "github.com/cli/cli/v2/context", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//git", + "//internal/ghrepo", + "//pkg/iostreams", + ], +) + +go_test( + name = "context_test", + srcs = ["remote_test.go"], + embed = [":context"], + deps = [ + "//git", + "//internal/ghrepo", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/git/BUILD.bazel b/git/BUILD.bazel new file mode 100644 index 000000000..f91d7b131 --- /dev/null +++ b/git/BUILD.bazel @@ -0,0 +1,43 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library", "go_test") + +go_library( + name = "git", + srcs = [ + "client.go", + "command.go", + "errors.go", + "objects.go", + "url.go", + ], + importpath = "github.com/cli/cli/v2/git", + visibility = ["//visibility:public"], + deps = [ + "//internal/ghinstance", + "//internal/run", + "@com_github_cli_safeexec//:safeexec", + ], +) + +go_test( + name = "git_test_bin", + srcs = [ + "client_test.go", + "url_test.go", + ], + embed = [":git"], + deps = [ + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], + data = glob(["fixtures/**"]), +) + +sh_test( + name = "git_test", + srcs = ["git_test_wrapper.sh"], + data = [ + ":git_test_bin", + ":git_test_bin_", + glob(["fixtures/**"]), + ], +) diff --git a/git/git_test_wrapper.sh b/git/git_test_wrapper.sh new file mode 100755 index 000000000..94ea19999 --- /dev/null +++ b/git/git_test_wrapper.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Runs the go_test binary from the git/ subdirectory of runfiles, +# so that ./fixtures/simple.git resolves correctly. +# +# Bazel's go_test CWD = _main/ (runfiles root) +# Data files live at _main/git/fixtures/ +# Test code expects ./fixtures/simple.git +# Solution: cd to _main/git/ before running the test. + +set -e + +cd git +exec ./git_test_bin_/git_test_bin "$@" diff --git a/internal/authflow/BUILD.bazel b/internal/authflow/BUILD.bazel new file mode 100644 index 000000000..654b397b0 --- /dev/null +++ b/internal/authflow/BUILD.bazel @@ -0,0 +1,28 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "authflow", + srcs = [ + "flow.go", + "success.go", + ], + importpath = "github.com/cli/cli/v2/internal/authflow", + visibility = ["//:__subpackages__"], + deps = [ + "//api", + "//internal/browser", + "//internal/ghinstance", + "//pkg/iostreams", + "//utils", + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_cli_oauth//:oauth", + "@com_github_henvic_httpretty//:httpretty", + ], +) + +go_test( + name = "authflow_test", + srcs = ["flow_test.go"], + embed = [":authflow"], + deps = ["@com_github_stretchr_testify//assert"], +) diff --git a/internal/browser/BUILD.bazel b/internal/browser/BUILD.bazel new file mode 100644 index 000000000..6bca82a0c --- /dev/null +++ b/internal/browser/BUILD.bazel @@ -0,0 +1,12 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "browser", + srcs = [ + "browser.go", + "stub.go", + ], + importpath = "github.com/cli/cli/v2/internal/browser", + visibility = ["//:__subpackages__"], + deps = ["@com_github_cli_go_gh_v2//pkg/browser"], +) diff --git a/internal/build/BUILD.bazel b/internal/build/BUILD.bazel new file mode 100644 index 000000000..b076f2732 --- /dev/null +++ b/internal/build/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "build", + srcs = ["build.go"], + importpath = "github.com/cli/cli/v2/internal/build", + visibility = ["//:__subpackages__"], +) diff --git a/internal/codespaces/BUILD.bazel b/internal/codespaces/BUILD.bazel new file mode 100644 index 000000000..eecba653b --- /dev/null +++ b/internal/codespaces/BUILD.bazel @@ -0,0 +1,27 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "codespaces", + srcs = [ + "codespaces.go", + "ssh.go", + "states.go", + ], + importpath = "github.com/cli/cli/v2/internal/codespaces", + visibility = ["//:__subpackages__"], + deps = [ + "//internal/codespaces/api", + "//internal/codespaces/connection", + "//internal/codespaces/portforwarder", + "//internal/codespaces/rpc", + "//internal/text", + "@com_github_cenkalti_backoff_v4//:backoff", + "@com_github_cli_safeexec//:safeexec", + ], +) + +go_test( + name = "codespaces_test", + srcs = ["ssh_test.go"], + embed = [":codespaces"], +) diff --git a/internal/codespaces/api/BUILD.bazel b/internal/codespaces/api/BUILD.bazel new file mode 100644 index 000000000..9344f38e8 --- /dev/null +++ b/internal/codespaces/api/BUILD.bazel @@ -0,0 +1,27 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "api", + srcs = ["api.go"], + importpath = "github.com/cli/cli/v2/internal/codespaces/api", + visibility = ["//:__subpackages__"], + deps = [ + "//api", + "//internal/ghinstance", + "//pkg/cmdutil", + "@com_github_cenkalti_backoff_v4//:backoff", + "@com_github_opentracing_opentracing_go//:opentracing-go", + ], +) + +go_test( + name = "api_test", + srcs = ["api_test.go"], + embed = [":api"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/gh/mock", + "//pkg/cmdutil", + ], +) diff --git a/internal/codespaces/connection/BUILD.bazel b/internal/codespaces/connection/BUILD.bazel new file mode 100644 index 000000000..2c50bd7d2 --- /dev/null +++ b/internal/codespaces/connection/BUILD.bazel @@ -0,0 +1,29 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "connection", + srcs = [ + "connection.go", + "tunnels_api_server_mock.go", + ], + importpath = "github.com/cli/cli/v2/internal/codespaces/connection", + visibility = ["//:__subpackages__"], + deps = [ + "//internal/codespaces/api", + "@com_github_gorilla_websocket//:websocket", + "@com_github_microsoft_dev_tunnels//go/tunnels", + "@com_github_microsoft_dev_tunnels//go/tunnels/ssh", + "@com_github_microsoft_dev_tunnels//go/tunnels/ssh/messages", + "@org_golang_x_crypto//ssh", + ], +) + +go_test( + name = "connection_test", + srcs = ["connection_test.go"], + embed = [":connection"], + deps = [ + "//internal/codespaces/api", + "@com_github_microsoft_dev_tunnels//go/tunnels", + ], +) diff --git a/internal/codespaces/portforwarder/BUILD.bazel b/internal/codespaces/portforwarder/BUILD.bazel new file mode 100644 index 000000000..070bba4d4 --- /dev/null +++ b/internal/codespaces/portforwarder/BUILD.bazel @@ -0,0 +1,23 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "portforwarder", + srcs = ["port_forwarder.go"], + importpath = "github.com/cli/cli/v2/internal/codespaces/portforwarder", + visibility = ["//:__subpackages__"], + deps = [ + "//internal/codespaces/connection", + "@com_github_microsoft_dev_tunnels//go/tunnels", + ], +) + +go_test( + name = "portforwarder_test", + srcs = ["port_forwarder_test.go"], + embed = [":portforwarder"], + deps = [ + "//internal/codespaces/api", + "//internal/codespaces/connection", + "@com_github_microsoft_dev_tunnels//go/tunnels", + ], +) diff --git a/internal/codespaces/rpc/BUILD.bazel b/internal/codespaces/rpc/BUILD.bazel new file mode 100644 index 000000000..e48065af1 --- /dev/null +++ b/internal/codespaces/rpc/BUILD.bazel @@ -0,0 +1,30 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "rpc", + srcs = ["invoker.go"], + importpath = "github.com/cli/cli/v2/internal/codespaces/rpc", + visibility = ["//:__subpackages__"], + deps = [ + "//internal/codespaces/portforwarder", + "//internal/codespaces/rpc/codespace", + "//internal/codespaces/rpc/jupyter", + "//internal/codespaces/rpc/ssh", + "@org_golang_google_grpc//:grpc", + "@org_golang_google_grpc//credentials/insecure", + "@org_golang_google_grpc//metadata", + ], +) + +go_test( + name = "rpc_test", + srcs = ["invoker_test.go"], + embed = [":rpc"], + deps = [ + "//internal/codespaces/rpc/codespace", + "//internal/codespaces/rpc/jupyter", + "//internal/codespaces/rpc/ssh", + "//internal/codespaces/rpc/test", + "@org_golang_google_grpc//:grpc", + ], +) diff --git a/internal/codespaces/rpc/codespace/BUILD.bazel b/internal/codespaces/rpc/codespace/BUILD.bazel new file mode 100644 index 000000000..f33a29a4b --- /dev/null +++ b/internal/codespaces/rpc/codespace/BUILD.bazel @@ -0,0 +1,28 @@ +load("@rules_go//go:def.bzl", "go_library") +load("@rules_go//proto:def.bzl", "go_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") + +proto_library( + name = "codespace_proto", + srcs = ["codespace_host_service.v1.proto"], + visibility = ["//:__subpackages__"], +) + +go_proto_library( + name = "codespace_go_proto", + compilers = [ + "@rules_go//proto:go_proto", + "@rules_go//proto:go_grpc_v2", + ], + importpath = "github.com/cli/cli/v2/internal/codespaces/rpc/codespace", + proto = ":codespace_proto", + visibility = ["//:__subpackages__"], +) + +go_library( + name = "codespace", + srcs = ["codespace_host_service.v1.proto.mock.go"], + importpath = "github.com/cli/cli/v2/internal/codespaces/rpc/codespace", + visibility = ["//:__subpackages__"], + embed = [":codespace_go_proto"], +) diff --git a/internal/codespaces/rpc/jupyter/BUILD.bazel b/internal/codespaces/rpc/jupyter/BUILD.bazel new file mode 100644 index 000000000..6a1df9b30 --- /dev/null +++ b/internal/codespaces/rpc/jupyter/BUILD.bazel @@ -0,0 +1,28 @@ +load("@rules_go//go:def.bzl", "go_library") +load("@rules_go//proto:def.bzl", "go_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") + +proto_library( + name = "jupyter_proto", + srcs = ["jupyter_server_host_service.v1.proto"], + visibility = ["//:__subpackages__"], +) + +go_proto_library( + name = "jupyter_go_proto", + compilers = [ + "@rules_go//proto:go_proto", + "@rules_go//proto:go_grpc_v2", + ], + importpath = "github.com/cli/cli/v2/internal/codespaces/rpc/jupyter", + proto = ":jupyter_proto", + visibility = ["//:__subpackages__"], +) + +go_library( + name = "jupyter", + srcs = ["jupyter_server_host_service.v1.proto.mock.go"], + importpath = "github.com/cli/cli/v2/internal/codespaces/rpc/jupyter", + visibility = ["//:__subpackages__"], + embed = [":jupyter_go_proto"], +) diff --git a/internal/codespaces/rpc/ssh/BUILD.bazel b/internal/codespaces/rpc/ssh/BUILD.bazel new file mode 100644 index 000000000..29d05542a --- /dev/null +++ b/internal/codespaces/rpc/ssh/BUILD.bazel @@ -0,0 +1,28 @@ +load("@rules_go//go:def.bzl", "go_library") +load("@rules_go//proto:def.bzl", "go_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") + +proto_library( + name = "ssh_proto", + srcs = ["ssh_server_host_service.v1.proto"], + visibility = ["//:__subpackages__"], +) + +go_proto_library( + name = "ssh_go_proto", + compilers = [ + "@rules_go//proto:go_proto", + "@rules_go//proto:go_grpc_v2", + ], + importpath = "github.com/cli/cli/v2/internal/codespaces/rpc/ssh", + proto = ":ssh_proto", + visibility = ["//:__subpackages__"], +) + +go_library( + name = "ssh", + srcs = ["ssh_server_host_service.v1.proto.mock.go"], + importpath = "github.com/cli/cli/v2/internal/codespaces/rpc/ssh", + visibility = ["//:__subpackages__"], + embed = [":ssh_go_proto"], +) diff --git a/internal/codespaces/rpc/test/BUILD.bazel b/internal/codespaces/rpc/test/BUILD.bazel new file mode 100644 index 000000000..8c0b7efb3 --- /dev/null +++ b/internal/codespaces/rpc/test/BUILD.bazel @@ -0,0 +1,12 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "test", + srcs = ["port_forwarder.go"], + importpath = "github.com/cli/cli/v2/internal/codespaces/rpc/test", + visibility = ["//:__subpackages__"], + deps = [ + "//internal/codespaces/portforwarder", + "@com_github_microsoft_dev_tunnels//go/tunnels", + ], +) diff --git a/internal/config/BUILD.bazel b/internal/config/BUILD.bazel new file mode 100644 index 000000000..5764eb2e0 --- /dev/null +++ b/internal/config/BUILD.bazel @@ -0,0 +1,37 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "config", + srcs = [ + "config.go", + "stub.go", + ], + importpath = "github.com/cli/cli/v2/internal/config", + visibility = ["//:__subpackages__"], + deps = [ + "//internal/gh", + "//internal/gh/mock", + "//internal/keyring", + "//pkg/option", + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_cli_go_gh_v2//pkg/config", + ], +) + +go_test( + name = "config_test", + srcs = [ + "auth_config_test.go", + "config_test.go", + "migrate_test.go", + ], + embed = [":config"], + deps = [ + "//internal/config/migration", + "//internal/gh", + "//internal/gh/mock", + "//internal/keyring", + "@com_github_cli_go_gh_v2//pkg/config", + "@com_github_stretchr_testify//require", + ], +) diff --git a/internal/config/migration/BUILD.bazel b/internal/config/migration/BUILD.bazel new file mode 100644 index 000000000..d17e0f9f3 --- /dev/null +++ b/internal/config/migration/BUILD.bazel @@ -0,0 +1,25 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "migration", + srcs = ["multi_account.go"], + importpath = "github.com/cli/cli/v2/internal/config/migration", + visibility = ["//:__subpackages__"], + deps = [ + "//internal/keyring", + "@com_github_cli_go_gh_v2//pkg/api", + "@com_github_cli_go_gh_v2//pkg/config", + ], +) + +go_test( + name = "migration_test", + srcs = ["multi_account_test.go"], + deps = [ + ":migration", + "//internal/keyring", + "//pkg/httpmock", + "@com_github_cli_go_gh_v2//pkg/config", + "@com_github_stretchr_testify//require", + ], +) diff --git a/internal/docs/BUILD.bazel b/internal/docs/BUILD.bazel new file mode 100644 index 000000000..118b8e8e5 --- /dev/null +++ b/internal/docs/BUILD.bazel @@ -0,0 +1,30 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "docs", + srcs = [ + "man.go", + "markdown.go", + ], + importpath = "github.com/cli/cli/v2/internal/docs", + visibility = ["//:__subpackages__"], + deps = [ + "//internal/text", + "//pkg/cmd/root", + "@com_github_cpuguy83_go_md2man_v2//md2man", + "@com_github_spf13_cobra//:cobra", + "@com_github_spf13_cobra//doc", + "@com_github_spf13_pflag//:pflag", + ], +) + +go_test( + name = "docs_test", + srcs = [ + "docs_test.go", + "man_test.go", + "markdown_test.go", + ], + embed = [":docs"], + deps = ["@com_github_spf13_cobra//:cobra"], +) diff --git a/internal/featuredetection/BUILD.bazel b/internal/featuredetection/BUILD.bazel new file mode 100644 index 000000000..0f2d7c006 --- /dev/null +++ b/internal/featuredetection/BUILD.bazel @@ -0,0 +1,27 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "featuredetection", + srcs = [ + "detector_mock.go", + "feature_detection.go", + ], + importpath = "github.com/cli/cli/v2/internal/featuredetection", + visibility = ["//:__subpackages__"], + deps = [ + "//api", + "@com_github_cli_go_gh_v2//pkg/auth", + "@org_golang_x_sync//errgroup", + ], +) + +go_test( + name = "featuredetection_test", + srcs = ["feature_detection_test.go"], + embed = [":featuredetection"], + deps = [ + "//pkg/httpmock", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/internal/gh/BUILD.bazel b/internal/gh/BUILD.bazel new file mode 100644 index 000000000..1c690ed25 --- /dev/null +++ b/internal/gh/BUILD.bazel @@ -0,0 +1,12 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "gh", + srcs = ["gh.go"], + importpath = "github.com/cli/cli/v2/internal/gh", + visibility = ["//:__subpackages__"], + deps = [ + "//pkg/option", + "@com_github_cli_go_gh_v2//pkg/config", + ], +) diff --git a/internal/gh/mock/BUILD.bazel b/internal/gh/mock/BUILD.bazel new file mode 100644 index 000000000..2173546db --- /dev/null +++ b/internal/gh/mock/BUILD.bazel @@ -0,0 +1,16 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "mock", + srcs = [ + "config.go", + "migration.go", + ], + importpath = "github.com/cli/cli/v2/internal/gh/mock", + visibility = ["//:__subpackages__"], + deps = [ + "//internal/gh", + "//pkg/option", + "@com_github_cli_go_gh_v2//pkg/config", + ], +) diff --git a/internal/ghcmd/BUILD.bazel b/internal/ghcmd/BUILD.bazel new file mode 100644 index 000000000..59053f631 --- /dev/null +++ b/internal/ghcmd/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "ghcmd", + srcs = ["cmd.go"], + importpath = "github.com/cli/cli/v2/internal/ghcmd", + visibility = ["//:__subpackages__"], + deps = [ + "//api", + "//internal/build", + "//internal/config", + "//internal/config/migration", + "//internal/update", + "//pkg/cmd/factory", + "//pkg/cmd/root", + "//pkg/cmdutil", + "//pkg/iostreams", + "//utils", + "@com_github_alecaivazis_survey_v2//core", + "@com_github_alecaivazis_survey_v2//terminal", + "@com_github_cli_safeexec//:safeexec", + "@com_github_mattn_go_isatty//:go-isatty", + "@com_github_mgutz_ansi//:ansi", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "ghcmd_test", + srcs = ["cmd_test.go"], + embed = [":ghcmd"], + deps = [ + "//pkg/cmdutil", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/internal/ghinstance/BUILD.bazel b/internal/ghinstance/BUILD.bazel new file mode 100644 index 000000000..53ae49ed3 --- /dev/null +++ b/internal/ghinstance/BUILD.bazel @@ -0,0 +1,16 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "ghinstance", + srcs = ["host.go"], + importpath = "github.com/cli/cli/v2/internal/ghinstance", + visibility = ["//:__subpackages__"], + deps = ["@com_github_cli_go_gh_v2//pkg/auth"], +) + +go_test( + name = "ghinstance_test", + srcs = ["host_test.go"], + embed = [":ghinstance"], + deps = ["@com_github_stretchr_testify//assert"], +) diff --git a/internal/ghrepo/BUILD.bazel b/internal/ghrepo/BUILD.bazel new file mode 100644 index 000000000..1ca70f805 --- /dev/null +++ b/internal/ghrepo/BUILD.bazel @@ -0,0 +1,19 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "ghrepo", + srcs = ["repo.go"], + importpath = "github.com/cli/cli/v2/internal/ghrepo", + visibility = ["//:__subpackages__"], + deps = [ + "//internal/ghinstance", + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_cli_go_gh_v2//pkg/repository", + ], +) + +go_test( + name = "ghrepo_test", + srcs = ["repo_test.go"], + embed = [":ghrepo"], +) diff --git a/internal/keyring/BUILD.bazel b/internal/keyring/BUILD.bazel new file mode 100644 index 000000000..01760b294 --- /dev/null +++ b/internal/keyring/BUILD.bazel @@ -0,0 +1,9 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "keyring", + srcs = ["keyring.go"], + importpath = "github.com/cli/cli/v2/internal/keyring", + visibility = ["//:__subpackages__"], + deps = ["@com_github_zalando_go_keyring//:go-keyring"], +) diff --git a/internal/prompter/BUILD.bazel b/internal/prompter/BUILD.bazel new file mode 100644 index 000000000..793ae3d00 --- /dev/null +++ b/internal/prompter/BUILD.bazel @@ -0,0 +1,19 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "prompter", + srcs = [ + "prompter.go", + "prompter_mock.go", + "test.go", + ], + importpath = "github.com/cli/cli/v2/internal/prompter", + visibility = ["//:__subpackages__"], + deps = [ + "//internal/ghinstance", + "//pkg/surveyext", + "@com_github_alecaivazis_survey_v2//:survey", + "@com_github_cli_go_gh_v2//pkg/prompter", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/internal/run/BUILD.bazel b/internal/run/BUILD.bazel new file mode 100644 index 000000000..7b47f37ff --- /dev/null +++ b/internal/run/BUILD.bazel @@ -0,0 +1,12 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "run", + srcs = [ + "run.go", + "stub.go", + ], + importpath = "github.com/cli/cli/v2/internal/run", + visibility = ["//:__subpackages__"], + deps = ["//utils"], +) diff --git a/internal/safepaths/BUILD.bazel b/internal/safepaths/BUILD.bazel new file mode 100644 index 000000000..b0554b3a3 --- /dev/null +++ b/internal/safepaths/BUILD.bazel @@ -0,0 +1,17 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "safepaths", + srcs = ["absolute.go"], + importpath = "github.com/cli/cli/v2/internal/safepaths", + visibility = ["//:__subpackages__"], +) + +go_test( + name = "safepaths_test", + srcs = ["absolute_test.go"], + deps = [ + ":safepaths", + "@com_github_stretchr_testify//require", + ], +) diff --git a/internal/tableprinter/BUILD.bazel b/internal/tableprinter/BUILD.bazel new file mode 100644 index 000000000..7aff7a4b1 --- /dev/null +++ b/internal/tableprinter/BUILD.bazel @@ -0,0 +1,23 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "tableprinter", + srcs = ["table_printer.go"], + importpath = "github.com/cli/cli/v2/internal/tableprinter", + visibility = ["//:__subpackages__"], + deps = [ + "//internal/text", + "//pkg/iostreams", + "@com_github_cli_go_gh_v2//pkg/tableprinter", + ], +) + +go_test( + name = "tableprinter_test", + srcs = ["table_printer_test.go"], + deps = [ + ":tableprinter", + "//pkg/iostreams", + "@com_github_stretchr_testify//require", + ], +) diff --git a/internal/text/BUILD.bazel b/internal/text/BUILD.bazel new file mode 100644 index 000000000..819a0685c --- /dev/null +++ b/internal/text/BUILD.bazel @@ -0,0 +1,20 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "text", + srcs = ["text.go"], + importpath = "github.com/cli/cli/v2/internal/text", + visibility = ["//:__subpackages__"], + deps = [ + "@com_github_cli_go_gh_v2//pkg/text", + "@org_golang_x_text//cases", + "@org_golang_x_text//language", + ], +) + +go_test( + name = "text_test", + srcs = ["text_test.go"], + embed = [":text"], + deps = ["@com_github_stretchr_testify//assert"], +) diff --git a/internal/update/BUILD.bazel b/internal/update/BUILD.bazel new file mode 100644 index 000000000..86337a192 --- /dev/null +++ b/internal/update/BUILD.bazel @@ -0,0 +1,19 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "update", + srcs = ["update.go"], + importpath = "github.com/cli/cli/v2/internal/update", + visibility = ["//:__subpackages__"], + deps = [ + "@com_github_hashicorp_go_version//:go-version", + "@in_gopkg_yaml_v3//:yaml_v3", + ], +) + +go_test( + name = "update_test", + srcs = ["update_test.go"], + embed = [":update"], + deps = ["//pkg/httpmock"], +) diff --git a/pkg/cmd/actions/BUILD.bazel b/pkg/cmd/actions/BUILD.bazel new file mode 100644 index 000000000..86f69197c --- /dev/null +++ b/pkg/cmd/actions/BUILD.bazel @@ -0,0 +1,14 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "actions", + srcs = ["actions.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/actions", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/alias/BUILD.bazel b/pkg/cmd/alias/BUILD.bazel new file mode 100644 index 000000000..c515ab924 --- /dev/null +++ b/pkg/cmd/alias/BUILD.bazel @@ -0,0 +1,17 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "alias", + srcs = ["alias.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/alias", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/alias/delete", + "//pkg/cmd/alias/imports", + "//pkg/cmd/alias/list", + "//pkg/cmd/alias/set", + "//pkg/cmdutil", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/alias/delete/BUILD.bazel b/pkg/cmd/alias/delete/BUILD.bazel new file mode 100644 index 000000000..63a8a615a --- /dev/null +++ b/pkg/cmd/alias/delete/BUILD.bazel @@ -0,0 +1,29 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "delete", + srcs = ["delete.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/alias/delete", + visibility = ["//visibility:public"], + deps = [ + "//internal/gh", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "delete_test", + srcs = ["delete_test.go"], + embed = [":delete"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/alias/imports/BUILD.bazel b/pkg/cmd/alias/imports/BUILD.bazel new file mode 100644 index 000000000..9d4b80afe --- /dev/null +++ b/pkg/cmd/alias/imports/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "imports", + srcs = ["import.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/alias/imports", + visibility = ["//visibility:public"], + deps = [ + "//internal/gh", + "//pkg/cmd/alias/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@in_gopkg_yaml_v3//:yaml_v3", + ], +) + +go_test( + name = "imports_test", + srcs = ["import_test.go"], + embed = [":imports"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmd/alias/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/alias/list/BUILD.bazel b/pkg/cmd/alias/list/BUILD.bazel new file mode 100644 index 000000000..380d5466e --- /dev/null +++ b/pkg/cmd/alias/list/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = ["list.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/alias/list", + visibility = ["//visibility:public"], + deps = [ + "//internal/gh", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@in_gopkg_yaml_v3//:yaml_v3", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/alias/set/BUILD.bazel b/pkg/cmd/alias/set/BUILD.bazel new file mode 100644 index 000000000..016667ad3 --- /dev/null +++ b/pkg/cmd/alias/set/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "set", + srcs = ["set.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/alias/set", + visibility = ["//visibility:public"], + deps = [ + "//internal/gh", + "//pkg/cmd/alias/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "set_test", + srcs = ["set_test.go"], + embed = [":set"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmd/alias/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_spf13_cobra//:cobra", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/alias/shared/BUILD.bazel b/pkg/cmd/alias/shared/BUILD.bazel new file mode 100644 index 000000000..9e488db57 --- /dev/null +++ b/pkg/cmd/alias/shared/BUILD.bazel @@ -0,0 +1,22 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "shared", + srcs = ["validations.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/alias/shared", + visibility = ["//visibility:public"], + deps = [ + "@com_github_google_shlex//:shlex", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "shared_test", + srcs = ["validations_test.go"], + embed = [":shared"], + deps = [ + "@com_github_spf13_cobra//:cobra", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/api/BUILD.bazel b/pkg/cmd/api/BUILD.bazel new file mode 100644 index 000000000..8ea750daf --- /dev/null +++ b/pkg/cmd/api/BUILD.bazel @@ -0,0 +1,52 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "api", + srcs = [ + "api.go", + "fields.go", + "http.go", + "pagination.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/api", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghinstance", + "//internal/ghrepo", + "//pkg/cmd/factory", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/jsoncolor", + "@com_github_cli_go_gh_v2//pkg/jq", + "@com_github_cli_go_gh_v2//pkg/template", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "api_test", + srcs = [ + "api_test.go", + "fields_test.go", + "http_test.go", + "pagination_test.go", + ], + embed = [":api"], + deps = [ + "//git", + "//internal/config", + "//internal/gh", + "//internal/gh/mock", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_cli_go_gh_v2//pkg/template", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/attestation/BUILD.bazel b/pkg/cmd/attestation/BUILD.bazel new file mode 100644 index 000000000..2a45c0644 --- /dev/null +++ b/pkg/cmd/attestation/BUILD.bazel @@ -0,0 +1,17 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "attestation", + srcs = ["attestation.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/attestation", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/attestation/download", + "//pkg/cmd/attestation/inspect", + "//pkg/cmd/attestation/trustedroot", + "//pkg/cmd/attestation/verify", + "//pkg/cmdutil", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/attestation/api/BUILD.bazel b/pkg/cmd/attestation/api/BUILD.bazel new file mode 100644 index 000000000..3fc73eb2b --- /dev/null +++ b/pkg/cmd/attestation/api/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "api", + srcs = [ + "attestation.go", + "client.go", + "mock_client.go", + "trust_domain.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/attestation/api", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//pkg/cmd/attestation/io", + "//pkg/cmd/attestation/test/data", + "@com_github_cenkalti_backoff_v4//:backoff", + "@com_github_sigstore_sigstore_go//pkg/bundle", + ], +) + +go_test( + name = "api_test", + srcs = [ + "client_test.go", + "mock_apiClient_test.go", + ], + embed = [":api"], + deps = [ + "//api", + "//pkg/cmd/attestation/io", + "@com_github_cli_go_gh_v2//pkg/api", + "@com_github_stretchr_testify//mock", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/attestation/artifact/BUILD.bazel b/pkg/cmd/attestation/artifact/BUILD.bazel new file mode 100644 index 000000000..302b9e677 --- /dev/null +++ b/pkg/cmd/attestation/artifact/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "artifact", + srcs = [ + "artifact.go", + "file.go", + "image.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/attestation/artifact", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/attestation/artifact/digest", + "//pkg/cmd/attestation/artifact/oci", + "@com_github_distribution_reference//:reference", + "@com_github_google_go_containerregistry//pkg/name", + ], +) + +go_test( + name = "artifact_test", + srcs = [ + "artifact_posix_test.go", + "artifact_windows_test.go", + "image_test.go", + ], + embed = [":artifact"], + deps = [ + "//pkg/cmd/attestation/artifact/oci", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/attestation/artifact/digest/BUILD.bazel b/pkg/cmd/attestation/artifact/digest/BUILD.bazel new file mode 100644 index 000000000..046259074 --- /dev/null +++ b/pkg/cmd/attestation/artifact/digest/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "digest", + srcs = ["digest.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/attestation/artifact/digest", + visibility = ["//visibility:public"], +) + +go_test( + name = "digest_test", + srcs = ["digest_test.go"], + embed = [":digest"], + deps = [ + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/attestation/artifact/oci/BUILD.bazel b/pkg/cmd/attestation/artifact/oci/BUILD.bazel new file mode 100644 index 000000000..32235fe17 --- /dev/null +++ b/pkg/cmd/attestation/artifact/oci/BUILD.bazel @@ -0,0 +1,34 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "oci", + srcs = [ + "client.go", + "mock_client.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/attestation/artifact/oci", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/attestation/api", + "//pkg/cmd/attestation/test/data", + "@com_github_google_go_containerregistry//pkg/authn", + "@com_github_google_go_containerregistry//pkg/name", + "@com_github_google_go_containerregistry//pkg/v1:pkg", + "@com_github_google_go_containerregistry//pkg/v1/remote", + "@com_github_google_go_containerregistry//pkg/v1/remote/transport", + "@com_github_sigstore_sigstore_go//pkg/bundle", + ], +) + +go_test( + name = "oci_test", + srcs = ["client_test.go"], + embed = [":oci"], + deps = [ + "@com_github_google_go_containerregistry//pkg/name", + "@com_github_google_go_containerregistry//pkg/v1:pkg", + "@com_github_google_go_containerregistry//pkg/v1/remote", + "@com_github_google_go_containerregistry//pkg/v1/remote/transport", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/attestation/auth/BUILD.bazel b/pkg/cmd/attestation/auth/BUILD.bazel new file mode 100644 index 000000000..90aad0cd0 --- /dev/null +++ b/pkg/cmd/attestation/auth/BUILD.bazel @@ -0,0 +1,19 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "auth", + srcs = ["host.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/attestation/auth", + visibility = ["//visibility:public"], + deps = ["@com_github_cli_go_gh_v2//pkg/auth"], +) + +go_test( + name = "auth_test", + srcs = ["host_test.go"], + embed = [":auth"], + deps = [ + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/attestation/download/BUILD.bazel b/pkg/cmd/attestation/download/BUILD.bazel new file mode 100644 index 000000000..c0b75225b --- /dev/null +++ b/pkg/cmd/attestation/download/BUILD.bazel @@ -0,0 +1,47 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "download", + srcs = [ + "download.go", + "metadata.go", + "options.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/attestation/download", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/attestation/api", + "//pkg/cmd/attestation/artifact", + "//pkg/cmd/attestation/artifact/oci", + "//pkg/cmd/attestation/auth", + "//pkg/cmd/attestation/io", + "//pkg/cmd/attestation/verification", + "//pkg/cmdutil", + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "download_test", + srcs = [ + "download_test.go", + "metadata_test.go", + "options_test.go", + ], + embed = [":download"], + deps = [ + "//pkg/cmd/attestation/api", + "//pkg/cmd/attestation/artifact", + "//pkg/cmd/attestation/artifact/oci", + "//pkg/cmd/attestation/io", + "//pkg/cmd/attestation/test", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], + data = ["//pkg/cmd/attestation/test/data:sigstore-js-2.1.0.tgz"], +) diff --git a/pkg/cmd/attestation/inspect/BUILD.bazel b/pkg/cmd/attestation/inspect/BUILD.bazel new file mode 100644 index 000000000..c3a3ba54a --- /dev/null +++ b/pkg/cmd/attestation/inspect/BUILD.bazel @@ -0,0 +1,52 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "inspect", + srcs = [ + "bundle.go", + "inspect.go", + "options.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/attestation/inspect", + visibility = ["//visibility:public"], + deps = [ + "//internal/ghinstance", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmd/attestation/api", + "//pkg/cmd/attestation/artifact/oci", + "//pkg/cmd/attestation/auth", + "//pkg/cmd/attestation/io", + "//pkg/cmd/attestation/verification", + "//pkg/cmdutil", + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_digitorus_timestamp//:timestamp", + "@com_github_in_toto_attestation//go/v1:go", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_sigstore_sigstore_go//pkg/bundle", + "@com_github_sigstore_sigstore_go//pkg/fulcio/certificate", + "@com_github_sigstore_sigstore_go//pkg/verify", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "inspect_test", + srcs = [ + "bundle_test.go", + "inspect_test.go", + ], + embed = [":inspect"], + deps = [ + "//pkg/cmd/attestation/artifact/oci", + "//pkg/cmd/attestation/io", + "//pkg/cmd/attestation/test", + "//pkg/cmd/attestation/verification", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], + data = ["//pkg/cmd/attestation/test/data:sigstore-js-2.1.0-bundle.json"], +) diff --git a/pkg/cmd/attestation/io/BUILD.bazel b/pkg/cmd/attestation/io/BUILD.bazel new file mode 100644 index 000000000..8a0d40971 --- /dev/null +++ b/pkg/cmd/attestation/io/BUILD.bazel @@ -0,0 +1,13 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "io", + srcs = ["handler.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/attestation/io", + visibility = ["//visibility:public"], + deps = [ + "//internal/tableprinter", + "//pkg/iostreams", + "//utils", + ], +) diff --git a/pkg/cmd/attestation/test/BUILD.bazel b/pkg/cmd/attestation/test/BUILD.bazel new file mode 100644 index 000000000..42f59f6b6 --- /dev/null +++ b/pkg/cmd/attestation/test/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "test", + srcs = ["path.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/attestation/test", + visibility = ["//visibility:public"], +) diff --git a/pkg/cmd/attestation/test/data/BUILD.bazel b/pkg/cmd/attestation/test/data/BUILD.bazel new file mode 100644 index 000000000..cc50c90d2 --- /dev/null +++ b/pkg/cmd/attestation/test/data/BUILD.bazel @@ -0,0 +1,21 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "data", + srcs = ["data.go"], + embedsrcs = ["sigstore-js-2.1.0-bundle.json"], + importpath = "github.com/cli/cli/v2/pkg/cmd/attestation/test/data", + visibility = ["//visibility:public"], + deps = [ + "@com_github_sigstore_sigstore_go//pkg/bundle", + "@com_github_sigstore_sigstore_go//pkg/testing/data", + ], +) + +exports_files([ + "sigstore-js-2.1.0.tgz", + "sigstore-js-2.1.0-bundle.json", + "sigstore-js-2.1.0_with_2_bundles.jsonl", + "github_provenance_demo-0.0.12-py3-none-any-bundle-missing-verification-material.jsonl", + "github_provenance_demo-0.0.12-py3-none-any-bundle-missing-cert.jsonl", +]) diff --git a/pkg/cmd/attestation/trustedroot/BUILD.bazel b/pkg/cmd/attestation/trustedroot/BUILD.bazel new file mode 100644 index 000000000..56ba44616 --- /dev/null +++ b/pkg/cmd/attestation/trustedroot/BUILD.bazel @@ -0,0 +1,39 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "trustedroot", + srcs = ["trustedroot.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/attestation/trustedroot", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/attestation/api", + "//pkg/cmd/attestation/auth", + "//pkg/cmd/attestation/io", + "//pkg/cmd/attestation/verification", + "//pkg/cmdutil", + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_sigstore_sigstore_go//pkg/tuf", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "trustedroot_test", + srcs = ["trustedroot_test.go"], + embed = [":trustedroot"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/gh/mock", + "//pkg/cmd/attestation/api", + "//pkg/cmd/attestation/test", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_sigstore_sigstore_go//pkg/tuf", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], + data = ["//pkg/cmd/attestation/verification:embed/tuf-repo.github.com/root.json"], +) diff --git a/pkg/cmd/attestation/verification/BUILD.bazel b/pkg/cmd/attestation/verification/BUILD.bazel new file mode 100644 index 000000000..c1d710240 --- /dev/null +++ b/pkg/cmd/attestation/verification/BUILD.bazel @@ -0,0 +1,59 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +exports_files(["embed/tuf-repo.github.com/root.json"]) + +go_library( + name = "verification", + srcs = [ + "attestation.go", + "extensions.go", + "mock_verifier.go", + "policy.go", + "sigstore.go", + "tuf.go", + ], + embedsrcs = ["embed/tuf-repo.github.com/root.json"], + importpath = "github.com/cli/cli/v2/pkg/cmd/attestation/verification", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/attestation/api", + "//pkg/cmd/attestation/artifact", + "//pkg/cmd/attestation/artifact/oci", + "//pkg/cmd/attestation/io", + "//pkg/cmd/attestation/test/data", + "@com_github_cli_go_gh_v2//pkg/config", + "@com_github_in_toto_attestation//go/v1:go", + "@com_github_sigstore_protobuf_specs//gen/pb-go/bundle/v1:bundle", + "@com_github_sigstore_sigstore_go//pkg/bundle", + "@com_github_sigstore_sigstore_go//pkg/fulcio/certificate", + "@com_github_sigstore_sigstore_go//pkg/root", + "@com_github_sigstore_sigstore_go//pkg/tuf", + "@com_github_sigstore_sigstore_go//pkg/verify", + ], +) + +go_test( + name = "verification_test", + srcs = [ + "attestation_test.go", + "extensions_test.go", + "tuf_test.go", + ], + embed = [":verification"], + deps = [ + "//pkg/cmd/attestation/api", + "@com_github_cli_go_gh_v2//pkg/config", + "@com_github_sigstore_protobuf_specs//gen/pb-go/bundle/v1:bundle", + "@com_github_sigstore_protobuf_specs//gen/pb-go/dsse", + "@com_github_sigstore_sigstore_go//pkg/bundle", + "@com_github_sigstore_sigstore_go//pkg/fulcio/certificate", + "@com_github_sigstore_sigstore_go//pkg/verify", + "@com_github_stretchr_testify//require", + ], + data = [ + "//pkg/cmd/attestation/test/data:sigstore-js-2.1.0_with_2_bundles.jsonl", + "//pkg/cmd/attestation/test/data:sigstore-js-2.1.0-bundle.json", + "//pkg/cmd/attestation/test/data:github_provenance_demo-0.0.12-py3-none-any-bundle-missing-verification-material.jsonl", + "//pkg/cmd/attestation/test/data:github_provenance_demo-0.0.12-py3-none-any-bundle-missing-cert.jsonl", + ], +) diff --git a/pkg/cmd/attestation/verify/BUILD.bazel b/pkg/cmd/attestation/verify/BUILD.bazel new file mode 100644 index 000000000..b92988d40 --- /dev/null +++ b/pkg/cmd/attestation/verify/BUILD.bazel @@ -0,0 +1,58 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "verify", + srcs = [ + "attestation.go", + "options.go", + "policy.go", + "verify.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/attestation/verify", + visibility = ["//visibility:public"], + deps = [ + "//internal/gh", + "//internal/ghinstance", + "//internal/text", + "//pkg/cmd/attestation/api", + "//pkg/cmd/attestation/artifact", + "//pkg/cmd/attestation/artifact/oci", + "//pkg/cmd/attestation/auth", + "//pkg/cmd/attestation/io", + "//pkg/cmd/attestation/verification", + "//pkg/cmdutil", + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_sigstore_sigstore_go//pkg/fulcio/certificate", + "@com_github_sigstore_sigstore_go//pkg/verify", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "verify_test", + srcs = [ + "options_test.go", + "policy_test.go", + "verify_test.go", + ], + embed = [":verify"], + deps = [ + "//pkg/cmd/attestation/api", + "//pkg/cmd/attestation/artifact/oci", + "//pkg/cmd/attestation/io", + "//pkg/cmd/attestation/test", + "//pkg/cmd/attestation/verification", + "//pkg/cmd/factory", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], + data = [ + "//pkg/cmd/attestation/test/data:sigstore-js-2.1.0.tgz", + "//pkg/cmd/attestation/test/data:sigstore-js-2.1.0-bundle.json", + ], +) diff --git a/pkg/cmd/auth/BUILD.bazel b/pkg/cmd/auth/BUILD.bazel new file mode 100644 index 000000000..ebdaab5b1 --- /dev/null +++ b/pkg/cmd/auth/BUILD.bazel @@ -0,0 +1,20 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "auth", + srcs = ["auth.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/auth", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/auth/gitcredential", + "//pkg/cmd/auth/login", + "//pkg/cmd/auth/logout", + "//pkg/cmd/auth/refresh", + "//pkg/cmd/auth/setupgit", + "//pkg/cmd/auth/status", + "//pkg/cmd/auth/switch", + "//pkg/cmd/auth/token", + "//pkg/cmdutil", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/auth/gitcredential/BUILD.bazel b/pkg/cmd/auth/gitcredential/BUILD.bazel new file mode 100644 index 000000000..8ef38cc34 --- /dev/null +++ b/pkg/cmd/auth/gitcredential/BUILD.bazel @@ -0,0 +1,23 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "gitcredential", + srcs = ["helper.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/auth/gitcredential", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "gitcredential_test", + srcs = ["helper_test.go"], + embed = [":gitcredential"], + deps = [ + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + ], +) diff --git a/pkg/cmd/auth/login/BUILD.bazel b/pkg/cmd/auth/login/BUILD.bazel new file mode 100644 index 000000000..6083a68f9 --- /dev/null +++ b/pkg/cmd/auth/login/BUILD.bazel @@ -0,0 +1,41 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "login", + srcs = ["login.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/auth/login", + visibility = ["//visibility:public"], + deps = [ + "//git", + "//internal/browser", + "//internal/gh", + "//internal/ghinstance", + "//pkg/cmd/auth/shared", + "//pkg/cmd/auth/shared/gitcredentials", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "login_test", + srcs = ["login_test.go"], + embed = [":login"], + deps = [ + "//git", + "//internal/config", + "//internal/gh", + "//internal/prompter", + "//internal/run", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/auth/logout/BUILD.bazel b/pkg/cmd/auth/logout/BUILD.bazel new file mode 100644 index 000000000..257f112ff --- /dev/null +++ b/pkg/cmd/auth/logout/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "logout", + srcs = ["logout.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/auth/logout", + visibility = ["//visibility:public"], + deps = [ + "//internal/gh", + "//pkg/cmd/auth/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "logout_test", + srcs = ["logout_test.go"], + embed = [":logout"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/auth/refresh/BUILD.bazel b/pkg/cmd/auth/refresh/BUILD.bazel new file mode 100644 index 000000000..374bc82ce --- /dev/null +++ b/pkg/cmd/auth/refresh/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "refresh", + srcs = ["refresh.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/auth/refresh", + visibility = ["//visibility:public"], + deps = [ + "//git", + "//internal/authflow", + "//internal/gh", + "//pkg/cmd/auth/shared", + "//pkg/cmd/auth/shared/gitcredentials", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/set", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "refresh_test", + srcs = ["refresh_test.go"], + embed = [":refresh"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/auth/setupgit/BUILD.bazel b/pkg/cmd/auth/setupgit/BUILD.bazel new file mode 100644 index 000000000..8e3131c24 --- /dev/null +++ b/pkg/cmd/auth/setupgit/BUILD.bazel @@ -0,0 +1,30 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "setupgit", + srcs = ["setupgit.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/auth/setupgit", + visibility = ["//visibility:public"], + deps = [ + "//internal/gh", + "//pkg/cmd/auth/shared/gitcredentials", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "setupgit_test", + srcs = ["setupgit_test.go"], + embed = [":setupgit"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/auth/shared/BUILD.bazel b/pkg/cmd/auth/shared/BUILD.bazel new file mode 100644 index 000000000..e0f8e568e --- /dev/null +++ b/pkg/cmd/auth/shared/BUILD.bazel @@ -0,0 +1,49 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "shared", + srcs = [ + "git_credential.go", + "login_flow.go", + "oauth_scopes.go", + "prompt.go", + "writeable.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/auth/shared", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//git", + "//internal/authflow", + "//internal/browser", + "//internal/gh", + "//internal/ghinstance", + "//pkg/cmd/auth/shared/gitcredentials", + "//pkg/cmd/ssh-key/add", + "//pkg/iostreams", + "//pkg/ssh", + "@com_github_makenowjust_heredoc//:heredoc", + ], +) + +go_test( + name = "shared_test", + srcs = [ + "git_credential_test.go", + "login_flow_test.go", + "oauth_scopes_test.go", + ], + embed = [":shared"], + deps = [ + "//git", + "//internal/prompter", + "//internal/run", + "//pkg/cmd/auth/shared/gitcredentials", + "//pkg/httpmock", + "//pkg/iostreams", + "//pkg/ssh", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/auth/shared/contract/BUILD.bazel b/pkg/cmd/auth/shared/contract/BUILD.bazel new file mode 100644 index 000000000..c84151d35 --- /dev/null +++ b/pkg/cmd/auth/shared/contract/BUILD.bazel @@ -0,0 +1,12 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "contract", + srcs = ["helper_config.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/auth/shared/contract", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/auth/shared", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/auth/shared/gitcredentials/BUILD.bazel b/pkg/cmd/auth/shared/gitcredentials/BUILD.bazel new file mode 100644 index 000000000..8a694802b --- /dev/null +++ b/pkg/cmd/auth/shared/gitcredentials/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "gitcredentials", + srcs = [ + "fake_helper_config.go", + "helper_config.go", + "updater.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/auth/shared/gitcredentials", + visibility = ["//visibility:public"], + deps = [ + "//git", + "//internal/ghinstance", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + ], +) + +go_test( + name = "gitcredentials_test", + srcs = [ + "fake_helper_config_test.go", + "helper_config_test.go", + "updater_test.go", + ], + deps = [ + ":gitcredentials", + "//git", + "//pkg/cmd/auth/shared", + "//pkg/cmd/auth/shared/contract", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/auth/status/BUILD.bazel b/pkg/cmd/auth/status/BUILD.bazel new file mode 100644 index 000000000..cf180cdb7 --- /dev/null +++ b/pkg/cmd/auth/status/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "status", + srcs = ["status.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/auth/status", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/config", + "//internal/gh", + "//pkg/cmd/auth/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "status_test", + srcs = ["status_test.go"], + embed = [":status"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/auth/switch/BUILD.bazel b/pkg/cmd/auth/switch/BUILD.bazel new file mode 100644 index 000000000..52b22c098 --- /dev/null +++ b/pkg/cmd/auth/switch/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "switch", + srcs = ["switch.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/auth/switch", + visibility = ["//visibility:public"], + deps = [ + "//internal/gh", + "//pkg/cmd/auth/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "switch_test", + srcs = ["switch_test.go"], + embed = [":switch"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/keyring", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/auth/token/BUILD.bazel b/pkg/cmd/auth/token/BUILD.bazel new file mode 100644 index 000000000..77342379e --- /dev/null +++ b/pkg/cmd/auth/token/BUILD.bazel @@ -0,0 +1,29 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "token", + srcs = ["token.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/auth/token", + visibility = ["//visibility:public"], + deps = [ + "//internal/gh", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "token_test", + srcs = ["token_test.go"], + embed = [":token"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/browse/BUILD.bazel b/pkg/cmd/browse/BUILD.bazel new file mode 100644 index 000000000..e79dfadcd --- /dev/null +++ b/pkg/cmd/browse/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "browse", + srcs = ["browse.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/browse", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//git", + "//internal/browser", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "browse_test", + srcs = ["browse_test.go"], + embed = [":browse"], + deps = [ + "//git", + "//internal/browser", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/cache/BUILD.bazel b/pkg/cmd/cache/BUILD.bazel new file mode 100644 index 000000000..767b51490 --- /dev/null +++ b/pkg/cmd/cache/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "cache", + srcs = ["cache.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/cache", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/cache/delete", + "//pkg/cmd/cache/list", + "//pkg/cmdutil", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/cache/delete/BUILD.bazel b/pkg/cmd/cache/delete/BUILD.bazel new file mode 100644 index 000000000..7caf17ed4 --- /dev/null +++ b/pkg/cmd/cache/delete/BUILD.bazel @@ -0,0 +1,33 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "delete", + srcs = ["delete.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/cache/delete", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmd/cache/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "delete_test", + srcs = ["delete_test.go"], + embed = [":delete"], + deps = [ + "//internal/ghrepo", + "//pkg/cmd/cache/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/cache/list/BUILD.bazel b/pkg/cmd/cache/list/BUILD.bazel new file mode 100644 index 000000000..42088791d --- /dev/null +++ b/pkg/cmd/cache/list/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = ["list.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/cache/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmd/cache/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//internal/ghrepo", + "//pkg/cmd/cache/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/cache/shared/BUILD.bazel b/pkg/cmd/cache/shared/BUILD.bazel new file mode 100644 index 000000000..0c11a63c8 --- /dev/null +++ b/pkg/cmd/cache/shared/BUILD.bazel @@ -0,0 +1,27 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "shared", + srcs = ["shared.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/cache/shared", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmdutil", + ], +) + +go_test( + name = "shared_test", + srcs = ["shared_test.go"], + embed = [":shared"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/httpmock", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/codespace/BUILD.bazel b/pkg/cmd/codespace/BUILD.bazel new file mode 100644 index 000000000..d42c59fb3 --- /dev/null +++ b/pkg/cmd/codespace/BUILD.bazel @@ -0,0 +1,83 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "codespace", + srcs = [ + "code.go", + "codespace_selector.go", + "common.go", + "create.go", + "delete.go", + "edit.go", + "jupyter.go", + "list.go", + "logs.go", + "mock_api.go", + "mock_prompter.go", + "ports.go", + "rebuild.go", + "root.go", + "select.go", + "ssh.go", + "stop.go", + "view.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/codespace", + visibility = ["//visibility:public"], + deps = [ + "//context", + "//internal/browser", + "//internal/codespaces", + "//internal/codespaces/api", + "//internal/codespaces/portforwarder", + "//internal/codespaces/rpc", + "//internal/ghrepo", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/ssh", + "@com_github_alecaivazis_survey_v2//:survey", + "@com_github_alecaivazis_survey_v2//terminal", + "@com_github_cli_safeexec//:safeexec", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_microsoft_dev_tunnels//go/tunnels", + "@com_github_muhammadmuzzammil1998_jsonc//:jsonc", + "@com_github_spf13_cobra//:cobra", + "@org_golang_x_sync//errgroup", + "@org_golang_x_term//:term", + ], +) + +go_test( + name = "codespace_test", + srcs = [ + "code_test.go", + "codespace_selector_test.go", + "common_test.go", + "create_test.go", + "delete_test.go", + "edit_test.go", + "list_test.go", + "logs_test.go", + "ports_test.go", + "rebuild_test.go", + "select_test.go", + "ssh_test.go", + "stop_test.go", + "view_test.go", + ], + embed = [":codespace"], + deps = [ + "//internal/browser", + "//internal/codespaces/api", + "//internal/codespaces/connection", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/ssh", + "@com_github_alecaivazis_survey_v2//:survey", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/completion/BUILD.bazel b/pkg/cmd/completion/BUILD.bazel new file mode 100644 index 000000000..9c24a3c20 --- /dev/null +++ b/pkg/cmd/completion/BUILD.bazel @@ -0,0 +1,25 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "completion", + srcs = ["completion.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/completion", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "completion_test", + srcs = ["completion_test.go"], + embed = [":completion"], + deps = [ + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/config/BUILD.bazel b/pkg/cmd/config/BUILD.bazel new file mode 100644 index 000000000..babf90969 --- /dev/null +++ b/pkg/cmd/config/BUILD.bazel @@ -0,0 +1,17 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "config", + srcs = ["config.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/config", + visibility = ["//visibility:public"], + deps = [ + "//internal/config", + "//pkg/cmd/config/clear-cache", + "//pkg/cmd/config/get", + "//pkg/cmd/config/list", + "//pkg/cmd/config/set", + "//pkg/cmdutil", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/config/clear-cache/BUILD.bazel b/pkg/cmd/config/clear-cache/BUILD.bazel new file mode 100644 index 000000000..ccc352080 --- /dev/null +++ b/pkg/cmd/config/clear-cache/BUILD.bazel @@ -0,0 +1,25 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "clear-cache", + srcs = ["clear_cache.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/config/clear-cache", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_cli_go_gh_v2//pkg/config", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "clear-cache_test", + srcs = ["clear_cache_test.go"], + embed = [":clear-cache"], + deps = [ + "//pkg/iostreams", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/config/get/BUILD.bazel b/pkg/cmd/config/get/BUILD.bazel new file mode 100644 index 000000000..ce5c32fbf --- /dev/null +++ b/pkg/cmd/config/get/BUILD.bazel @@ -0,0 +1,30 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "get", + srcs = ["get.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/config/get", + visibility = ["//visibility:public"], + deps = [ + "//internal/gh", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "get_test", + srcs = ["get_test.go"], + embed = [":get"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/config/list/BUILD.bazel b/pkg/cmd/config/list/BUILD.bazel new file mode 100644 index 000000000..5e4d68c8a --- /dev/null +++ b/pkg/cmd/config/list/BUILD.bazel @@ -0,0 +1,30 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = ["list.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/config/list", + visibility = ["//visibility:public"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/config/set/BUILD.bazel b/pkg/cmd/config/set/BUILD.bazel new file mode 100644 index 000000000..a5f05c0e8 --- /dev/null +++ b/pkg/cmd/config/set/BUILD.bazel @@ -0,0 +1,30 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "set", + srcs = ["set.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/config/set", + visibility = ["//visibility:public"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "set_test", + srcs = ["set_test.go"], + embed = [":set"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/extension/BUILD.bazel b/pkg/cmd/extension/BUILD.bazel new file mode 100644 index 000000000..36127bc90 --- /dev/null +++ b/pkg/cmd/extension/BUILD.bazel @@ -0,0 +1,73 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "extension", + srcs = [ + "command.go", + "extension.go", + "git.go", + "http.go", + "manager.go", + "mocks.go", + "symlink_other.go", + "symlink_windows.go", + ], + embedsrcs = [ + "ext_tmpls/buildScript.sh", + "ext_tmpls/goBinMain.go.txt", + "ext_tmpls/goBinWorkflow.yml", + "ext_tmpls/otherBinWorkflow.yml", + "ext_tmpls/script.sh", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/extension", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//git", + "//internal/config", + "//internal/gh", + "//internal/ghinstance", + "//internal/ghrepo", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmd/extension/browse", + "//pkg/cmdutil", + "//pkg/extensions", + "//pkg/findsh", + "//pkg/iostreams", + "//pkg/search", + "@com_github_cli_safeexec//:safeexec", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@com_github_stretchr_testify//mock", + "@in_gopkg_yaml_v3//:yaml_v3", + ], +) + +go_test( + name = "extension_test", + srcs = [ + "command_test.go", + "extension_test.go", + "manager_test.go", + ], + embed = [":extension"], + deps = [ + "//git", + "//internal/browser", + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//internal/run", + "//pkg/cmdutil", + "//pkg/extensions", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + "@in_gopkg_yaml_v3//:yaml_v3", + ], +) diff --git a/pkg/cmd/extension/browse/BUILD.bazel b/pkg/cmd/extension/browse/BUILD.bazel new file mode 100644 index 000000000..4a4df5358 --- /dev/null +++ b/pkg/cmd/extension/browse/BUILD.bazel @@ -0,0 +1,43 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "browse", + srcs = [ + "browse.go", + "rg.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/extension/browse", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//git", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/repo/view", + "//pkg/extensions", + "//pkg/iostreams", + "//pkg/search", + "@com_github_charmbracelet_glamour//:glamour", + "@com_github_gdamore_tcell_v2//:tcell", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_rivo_tview//:tview", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "browse_test", + srcs = ["browse_test.go"], + embed = [":browse"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/repo/view", + "//pkg/extensions", + "//pkg/httpmock", + "//pkg/search", + "@com_github_rivo_tview//:tview", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/factory/BUILD.bazel b/pkg/cmd/factory/BUILD.bazel new file mode 100644 index 000000000..07f30e005 --- /dev/null +++ b/pkg/cmd/factory/BUILD.bazel @@ -0,0 +1,47 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "factory", + srcs = [ + "default.go", + "remote_resolver.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/factory", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//context", + "//git", + "//internal/browser", + "//internal/config", + "//internal/gh", + "//internal/ghinstance", + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/extension", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/set", + "@com_github_cli_go_gh_v2//pkg/ssh", + ], +) + +go_test( + name = "factory_test", + srcs = [ + "default_test.go", + "remote_resolver_test.go", + ], + embed = [":factory"], + deps = [ + "//git", + "//internal/config", + "//internal/gh", + "//internal/gh/mock", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/gist/BUILD.bazel b/pkg/cmd/gist/BUILD.bazel new file mode 100644 index 000000000..589bde02a --- /dev/null +++ b/pkg/cmd/gist/BUILD.bazel @@ -0,0 +1,20 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "gist", + srcs = ["gist.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/gist", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/gist/clone", + "//pkg/cmd/gist/create", + "//pkg/cmd/gist/delete", + "//pkg/cmd/gist/edit", + "//pkg/cmd/gist/list", + "//pkg/cmd/gist/rename", + "//pkg/cmd/gist/view", + "//pkg/cmdutil", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/gist/clone/BUILD.bazel b/pkg/cmd/gist/clone/BUILD.bazel new file mode 100644 index 000000000..271b7ef00 --- /dev/null +++ b/pkg/cmd/gist/clone/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "clone", + srcs = ["clone.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/gist/clone", + visibility = ["//visibility:public"], + deps = [ + "//git", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@com_github_spf13_pflag//:pflag", + ], +) + +go_test( + name = "clone_test", + srcs = ["clone_test.go"], + embed = [":clone"], + deps = [ + "//git", + "//internal/config", + "//internal/gh", + "//internal/run", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/gist/create/BUILD.bazel b/pkg/cmd/gist/create/BUILD.bazel new file mode 100644 index 000000000..ead225b81 --- /dev/null +++ b/pkg/cmd/gist/create/BUILD.bazel @@ -0,0 +1,39 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "create", + srcs = ["create.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/gist/create", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/browser", + "//internal/gh", + "//internal/ghinstance", + "//internal/text", + "//pkg/cmd/gist/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "create_test", + srcs = ["create_test.go"], + embed = [":create"], + deps = [ + "//internal/browser", + "//internal/config", + "//internal/gh", + "//internal/run", + "//pkg/cmd/gist/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/gist/delete/BUILD.bazel b/pkg/cmd/gist/delete/BUILD.bazel new file mode 100644 index 000000000..a9e97ebc8 --- /dev/null +++ b/pkg/cmd/gist/delete/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "delete", + srcs = ["delete.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/gist/delete", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//pkg/cmd/gist/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "delete_test", + srcs = ["delete_test.go"], + embed = [":delete"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/gist/edit/BUILD.bazel b/pkg/cmd/gist/edit/BUILD.bazel new file mode 100644 index 000000000..e3846c1af --- /dev/null +++ b/pkg/cmd/gist/edit/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "edit", + srcs = ["edit.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/gist/edit", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/prompter", + "//pkg/cmd/gist/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/surveyext", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "edit_test", + srcs = ["edit_test.go"], + embed = [":edit"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/prompter", + "//pkg/cmd/gist/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/gist/list/BUILD.bazel b/pkg/cmd/gist/list/BUILD.bazel new file mode 100644 index 000000000..d0f995224 --- /dev/null +++ b/pkg/cmd/gist/list/BUILD.bazel @@ -0,0 +1,34 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = ["list.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/gist/list", + visibility = ["//visibility:public"], + deps = [ + "//internal/gh", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmd/gist/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/gist/rename/BUILD.bazel b/pkg/cmd/gist/rename/BUILD.bazel new file mode 100644 index 000000000..347fc47f1 --- /dev/null +++ b/pkg/cmd/gist/rename/BUILD.bazel @@ -0,0 +1,33 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "rename", + srcs = ["rename.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/gist/rename", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//pkg/cmd/gist/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "rename_test", + srcs = ["rename_test.go"], + embed = [":rename"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmd/gist/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/gist/shared/BUILD.bazel b/pkg/cmd/gist/shared/BUILD.bazel new file mode 100644 index 000000000..e416f1181 --- /dev/null +++ b/pkg/cmd/gist/shared/BUILD.bazel @@ -0,0 +1,28 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "shared", + srcs = ["shared.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/gist/shared", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/prompter", + "//internal/text", + "//pkg/iostreams", + "@com_github_gabriel_vasile_mimetype//:mimetype", + "@com_github_shurcool_githubv4//:githubv4", + ], +) + +go_test( + name = "shared_test", + srcs = ["shared_test.go"], + embed = [":shared"], + deps = [ + "//internal/prompter", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/gist/view/BUILD.bazel b/pkg/cmd/gist/view/BUILD.bazel new file mode 100644 index 000000000..e9c5e98ee --- /dev/null +++ b/pkg/cmd/gist/view/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "view", + srcs = ["view.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/gist/view", + visibility = ["//visibility:public"], + deps = [ + "//internal/gh", + "//internal/ghinstance", + "//internal/prompter", + "//internal/text", + "//pkg/cmd/gist/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/markdown", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "view_test", + srcs = ["view_test.go"], + embed = [":view"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/prompter", + "//pkg/cmd/gist/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/gpg-key/BUILD.bazel b/pkg/cmd/gpg-key/BUILD.bazel new file mode 100644 index 000000000..111f7e389 --- /dev/null +++ b/pkg/cmd/gpg-key/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "gpg-key", + srcs = ["gpg_key.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/gpg-key", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/gpg-key/add", + "//pkg/cmd/gpg-key/delete", + "//pkg/cmd/gpg-key/list", + "//pkg/cmdutil", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/gpg-key/add/BUILD.bazel b/pkg/cmd/gpg-key/add/BUILD.bazel new file mode 100644 index 000000000..7d12dad9f --- /dev/null +++ b/pkg/cmd/gpg-key/add/BUILD.bazel @@ -0,0 +1,34 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "add", + srcs = [ + "add.go", + "http.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/gpg-key/add", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghinstance", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "add_test", + srcs = ["add_test.go"], + embed = [":add"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/gpg-key/delete/BUILD.bazel b/pkg/cmd/gpg-key/delete/BUILD.bazel new file mode 100644 index 000000000..45c9cebd1 --- /dev/null +++ b/pkg/cmd/gpg-key/delete/BUILD.bazel @@ -0,0 +1,37 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "delete", + srcs = [ + "delete.go", + "http.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/gpg-key/delete", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghinstance", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "delete_test", + srcs = ["delete_test.go"], + embed = [":delete"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_cli_go_gh_v2//pkg/api", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/gpg-key/list/BUILD.bazel b/pkg/cmd/gpg-key/list/BUILD.bazel new file mode 100644 index 000000000..b0520eab4 --- /dev/null +++ b/pkg/cmd/gpg-key/list/BUILD.bazel @@ -0,0 +1,34 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = [ + "http.go", + "list.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/gpg-key/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghinstance", + "//internal/tableprinter", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/issue/BUILD.bazel b/pkg/cmd/issue/BUILD.bazel new file mode 100644 index 000000000..c45baef29 --- /dev/null +++ b/pkg/cmd/issue/BUILD.bazel @@ -0,0 +1,27 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "issue", + srcs = ["issue.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/issue/close", + "//pkg/cmd/issue/comment", + "//pkg/cmd/issue/create", + "//pkg/cmd/issue/delete", + "//pkg/cmd/issue/develop", + "//pkg/cmd/issue/edit", + "//pkg/cmd/issue/list", + "//pkg/cmd/issue/lock", + "//pkg/cmd/issue/pin", + "//pkg/cmd/issue/reopen", + "//pkg/cmd/issue/status", + "//pkg/cmd/issue/transfer", + "//pkg/cmd/issue/unpin", + "//pkg/cmd/issue/view", + "//pkg/cmdutil", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/issue/close/BUILD.bazel b/pkg/cmd/issue/close/BUILD.bazel new file mode 100644 index 000000000..4de4e919a --- /dev/null +++ b/pkg/cmd/issue/close/BUILD.bazel @@ -0,0 +1,34 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "close", + srcs = ["close.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue/close", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/featuredetection", + "//internal/ghrepo", + "//pkg/cmd/issue/shared", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "close_test", + srcs = ["close_test.go"], + embed = [":close"], + deps = [ + "//internal/featuredetection", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/issue/comment/BUILD.bazel b/pkg/cmd/issue/comment/BUILD.bazel new file mode 100644 index 000000000..69c7aaf74 --- /dev/null +++ b/pkg/cmd/issue/comment/BUILD.bazel @@ -0,0 +1,34 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "comment", + srcs = ["comment.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue/comment", + visibility = ["//visibility:public"], + deps = [ + "//internal/ghrepo", + "//pkg/cmd/issue/shared", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "comment_test", + srcs = ["comment_test.go"], + embed = [":comment"], + deps = [ + "//api", + "//internal/browser", + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/issue/create/BUILD.bazel b/pkg/cmd/issue/create/BUILD.bazel new file mode 100644 index 000000000..d2c6b58a6 --- /dev/null +++ b/pkg/cmd/issue/create/BUILD.bazel @@ -0,0 +1,43 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "create", + srcs = ["create.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue/create", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/browser", + "//internal/gh", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "create_test", + srcs = ["create_test.go"], + embed = [":create"], + deps = [ + "//internal/browser", + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//internal/run", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/issue/delete/BUILD.bazel b/pkg/cmd/issue/delete/BUILD.bazel new file mode 100644 index 000000000..e594e2059 --- /dev/null +++ b/pkg/cmd/issue/delete/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "delete", + srcs = ["delete.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue/delete", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/issue/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "delete_test", + srcs = ["delete_test.go"], + embed = [":delete"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/issue/develop/BUILD.bazel b/pkg/cmd/issue/develop/BUILD.bazel new file mode 100644 index 000000000..fb518c90d --- /dev/null +++ b/pkg/cmd/issue/develop/BUILD.bazel @@ -0,0 +1,38 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "develop", + srcs = ["develop.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue/develop", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//context", + "//git", + "//internal/ghrepo", + "//internal/tableprinter", + "//pkg/cmd/issue/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "develop_test", + srcs = ["develop_test.go"], + embed = [":develop"], + deps = [ + "//context", + "//git", + "//internal/ghrepo", + "//internal/run", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/issue/edit/BUILD.bazel b/pkg/cmd/issue/edit/BUILD.bazel new file mode 100644 index 000000000..bf7fc9ffc --- /dev/null +++ b/pkg/cmd/issue/edit/BUILD.bazel @@ -0,0 +1,37 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "edit", + srcs = ["edit.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue/edit", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmd/issue/shared", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "edit_test", + srcs = ["edit_test.go"], + embed = [":edit"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/issue/list/BUILD.bazel b/pkg/cmd/issue/list/BUILD.bazel new file mode 100644 index 000000000..1447972be --- /dev/null +++ b/pkg/cmd/issue/list/BUILD.bazel @@ -0,0 +1,53 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = [ + "http.go", + "list.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/browser", + "//internal/featuredetection", + "//internal/gh", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmd/issue/shared", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = [ + "http_test.go", + "list_test.go", + ], + embed = [":list"], + deps = [ + "//api", + "//internal/browser", + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/run", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], + data = glob(["fixtures/**"]), +) diff --git a/pkg/cmd/issue/lock/BUILD.bazel b/pkg/cmd/issue/lock/BUILD.bazel new file mode 100644 index 000000000..a6ce59f55 --- /dev/null +++ b/pkg/cmd/issue/lock/BUILD.bazel @@ -0,0 +1,34 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "lock", + srcs = ["lock.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue/lock", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/issue/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "lock_test", + srcs = ["lock_test.go"], + embed = [":lock"], + deps = [ + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/issue/pin/BUILD.bazel b/pkg/cmd/issue/pin/BUILD.bazel new file mode 100644 index 000000000..1b4c70f74 --- /dev/null +++ b/pkg/cmd/issue/pin/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "pin", + srcs = ["pin.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue/pin", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/issue/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "pin_test", + srcs = ["pin_test.go"], + embed = [":pin"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/issue/reopen/BUILD.bazel b/pkg/cmd/issue/reopen/BUILD.bazel new file mode 100644 index 000000000..48b5a10f2 --- /dev/null +++ b/pkg/cmd/issue/reopen/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "reopen", + srcs = ["reopen.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue/reopen", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/issue/shared", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "reopen_test", + srcs = ["reopen_test.go"], + embed = [":reopen"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/issue/shared/BUILD.bazel b/pkg/cmd/issue/shared/BUILD.bazel new file mode 100644 index 000000000..7ec7b7c4e --- /dev/null +++ b/pkg/cmd/issue/shared/BUILD.bazel @@ -0,0 +1,33 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "shared", + srcs = [ + "display.go", + "lookup.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue/shared", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/featuredetection", + "//internal/ghrepo", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmd/pr/shared", + "//pkg/iostreams", + "//pkg/set", + "@org_golang_x_sync//errgroup", + ], +) + +go_test( + name = "shared_test", + srcs = ["lookup_test.go"], + embed = [":shared"], + deps = [ + "//internal/ghrepo", + "//pkg/httpmock", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/issue/status/BUILD.bazel b/pkg/cmd/issue/status/BUILD.bazel new file mode 100644 index 000000000..e1333c46f --- /dev/null +++ b/pkg/cmd/issue/status/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "status", + srcs = ["status.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue/status", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/issue/shared", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "status_test", + srcs = ["status_test.go"], + embed = [":status"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + ], + data = glob(["fixtures/**"]), +) diff --git a/pkg/cmd/issue/transfer/BUILD.bazel b/pkg/cmd/issue/transfer/BUILD.bazel new file mode 100644 index 000000000..f5a94a9cd --- /dev/null +++ b/pkg/cmd/issue/transfer/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "transfer", + srcs = ["transfer.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue/transfer", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/issue/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "transfer_test", + srcs = ["transfer_test.go"], + embed = [":transfer"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/issue/unpin/BUILD.bazel b/pkg/cmd/issue/unpin/BUILD.bazel new file mode 100644 index 000000000..ee63d250c --- /dev/null +++ b/pkg/cmd/issue/unpin/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "unpin", + srcs = ["unpin.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue/unpin", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/issue/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "unpin_test", + srcs = ["unpin_test.go"], + embed = [":unpin"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/issue/view/BUILD.bazel b/pkg/cmd/issue/view/BUILD.bazel new file mode 100644 index 000000000..a8fa6c1f6 --- /dev/null +++ b/pkg/cmd/issue/view/BUILD.bazel @@ -0,0 +1,47 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "view", + srcs = [ + "http.go", + "view.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/issue/view", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/browser", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmd/issue/shared", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/markdown", + "//pkg/set", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "view_test", + srcs = ["view_test.go"], + embed = [":view"], + deps = [ + "//internal/browser", + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/run", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//pkg/jsonfieldstest", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], + data = glob(["fixtures/**"]), +) diff --git a/pkg/cmd/label/BUILD.bazel b/pkg/cmd/label/BUILD.bazel new file mode 100644 index 000000000..6655fd9cd --- /dev/null +++ b/pkg/cmd/label/BUILD.bazel @@ -0,0 +1,53 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "label", + srcs = [ + "clone.go", + "create.go", + "delete.go", + "edit.go", + "http.go", + "label.go", + "list.go", + "shared.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/label", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/browser", + "//internal/ghrepo", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@org_golang_x_sync//errgroup", + ], +) + +go_test( + name = "label_test", + srcs = [ + "clone_test.go", + "create_test.go", + "delete_test.go", + "edit_test.go", + "http_test.go", + "list_test.go", + ], + embed = [":label"], + deps = [ + "//internal/browser", + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/org/BUILD.bazel b/pkg/cmd/org/BUILD.bazel new file mode 100644 index 000000000..72be7646c --- /dev/null +++ b/pkg/cmd/org/BUILD.bazel @@ -0,0 +1,14 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "org", + srcs = ["org.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/org", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/org/list", + "//pkg/cmdutil", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/org/list/BUILD.bazel b/pkg/cmd/org/list/BUILD.bazel new file mode 100644 index 000000000..74848fafb --- /dev/null +++ b/pkg/cmd/org/list/BUILD.bazel @@ -0,0 +1,39 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = [ + "http.go", + "list.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/org/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/text", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = [ + "http_test.go", + "list_test.go", + ], + embed = [":list"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/pr/BUILD.bazel b/pkg/cmd/pr/BUILD.bazel new file mode 100644 index 000000000..c13c7a0a3 --- /dev/null +++ b/pkg/cmd/pr/BUILD.bazel @@ -0,0 +1,29 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "pr", + srcs = ["pr.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/issue/lock", + "//pkg/cmd/pr/checkout", + "//pkg/cmd/pr/checks", + "//pkg/cmd/pr/close", + "//pkg/cmd/pr/comment", + "//pkg/cmd/pr/create", + "//pkg/cmd/pr/diff", + "//pkg/cmd/pr/edit", + "//pkg/cmd/pr/list", + "//pkg/cmd/pr/merge", + "//pkg/cmd/pr/ready", + "//pkg/cmd/pr/reopen", + "//pkg/cmd/pr/review", + "//pkg/cmd/pr/status", + "//pkg/cmd/pr/update-branch", + "//pkg/cmd/pr/view", + "//pkg/cmdutil", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/pr/checkout/BUILD.bazel b/pkg/cmd/pr/checkout/BUILD.bazel new file mode 100644 index 000000000..159f36d69 --- /dev/null +++ b/pkg/cmd/pr/checkout/BUILD.bazel @@ -0,0 +1,41 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "checkout", + srcs = ["checkout.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/checkout", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//context", + "//git", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "checkout_test", + srcs = ["checkout_test.go"], + embed = [":checkout"], + deps = [ + "//api", + "//context", + "//git", + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/run", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/pr/checks/BUILD.bazel b/pkg/cmd/pr/checks/BUILD.bazel new file mode 100644 index 000000000..fe2a45cfe --- /dev/null +++ b/pkg/cmd/pr/checks/BUILD.bazel @@ -0,0 +1,46 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "checks", + srcs = [ + "aggregate.go", + "checks.go", + "output.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/checks", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/browser", + "//internal/featuredetection", + "//internal/ghrepo", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "checks_test", + srcs = ["checks_test.go"], + embed = [":checks"], + deps = [ + "//api", + "//internal/browser", + "//internal/featuredetection", + "//internal/ghrepo", + "//internal/run", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], + data = glob(["fixtures/**"]), +) diff --git a/pkg/cmd/pr/close/BUILD.bazel b/pkg/cmd/pr/close/BUILD.bazel new file mode 100644 index 000000000..98579a4fe --- /dev/null +++ b/pkg/cmd/pr/close/BUILD.bazel @@ -0,0 +1,37 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "close", + srcs = ["close.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/close", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//git", + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "close_test", + srcs = ["close_test.go"], + embed = [":close"], + deps = [ + "//api", + "//git", + "//internal/ghrepo", + "//internal/run", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/pr/comment/BUILD.bazel b/pkg/cmd/pr/comment/BUILD.bazel new file mode 100644 index 000000000..85e283b91 --- /dev/null +++ b/pkg/cmd/pr/comment/BUILD.bazel @@ -0,0 +1,33 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "comment", + srcs = ["comment.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/comment", + visibility = ["//visibility:public"], + deps = [ + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "comment_test", + srcs = ["comment_test.go"], + embed = [":comment"], + deps = [ + "//api", + "//internal/browser", + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/pr/create/BUILD.bazel b/pkg/cmd/pr/create/BUILD.bazel new file mode 100644 index 000000000..8dd958511 --- /dev/null +++ b/pkg/cmd/pr/create/BUILD.bazel @@ -0,0 +1,56 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "create", + srcs = [ + "create.go", + "regexp_writer.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/create", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//context", + "//git", + "//internal/browser", + "//internal/gh", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/markdown", + "@com_github_cenkalti_backoff_v4//:backoff", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "create_test", + srcs = [ + "create_test.go", + "regexp_writer_test.go", + ], + embed = [":create"], + deps = [ + "//api", + "//context", + "//git", + "//internal/browser", + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//internal/run", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/pr/diff/BUILD.bazel b/pkg/cmd/pr/diff/BUILD.bazel new file mode 100644 index 000000000..9ddfe6230 --- /dev/null +++ b/pkg/cmd/pr/diff/BUILD.bazel @@ -0,0 +1,39 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "diff", + srcs = ["diff.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/diff", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/browser", + "//internal/ghinstance", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@org_golang_x_text//transform", + ], +) + +go_test( + name = "diff_test", + srcs = ["diff_test.go"], + embed = [":diff"], + deps = [ + "//api", + "//internal/browser", + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/pr/edit/BUILD.bazel b/pkg/cmd/pr/edit/BUILD.bazel new file mode 100644 index 000000000..b2a8b4355 --- /dev/null +++ b/pkg/cmd/pr/edit/BUILD.bazel @@ -0,0 +1,37 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "edit", + srcs = ["edit.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/edit", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + "@org_golang_x_sync//errgroup", + ], +) + +go_test( + name = "edit_test", + srcs = ["edit_test.go"], + embed = [":edit"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/pr/list/BUILD.bazel b/pkg/cmd/pr/list/BUILD.bazel new file mode 100644 index 000000000..4ac24b867 --- /dev/null +++ b/pkg/cmd/pr/list/BUILD.bazel @@ -0,0 +1,48 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = [ + "http.go", + "list.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/browser", + "//internal/ghrepo", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = [ + "http_test.go", + "list_test.go", + ], + embed = [":list"], + deps = [ + "//api", + "//internal/browser", + "//internal/ghrepo", + "//internal/run", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], + data = glob(["fixtures/**"]), +) diff --git a/pkg/cmd/pr/merge/BUILD.bazel b/pkg/cmd/pr/merge/BUILD.bazel new file mode 100644 index 000000000..d2ff8748b --- /dev/null +++ b/pkg/cmd/pr/merge/BUILD.bazel @@ -0,0 +1,48 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "merge", + srcs = [ + "http.go", + "merge.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/merge", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//context", + "//git", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/surveyext", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "merge_test", + srcs = ["merge_test.go"], + embed = [":merge"], + deps = [ + "//api", + "//context", + "//git", + "//internal/ghrepo", + "//internal/prompter", + "//internal/run", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/pr/ready/BUILD.bazel b/pkg/cmd/pr/ready/BUILD.bazel new file mode 100644 index 000000000..4e6a7c5c6 --- /dev/null +++ b/pkg/cmd/pr/ready/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "ready", + srcs = ["ready.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/ready", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "ready_test", + srcs = ["ready_test.go"], + embed = [":ready"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/pr/reopen/BUILD.bazel b/pkg/cmd/pr/reopen/BUILD.bazel new file mode 100644 index 000000000..957c1db38 --- /dev/null +++ b/pkg/cmd/pr/reopen/BUILD.bazel @@ -0,0 +1,33 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "reopen", + srcs = ["reopen.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/reopen", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "reopen_test", + srcs = ["reopen_test.go"], + embed = [":reopen"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/pr/review/BUILD.bazel b/pkg/cmd/pr/review/BUILD.bazel new file mode 100644 index 000000000..bffc63f2a --- /dev/null +++ b/pkg/cmd/pr/review/BUILD.bazel @@ -0,0 +1,42 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "review", + srcs = ["review.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/review", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/markdown", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "review_test", + srcs = ["review_test.go"], + embed = [":review"], + deps = [ + "//api", + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/pr/shared/BUILD.bazel b/pkg/cmd/pr/shared/BUILD.bazel new file mode 100644 index 000000000..c2c54cf97 --- /dev/null +++ b/pkg/cmd/pr/shared/BUILD.bazel @@ -0,0 +1,68 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "shared", + srcs = [ + "commentable.go", + "comments.go", + "completion.go", + "display.go", + "editable.go", + "editable_http.go", + "finder.go", + "params.go", + "preserve.go", + "reaction_groups.go", + "state.go", + "survey.go", + "templates.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/shared", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//context", + "//git", + "//internal/featuredetection", + "//internal/gh", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmdutil", + "//pkg/githubtemplate", + "//pkg/iostreams", + "//pkg/markdown", + "//pkg/search", + "//pkg/set", + "//pkg/surveyext", + "@com_github_google_shlex//:shlex", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + "@org_golang_x_sync//errgroup", + ], +) + +go_test( + name = "shared_test", + srcs = [ + "display_test.go", + "finder_test.go", + "params_test.go", + "preserve_test.go", + "survey_test.go", + "templates_test.go", + ], + embed = [":shared"], + deps = [ + "//api", + "//context", + "//git", + "//internal/featuredetection", + "//internal/ghrepo", + "//internal/prompter", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/pr/status/BUILD.bazel b/pkg/cmd/pr/status/BUILD.bazel new file mode 100644 index 000000000..d94e1ec4e --- /dev/null +++ b/pkg/cmd/pr/status/BUILD.bazel @@ -0,0 +1,53 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "status", + srcs = [ + "http.go", + "status.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/status", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//context", + "//git", + "//internal/featuredetection", + "//internal/gh", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/set", + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "status_test", + srcs = [ + "http_test.go", + "status_test.go", + ], + embed = [":status"], + deps = [ + "//api", + "//context", + "//git", + "//internal/config", + "//internal/featuredetection", + "//internal/gh", + "//internal/ghrepo", + "//internal/run", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], + data = glob(["fixtures/**"]), +) diff --git a/pkg/cmd/pr/update-branch/BUILD.bazel b/pkg/cmd/pr/update-branch/BUILD.bazel new file mode 100644 index 000000000..389c3a9ef --- /dev/null +++ b/pkg/cmd/pr/update-branch/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "update-branch", + srcs = ["update_branch.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/update-branch", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//git", + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "update-branch_test", + srcs = ["update_branch_test.go"], + embed = [":update-branch"], + deps = [ + "//api", + "//git", + "//internal/ghrepo", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/pr/view/BUILD.bazel b/pkg/cmd/pr/view/BUILD.bazel new file mode 100644 index 000000000..4d19bb59a --- /dev/null +++ b/pkg/cmd/pr/view/BUILD.bazel @@ -0,0 +1,42 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "view", + srcs = ["view.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/pr/view", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/browser", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/markdown", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "view_test", + srcs = ["view_test.go"], + embed = [":view"], + deps = [ + "//api", + "//internal/browser", + "//internal/ghrepo", + "//internal/run", + "//pkg/cmd/pr/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//pkg/jsonfieldstest", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], + data = glob(["fixtures/**"]), +) diff --git a/pkg/cmd/project/BUILD.bazel b/pkg/cmd/project/BUILD.bazel new file mode 100644 index 000000000..5777d83cb --- /dev/null +++ b/pkg/cmd/project/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "project", + srcs = ["project.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/close", + "//pkg/cmd/project/copy", + "//pkg/cmd/project/create", + "//pkg/cmd/project/delete", + "//pkg/cmd/project/edit", + "//pkg/cmd/project/field-create", + "//pkg/cmd/project/field-delete", + "//pkg/cmd/project/field-list", + "//pkg/cmd/project/item-add", + "//pkg/cmd/project/item-archive", + "//pkg/cmd/project/item-create", + "//pkg/cmd/project/item-delete", + "//pkg/cmd/project/item-edit", + "//pkg/cmd/project/item-list", + "//pkg/cmd/project/link", + "//pkg/cmd/project/list", + "//pkg/cmd/project/mark-template", + "//pkg/cmd/project/unlink", + "//pkg/cmd/project/view", + "//pkg/cmdutil", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/project/close/BUILD.bazel b/pkg/cmd/project/close/BUILD.bazel new file mode 100644 index 000000000..a206f0bac --- /dev/null +++ b/pkg/cmd/project/close/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "close", + srcs = ["close.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/close", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "close_test", + srcs = ["close_test.go"], + embed = [":close"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/copy/BUILD.bazel b/pkg/cmd/project/copy/BUILD.bazel new file mode 100644 index 000000000..fdbf8df8f --- /dev/null +++ b/pkg/cmd/project/copy/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "copy", + srcs = ["copy.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/copy", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "copy_test", + srcs = ["copy_test.go"], + embed = [":copy"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/create/BUILD.bazel b/pkg/cmd/project/create/BUILD.bazel new file mode 100644 index 000000000..193f1e73f --- /dev/null +++ b/pkg/cmd/project/create/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "create", + srcs = ["create.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/create", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "create_test", + srcs = ["create_test.go"], + embed = [":create"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/delete/BUILD.bazel b/pkg/cmd/project/delete/BUILD.bazel new file mode 100644 index 000000000..951a5e928 --- /dev/null +++ b/pkg/cmd/project/delete/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "delete", + srcs = ["delete.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/delete", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "delete_test", + srcs = ["delete_test.go"], + embed = [":delete"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/edit/BUILD.bazel b/pkg/cmd/project/edit/BUILD.bazel new file mode 100644 index 000000000..1938d75f8 --- /dev/null +++ b/pkg/cmd/project/edit/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "edit", + srcs = ["edit.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/edit", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "edit_test", + srcs = ["edit_test.go"], + embed = [":edit"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/field-create/BUILD.bazel b/pkg/cmd/project/field-create/BUILD.bazel new file mode 100644 index 000000000..66980f86c --- /dev/null +++ b/pkg/cmd/project/field-create/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "field-create", + srcs = ["field_create.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/field-create", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "field-create_test", + srcs = ["field_create_test.go"], + embed = [":field-create"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/field-delete/BUILD.bazel b/pkg/cmd/project/field-delete/BUILD.bazel new file mode 100644 index 000000000..8db2b05ac --- /dev/null +++ b/pkg/cmd/project/field-delete/BUILD.bazel @@ -0,0 +1,30 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "field-delete", + srcs = ["field_delete.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/field-delete", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "field-delete_test", + srcs = ["field_delete_test.go"], + embed = [":field-delete"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/field-list/BUILD.bazel b/pkg/cmd/project/field-list/BUILD.bazel new file mode 100644 index 000000000..3dfc37466 --- /dev/null +++ b/pkg/cmd/project/field-list/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "field-list", + srcs = ["field_list.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/field-list", + visibility = ["//visibility:public"], + deps = [ + "//internal/tableprinter", + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "field-list_test", + srcs = ["field_list_test.go"], + embed = [":field-list"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/item-add/BUILD.bazel b/pkg/cmd/project/item-add/BUILD.bazel new file mode 100644 index 000000000..5435918f9 --- /dev/null +++ b/pkg/cmd/project/item-add/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "item-add", + srcs = ["item_add.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/item-add", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "item-add_test", + srcs = ["item_add_test.go"], + embed = [":item-add"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/item-archive/BUILD.bazel b/pkg/cmd/project/item-archive/BUILD.bazel new file mode 100644 index 000000000..917164faa --- /dev/null +++ b/pkg/cmd/project/item-archive/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "item-archive", + srcs = ["item_archive.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/item-archive", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "item-archive_test", + srcs = ["item_archive_test.go"], + embed = [":item-archive"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/item-create/BUILD.bazel b/pkg/cmd/project/item-create/BUILD.bazel new file mode 100644 index 000000000..f678329da --- /dev/null +++ b/pkg/cmd/project/item-create/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "item-create", + srcs = ["item_create.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/item-create", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "item-create_test", + srcs = ["item_create_test.go"], + embed = [":item-create"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/item-delete/BUILD.bazel b/pkg/cmd/project/item-delete/BUILD.bazel new file mode 100644 index 000000000..8f938ae82 --- /dev/null +++ b/pkg/cmd/project/item-delete/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "item-delete", + srcs = ["item_delete.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/item-delete", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "item-delete_test", + srcs = ["item_delete_test.go"], + embed = [":item-delete"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/item-edit/BUILD.bazel b/pkg/cmd/project/item-edit/BUILD.bazel new file mode 100644 index 000000000..f87f5ec1b --- /dev/null +++ b/pkg/cmd/project/item-edit/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "item-edit", + srcs = ["item_edit.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/item-edit", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "item-edit_test", + srcs = ["item_edit_test.go"], + embed = [":item-edit"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/item-list/BUILD.bazel b/pkg/cmd/project/item-list/BUILD.bazel new file mode 100644 index 000000000..1f4d7d390 --- /dev/null +++ b/pkg/cmd/project/item-list/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "item-list", + srcs = ["item_list.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/item-list", + visibility = ["//visibility:public"], + deps = [ + "//internal/tableprinter", + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "item-list_test", + srcs = ["item_list_test.go"], + embed = [":item-list"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/link/BUILD.bazel b/pkg/cmd/project/link/BUILD.bazel new file mode 100644 index 000000000..66528c4bc --- /dev/null +++ b/pkg/cmd/project/link/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "link", + srcs = ["link.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/link", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "link_test", + srcs = ["link_test.go"], + embed = [":link"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//require", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/list/BUILD.bazel b/pkg/cmd/project/list/BUILD.bazel new file mode 100644 index 000000000..a7a708e55 --- /dev/null +++ b/pkg/cmd/project/list/BUILD.bazel @@ -0,0 +1,33 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = ["list.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/list", + visibility = ["//visibility:public"], + deps = [ + "//internal/tableprinter", + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/format", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/mark-template/BUILD.bazel b/pkg/cmd/project/mark-template/BUILD.bazel new file mode 100644 index 000000000..b156c5a36 --- /dev/null +++ b/pkg/cmd/project/mark-template/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "mark-template", + srcs = ["mark_template.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/mark-template", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "mark-template_test", + srcs = ["mark_template_test.go"], + embed = [":mark-template"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/shared/client/BUILD.bazel b/pkg/cmd/project/shared/client/BUILD.bazel new file mode 100644 index 000000000..07d75227b --- /dev/null +++ b/pkg/cmd/project/shared/client/BUILD.bazel @@ -0,0 +1,12 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "client", + srcs = ["client.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/shared/client", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + ], +) diff --git a/pkg/cmd/project/shared/format/BUILD.bazel b/pkg/cmd/project/shared/format/BUILD.bazel new file mode 100644 index 000000000..b10ef12b8 --- /dev/null +++ b/pkg/cmd/project/shared/format/BUILD.bazel @@ -0,0 +1,19 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "format", + srcs = ["display.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/shared/format", + visibility = ["//visibility:public"], + deps = ["//pkg/cmd/project/shared/queries"], +) + +go_test( + name = "format_test", + srcs = ["display_test.go"], + embed = [":format"], + deps = [ + "//pkg/cmd/project/shared/queries", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/project/shared/queries/BUILD.bazel b/pkg/cmd/project/shared/queries/BUILD.bazel new file mode 100644 index 000000000..cc60be589 --- /dev/null +++ b/pkg/cmd/project/shared/queries/BUILD.bazel @@ -0,0 +1,29 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "queries", + srcs = ["queries.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/shared/queries", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/prompter", + "//pkg/iostreams", + "//pkg/set", + "@com_github_briandowns_spinner//:spinner", + "@com_github_shurcool_githubv4//:githubv4", + ], +) + +go_test( + name = "queries_test", + srcs = [ + "export_data_test.go", + "queries_test.go", + ], + embed = [":queries"], + deps = [ + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/unlink/BUILD.bazel b/pkg/cmd/project/unlink/BUILD.bazel new file mode 100644 index 000000000..983bf4b17 --- /dev/null +++ b/pkg/cmd/project/unlink/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "unlink", + srcs = ["unlink.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/unlink", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "unlink_test", + srcs = ["unlink_test.go"], + embed = [":unlink"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//require", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/project/view/BUILD.bazel b/pkg/cmd/project/view/BUILD.bazel new file mode 100644 index 000000000..8e86a6e8b --- /dev/null +++ b/pkg/cmd/project/view/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "view", + srcs = ["view.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/project/view", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/project/shared/client", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/markdown", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "view_test", + srcs = ["view_test.go"], + embed = [":view"], + deps = [ + "//internal/prompter", + "//pkg/cmd/project/shared/queries", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@in_gopkg_h2non_gock_v1//:gock_v1", + ], +) diff --git a/pkg/cmd/release/BUILD.bazel b/pkg/cmd/release/BUILD.bazel new file mode 100644 index 000000000..f91613c51 --- /dev/null +++ b/pkg/cmd/release/BUILD.bazel @@ -0,0 +1,20 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "release", + srcs = ["release.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/release", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/release/create", + "//pkg/cmd/release/delete", + "//pkg/cmd/release/delete-asset", + "//pkg/cmd/release/download", + "//pkg/cmd/release/edit", + "//pkg/cmd/release/list", + "//pkg/cmd/release/upload", + "//pkg/cmd/release/view", + "//pkg/cmdutil", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/release/create/BUILD.bazel b/pkg/cmd/release/create/BUILD.bazel new file mode 100644 index 000000000..83464f305 --- /dev/null +++ b/pkg/cmd/release/create/BUILD.bazel @@ -0,0 +1,49 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "create", + srcs = [ + "create.go", + "http.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/release/create", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//git", + "//internal/gh", + "//internal/ghinstance", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmd/release/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/surveyext", + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "create_test", + srcs = ["create_test.go"], + embed = [":create"], + deps = [ + "//git", + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//internal/run", + "//pkg/cmd/release/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/release/delete-asset/BUILD.bazel b/pkg/cmd/release/delete-asset/BUILD.bazel new file mode 100644 index 000000000..41e121081 --- /dev/null +++ b/pkg/cmd/release/delete-asset/BUILD.bazel @@ -0,0 +1,33 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "delete-asset", + srcs = ["delete_asset.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/release/delete-asset", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmd/release/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "delete-asset_test", + srcs = ["delete_asset_test.go"], + embed = [":delete-asset"], + deps = [ + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/release/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/release/delete/BUILD.bazel b/pkg/cmd/release/delete/BUILD.bazel new file mode 100644 index 000000000..8979f357f --- /dev/null +++ b/pkg/cmd/release/delete/BUILD.bazel @@ -0,0 +1,38 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "delete", + srcs = ["delete.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/release/delete", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//git", + "//internal/ghinstance", + "//internal/ghrepo", + "//pkg/cmd/release/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "delete_test", + srcs = ["delete_test.go"], + embed = [":delete"], + deps = [ + "//git", + "//internal/ghrepo", + "//internal/prompter", + "//internal/run", + "//pkg/cmd/release/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/release/download/BUILD.bazel b/pkg/cmd/release/download/BUILD.bazel new file mode 100644 index 000000000..aa7121153 --- /dev/null +++ b/pkg/cmd/release/download/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "download", + srcs = ["download.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/release/download", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmd/release/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "download_test", + srcs = ["download_test.go"], + embed = [":download"], + deps = [ + "//internal/ghrepo", + "//pkg/cmd/release/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/release/edit/BUILD.bazel b/pkg/cmd/release/edit/BUILD.bazel new file mode 100644 index 000000000..5eb2c311f --- /dev/null +++ b/pkg/cmd/release/edit/BUILD.bazel @@ -0,0 +1,38 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "edit", + srcs = [ + "edit.go", + "http.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/release/edit", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghinstance", + "//internal/ghrepo", + "//pkg/cmd/release/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "edit_test", + srcs = ["edit_test.go"], + embed = [":edit"], + deps = [ + "//internal/ghrepo", + "//pkg/cmd/release/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/release/list/BUILD.bazel b/pkg/cmd/release/list/BUILD.bazel new file mode 100644 index 000000000..bc9fe84cb --- /dev/null +++ b/pkg/cmd/release/list/BUILD.bazel @@ -0,0 +1,37 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = [ + "http.go", + "list.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/release/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/release/shared/BUILD.bazel b/pkg/cmd/release/shared/BUILD.bazel new file mode 100644 index 000000000..1962e441f --- /dev/null +++ b/pkg/cmd/release/shared/BUILD.bazel @@ -0,0 +1,27 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "shared", + srcs = [ + "fetch.go", + "upload.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/release/shared", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghinstance", + "//internal/ghrepo", + "//pkg/httpmock", + "@com_github_cenkalti_backoff_v4//:backoff", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_stretchr_testify//assert", + "@org_golang_x_sync//errgroup", + ], +) + +go_test( + name = "shared_test", + srcs = ["upload_test.go"], + embed = [":shared"], +) diff --git a/pkg/cmd/release/upload/BUILD.bazel b/pkg/cmd/release/upload/BUILD.bazel new file mode 100644 index 000000000..0b62e38b9 --- /dev/null +++ b/pkg/cmd/release/upload/BUILD.bazel @@ -0,0 +1,24 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "upload", + srcs = ["upload.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/release/upload", + visibility = ["//visibility:public"], + deps = [ + "//internal/ghrepo", + "//internal/text", + "//pkg/cmd/release/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "upload_test", + srcs = ["upload_test.go"], + embed = [":upload"], + deps = ["@com_github_stretchr_testify//assert"], +) diff --git a/pkg/cmd/release/view/BUILD.bazel b/pkg/cmd/release/view/BUILD.bazel new file mode 100644 index 000000000..7876b0d68 --- /dev/null +++ b/pkg/cmd/release/view/BUILD.bazel @@ -0,0 +1,37 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "view", + srcs = ["view.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/release/view", + visibility = ["//visibility:public"], + deps = [ + "//internal/ghrepo", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmd/release/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/markdown", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "view_test", + srcs = ["view_test.go"], + embed = [":view"], + deps = [ + "//internal/ghrepo", + "//pkg/cmd/release/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//pkg/jsonfieldstest", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/repo/BUILD.bazel b/pkg/cmd/repo/BUILD.bazel new file mode 100644 index 000000000..2ee57485e --- /dev/null +++ b/pkg/cmd/repo/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "repo", + srcs = ["repo.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/repo/archive", + "//pkg/cmd/repo/autolink", + "//pkg/cmd/repo/clone", + "//pkg/cmd/repo/create", + "//pkg/cmd/repo/credits", + "//pkg/cmd/repo/delete", + "//pkg/cmd/repo/deploy-key", + "//pkg/cmd/repo/edit", + "//pkg/cmd/repo/fork", + "//pkg/cmd/repo/garden", + "//pkg/cmd/repo/gitignore", + "//pkg/cmd/repo/license", + "//pkg/cmd/repo/list", + "//pkg/cmd/repo/rename", + "//pkg/cmd/repo/setdefault", + "//pkg/cmd/repo/sync", + "//pkg/cmd/repo/unarchive", + "//pkg/cmd/repo/view", + "//pkg/cmdutil", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/repo/archive/BUILD.bazel b/pkg/cmd/repo/archive/BUILD.bazel new file mode 100644 index 000000000..2d038539f --- /dev/null +++ b/pkg/cmd/repo/archive/BUILD.bazel @@ -0,0 +1,37 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "archive", + srcs = [ + "archive.go", + "http.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/archive", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "archive_test", + srcs = ["archive_test.go"], + embed = [":archive"], + deps = [ + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/repo/autolink/BUILD.bazel b/pkg/cmd/repo/autolink/BUILD.bazel new file mode 100644 index 000000000..477436dc1 --- /dev/null +++ b/pkg/cmd/repo/autolink/BUILD.bazel @@ -0,0 +1,14 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "autolink", + srcs = ["autolink.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/autolink", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/repo/autolink/list", + "//pkg/cmdutil", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/repo/autolink/list/BUILD.bazel b/pkg/cmd/repo/autolink/list/BUILD.bazel new file mode 100644 index 000000000..b984c6792 --- /dev/null +++ b/pkg/cmd/repo/autolink/list/BUILD.bazel @@ -0,0 +1,44 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = [ + "http.go", + "list.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/autolink/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/browser", + "//internal/ghinstance", + "//internal/ghrepo", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = [ + "http_test.go", + "list_test.go", + ], + embed = [":list"], + deps = [ + "//internal/browser", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//pkg/jsonfieldstest", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/repo/clone/BUILD.bazel b/pkg/cmd/repo/clone/BUILD.bazel new file mode 100644 index 000000000..9e3663b53 --- /dev/null +++ b/pkg/cmd/repo/clone/BUILD.bazel @@ -0,0 +1,38 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "clone", + srcs = ["clone.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/clone", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//git", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@com_github_spf13_pflag//:pflag", + ], +) + +go_test( + name = "clone_test", + srcs = ["clone_test.go"], + embed = [":clone"], + deps = [ + "//git", + "//internal/config", + "//internal/gh", + "//internal/run", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/repo/create/BUILD.bazel b/pkg/cmd/repo/create/BUILD.bazel new file mode 100644 index 000000000..b32639b25 --- /dev/null +++ b/pkg/cmd/repo/create/BUILD.bazel @@ -0,0 +1,49 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "create", + srcs = [ + "create.go", + "http.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/create", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//git", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/repo/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_cenkalti_backoff_v4//:backoff", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "create_test", + srcs = [ + "create_test.go", + "http_test.go", + ], + embed = [":create"], + deps = [ + "//git", + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//internal/run", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_cenkalti_backoff_v4//:backoff", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], + data = glob(["fixtures/**"]), +) diff --git a/pkg/cmd/repo/credits/BUILD.bazel b/pkg/cmd/repo/credits/BUILD.bazel new file mode 100644 index 000000000..5df2f7c5d --- /dev/null +++ b/pkg/cmd/repo/credits/BUILD.bazel @@ -0,0 +1,17 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "credits", + srcs = ["credits.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/credits", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/iostreams", + "//utils", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/repo/delete/BUILD.bazel b/pkg/cmd/repo/delete/BUILD.bazel new file mode 100644 index 000000000..d47362704 --- /dev/null +++ b/pkg/cmd/repo/delete/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "delete", + srcs = [ + "delete.go", + "http.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/delete", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghinstance", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "delete_test", + srcs = ["delete_test.go"], + embed = [":delete"], + deps = [ + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/repo/deploy-key/BUILD.bazel b/pkg/cmd/repo/deploy-key/BUILD.bazel new file mode 100644 index 000000000..9dd2e1695 --- /dev/null +++ b/pkg/cmd/repo/deploy-key/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "deploy-key", + srcs = ["deploy-key.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/deploy-key", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/repo/deploy-key/add", + "//pkg/cmd/repo/deploy-key/delete", + "//pkg/cmd/repo/deploy-key/list", + "//pkg/cmdutil", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/repo/deploy-key/add/BUILD.bazel b/pkg/cmd/repo/deploy-key/add/BUILD.bazel new file mode 100644 index 000000000..36e16f352 --- /dev/null +++ b/pkg/cmd/repo/deploy-key/add/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "add", + srcs = [ + "add.go", + "http.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/deploy-key/add", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghinstance", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "add_test", + srcs = ["add_test.go"], + embed = [":add"], + deps = [ + "//internal/ghrepo", + "//pkg/httpmock", + "//pkg/iostreams", + ], +) diff --git a/pkg/cmd/repo/deploy-key/delete/BUILD.bazel b/pkg/cmd/repo/deploy-key/delete/BUILD.bazel new file mode 100644 index 000000000..81f02bf0f --- /dev/null +++ b/pkg/cmd/repo/deploy-key/delete/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "delete", + srcs = [ + "delete.go", + "http.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/deploy-key/delete", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghinstance", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "delete_test", + srcs = ["delete_test.go"], + embed = [":delete"], + deps = [ + "//internal/ghrepo", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/repo/deploy-key/list/BUILD.bazel b/pkg/cmd/repo/deploy-key/list/BUILD.bazel new file mode 100644 index 000000000..8d0b1a4cf --- /dev/null +++ b/pkg/cmd/repo/deploy-key/list/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = [ + "http.go", + "list.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/deploy-key/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghinstance", + "//internal/ghrepo", + "//internal/tableprinter", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//internal/ghrepo", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + ], +) diff --git a/pkg/cmd/repo/edit/BUILD.bazel b/pkg/cmd/repo/edit/BUILD.bazel new file mode 100644 index 000000000..e7116d041 --- /dev/null +++ b/pkg/cmd/repo/edit/BUILD.bazel @@ -0,0 +1,37 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "edit", + srcs = ["edit.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/edit", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/featuredetection", + "//internal/ghinstance", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/set", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@org_golang_x_sync//errgroup", + ], +) + +go_test( + name = "edit_test", + srcs = ["edit_test.go"], + embed = [":edit"], + deps = [ + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/repo/fork/BUILD.bazel b/pkg/cmd/repo/fork/BUILD.bazel new file mode 100644 index 000000000..fb86f1640 --- /dev/null +++ b/pkg/cmd/repo/fork/BUILD.bazel @@ -0,0 +1,43 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "fork", + srcs = ["fork.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/fork", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//context", + "//git", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/repo/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_cenkalti_backoff_v4//:backoff", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@com_github_spf13_pflag//:pflag", + ], +) + +go_test( + name = "fork_test", + srcs = ["fork_test.go"], + embed = [":fork"], + deps = [ + "//context", + "//git", + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//internal/run", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_cenkalti_backoff_v4//:backoff", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/repo/garden/BUILD.bazel b/pkg/cmd/repo/garden/BUILD.bazel new file mode 100644 index 000000000..aa592e4a2 --- /dev/null +++ b/pkg/cmd/repo/garden/BUILD.bazel @@ -0,0 +1,22 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "garden", + srcs = [ + "garden.go", + "http.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/garden", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghinstance", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/iostreams", + "//utils", + "@com_github_spf13_cobra//:cobra", + "@org_golang_x_term//:term", + ], +) diff --git a/pkg/cmd/repo/gitignore/BUILD.bazel b/pkg/cmd/repo/gitignore/BUILD.bazel new file mode 100644 index 000000000..6683a30f5 --- /dev/null +++ b/pkg/cmd/repo/gitignore/BUILD.bazel @@ -0,0 +1,14 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "gitignore", + srcs = ["gitignore.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/gitignore", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/repo/gitignore/list", + "//pkg/cmd/repo/gitignore/view", + "//pkg/cmdutil", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/repo/gitignore/list/BUILD.bazel b/pkg/cmd/repo/gitignore/list/BUILD.bazel new file mode 100644 index 000000000..6234d7e36 --- /dev/null +++ b/pkg/cmd/repo/gitignore/list/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = ["list.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/gitignore/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/tableprinter", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/repo/gitignore/view/BUILD.bazel b/pkg/cmd/repo/gitignore/view/BUILD.bazel new file mode 100644 index 000000000..330ae51b0 --- /dev/null +++ b/pkg/cmd/repo/gitignore/view/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "view", + srcs = ["view.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/gitignore/view", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "view_test", + srcs = ["view_test.go"], + embed = [":view"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/repo/license/BUILD.bazel b/pkg/cmd/repo/license/BUILD.bazel new file mode 100644 index 000000000..ced553873 --- /dev/null +++ b/pkg/cmd/repo/license/BUILD.bazel @@ -0,0 +1,14 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "license", + srcs = ["license.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/license", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/repo/license/list", + "//pkg/cmd/repo/license/view", + "//pkg/cmdutil", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/repo/license/list/BUILD.bazel b/pkg/cmd/repo/license/list/BUILD.bazel new file mode 100644 index 000000000..653c5876c --- /dev/null +++ b/pkg/cmd/repo/license/list/BUILD.bazel @@ -0,0 +1,33 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = ["list.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/license/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/tableprinter", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/repo/license/view/BUILD.bazel b/pkg/cmd/repo/license/view/BUILD.bazel new file mode 100644 index 000000000..6df3b87ef --- /dev/null +++ b/pkg/cmd/repo/license/view/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "view", + srcs = ["view.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/license/view", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/browser", + "//internal/gh", + "//internal/text", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "view_test", + srcs = ["view_test.go"], + embed = [":view"], + deps = [ + "//internal/browser", + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/repo/list/BUILD.bazel b/pkg/cmd/repo/list/BUILD.bazel new file mode 100644 index 000000000..6248acf25 --- /dev/null +++ b/pkg/cmd/repo/list/BUILD.bazel @@ -0,0 +1,48 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = [ + "http.go", + "list.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/featuredetection", + "//internal/gh", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/search", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = [ + "http_test.go", + "list_test.go", + ], + embed = [":list"], + deps = [ + "//internal/config", + "//internal/featuredetection", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//pkg/jsonfieldstest", + "//test", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], + data = glob(["fixtures/**"]), +) diff --git a/pkg/cmd/repo/rename/BUILD.bazel b/pkg/cmd/repo/rename/BUILD.bazel new file mode 100644 index 000000000..c562ccafb --- /dev/null +++ b/pkg/cmd/repo/rename/BUILD.bazel @@ -0,0 +1,39 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "rename", + srcs = ["rename.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/rename", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//context", + "//git", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "rename_test", + srcs = ["rename_test.go"], + embed = [":rename"], + deps = [ + "//context", + "//git", + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//internal/run", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/repo/setdefault/BUILD.bazel b/pkg/cmd/repo/setdefault/BUILD.bazel new file mode 100644 index 000000000..3a5484d51 --- /dev/null +++ b/pkg/cmd/repo/setdefault/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "setdefault", + srcs = ["setdefault.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/setdefault", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//context", + "//git", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "setdefault_test", + srcs = ["setdefault_test.go"], + embed = [":setdefault"], + deps = [ + "//context", + "//git", + "//internal/ghrepo", + "//internal/prompter", + "//internal/run", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/repo/shared/BUILD.bazel b/pkg/cmd/repo/shared/BUILD.bazel new file mode 100644 index 000000000..3c33410e8 --- /dev/null +++ b/pkg/cmd/repo/shared/BUILD.bazel @@ -0,0 +1,14 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "shared", + srcs = ["repo.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/shared", + visibility = ["//visibility:public"], +) + +go_test( + name = "shared_test", + srcs = ["repo_test.go"], + embed = [":shared"], +) diff --git a/pkg/cmd/repo/sync/BUILD.bazel b/pkg/cmd/repo/sync/BUILD.bazel new file mode 100644 index 000000000..fb2f6ea56 --- /dev/null +++ b/pkg/cmd/repo/sync/BUILD.bazel @@ -0,0 +1,40 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "sync", + srcs = [ + "git.go", + "http.go", + "mocks.go", + "sync.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/sync", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//context", + "//git", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@com_github_stretchr_testify//mock", + ], +) + +go_test( + name = "sync_test", + srcs = ["sync_test.go"], + embed = [":sync"], + deps = [ + "//context", + "//git", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/repo/unarchive/BUILD.bazel b/pkg/cmd/repo/unarchive/BUILD.bazel new file mode 100644 index 000000000..04c6e90c1 --- /dev/null +++ b/pkg/cmd/repo/unarchive/BUILD.bazel @@ -0,0 +1,37 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "unarchive", + srcs = [ + "http.go", + "unarchive.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/unarchive", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_shurcool_githubv4//:githubv4", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "unarchive_test", + srcs = ["unarchive_test.go"], + embed = [":unarchive"], + deps = [ + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/repo/view/BUILD.bazel b/pkg/cmd/repo/view/BUILD.bazel new file mode 100644 index 000000000..d214f048c --- /dev/null +++ b/pkg/cmd/repo/view/BUILD.bazel @@ -0,0 +1,46 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "view", + srcs = [ + "http.go", + "view.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/repo/view", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/browser", + "//internal/gh", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/markdown", + "@com_github_cli_go_gh_v2//pkg/asciisanitizer", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@org_golang_x_text//transform", + ], +) + +go_test( + name = "view_test", + srcs = ["view_test.go"], + embed = [":view"], + deps = [ + "//api", + "//internal/browser", + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/run", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "//pkg/jsonfieldstest", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/root/BUILD.bazel b/pkg/cmd/root/BUILD.bazel new file mode 100644 index 000000000..aea55c84e --- /dev/null +++ b/pkg/cmd/root/BUILD.bazel @@ -0,0 +1,78 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "root", + srcs = [ + "alias.go", + "extension.go", + "help.go", + "help_reference.go", + "help_topic.go", + "root.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/root", + visibility = ["//visibility:public"], + deps = [ + "//internal/run", + "//internal/text", + "//pkg/cmd/actions", + "//pkg/cmd/alias", + "//pkg/cmd/alias/shared", + "//pkg/cmd/api", + "//pkg/cmd/attestation", + "//pkg/cmd/auth", + "//pkg/cmd/browse", + "//pkg/cmd/cache", + "//pkg/cmd/codespace", + "//pkg/cmd/completion", + "//pkg/cmd/config", + "//pkg/cmd/extension", + "//pkg/cmd/factory", + "//pkg/cmd/gist", + "//pkg/cmd/gpg-key", + "//pkg/cmd/issue", + "//pkg/cmd/label", + "//pkg/cmd/org", + "//pkg/cmd/pr", + "//pkg/cmd/project", + "//pkg/cmd/release", + "//pkg/cmd/repo", + "//pkg/cmd/repo/credits", + "//pkg/cmd/ruleset", + "//pkg/cmd/run", + "//pkg/cmd/search", + "//pkg/cmd/secret", + "//pkg/cmd/ssh-key", + "//pkg/cmd/status", + "//pkg/cmd/variable", + "//pkg/cmd/version", + "//pkg/cmd/workflow", + "//pkg/cmdutil", + "//pkg/extensions", + "//pkg/findsh", + "//pkg/iostreams", + "//pkg/markdown", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@com_github_spf13_pflag//:pflag", + ], +) + +go_test( + name = "root_test", + srcs = [ + "alias_test.go", + "extension_test.go", + "help_test.go", + "help_topic_test.go", + ], + embed = [":root"], + deps = [ + "//pkg/extensions", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/ruleset/BUILD.bazel b/pkg/cmd/ruleset/BUILD.bazel new file mode 100644 index 000000000..0894be9c2 --- /dev/null +++ b/pkg/cmd/ruleset/BUILD.bazel @@ -0,0 +1,16 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "ruleset", + srcs = ["ruleset.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/ruleset", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/ruleset/check", + "//pkg/cmd/ruleset/list", + "//pkg/cmd/ruleset/view", + "//pkg/cmdutil", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/ruleset/check/BUILD.bazel b/pkg/cmd/ruleset/check/BUILD.bazel new file mode 100644 index 000000000..b352633d5 --- /dev/null +++ b/pkg/cmd/ruleset/check/BUILD.bazel @@ -0,0 +1,39 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "check", + srcs = ["check.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/ruleset/check", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//git", + "//internal/browser", + "//internal/gh", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmd/ruleset/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "check_test", + srcs = ["check_test.go"], + embed = [":check"], + deps = [ + "//internal/browser", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], + data = glob(["fixtures/**"]), +) diff --git a/pkg/cmd/ruleset/list/BUILD.bazel b/pkg/cmd/ruleset/list/BUILD.bazel new file mode 100644 index 000000000..c7b60d476 --- /dev/null +++ b/pkg/cmd/ruleset/list/BUILD.bazel @@ -0,0 +1,40 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = ["list.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/ruleset/list", + visibility = ["//visibility:public"], + deps = [ + "//internal/browser", + "//internal/ghinstance", + "//internal/ghrepo", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmd/ruleset/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//internal/browser", + "//internal/ghrepo", + "//pkg/cmd/ruleset/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], + data = glob(["fixtures/**"]), +) diff --git a/pkg/cmd/ruleset/shared/BUILD.bazel b/pkg/cmd/ruleset/shared/BUILD.bazel new file mode 100644 index 000000000..0ad6f9b97 --- /dev/null +++ b/pkg/cmd/ruleset/shared/BUILD.bazel @@ -0,0 +1,16 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "shared", + srcs = [ + "http.go", + "shared.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/ruleset/shared", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmdutil", + ], +) diff --git a/pkg/cmd/ruleset/view/BUILD.bazel b/pkg/cmd/ruleset/view/BUILD.bazel new file mode 100644 index 000000000..6829416cf --- /dev/null +++ b/pkg/cmd/ruleset/view/BUILD.bazel @@ -0,0 +1,44 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "view", + srcs = [ + "http.go", + "view.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/ruleset/view", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/browser", + "//internal/ghrepo", + "//internal/prompter", + "//internal/text", + "//pkg/cmd/ruleset/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_cli_go_gh_v2//pkg/auth", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "view_test", + srcs = ["view_test.go"], + embed = [":view"], + deps = [ + "//internal/browser", + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/ruleset/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], + data = glob(["fixtures/**"]), +) diff --git a/pkg/cmd/run/BUILD.bazel b/pkg/cmd/run/BUILD.bazel new file mode 100644 index 000000000..a1b7a710a --- /dev/null +++ b/pkg/cmd/run/BUILD.bazel @@ -0,0 +1,19 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "run", + srcs = ["run.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/run", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/run/cancel", + "//pkg/cmd/run/delete", + "//pkg/cmd/run/download", + "//pkg/cmd/run/list", + "//pkg/cmd/run/rerun", + "//pkg/cmd/run/view", + "//pkg/cmd/run/watch", + "//pkg/cmdutil", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/run/cancel/BUILD.bazel b/pkg/cmd/run/cancel/BUILD.bazel new file mode 100644 index 000000000..7bfa3e76f --- /dev/null +++ b/pkg/cmd/run/cancel/BUILD.bazel @@ -0,0 +1,33 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "cancel", + srcs = ["cancel.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/run/cancel", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmd/run/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "cancel_test", + srcs = ["cancel_test.go"], + embed = [":cancel"], + deps = [ + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/run/shared", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/run/delete/BUILD.bazel b/pkg/cmd/run/delete/BUILD.bazel new file mode 100644 index 000000000..d7c851f47 --- /dev/null +++ b/pkg/cmd/run/delete/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "delete", + srcs = ["delete.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/run/delete", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/run/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "delete_test", + srcs = ["delete_test.go"], + embed = [":delete"], + deps = [ + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/run/shared", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/run/download/BUILD.bazel b/pkg/cmd/run/download/BUILD.bazel new file mode 100644 index 000000000..6f1d0d824 --- /dev/null +++ b/pkg/cmd/run/download/BUILD.bazel @@ -0,0 +1,46 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "download", + srcs = [ + "download.go", + "http.go", + "zip.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/run/download", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//internal/safepaths", + "//pkg/cmd/run/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/set", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "download_test", + srcs = [ + "download_test.go", + "http_test.go", + "zip_test.go", + ], + embed = [":download"], + deps = [ + "//internal/ghrepo", + "//internal/prompter", + "//internal/safepaths", + "//pkg/cmd/run/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], + data = glob(["fixtures/**"]), +) diff --git a/pkg/cmd/run/list/BUILD.bazel b/pkg/cmd/run/list/BUILD.bazel new file mode 100644 index 000000000..46ad82652 --- /dev/null +++ b/pkg/cmd/run/list/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = ["list.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/run/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//internal/tableprinter", + "//pkg/cmd/run/shared", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//internal/ghrepo", + "//pkg/cmd/run/shared", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/run/rerun/BUILD.bazel b/pkg/cmd/run/rerun/BUILD.bazel new file mode 100644 index 000000000..774887e8c --- /dev/null +++ b/pkg/cmd/run/rerun/BUILD.bazel @@ -0,0 +1,34 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "rerun", + srcs = ["rerun.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/run/rerun", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmd/run/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "rerun_test", + srcs = ["rerun_test.go"], + embed = [":rerun"], + deps = [ + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/run/shared", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/run/shared/BUILD.bazel b/pkg/cmd/run/shared/BUILD.bazel new file mode 100644 index 000000000..0d8f023d9 --- /dev/null +++ b/pkg/cmd/run/shared/BUILD.bazel @@ -0,0 +1,37 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "shared", + srcs = [ + "artifacts.go", + "presentation.go", + "shared.go", + "test.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/run/shared", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghinstance", + "//internal/ghrepo", + "//pkg/cmd/workflow/shared", + "//pkg/iostreams", + ], +) + +go_test( + name = "shared_test", + srcs = [ + "artifacts_test.go", + "shared_test.go", + ], + embed = [":shared"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/httpmock", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/run/view/BUILD.bazel b/pkg/cmd/run/view/BUILD.bazel new file mode 100644 index 000000000..4ccfd8fd8 --- /dev/null +++ b/pkg/cmd/run/view/BUILD.bazel @@ -0,0 +1,43 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "view", + srcs = ["view.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/run/view", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/browser", + "//internal/ghinstance", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmd/run/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "view_test", + srcs = ["view_test.go"], + embed = [":view"], + deps = [ + "//internal/browser", + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/run/shared", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], + data = glob(["fixtures/**"]), +) diff --git a/pkg/cmd/run/watch/BUILD.bazel b/pkg/cmd/run/watch/BUILD.bazel new file mode 100644 index 000000000..05b899385 --- /dev/null +++ b/pkg/cmd/run/watch/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "watch", + srcs = ["watch.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/run/watch", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//internal/text", + "//pkg/cmd/run/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "watch_test", + srcs = ["watch_test.go"], + embed = [":watch"], + deps = [ + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/run/shared", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_cli_go_gh_v2//pkg/api", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/search/BUILD.bazel b/pkg/cmd/search/BUILD.bazel new file mode 100644 index 000000000..f335635eb --- /dev/null +++ b/pkg/cmd/search/BUILD.bazel @@ -0,0 +1,17 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "search", + srcs = ["search.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/search", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/search/code", + "//pkg/cmd/search/commits", + "//pkg/cmd/search/issues", + "//pkg/cmd/search/prs", + "//pkg/cmd/search/repos", + "//pkg/cmdutil", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/search/code/BUILD.bazel b/pkg/cmd/search/code/BUILD.bazel new file mode 100644 index 000000000..0ea299f24 --- /dev/null +++ b/pkg/cmd/search/code/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "code", + srcs = ["code.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/search/code", + visibility = ["//visibility:public"], + deps = [ + "//internal/browser", + "//internal/text", + "//pkg/cmd/search/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/search", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "code_test", + srcs = ["code_test.go"], + embed = [":code"], + deps = [ + "//internal/browser", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/search", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/search/commits/BUILD.bazel b/pkg/cmd/search/commits/BUILD.bazel new file mode 100644 index 000000000..11778a6a6 --- /dev/null +++ b/pkg/cmd/search/commits/BUILD.bazel @@ -0,0 +1,33 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "commits", + srcs = ["commits.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/search/commits", + visibility = ["//visibility:public"], + deps = [ + "//internal/browser", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmd/search/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/search", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "commits_test", + srcs = ["commits_test.go"], + embed = [":commits"], + deps = [ + "//internal/browser", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/search", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/search/issues/BUILD.bazel b/pkg/cmd/search/issues/BUILD.bazel new file mode 100644 index 000000000..092fa93a6 --- /dev/null +++ b/pkg/cmd/search/issues/BUILD.bazel @@ -0,0 +1,29 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "issues", + srcs = ["issues.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/search/issues", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/search/shared", + "//pkg/cmdutil", + "//pkg/search", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "issues_test", + srcs = ["issues_test.go"], + embed = [":issues"], + deps = [ + "//pkg/cmd/search/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/search", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/search/prs/BUILD.bazel b/pkg/cmd/search/prs/BUILD.bazel new file mode 100644 index 000000000..2938ed759 --- /dev/null +++ b/pkg/cmd/search/prs/BUILD.bazel @@ -0,0 +1,29 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "prs", + srcs = ["prs.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/search/prs", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/search/shared", + "//pkg/cmdutil", + "//pkg/search", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "prs_test", + srcs = ["prs_test.go"], + embed = [":prs"], + deps = [ + "//pkg/cmd/search/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/search", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/search/repos/BUILD.bazel b/pkg/cmd/search/repos/BUILD.bazel new file mode 100644 index 000000000..5d0d05ad6 --- /dev/null +++ b/pkg/cmd/search/repos/BUILD.bazel @@ -0,0 +1,33 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "repos", + srcs = ["repos.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/search/repos", + visibility = ["//visibility:public"], + deps = [ + "//internal/browser", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmd/search/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/search", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "repos_test", + srcs = ["repos_test.go"], + embed = [":repos"], + deps = [ + "//internal/browser", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/search", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/search/shared/BUILD.bazel b/pkg/cmd/search/shared/BUILD.bazel new file mode 100644 index 000000000..ebf5b602c --- /dev/null +++ b/pkg/cmd/search/shared/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "shared", + srcs = ["shared.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/search/shared", + visibility = ["//visibility:public"], + deps = [ + "//internal/browser", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/search", + ], +) + +go_test( + name = "shared_test", + srcs = ["shared_test.go"], + embed = [":shared"], + deps = [ + "//internal/browser", + "//internal/config", + "//internal/gh", + "//pkg/cmd/factory", + "//pkg/iostreams", + "//pkg/search", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/secret/BUILD.bazel b/pkg/cmd/secret/BUILD.bazel new file mode 100644 index 000000000..3ae836f33 --- /dev/null +++ b/pkg/cmd/secret/BUILD.bazel @@ -0,0 +1,16 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "secret", + srcs = ["secret.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/secret", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/secret/delete", + "//pkg/cmd/secret/list", + "//pkg/cmd/secret/set", + "//pkg/cmdutil", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/secret/delete/BUILD.bazel b/pkg/cmd/secret/delete/BUILD.bazel new file mode 100644 index 000000000..b039a9b01 --- /dev/null +++ b/pkg/cmd/secret/delete/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "delete", + srcs = ["delete.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/secret/delete", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/secret/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "delete_test", + srcs = ["delete_test.go"], + embed = [":delete"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/secret/list/BUILD.bazel b/pkg/cmd/secret/list/BUILD.bazel new file mode 100644 index 000000000..96ae0c261 --- /dev/null +++ b/pkg/cmd/secret/list/BUILD.bazel @@ -0,0 +1,37 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = ["list.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/secret/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//internal/tableprinter", + "//pkg/cmd/secret/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/secret/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/secret/set/BUILD.bazel b/pkg/cmd/secret/set/BUILD.bazel new file mode 100644 index 000000000..778b3f403 --- /dev/null +++ b/pkg/cmd/secret/set/BUILD.bazel @@ -0,0 +1,43 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "set", + srcs = [ + "http.go", + "set.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/secret/set", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/secret/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_hashicorp_go_multierror//:go-multierror", + "@com_github_joho_godotenv//:godotenv", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@org_golang_x_crypto//nacl/box", + ], +) + +go_test( + name = "set_test", + srcs = ["set_test.go"], + embed = [":set"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/secret/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/secret/shared/BUILD.bazel b/pkg/cmd/secret/shared/BUILD.bazel new file mode 100644 index 000000000..ab7cf1c2e --- /dev/null +++ b/pkg/cmd/secret/shared/BUILD.bazel @@ -0,0 +1,16 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "shared", + srcs = ["shared.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/secret/shared", + visibility = ["//visibility:public"], + deps = ["//internal/text"], +) + +go_test( + name = "shared_test", + srcs = ["shared_test.go"], + embed = [":shared"], + deps = ["@com_github_stretchr_testify//assert"], +) diff --git a/pkg/cmd/ssh-key/BUILD.bazel b/pkg/cmd/ssh-key/BUILD.bazel new file mode 100644 index 000000000..0faba37ba --- /dev/null +++ b/pkg/cmd/ssh-key/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "ssh-key", + srcs = ["ssh_key.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/ssh-key", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/ssh-key/add", + "//pkg/cmd/ssh-key/delete", + "//pkg/cmd/ssh-key/list", + "//pkg/cmdutil", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/ssh-key/add/BUILD.bazel b/pkg/cmd/ssh-key/add/BUILD.bazel new file mode 100644 index 000000000..6300e7e88 --- /dev/null +++ b/pkg/cmd/ssh-key/add/BUILD.bazel @@ -0,0 +1,33 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "add", + srcs = [ + "add.go", + "http.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/ssh-key/add", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghinstance", + "//pkg/cmd/ssh-key/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "add_test", + srcs = ["add_test.go"], + embed = [":add"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/ssh-key/delete/BUILD.bazel b/pkg/cmd/ssh-key/delete/BUILD.bazel new file mode 100644 index 000000000..0a6f65cda --- /dev/null +++ b/pkg/cmd/ssh-key/delete/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "delete", + srcs = [ + "delete.go", + "http.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/ssh-key/delete", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghinstance", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "delete_test", + srcs = ["delete_test.go"], + embed = [":delete"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/prompter", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/ssh-key/list/BUILD.bazel b/pkg/cmd/ssh-key/list/BUILD.bazel new file mode 100644 index 000000000..e202741ab --- /dev/null +++ b/pkg/cmd/ssh-key/list/BUILD.bazel @@ -0,0 +1,30 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = ["list.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/ssh-key/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/tableprinter", + "//pkg/cmd/ssh-key/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + ], +) diff --git a/pkg/cmd/ssh-key/shared/BUILD.bazel b/pkg/cmd/ssh-key/shared/BUILD.bazel new file mode 100644 index 000000000..b44e5a19f --- /dev/null +++ b/pkg/cmd/ssh-key/shared/BUILD.bazel @@ -0,0 +1,12 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "shared", + srcs = ["user_keys.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/ssh-key/shared", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghinstance", + ], +) diff --git a/pkg/cmd/status/BUILD.bazel b/pkg/cmd/status/BUILD.bazel new file mode 100644 index 000000000..ec60a9a4c --- /dev/null +++ b/pkg/cmd/status/BUILD.bazel @@ -0,0 +1,38 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "status", + srcs = ["status.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/status", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/tableprinter", + "//pkg/cmd/factory", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/set", + "@com_github_charmbracelet_lipgloss//:lipgloss", + "@com_github_cli_go_gh_v2//pkg/api", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@org_golang_x_sync//errgroup", + ], +) + +go_test( + name = "status_test", + srcs = ["status_test.go"], + embed = [":status"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], + data = glob(["fixtures/**"]), +) diff --git a/pkg/cmd/variable/BUILD.bazel b/pkg/cmd/variable/BUILD.bazel new file mode 100644 index 000000000..255836c9d --- /dev/null +++ b/pkg/cmd/variable/BUILD.bazel @@ -0,0 +1,17 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "variable", + srcs = ["variable.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/variable", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/variable/delete", + "//pkg/cmd/variable/get", + "//pkg/cmd/variable/list", + "//pkg/cmd/variable/set", + "//pkg/cmdutil", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/variable/delete/BUILD.bazel b/pkg/cmd/variable/delete/BUILD.bazel new file mode 100644 index 000000000..169486e7c --- /dev/null +++ b/pkg/cmd/variable/delete/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "delete", + srcs = ["delete.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/variable/delete", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/variable/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "delete_test", + srcs = ["delete_test.go"], + embed = [":delete"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/variable/get/BUILD.bazel b/pkg/cmd/variable/get/BUILD.bazel new file mode 100644 index 000000000..1ac96cc3b --- /dev/null +++ b/pkg/cmd/variable/get/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "get", + srcs = ["get.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/variable/get", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/variable/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "get_test", + srcs = ["get_test.go"], + embed = [":get"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/variable/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/variable/list/BUILD.bazel b/pkg/cmd/variable/list/BUILD.bazel new file mode 100644 index 000000000..e802507ec --- /dev/null +++ b/pkg/cmd/variable/list/BUILD.bazel @@ -0,0 +1,37 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = ["list.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/variable/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//internal/tableprinter", + "//pkg/cmd/variable/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/variable/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/cmd/variable/set/BUILD.bazel b/pkg/cmd/variable/set/BUILD.bazel new file mode 100644 index 000000000..8aeb6a44f --- /dev/null +++ b/pkg/cmd/variable/set/BUILD.bazel @@ -0,0 +1,42 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "set", + srcs = [ + "http.go", + "set.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/variable/set", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/gh", + "//internal/ghrepo", + "//pkg/cmd/variable/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_hashicorp_go_multierror//:go-multierror", + "@com_github_joho_godotenv//:godotenv", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "set_test", + srcs = ["set_test.go"], + embed = [":set"], + deps = [ + "//internal/config", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/variable/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/variable/shared/BUILD.bazel b/pkg/cmd/variable/shared/BUILD.bazel new file mode 100644 index 000000000..74d499b73 --- /dev/null +++ b/pkg/cmd/variable/shared/BUILD.bazel @@ -0,0 +1,19 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "shared", + srcs = ["shared.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/variable/shared", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//pkg/cmdutil", + ], +) + +go_test( + name = "shared_test", + srcs = ["shared_test.go"], + embed = [":shared"], + deps = ["@com_github_stretchr_testify//assert"], +) diff --git a/pkg/cmd/version/BUILD.bazel b/pkg/cmd/version/BUILD.bazel new file mode 100644 index 000000000..630a4a7b9 --- /dev/null +++ b/pkg/cmd/version/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "version", + srcs = ["version.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/version", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmdutil", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "version_test", + srcs = ["version_test.go"], + embed = [":version"], +) diff --git a/pkg/cmd/workflow/BUILD.bazel b/pkg/cmd/workflow/BUILD.bazel new file mode 100644 index 000000000..dfe1208f7 --- /dev/null +++ b/pkg/cmd/workflow/BUILD.bazel @@ -0,0 +1,17 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "workflow", + srcs = ["workflow.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/workflow", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmd/workflow/disable", + "//pkg/cmd/workflow/enable", + "//pkg/cmd/workflow/list", + "//pkg/cmd/workflow/run", + "//pkg/cmd/workflow/view", + "//pkg/cmdutil", + "@com_github_spf13_cobra//:cobra", + ], +) diff --git a/pkg/cmd/workflow/disable/BUILD.bazel b/pkg/cmd/workflow/disable/BUILD.bazel new file mode 100644 index 000000000..97633c862 --- /dev/null +++ b/pkg/cmd/workflow/disable/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "disable", + srcs = ["disable.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/workflow/disable", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "disable_test", + srcs = ["disable_test.go"], + embed = [":disable"], + deps = [ + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/workflow/enable/BUILD.bazel b/pkg/cmd/workflow/enable/BUILD.bazel new file mode 100644 index 000000000..71e324f4a --- /dev/null +++ b/pkg/cmd/workflow/enable/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "enable", + srcs = ["enable.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/workflow/enable", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "enable_test", + srcs = ["enable_test.go"], + embed = [":enable"], + deps = [ + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/workflow/list/BUILD.bazel b/pkg/cmd/workflow/list/BUILD.bazel new file mode 100644 index 000000000..c3993fdf9 --- /dev/null +++ b/pkg/cmd/workflow/list/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "list", + srcs = ["list.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/workflow/list", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//internal/tableprinter", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "list_test", + srcs = ["list_test.go"], + embed = [":list"], + deps = [ + "//internal/ghrepo", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/workflow/run/BUILD.bazel b/pkg/cmd/workflow/run/BUILD.bazel new file mode 100644 index 000000000..3a940b883 --- /dev/null +++ b/pkg/cmd/workflow/run/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "run", + srcs = ["run.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/workflow/run", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + "@in_gopkg_yaml_v3//:yaml_v3", + ], +) + +go_test( + name = "run_test", + srcs = ["run_test.go"], + embed = [":run"], + deps = [ + "//api", + "//internal/ghrepo", + "//internal/prompter", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmd/workflow/shared/BUILD.bazel b/pkg/cmd/workflow/shared/BUILD.bazel new file mode 100644 index 000000000..0099b486a --- /dev/null +++ b/pkg/cmd/workflow/shared/BUILD.bazel @@ -0,0 +1,19 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "shared", + srcs = [ + "shared.go", + "test.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmd/workflow/shared", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/ghrepo", + "//pkg/cmdutil", + "//pkg/iostreams", + "@com_github_cli_go_gh_v2//pkg/asciisanitizer", + "@org_golang_x_text//transform", + ], +) diff --git a/pkg/cmd/workflow/view/BUILD.bazel b/pkg/cmd/workflow/view/BUILD.bazel new file mode 100644 index 000000000..303794b1d --- /dev/null +++ b/pkg/cmd/workflow/view/BUILD.bazel @@ -0,0 +1,40 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "view", + srcs = ["view.go"], + importpath = "github.com/cli/cli/v2/pkg/cmd/workflow/view", + visibility = ["//visibility:public"], + deps = [ + "//api", + "//internal/browser", + "//internal/ghrepo", + "//internal/tableprinter", + "//internal/text", + "//pkg/cmd/run/shared", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/iostreams", + "//pkg/markdown", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_spf13_cobra//:cobra", + ], +) + +go_test( + name = "view_test", + srcs = ["view_test.go"], + embed = [":view"], + deps = [ + "//internal/browser", + "//internal/ghrepo", + "//pkg/cmd/run/shared", + "//pkg/cmd/workflow/shared", + "//pkg/cmdutil", + "//pkg/httpmock", + "//pkg/iostreams", + "@com_github_google_shlex//:shlex", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/pkg/cmdutil/BUILD.bazel b/pkg/cmdutil/BUILD.bazel new file mode 100644 index 000000000..b6dfbd54a --- /dev/null +++ b/pkg/cmdutil/BUILD.bazel @@ -0,0 +1,55 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "cmdutil", + srcs = [ + "args.go", + "auth_check.go", + "cmdgroup.go", + "errors.go", + "factory.go", + "file_input.go", + "flags.go", + "json_flags.go", + "legacy.go", + "repo_override.go", + ], + importpath = "github.com/cli/cli/v2/pkg/cmdutil", + visibility = ["//visibility:public"], + deps = [ + "//context", + "//git", + "//internal/browser", + "//internal/gh", + "//internal/ghrepo", + "//internal/prompter", + "//pkg/extensions", + "//pkg/iostreams", + "//pkg/jsoncolor", + "//pkg/set", + "@com_github_alecaivazis_survey_v2//terminal", + "@com_github_cli_go_gh_v2//pkg/jq", + "@com_github_cli_go_gh_v2//pkg/template", + "@com_github_spf13_cobra//:cobra", + "@com_github_spf13_pflag//:pflag", + ], +) + +go_test( + name = "cmdutil_test", + srcs = [ + "args_test.go", + "auth_check_test.go", + "factory_test.go", + "json_flags_test.go", + ], + embed = [":cmdutil"], + deps = [ + "//internal/config", + "//internal/gh", + "//pkg/iostreams", + "@com_github_spf13_cobra//:cobra", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/extensions/BUILD.bazel b/pkg/extensions/BUILD.bazel new file mode 100644 index 000000000..f3f4d458e --- /dev/null +++ b/pkg/extensions/BUILD.bazel @@ -0,0 +1,13 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "extensions", + srcs = [ + "extension.go", + "extension_mock.go", + "manager_mock.go", + ], + importpath = "github.com/cli/cli/v2/pkg/extensions", + visibility = ["//visibility:public"], + deps = ["//internal/ghrepo"], +) diff --git a/pkg/findsh/BUILD.bazel b/pkg/findsh/BUILD.bazel new file mode 100644 index 000000000..631a0589b --- /dev/null +++ b/pkg/findsh/BUILD.bazel @@ -0,0 +1,17 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "findsh", + srcs = [ + "find.go", + "find_windows.go", + ], + importpath = "github.com/cli/cli/v2/pkg/findsh", + visibility = ["//visibility:public"], + deps = select({ + "@rules_go//go/platform:windows": [ + "@com_github_cli_safeexec//:safeexec", + ], + "//conditions:default": [], + }), +) diff --git a/pkg/githubtemplate/BUILD.bazel b/pkg/githubtemplate/BUILD.bazel new file mode 100644 index 000000000..03582bbff --- /dev/null +++ b/pkg/githubtemplate/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "githubtemplate", + srcs = ["github_template.go"], + importpath = "github.com/cli/cli/v2/pkg/githubtemplate", + visibility = ["//visibility:public"], + deps = ["@in_gopkg_yaml_v3//:yaml_v3"], +) + +go_test( + name = "githubtemplate_test", + srcs = ["github_template_test.go"], + embed = [":githubtemplate"], +) diff --git a/pkg/httpmock/BUILD.bazel b/pkg/httpmock/BUILD.bazel new file mode 100644 index 000000000..c235bcd2f --- /dev/null +++ b/pkg/httpmock/BUILD.bazel @@ -0,0 +1,13 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "httpmock", + srcs = [ + "legacy.go", + "registry.go", + "stub.go", + ], + importpath = "github.com/cli/cli/v2/pkg/httpmock", + visibility = ["//visibility:public"], + deps = ["@com_github_stretchr_testify//assert"], +) diff --git a/pkg/iostreams/BUILD.bazel b/pkg/iostreams/BUILD.bazel new file mode 100644 index 000000000..94f1dc488 --- /dev/null +++ b/pkg/iostreams/BUILD.bazel @@ -0,0 +1,34 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "iostreams", + srcs = [ + "color.go", + "console.go", + "console_windows.go", + "epipe_other.go", + "epipe_windows.go", + "iostreams.go", + ], + importpath = "github.com/cli/cli/v2/pkg/iostreams", + visibility = ["//visibility:public"], + deps = [ + "@com_github_briandowns_spinner//:spinner", + "@com_github_cli_go_gh_v2//pkg/term", + "@com_github_cli_safeexec//:safeexec", + "@com_github_google_shlex//:shlex", + "@com_github_mattn_go_colorable//:go-colorable", + "@com_github_mattn_go_isatty//:go-isatty", + "@com_github_mgutz_ansi//:ansi", + ], +) + +go_test( + name = "iostreams_test", + srcs = [ + "color_test.go", + "iostreams_test.go", + ], + embed = [":iostreams"], + deps = ["@com_github_stretchr_testify//assert"], +) diff --git a/pkg/jsoncolor/BUILD.bazel b/pkg/jsoncolor/BUILD.bazel new file mode 100644 index 000000000..52fb3340c --- /dev/null +++ b/pkg/jsoncolor/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "jsoncolor", + srcs = ["jsoncolor.go"], + importpath = "github.com/cli/cli/v2/pkg/jsoncolor", + visibility = ["//visibility:public"], +) + +go_test( + name = "jsoncolor_test", + srcs = ["jsoncolor_test.go"], + embed = [":jsoncolor"], + deps = ["@com_github_google_go_cmp//cmp"], +) diff --git a/pkg/jsonfieldstest/BUILD.bazel b/pkg/jsonfieldstest/BUILD.bazel new file mode 100644 index 000000000..71862b62f --- /dev/null +++ b/pkg/jsonfieldstest/BUILD.bazel @@ -0,0 +1,14 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "jsonfieldstest", + srcs = ["jsonfieldstest.go"], + importpath = "github.com/cli/cli/v2/pkg/jsonfieldstest", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cmdutil", + "@com_github_spf13_cobra//:cobra", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/markdown/BUILD.bazel b/pkg/markdown/BUILD.bazel new file mode 100644 index 000000000..8252ceb52 --- /dev/null +++ b/pkg/markdown/BUILD.bazel @@ -0,0 +1,12 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "markdown", + srcs = ["markdown.go"], + importpath = "github.com/cli/cli/v2/pkg/markdown", + visibility = ["//visibility:public"], + deps = [ + "@com_github_charmbracelet_glamour//:glamour", + "@com_github_cli_go_gh_v2//pkg/markdown", + ], +) diff --git a/pkg/option/BUILD.bazel b/pkg/option/BUILD.bazel new file mode 100644 index 000000000..b1069bc44 --- /dev/null +++ b/pkg/option/BUILD.bazel @@ -0,0 +1,17 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "option", + srcs = ["option.go"], + importpath = "github.com/cli/cli/v2/pkg/option", + visibility = ["//visibility:public"], +) + +go_test( + name = "option_test", + srcs = ["option_test.go"], + deps = [ + ":option", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/search/BUILD.bazel b/pkg/search/BUILD.bazel new file mode 100644 index 000000000..5276225a8 --- /dev/null +++ b/pkg/search/BUILD.bazel @@ -0,0 +1,33 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "search", + srcs = [ + "query.go", + "result.go", + "searcher.go", + "searcher_mock.go", + ], + importpath = "github.com/cli/cli/v2/pkg/search", + visibility = ["//visibility:public"], + deps = [ + "//internal/ghinstance", + "//pkg/cmdutil", + ], +) + +go_test( + name = "search_test", + srcs = [ + "query_test.go", + "result_test.go", + "searcher_test.go", + ], + embed = [":search"], + deps = [ + "//pkg/httpmock", + "@com_github_makenowjust_heredoc//:heredoc", + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/pkg/set/BUILD.bazel b/pkg/set/BUILD.bazel new file mode 100644 index 000000000..b12fa443f --- /dev/null +++ b/pkg/set/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "set", + srcs = ["string_set.go"], + importpath = "github.com/cli/cli/v2/pkg/set", + visibility = ["//visibility:public"], +) + +go_test( + name = "set_test", + srcs = ["string_set_test.go"], + embed = [":set"], + deps = ["@com_github_stretchr_testify//assert"], +) diff --git a/pkg/ssh/BUILD.bazel b/pkg/ssh/BUILD.bazel new file mode 100644 index 000000000..46a2159ab --- /dev/null +++ b/pkg/ssh/BUILD.bazel @@ -0,0 +1,13 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "ssh", + srcs = ["ssh_keys.go"], + importpath = "github.com/cli/cli/v2/pkg/ssh", + visibility = ["//visibility:public"], + deps = [ + "//internal/config", + "//internal/run", + "@com_github_cli_safeexec//:safeexec", + ], +) diff --git a/pkg/surveyext/BUILD.bazel b/pkg/surveyext/BUILD.bazel new file mode 100644 index 000000000..16bd7821b --- /dev/null +++ b/pkg/surveyext/BUILD.bazel @@ -0,0 +1,29 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "surveyext", + srcs = [ + "editor.go", + "editor_manual.go", + ], + importpath = "github.com/cli/cli/v2/pkg/surveyext", + visibility = ["//visibility:public"], + deps = [ + "@com_github_alecaivazis_survey_v2//:survey", + "@com_github_alecaivazis_survey_v2//terminal", + "@com_github_cli_safeexec//:safeexec", + "@com_github_kballard_go_shellquote//:go-shellquote", + ], +) + +go_test( + name = "surveyext_test", + srcs = ["editor_test.go"], + embed = [":surveyext"], + deps = [ + "@com_github_alecaivazis_survey_v2//:survey", + "@com_github_alecaivazis_survey_v2//terminal", + "@com_github_creack_pty//:pty", + "@com_github_stretchr_testify//assert", + ], +) diff --git a/script/BUILD.bazel b/script/BUILD.bazel new file mode 100644 index 000000000..e64ecc885 --- /dev/null +++ b/script/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "script_lib", + srcs = ["build.go"], + importpath = "github.com/cli/cli/v2/script", + visibility = ["//visibility:private"], + deps = ["@com_github_cli_safeexec//:safeexec"], +) + +go_binary( + name = "script", + embed = [":script_lib"], + visibility = ["//visibility:public"], +) diff --git a/test/BUILD.bazel b/test/BUILD.bazel new file mode 100644 index 000000000..1f89b149b --- /dev/null +++ b/test/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "test", + srcs = ["helpers.go"], + importpath = "github.com/cli/cli/v2/test", + visibility = ["//visibility:public"], +) diff --git a/utils/BUILD.bazel b/utils/BUILD.bazel new file mode 100644 index 000000000..dddd6acff --- /dev/null +++ b/utils/BUILD.bazel @@ -0,0 +1,9 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "utils", + srcs = ["utils.go"], + importpath = "github.com/cli/cli/v2/utils", + visibility = ["//visibility:public"], + deps = ["@org_golang_x_term//:term"], +) From 859b7d4ee10f32a871e2f7e0c4c155faf455e2fd Mon Sep 17 00:00:00 2001 From: Jifeng Zhang Date: Sat, 13 Jun 2026 23:00:06 +0200 Subject: [PATCH 2/9] Add Bazel entries to .gitignore --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 272b7703d..dbf0b5190 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,10 @@ *~ vendor/ + +# Bazel +/bazel-* +/bazel-bin +/bazel-out +/bazel-testlogs +/bazel-workspace From 34462f18d7e52e91159d6d3f142ff713f08ac065 Mon Sep 17 00:00:00 2001 From: Jifeng Zhang Date: Sat, 13 Jun 2026 23:01:53 +0200 Subject: [PATCH 3/9] Update: fix bare repo config, update MODULE.bazel, ignore lock file --- .gitignore | 1 + MODULE.bazel | 73 ++++++++++++++++++++++++++++++++++ git/fixtures/simple.git/config | 2 +- 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 MODULE.bazel diff --git a/.gitignore b/.gitignore index dbf0b5190..15b217d4b 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,4 @@ vendor/ /bazel-out /bazel-testlogs /bazel-workspace +MODULE.bazel.lock diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 000000000..b392bbd7f --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,73 @@ +module( + name = "gh", + version = "2.0.0", +) + +bazel_dep(name = "rules_go", version = "0.60.0") +bazel_dep(name = "gazelle", version = "0.45.0") +bazel_dep(name = "bazel_skylib", version = "1.8.2") +bazel_dep(name = "rules_cc", version = "0.2.17") +bazel_dep(name = "rules_proto", version = "7.1.0") +bazel_dep(name = "protobuf", version = "33.4") +bazel_dep(name = "aspect_bazel_lib", version = "2.20.4") + +go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") +go_sdk.download(version = "1.24.4") + +go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") +go_deps.from_file(go_mod = "//:go.mod") +go_deps.gazelle_override( + path = "github.com/google/certificate-transparency-go", + build_file_generation = "clean", +) +use_repo( + go_deps, + "com_github_alecaivazis_survey_v2", + "com_github_briandowns_spinner", + "com_github_cenkalti_backoff_v4", + "com_github_charmbracelet_glamour", + "com_github_charmbracelet_lipgloss", + "com_github_cli_go_gh_v2", + "com_github_cli_go_internal", + "com_github_cli_oauth", + "com_github_cli_safeexec", + "com_github_cpuguy83_go_md2man_v2", + "com_github_creack_pty", + "com_github_digitorus_timestamp", + "com_github_distribution_reference", + "com_github_gabriel_vasile_mimetype", + "com_github_gdamore_tcell_v2", + "com_github_google_go_cmp", + "com_github_google_go_containerregistry", + "com_github_google_shlex", + "com_github_gorilla_websocket", + "com_github_hashicorp_go_multierror", + "com_github_hashicorp_go_version", + "com_github_henvic_httpretty", + "com_github_in_toto_attestation", + "com_github_joho_godotenv", + "com_github_kballard_go_shellquote", + "com_github_makenowjust_heredoc", + "com_github_mattn_go_colorable", + "com_github_mattn_go_isatty", + "com_github_mgutz_ansi", + "com_github_microsoft_dev_tunnels", + "com_github_muhammadmuzzammil1998_jsonc", + "com_github_opentracing_opentracing_go", + "com_github_rivo_tview", + "com_github_shurcool_githubv4", + "com_github_sigstore_protobuf_specs", + "com_github_sigstore_sigstore_go", + "com_github_spf13_cobra", + "com_github_spf13_pflag", + "com_github_stretchr_testify", + "com_github_zalando_go_keyring", + "in_gopkg_h2non_gock_v1", + "in_gopkg_yaml_v3", + "org_golang_google_grpc", + "org_golang_google_protobuf", + "org_golang_x_crypto", + "org_golang_x_sync", + "org_golang_x_term", + "org_golang_x_text", +) diff --git a/git/fixtures/simple.git/config b/git/fixtures/simple.git/config index f0858dd73..7ee9a902c 100644 --- a/git/fixtures/simple.git/config +++ b/git/fixtures/simple.git/config @@ -1,7 +1,7 @@ [core] repositoryformatversion = 0 filemode = true - ;bare = true + bare = true ignorecase = true precomposeunicode = true [user] From 892920f84bc656e4ee8b3f70ae58395b872a5fb8 Mon Sep 17 00:00:00 2001 From: Jifeng Zhang Date: Sat, 13 Jun 2026 23:17:08 +0200 Subject: [PATCH 4/9] Fix git/BUILD.bazel: remove broken sh_test and genrule experiments --- git/BUILD.bazel | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/git/BUILD.bazel b/git/BUILD.bazel index f91d7b131..1485fdbc9 100644 --- a/git/BUILD.bazel +++ b/git/BUILD.bazel @@ -1,4 +1,4 @@ -load("@rules_go//go:def.bzl", "go_binary", "go_library", "go_test") +load("@rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "git", @@ -19,7 +19,7 @@ go_library( ) go_test( - name = "git_test_bin", + name = "git_test", srcs = [ "client_test.go", "url_test.go", @@ -31,13 +31,3 @@ go_test( ], data = glob(["fixtures/**"]), ) - -sh_test( - name = "git_test", - srcs = ["git_test_wrapper.sh"], - data = [ - ":git_test_bin", - ":git_test_bin_", - glob(["fixtures/**"]), - ], -) From 4b91ade474d91e5a144e0ed4187a3568d096619f Mon Sep 17 00:00:00 2001 From: Jifeng Zhang Date: Sun, 14 Jun 2026 00:29:15 +0200 Subject: [PATCH 5/9] Disable Dependabot --- .github/dependabot.yml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1a850c9b3..e180032a0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,15 +1,2 @@ version: 2 -updates: -- package-ecosystem: gomod - directory: "/" - schedule: - interval: "daily" - ignore: - - dependency-name: "*" - update-types: - - version-update:semver-minor - - version-update:semver-major -- package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "daily" +updates: [] From b32291f203d293d7ee885252a9482fe7f44a851a Mon Sep 17 00:00:00 2001 From: Jifeng Zhang Date: Sun, 21 Jun 2026 19:14:31 +0200 Subject: [PATCH 6/9] Fix Bazel build: enable Gazelle BUILD generation for certificate-transparency-go The 'clean' build_file_generation mode prevented Gazelle from generating BUILD files for certificate-transparency-go, causing missing dependency errors for the configpb sub-package. Switch to 'auto' with proto mode disabled so Gazelle generates correct go_library rules. --- MODULE.bazel | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index b392bbd7f..bfd1fe10f 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -18,7 +18,10 @@ go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") go_deps.from_file(go_mod = "//:go.mod") go_deps.gazelle_override( path = "github.com/google/certificate-transparency-go", - build_file_generation = "clean", + build_file_generation = "auto", + directives = [ + "gazelle:proto disable", + ], ) use_repo( go_deps, From 63eb3d5acfb189b72ea125f413617a77723f3af1 Mon Sep 17 00:00:00 2001 From: Jifeng Zhang Date: Sun, 21 Jun 2026 19:14:37 +0200 Subject: [PATCH 7/9] Fix git tests for Bazel: copy fixture to temp dir to avoid sandbox issues Bazel's linux-sandbox prevents git subprocesses from accessing data files through the runfiles directory. Copy the simple.git fixture to a temp directory so git can read it directly. --- git/client_test.go | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/git/client_test.go b/git/client_test.go index fff1397f3..ca78f77f4 100644 --- a/git/client_test.go +++ b/git/client_test.go @@ -706,8 +706,10 @@ func createCommitsCommandContext(t *testing.T, testData stubbedCommitsCommandDat } func TestClientLastCommit(t *testing.T) { + dir := t.TempDir() + cpFixture(t, dir) client := Client{ - RepoDir: "./fixtures/simple.git", + RepoDir: dir, } c, err := client.LastCommit(context.Background()) assert.NoError(t, err) @@ -716,14 +718,51 @@ func TestClientLastCommit(t *testing.T) { } func TestClientCommitBody(t *testing.T) { + dir := t.TempDir() + cpFixture(t, dir) client := Client{ - RepoDir: "./fixtures/simple.git", + RepoDir: dir, } body, err := client.CommitBody(context.Background(), "6f1a2405cace1633d89a79c74c65f22fe78f9659") assert.NoError(t, err) assert.Equal(t, "I'm starting to get the hang of things\n", body) } +func cpFixture(t *testing.T, dst string) { + t.Helper() + src, err := filepath.Abs("./fixtures/simple.git") + if err != nil { + t.Fatal(err) + } + if _, err := os.Stat(src); os.IsNotExist(err) { + exe, _ := os.Executable() + src = filepath.Join(filepath.Dir(exe), "..", "git", "fixtures", "simple.git") + } + err = copyDir(src, dst) + require.NoError(t, err) +} + +func copyDir(src, dst string) error { + return filepath.Walk(src, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + rel, err := filepath.Rel(src, path) + if err != nil { + return err + } + target := filepath.Join(dst, rel) + if info.IsDir() { + return os.MkdirAll(target, info.Mode()) + } + data, err := os.ReadFile(path) + if err != nil { + return err + } + return os.WriteFile(target, data, info.Mode()) + }) +} + func TestClientReadBranchConfig(t *testing.T) { tests := []struct { name string From 36ff9d0db4be77ff7fafa090283c127d35b54f3d Mon Sep 17 00:00:00 2001 From: Jifeng Zhang Date: Sun, 21 Jun 2026 20:16:29 +0200 Subject: [PATCH 8/9] Add Bazel build documentation Document how to build and test with Bazel, including Gazelle usage, the certificate-transparency-go override, and the git test sandbox workaround. Update project-layout.md to reference the new doc. --- docs/bazel.md | 120 +++++++++++++++++++++++++++++++++++++++++ docs/project-layout.md | 1 + 2 files changed, 121 insertions(+) create mode 100644 docs/bazel.md diff --git a/docs/bazel.md b/docs/bazel.md new file mode 100644 index 000000000..d99358b68 --- /dev/null +++ b/docs/bazel.md @@ -0,0 +1,120 @@ +# Building with Bazel + +This project can be built using [Bazel](https://bazel.build/) as an alternative to the +Makefile/`go build` workflow. Bazel provides reproducible, hermetic builds with fine-grained +incremental caching. + +## Prerequisites + +- **Bazelisk** (recommended) or Bazel 9.x+. Bazelisk automatically downloads the correct + Bazel version based on the `MODULE.bazel` file. + + ```sh + # install bazelisk + go install github.com/bazelbuild/bazelisk@latest + ``` + +- **Go 1.24.4** — automatically downloaded by `rules_go`; no manual install required. + +- **Linux x86_64** — the current Bazel configuration targets `k8-fastbuild`. Other platforms + require additional configuration. + +## Building + +```sh +# build everything (binary, libraries, and test targets) +bazel build //... + +# build just the gh binary +bazel build //cmd/gh +``` + +The resulting binary is at `bazel-bin/cmd/gh/gh_/gh`. + +## Running tests + +```sh +# run all tests +bazel test //... + +# run tests for a specific package +bazel test //git:git_test +bazel test //pkg/cmd/pr/list:list_test +``` + +Test results and logs are under `bazel-testlogs/`. + +## How it works + +### MODULE.bazel + +The project uses [Bzlmod](https://bazel.build/external/module) (the modern Bazel dependency +system) via `MODULE.bazel`. Key dependencies: + +| Dependency | Version | Purpose | +|---|---|---| +| `rules_go` | 0.60.0 | Go compilation rules | +| `gazelle` | 0.45.0 | Automatic BUILD file generation from `go.mod` | +| `rules_proto` | 7.1.0 | Protocol Buffer compilation | +| `protobuf` | 33.4 | Protobuf runtime and compiler | + +### Gazelle and BUILD.bazel files + +[Gazelle](https://github.com/bazelbuild/bazel-gazelle) reads `go.mod` and generates +`BUILD.bazel` files for every Go package. When adding or removing Go source files, regenerate +BUILD files: + +```sh +bazel run //:gazelle +``` + +When adding a new external dependency, update `go.mod` first, then run: + +```sh +bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%go_dependencies +``` + +### Gazelle overrides + +Some third-party dependencies need special handling. Overrides are declared in `MODULE.bazel` +under `go_deps.gazelle_override()`. For example, `certificate-transparency-go` requires proto +mode to be disabled because its `configpb` sub-package contains pre-generated `.pb.go` files +that conflict with Gazelle's proto BUILD generation. + +## Known issues + +### git tests and Bazel sandbox + +The `//git:git_test` target exercises real git operations against a fixture bare repository +(`git/fixtures/simple.git`). Bazel's linux sandbox prevents git subprocesses from accessing +data files through the runfiles directory. The test works around this by copying the fixture +to a temp directory at runtime. + +If you add new tests to `git/` that use the fixture, use the `cpFixture` helper: + +```go +func TestSomething(t *testing.T) { + dir := t.TempDir() + cpFixture(t, dir) + client := Client{RepoDir: dir} + // ... +} +``` + +### External dependency resolution + +When `bazel build` or `bazel test` fails with missing dependency errors for an external Go +module, check the `go_deps.gazelle_override()` section in `MODULE.bazel`. The override may +need additional directives or a different `build_file_generation` mode. + +## Comparison with Make + +| Task | Make | Bazel | +|---|---|---| +| Build binary | `make bin/gh` | `bazel build //cmd/gh` | +| Run tests | `make test` | `bazel test //...` | +| Cross-compile | `GOOS=linux GOARCH=arm make bin/gh` | not yet configured | +| Generate docs | `make manpages` | not yet configured | +| Install | `make install` | not yet configured | + +Bazel does not yet replace the full Makefile workflow. It covers building and testing only. diff --git a/docs/project-layout.md b/docs/project-layout.md index 89337596a..69eba01d3 100644 --- a/docs/project-layout.md +++ b/docs/project-layout.md @@ -7,6 +7,7 @@ At a high level, these areas make up the `github.com/cli/cli` project: - [`script/`](../script) - build and release scripts - [`internal/`](../internal) - Go packages highly specific to our needs and thus internal - [`go.mod`](../go.mod) - external Go dependencies for this project, automatically fetched by Go at build time +- [`MODULE.bazel`](../MODULE.bazel) - Bazel build configuration ([Bazel build docs](bazel.md)) Some auxiliary Go packages are at the top level of the project for historical reasons: - [`api/`](../api) - main utilities for making requests to the GitHub API From 72c29b9d6ebf9157191119ef5271b547741db94b Mon Sep 17 00:00:00 2001 From: Jifeng Zhang Date: Mon, 22 Jun 2026 21:55:42 +0200 Subject: [PATCH 9/9] Add Bazel agent skills for Claude Code, MiMoCode, OpenCode, and Codex Create cross-agent Bazel skill files that point to docs/bazel.md as the single source of truth. Each agent gets a thin quick-reference wrapper with commands, common fixes, and project quirks inline. --- .claude/skills/bazel/SKILL.md | 42 +++++++++++++++++++ .mimocode/skills/bazel/SKILL.md | 42 +++++++++++++++++++ .opencode/skills/bazel/SKILL.md | 42 +++++++++++++++++++ AGENTS.md | 48 +++++++++++++++++++++ docs/bazel.md | 74 +++++++++++++++++++++++++++++++++ 5 files changed, 248 insertions(+) create mode 100644 .claude/skills/bazel/SKILL.md create mode 100644 .mimocode/skills/bazel/SKILL.md create mode 100644 .opencode/skills/bazel/SKILL.md create mode 100644 AGENTS.md diff --git a/.claude/skills/bazel/SKILL.md b/.claude/skills/bazel/SKILL.md new file mode 100644 index 000000000..a26b0f6d9 --- /dev/null +++ b/.claude/skills/bazel/SKILL.md @@ -0,0 +1,42 @@ +--- +name: bazel +description: Use when asking questions about Bazel builds, troubleshooting Bazel errors, adding BUILD files, understanding MODULE.bazel, running tests with Bazel, or any Bazel-related task in this project +--- + +# Bazel Quick Reference + +Read `docs/bazel.md` for full documentation. Below is a quick reference. + +## Commands + +| Task | Command | +|------|---------| +| Build everything | `bazel build //...` | +| Build gh binary | `bazel build //cmd/gh` | +| Run all tests | `bazel test //...` | +| Run one test | `bazel test //git:git_test` | +| Regenerate BUILD files | `bazel run //:gazelle` | +| Update deps | `bazel run //:gazelle -- update-repos -from_file=go.mod` | +| Clean | `bazel clean` | +| Debug build | `bazel build //... --verbose_failures` | + +## Common Fixes + +- **"missing strict dependencies"** → `bazel run //:gazelle` +- **"no such package"** → add repo to `use_repo(go_deps, ...)` in MODULE.bazel +- **"flag provided but not defined"** → wrong Gazelle directive, check MODULE.bazel +- **Test file not found** → sandbox issue; copy fixtures to `t.TempDir()` at runtime + +## Project Quirks + +- `certificate-transparency-go` needs `gazelle:proto disable` +- Git tests use `cpFixture()` to work around sandbox restrictions +- Cross-compilation and install not yet configured; use `make` for those + +## Labels + +``` +//cmd/gh # the gh binary +//git:git_test # test target +//... # all targets +``` diff --git a/.mimocode/skills/bazel/SKILL.md b/.mimocode/skills/bazel/SKILL.md new file mode 100644 index 000000000..a26b0f6d9 --- /dev/null +++ b/.mimocode/skills/bazel/SKILL.md @@ -0,0 +1,42 @@ +--- +name: bazel +description: Use when asking questions about Bazel builds, troubleshooting Bazel errors, adding BUILD files, understanding MODULE.bazel, running tests with Bazel, or any Bazel-related task in this project +--- + +# Bazel Quick Reference + +Read `docs/bazel.md` for full documentation. Below is a quick reference. + +## Commands + +| Task | Command | +|------|---------| +| Build everything | `bazel build //...` | +| Build gh binary | `bazel build //cmd/gh` | +| Run all tests | `bazel test //...` | +| Run one test | `bazel test //git:git_test` | +| Regenerate BUILD files | `bazel run //:gazelle` | +| Update deps | `bazel run //:gazelle -- update-repos -from_file=go.mod` | +| Clean | `bazel clean` | +| Debug build | `bazel build //... --verbose_failures` | + +## Common Fixes + +- **"missing strict dependencies"** → `bazel run //:gazelle` +- **"no such package"** → add repo to `use_repo(go_deps, ...)` in MODULE.bazel +- **"flag provided but not defined"** → wrong Gazelle directive, check MODULE.bazel +- **Test file not found** → sandbox issue; copy fixtures to `t.TempDir()` at runtime + +## Project Quirks + +- `certificate-transparency-go` needs `gazelle:proto disable` +- Git tests use `cpFixture()` to work around sandbox restrictions +- Cross-compilation and install not yet configured; use `make` for those + +## Labels + +``` +//cmd/gh # the gh binary +//git:git_test # test target +//... # all targets +``` diff --git a/.opencode/skills/bazel/SKILL.md b/.opencode/skills/bazel/SKILL.md new file mode 100644 index 000000000..a26b0f6d9 --- /dev/null +++ b/.opencode/skills/bazel/SKILL.md @@ -0,0 +1,42 @@ +--- +name: bazel +description: Use when asking questions about Bazel builds, troubleshooting Bazel errors, adding BUILD files, understanding MODULE.bazel, running tests with Bazel, or any Bazel-related task in this project +--- + +# Bazel Quick Reference + +Read `docs/bazel.md` for full documentation. Below is a quick reference. + +## Commands + +| Task | Command | +|------|---------| +| Build everything | `bazel build //...` | +| Build gh binary | `bazel build //cmd/gh` | +| Run all tests | `bazel test //...` | +| Run one test | `bazel test //git:git_test` | +| Regenerate BUILD files | `bazel run //:gazelle` | +| Update deps | `bazel run //:gazelle -- update-repos -from_file=go.mod` | +| Clean | `bazel clean` | +| Debug build | `bazel build //... --verbose_failures` | + +## Common Fixes + +- **"missing strict dependencies"** → `bazel run //:gazelle` +- **"no such package"** → add repo to `use_repo(go_deps, ...)` in MODULE.bazel +- **"flag provided but not defined"** → wrong Gazelle directive, check MODULE.bazel +- **Test file not found** → sandbox issue; copy fixtures to `t.TempDir()` at runtime + +## Project Quirks + +- `certificate-transparency-go` needs `gazelle:proto disable` +- Git tests use `cpFixture()` to work around sandbox restrictions +- Cross-compilation and install not yet configured; use `make` for those + +## Labels + +``` +//cmd/gh # the gh binary +//git:git_test # test target +//... # all targets +``` diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..89669cb11 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,48 @@ +# Agents Guide + +## Bazel Build System + +This project can be built with Bazel. The main config is `MODULE.bazel`. BUILD files are auto-generated by Gazelle from `go.mod`. + +### Common Commands + +```sh +bazel build //... # build everything +bazel build //cmd/gh # build the gh binary +bazel test //... # run all tests +bazel test //git:git_test # run a specific test +bazel run //:gazelle # regenerate BUILD files +bazel run //:gazelle -- update-repos -from_file=go.mod # update deps +``` + +### When Builds Fail + +1. **"missing strict dependencies"** → run `bazel run //:gazelle` to regenerate BUILD files +2. **"no such package"** → add missing repo to `use_repo(go_deps, ...)` in MODULE.bazel +3. **"flag provided but not defined"** → wrong Gazelle directive name, check MODULE.bazel +4. **Test can't find files** → Bazel sandbox isolates tests; copy fixtures to `t.TempDir()` at runtime + +### Adding Dependencies + +```sh +go get github.com/new/dep@version +go mod tidy +bazel run //:gazelle -- update-repos -from_file=go.mod +``` + +### Project-Specific Notes + +- Go SDK 1.24.4 is pinned in MODULE.bazel +- `certificate-transparency-go` needs `gazelle:proto disable` directive +- Git tests use `cpFixture()` helper to work around sandbox restrictions +- Cross-compilation and install targets not yet configured; use `make` for those + +### Debugging + +```sh +bazel build //... --verbose_failures # see failing commands +bazel build //... --sandbox_debug # debug sandbox issues +bazel query 'deps(//cmd/gh)' # check dependencies +``` + +Full documentation: `docs/bazel.md` diff --git a/docs/bazel.md b/docs/bazel.md index d99358b68..c53259dc5 100644 --- a/docs/bazel.md +++ b/docs/bazel.md @@ -107,6 +107,80 @@ When `bazel build` or `bazel test` fails with missing dependency errors for an e module, check the `go_deps.gazelle_override()` section in `MODULE.bazel`. The override may need additional directives or a different `build_file_generation` mode. +## Troubleshooting + +### "missing strict dependencies" / "No dependencies were provided" + +A Go file imports a package that isn't declared in `deps` in the BUILD.bazel. + +**Fix:** +1. Run `bazel run //:gazelle` to regenerate BUILD files +2. If that doesn't help, check if the import path matches the `importpath` in the target's BUILD.bazel +3. For proto packages, you may need a `gazelle_override` in `MODULE.bazel` (see "Gazelle overrides" above) + +### "flag provided but not defined" + +A Gazelle directive name is wrong in `MODULE.bazel`. + +**Fix:** Check the directive name against [Gazelle docs](https://github.com/bazelbuild/bazel-gazelle#directives). Common correct directives: +- `gazelle:proto disable` +- `gazelle:resolve go ` +- `gazelle:exclude ` + +### "no such package" / "repository could not be resolved" + +A dependency isn't declared in `use_repo()` in `MODULE.bazel`. + +**Fix:** Add the repo name to the `use_repo(go_deps, ...)` list. Repo names follow the pattern: `com_github_owner_repo` (underscores replace slashes/dots). + +### Test fails with "not a git repository" or file not found + +Bazel's sandbox isolates the test from the source tree. Relative paths like `./fixtures/simple.git` don't resolve. + +**Fix:** Copy test fixtures to `t.TempDir()` at runtime. See `git/client_test.go` for the `cpFixture()` helper. + +### Build is very slow on first run + +Protobuf toolchains and Go SDK download/compile on first build. Subsequent builds use the cache. + +**Fix:** Be patient. Use `--jobs=N` to limit parallelism if memory-constrained. + +### "ERROR: interrupted" / timeout + +Large builds may exceed default timeouts. + +**Fix:** Add `--timeout=3600` (seconds) to the command. + +### Debugging commands + +```sh +bazel build //... --verbose_failures # see failing commands +bazel build //... --sandbox_debug # debug sandbox issues +bazel query 'deps(//cmd/gh)' # check dependencies +bazel query 'kind(".*_test", //...)' # list all test targets +``` + +## Adding a new Go package + +1. Create your Go package normally +2. Run `bazel run //:gazelle` — it auto-generates the BUILD.bazel +3. Verify: `bazel build //your/package` + +## Adding a new external dependency + +1. `go get github.com/new/dep@version` +2. `go mod tidy` +3. `bazel run //:gazelle -- update-repos -from_file=go.mod` +4. If the new dep needs special handling, add a `go_deps.gazelle_override()` in `MODULE.bazel` + +## Project-specific quirks + +1. **Go SDK 1.24.4** — pinned in `MODULE.bazel` via `go_sdk.download(version = "1.24.4")` +2. **certificate-transparency-go** — needs `build_file_generation = "auto"` with `gazelle:proto disable` because its `configpb` package has pre-generated proto files +3. **git tests** — use `cpFixture()` to copy `git/fixtures/simple.git` to a temp dir (sandbox blocks subprocess access to data files) +4. **No cross-compilation yet** — Bazel config targets `k8-fastbuild` only +5. **No install/release** — `make install` and `goreleaser` still use the Makefile workflow + ## Comparison with Make | Task | Make | Bazel |