Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(NA): @kbn/pm new commands to support development on Bazel packages #96465

Merged
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
61218cc
chore(NA): add warnings both to run and watch commands about Bazel bu…
mistic Apr 7, 2021
20206ff
Merge remote-tracking branch 'upstream/master' into kbn-commands-to-s…
mistic Apr 7, 2021
196d595
chore(NA): add new commands to build and watch bazel packages
mistic Apr 7, 2021
7439b71
docs(NA): add documentation about how to deal with bazel packages
mistic Apr 7, 2021
b7f65c6
Merge branch 'master' into kbn-commands-to-support-build-for-bazel-pa…
kibanamachine Apr 8, 2021
ab45c18
chore(NA): addressed majority of the feedback received except for imp…
mistic Apr 9, 2021
2428671
chore(NA): disable ibazel info notification.
mistic Apr 9, 2021
e29b3f3
chore(NA): remove iBazel notification
mistic Apr 9, 2021
cdf3496
chore(NA): remove iBazel notification - kbn pm dist
mistic Apr 9, 2021
a3a68bd
Merge branch 'master' into kbn-commands-to-support-build-for-bazel-pa…
kibanamachine Apr 9, 2021
0f57eca
chore(NA): move show_results option to kbn-pm only
mistic Apr 11, 2021
29ff0fd
Merge remote-tracking branch 'upstream/master' into kbn-commands-to-s…
mistic Apr 11, 2021
ff08bfb
Merge branch 'kbn-commands-to-support-build-for-bazel-packages' of gi…
mistic Apr 11, 2021
13d3394
Merge branch 'master' into kbn-commands-to-support-build-for-bazel-pa…
kibanamachine Apr 12, 2021
03d5744
chore(NA): patch build bazel command to include packages target list
mistic Apr 12, 2021
b610ca7
chore(NA): add pretty logging for elastic-datemath
mistic Apr 12, 2021
8623196
chore(NA): remove double error output from commands ran with Bazel
mistic Apr 12, 2021
7950d47
fix(NA): include simple error message to preserve subprocess failure …
mistic Apr 12, 2021
1d83240
docs(NA): missing docs about how to independentely watch non bazel pa…
mistic Apr 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .bazelrc.common
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
build --experimental_guard_against_concurrent_changes
run --experimental_guard_against_concurrent_changes
test --experimental_guard_against_concurrent_changes
query --experimental_guard_against_concurrent_changes

## Cache action outputs on disk so they persist across output_base and bazel shutdown (eg. changing branches)
build --disk_cache=~/.bazel-cache/disk-cache
common --disk_cache=~/.bazel-cache/disk-cache

## Bazel repo cache settings
build --repository_cache=~/.bazel-cache/repository-cache
common --repository_cache=~/.bazel-cache/repository-cache

# Bazel will create symlinks from the workspace directory to output artifacts.
# Build results will be placed in a directory called "bazel-bin"
Expand All @@ -35,13 +36,16 @@ build --experimental_inprocess_symlink_creation
# Incompatible flags to run with
build --incompatible_no_implicit_file_export
build --incompatible_restrict_string_escapes
query --incompatible_no_implicit_file_export
query --incompatible_restrict_string_escapes

# Log configs
## different from default
common --color=yes
build --show_task_finish
build --noshow_progress
common --noshow_progress
common --show_task_finish
build --noshow_loading_progress
query --noshow_loading_progress
build --show_result=0

# Specifies desired output mode for running tests.
Expand Down Expand Up @@ -82,7 +86,7 @@ test:debug --test_output=streamed --test_strategy=exclusive --test_timeout=9999
run:debug --define=VERBOSE_LOGS=1 -- --node_options=--inspect-brk
# The following option will change the build output of certain rules such as terser and may not be desirable in all cases
# It will also output both the repo cache and action cache to a folder inside the repo
build:debug --compilation_mode=dbg --show_result=1
build:debug --compilation_mode=dbg --show_result=0 --noshow_loading_progress --noshow_progress --show_task_finish

# Turn off legacy external runfiles
# This prevents accidentally depending on this feature, which Bazel will remove.
Expand Down
3 changes: 0 additions & 3 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ node_repositories(
# NOTE: FORCE_COLOR env var forces colors on non tty mode
yarn_install(
name = "npm",
environment = {
"FORCE_COLOR": "True",
},
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
data = [
Expand Down
5 changes: 4 additions & 1 deletion docs/developer/getting-started/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ yarn kbn bootstrap --force-install

(You can also run `yarn kbn` to see the other available commands. For
more info about this tool, see
{kib-repo}tree/{branch}/packages/kbn-pm[{kib-repo}tree/{branch}/packages/kbn-pm].)
{kib-repo}tree/{branch}/packages/kbn-pm[{kib-repo}tree/{branch}/packages/kbn-pm]. If you want more
information about how to actively develop over packages please read <<monorepo-packages>>)

When switching branches which use different versions of npm packages you
may need to run:
Expand Down Expand Up @@ -169,3 +170,5 @@ include::debugging.asciidoc[leveloffset=+1]
include::building-kibana.asciidoc[leveloffset=+1]

include::development-plugin-resources.asciidoc[leveloffset=+1]

include::monorepo-packages.asciidoc[leveloffset=+1]
61 changes: 61 additions & 0 deletions docs/developer/getting-started/monorepo-packages.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[[monorepo-packages]]
== {kib} Monorepo Packages

Currently {kib} works as a monorepo composed by a core, plugins and packages.
The latest are located in a folder called `packages` and are pieces of software that
composes a set of features that can be isolated and reused across the entire repository.
They are also supposed to be able to imported just like any other `node_module`.

Previously we relied solely on `@kbn/pm` to manage the development tools of those packages, but we are
now in the middle of migrating those responsibilities into Bazel. Every package already migrated
will contain in its root folder a `BUILD.bazel` file and other `build` and `watching` strategies should be used.

Remember that any time you need to make sure the monorepo is ready to be used just run:

[source,bash]
----
yarn kbn bootstrap
----

[discrete]
=== Building Non Bazel Packages

Non Bazel packages can be built independently with

[source,bash]
----
yarn kbn run build -i PACKAGE_NAME
----

[discrete]
=== Watching Non Bazel Packages

Non Bazel packages can be watched independently with
spalger marked this conversation as resolved.
Show resolved Hide resolved

[discrete]
=== Building Bazel Packages

Bazel packages are built as a whole for now. You can use:

[source,bash]
----
yarn kbn build-bazel
----

[discrete]
=== Watching Bazel Packages

Bazel packages are watched as a whole for now. You can use:

[source,bash]
----
yarn kbn watch-bazel
----


[discrete]
=== List of Already Migrated Packages to Bazel

- @elastic/datemath


1 change: 1 addition & 0 deletions packages/elastic-datemath/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ts_config(

ts_project(
name = "tsc",
args = ['--pretty'],
srcs = SRCS,
deps = DEPS,
declaration = True,
Expand Down
Loading