Skip to content

Commit

Permalink
Merge pull request #58 from player-ui/doc-gen
Browse files Browse the repository at this point in the history
Generate docs for all rules
  • Loading branch information
adierkens authored Jul 19, 2024
2 parents 96db91f + 8431f1d commit 8643480
Show file tree
Hide file tree
Showing 13 changed files with 467 additions and 10 deletions.
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rules_ts_ext.deps()
use_repo(rules_ts_ext, "npm_typescript")

bazel_dep(name = "rules_kotlin", version = "1.9.1")

bazel_dep(name = "rules_java", version = "7.2.0", dev_dependency = True)
bazel_dep(name = "rules_jvm_external", version = "5.3")
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")

Expand Down
19 changes: 17 additions & 2 deletions docs/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
load("@aspect_bazel_lib//lib:docs.bzl", "stardoc_with_diff_test", "update_docs")

stardoc_with_diff_test(
name = "rules",
name = "javascript",
bzl_library_target = "//javascript:defs",
)

update_docs(name = "update")
stardoc_with_diff_test(
name = "kotlin",
bzl_library_target = "//kotlin:defs",
)

stardoc_with_diff_test(
name = "ios",
bzl_library_target = "//ios:defs",
)

stardoc_with_diff_test(
name = "player",
bzl_library_target = "//player:defs",
)

update_docs(name = "update")
142 changes: 142 additions & 0 deletions docs/ios.md

Large diffs are not rendered by default.

File renamed without changes.
143 changes: 143 additions & 0 deletions docs/kotlin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->


Public API for Kotlin based project rules


<a id="distribution"></a>

## distribution

<pre>
distribution(<a href="#distribution-name">name</a>, <a href="#distribution-maven_coordinates">maven_coordinates</a>, <a href="#distribution-lib_name">lib_name</a>, <a href="#distribution-kwargs">kwargs</a>)
</pre>



**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="distribution-name"></a>name | <p align="center"> - </p> | none |
| <a id="distribution-maven_coordinates"></a>maven_coordinates | <p align="center"> - </p> | none |
| <a id="distribution-lib_name"></a>lib_name | <p align="center"> - </p> | <code>None</code> |
| <a id="distribution-kwargs"></a>kwargs | <p align="center"> - </p> | none |


<a id="kt_jvm"></a>

## kt_jvm

<pre>
kt_jvm(<a href="#kt_jvm-name">name</a>, <a href="#kt_jvm-lint_config">lint_config</a>, <a href="#kt_jvm-group">group</a>, <a href="#kt_jvm-version">version</a>, <a href="#kt_jvm-deploy_env">deploy_env</a>, <a href="#kt_jvm-excluded_workspaces">excluded_workspaces</a>, <a href="#kt_jvm-pom_template">pom_template</a>,
<a href="#kt_jvm-module_name">module_name</a>, <a href="#kt_jvm-main_opts">main_opts</a>, <a href="#kt_jvm-main_srcs">main_srcs</a>, <a href="#kt_jvm-main_resources">main_resources</a>, <a href="#kt_jvm-main_resource_jars">main_resource_jars</a>,
<a href="#kt_jvm-main_resource_strip_prefix">main_resource_strip_prefix</a>, <a href="#kt_jvm-main_associates">main_associates</a>, <a href="#kt_jvm-main_deps">main_deps</a>, <a href="#kt_jvm-main_exports">main_exports</a>, <a href="#kt_jvm-main_runtime_deps">main_runtime_deps</a>,
<a href="#kt_jvm-test_package">test_package</a>, <a href="#kt_jvm-test_opts">test_opts</a>, <a href="#kt_jvm-test_srcs">test_srcs</a>, <a href="#kt_jvm-test_resources">test_resources</a>, <a href="#kt_jvm-test_resource_jars">test_resource_jars</a>,
<a href="#kt_jvm-test_resource_strip_prefix">test_resource_strip_prefix</a>, <a href="#kt_jvm-test_associates">test_associates</a>, <a href="#kt_jvm-test_deps">test_deps</a>, <a href="#kt_jvm-test_runtime_deps">test_runtime_deps</a>)
</pre>

Generic Kotlin JVM macro for conditionally configuring build & test targets, linting, and publishing.

# Building + Testing

Most kt_jvm_library parameters can be forwarded for either the main or test
set by prefixing the paremeter with `main` or `test`, i.e. `main_srcs`, `test_deps`

If `srcs` or `resources` are undefined, they will default to globbing the
files grouped under Maven convention, i.e. `src/main/kotlin` and `src/main/resources`

# Linting

If a `lint_config` target it provided, a lint test and lint fix target will be
generated.

# Publishing

Distribution requires a group and version to use for Maven coordinates.

If either of these properties are provided, publishing targets will be attempted to be
created, but will error out if any of the other required properties are missing.

Three targets are created for publishing:
- {name}-assemble: Package artifact and generate POM
- {name}-deploy: Executable target for actually deploying to a Maven repo
- {name}-install: Exectuable target to locally install the artifacts


**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="kt_jvm-name"></a>name | used for the underlying <code>kt_jvm_library</code> rule | none |
| <a id="kt_jvm-lint_config"></a>lint_config | project level KtLint config | <code>None</code> |
| <a id="kt_jvm-group"></a>group | (optional) group identifier for publishing | <code>None</code> |
| <a id="kt_jvm-version"></a>version | (optional) version to publish under | <code>None</code> |
| <a id="kt_jvm-deploy_env"></a>deploy_env | (optional) collection of targets to exclude from transitive closure | <code>None</code> |
| <a id="kt_jvm-excluded_workspaces"></a>excluded_workspaces | (optional) dict of workspace names to replace, or remove, from transitive closure | <code>None</code> |
| <a id="kt_jvm-pom_template"></a>pom_template | <p align="center"> - </p> | <code>None</code> |
| <a id="kt_jvm-module_name"></a>module_name | (optional) Kotlin module name | <code>None</code> |
| <a id="kt_jvm-main_opts"></a>main_opts | (optional) Kotlin compiler options used to compile the main source set | <code>None</code> |
| <a id="kt_jvm-main_srcs"></a>main_srcs | (optional) main source set -- defaults to <code>glob(["src/main/kotlin/**/*.kt"])</code> | <code>None</code> |
| <a id="kt_jvm-main_resources"></a>main_resources | (optional) main resources -- defaults to <code>glob(["src/main/resources/**/*"])</code> | <code>None</code> |
| <a id="kt_jvm-main_resource_jars"></a>main_resource_jars | (optional) additional resource JARs for the main sources | <code>None</code> |
| <a id="kt_jvm-main_resource_strip_prefix"></a>main_resource_strip_prefix | (optional) remove prefix from resources | <code>None</code> |
| <a id="kt_jvm-main_associates"></a>main_associates | (optional) Kotlin module dependencies to treat as associates of the same module | <code>None</code> |
| <a id="kt_jvm-main_deps"></a>main_deps | (optional) dependencies of the main source set | <code>None</code> |
| <a id="kt_jvm-main_exports"></a>main_exports | (optional) dependencies that should be exported as apart of this module | <code>None</code> |
| <a id="kt_jvm-main_runtime_deps"></a>main_runtime_deps | (optional) depencies of the main source set that are provided at runtime | <code>None</code> |
| <a id="kt_jvm-test_package"></a>test_package | (required if test sources are provided) package containing tests | <code>None</code> |
| <a id="kt_jvm-test_opts"></a>test_opts | (optional) Kotlin compiler options used to compile the test source set | <code>None</code> |
| <a id="kt_jvm-test_srcs"></a>test_srcs | (optional) test source set -- defaults to <code>glob(["src/test/kotlin/**/*.kt"])</code> | <code>None</code> |
| <a id="kt_jvm-test_resources"></a>test_resources | (optional) main resources -- defaults to <code>glob(["src/test/resources/**/*"])</code> | <code>None</code> |
| <a id="kt_jvm-test_resource_jars"></a>test_resource_jars | (optional) additional resource JARs for the test sources | <code>None</code> |
| <a id="kt_jvm-test_resource_strip_prefix"></a>test_resource_strip_prefix | (optional) remove prefix from resources | <code>None</code> |
| <a id="kt_jvm-test_associates"></a>test_associates | (optional) Kotlin module dependencies to treat as associates of the same module | <code>None</code> |
| <a id="kt_jvm-test_deps"></a>test_deps | (optional) dependencies of the test source set | <code>None</code> |
| <a id="kt_jvm-test_runtime_deps"></a>test_runtime_deps | (optional) depencies of the test source set that are provided at runtime | <code>None</code> |


<a id="kt_jvm_junit5_test"></a>

## kt_jvm_junit5_test

<pre>
kt_jvm_junit5_test(<a href="#kt_jvm_junit5_test-name">name</a>, <a href="#kt_jvm_junit5_test-srcs">srcs</a>, <a href="#kt_jvm_junit5_test-test_package">test_package</a>, <a href="#kt_jvm_junit5_test-deps">deps</a>, <a href="#kt_jvm_junit5_test-runtime_deps">runtime_deps</a>, <a href="#kt_jvm_junit5_test-kwargs">kwargs</a>)
</pre>



**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="kt_jvm_junit5_test-name"></a>name | <p align="center"> - </p> | none |
| <a id="kt_jvm_junit5_test-srcs"></a>srcs | <p align="center"> - </p> | none |
| <a id="kt_jvm_junit5_test-test_package"></a>test_package | <p align="center"> - </p> | none |
| <a id="kt_jvm_junit5_test-deps"></a>deps | <p align="center"> - </p> | <code>[]</code> |
| <a id="kt_jvm_junit5_test-runtime_deps"></a>runtime_deps | <p align="center"> - </p> | <code>[]</code> |
| <a id="kt_jvm_junit5_test-kwargs"></a>kwargs | <p align="center"> - </p> | none |


<a id="lint"></a>

## lint

<pre>
lint(<a href="#lint-name">name</a>, <a href="#lint-srcs">srcs</a>, <a href="#lint-lint_config">lint_config</a>)
</pre>



**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="lint-name"></a>name | <p align="center"> - </p> | none |
| <a id="lint-srcs"></a>srcs | <p align="center"> - </p> | none |
| <a id="lint-lint_config"></a>lint_config | <p align="center"> - </p> | none |


125 changes: 125 additions & 0 deletions docs/player.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->


Public API for player Bazel rules.


<a id="create_base_config"></a>

## create_base_config

<pre>
create_base_config(<a href="#create_base_config-name">name</a>, <a href="#create_base_config-plugins">plugins</a>, <a href="#create_base_config-presets">presets</a>)
</pre>



**ATTRIBUTES**


| Name | Description | Type | Mandatory | Default |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="create_base_config-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
| <a id="create_base_config-plugins"></a>plugins | - | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> |
| <a id="create_base_config-presets"></a>presets | - | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> |


<a id="compile"></a>

## compile

<pre>
compile(<a href="#compile-name">name</a>, <a href="#compile-node_modules">node_modules</a>, <a href="#compile-srcs">srcs</a>, <a href="#compile-input_dir">input_dir</a>, <a href="#compile-output_dir">output_dir</a>, <a href="#compile-data">data</a>, <a href="#compile-config">config</a>, <a href="#compile-skip_test">skip_test</a>, <a href="#compile-kwargs">kwargs</a>)
</pre>

Run the src or src_dir through the player compiler.

**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="compile-name"></a>name | The name of the target. | none |
| <a id="compile-node_modules"></a>node_modules | The node_modules target to use. | <code>"//:node_modules"</code> |
| <a id="compile-srcs"></a>srcs | The source files to compile. | <code>None</code> |
| <a id="compile-input_dir"></a>input_dir | <p align="center"> - </p> | <code>"src"</code> |
| <a id="compile-output_dir"></a>output_dir | <p align="center"> - </p> | <code>None</code> |
| <a id="compile-data"></a>data | <p align="center"> - </p> | <code>[]</code> |
| <a id="compile-config"></a>config | <p align="center"> - </p> | <code>None</code> |
| <a id="compile-skip_test"></a>skip_test | <p align="center"> - </p> | <code>False</code> |
| <a id="compile-kwargs"></a>kwargs | <p align="center"> - </p> | none |


<a id="dsl_compile"></a>

## dsl_compile

<pre>
dsl_compile(<a href="#dsl_compile-name">name</a>, <a href="#dsl_compile-node_modules">node_modules</a>, <a href="#dsl_compile-srcs">srcs</a>, <a href="#dsl_compile-input_dir">input_dir</a>, <a href="#dsl_compile-output_dir">output_dir</a>, <a href="#dsl_compile-data">data</a>, <a href="#dsl_compile-config">config</a>, <a href="#dsl_compile-skip_test">skip_test</a>, <a href="#dsl_compile-kwargs">kwargs</a>)
</pre>

Run the src or src_dir through the player compiler.

**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="dsl_compile-name"></a>name | The name of the target. | none |
| <a id="dsl_compile-node_modules"></a>node_modules | The node_modules target to use. | <code>"//:node_modules"</code> |
| <a id="dsl_compile-srcs"></a>srcs | The source files to compile. | <code>None</code> |
| <a id="dsl_compile-input_dir"></a>input_dir | <p align="center"> - </p> | <code>"src"</code> |
| <a id="dsl_compile-output_dir"></a>output_dir | <p align="center"> - </p> | <code>None</code> |
| <a id="dsl_compile-data"></a>data | <p align="center"> - </p> | <code>[]</code> |
| <a id="dsl_compile-config"></a>config | <p align="center"> - </p> | <code>None</code> |
| <a id="dsl_compile-skip_test"></a>skip_test | <p align="center"> - </p> | <code>False</code> |
| <a id="dsl_compile-kwargs"></a>kwargs | <p align="center"> - </p> | none |


<a id="js_xlr_pipeline"></a>

## js_xlr_pipeline

<pre>
js_xlr_pipeline(<a href="#js_xlr_pipeline-name">name</a>, <a href="#js_xlr_pipeline-xlr_mode">xlr_mode</a>, <a href="#js_xlr_pipeline-xlr_input_dir">xlr_input_dir</a>, <a href="#js_xlr_pipeline-srcs">srcs</a>, <a href="#js_xlr_pipeline-kwargs">kwargs</a>)
</pre>

A rule for compiling player flows with xlr mode.

**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="js_xlr_pipeline-name"></a>name | The name of the target. | <code>None</code> |
| <a id="js_xlr_pipeline-xlr_mode"></a>xlr_mode | The mode to use when compiling with XLR. Defaults to "plugin". | <code>"plugin"</code> |
| <a id="js_xlr_pipeline-xlr_input_dir"></a>xlr_input_dir | <p align="center"> - </p> | <code>"src"</code> |
| <a id="js_xlr_pipeline-srcs"></a>srcs | <p align="center"> - </p> | <code>None</code> |
| <a id="js_xlr_pipeline-kwargs"></a>kwargs | <p align="center"> - </p> | none |


<a id="xlr_compile"></a>

## xlr_compile

<pre>
xlr_compile(<a href="#xlr_compile-name">name</a>, <a href="#xlr_compile-node_modules">node_modules</a>, <a href="#xlr_compile-srcs">srcs</a>, <a href="#xlr_compile-data">data</a>, <a href="#xlr_compile-config">config</a>, <a href="#xlr_compile-input_dir">input_dir</a>, <a href="#xlr_compile-mode">mode</a>, <a href="#xlr_compile-kwargs">kwargs</a>)
</pre>



**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="xlr_compile-name"></a>name | <p align="center"> - </p> | none |
| <a id="xlr_compile-node_modules"></a>node_modules | <p align="center"> - </p> | <code>"//:node_modules"</code> |
| <a id="xlr_compile-srcs"></a>srcs | <p align="center"> - </p> | <code>None</code> |
| <a id="xlr_compile-data"></a>data | <p align="center"> - </p> | <code>[]</code> |
| <a id="xlr_compile-config"></a>config | <p align="center"> - </p> | <code>None</code> |
| <a id="xlr_compile-input_dir"></a>input_dir | <p align="center"> - </p> | <code>"src"</code> |
| <a id="xlr_compile-mode"></a>mode | <p align="center"> - </p> | <code>"plugin"</code> |
| <a id="xlr_compile-kwargs"></a>kwargs | <p align="center"> - </p> | none |


11 changes: 10 additions & 1 deletion ios/private/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

bzl_library(
name = "common_utils",
srcs = ["common_utils.bzl"],
srcs = ["common_utils.bzl", "publishing.bzl"],
visibility = [
"//ios:__subpackages__",
],
deps = [
"@rules_pkg//:pkg.bzl",
"@rules_pkg//:mappings.bzl",
"@rules_pkg//pkg:bzl_srcs",
"@bazel_skylib//lib:paths",
"@build_bazel_rules_apple//apple:resources",
"@build_bazel_rules_ios//rules:test",
"@aspect_bazel_lib//lib:stamping"
]
)

exports_files([
Expand Down
14 changes: 13 additions & 1 deletion kotlin/private/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ bzl_library(
]
)

bzl_library(
name = "junit",
srcs = ["junit_test.bzl", "junit5.bzl"],
visibility = [
"//kotlin:__subpackages__",
],
)

bzl_library(
name = "distribution",
srcs = ["distribution.bzl"],
Expand All @@ -25,14 +33,18 @@ bzl_library(

bzl_library(
name = "kt_jvm",
srcs = ["kt_jvm.bzl"],
srcs = ["kt_jvm.bzl",],
visibility = [
"//kotlin:__subpackages__",
],
deps = [
":lint",
":distribution",
":kt_jvm_library_and_test.bzl",
":junit",
"@rules_kotlin//kotlin",
"@rules_jvm_external//:implementation",
"@rules_java//java:rules",
]
)

Expand Down
5 changes: 1 addition & 4 deletions kotlin/private/kt_jvm.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,21 @@ def kt_jvm(
Args:
name: used for the underlying `kt_jvm_library` rule
# Project config
lint_config: project level KtLint config
# Distribution project config
group: (optional) group identifier for publishing
version: (optional) version to publish under
deploy_env: (optional) collection of targets to exclude from transitive closure
excluded_workspaces: (optional) dict of workspace names to replace, or remove, from transitive closure
# Distribution target config
project_name: (optional) project name for POM
project_description: (optional) project description for POM
project_url: (optional) project url for POM
scm_url: (optional) project scm url for POM
developers: (optional) developers for POM
workspace_refs: (optional) refs used to track dependencies
# Package level config
module_name: (optional) Kotlin module name
main_opts: (optional) Kotlin compiler options used to compile the main source set
main_srcs: (optional) main source set -- defaults to `glob(["src/main/kotlin/**/*.kt"])`
Expand Down
2 changes: 2 additions & 0 deletions player/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ bzl_library(
visibility = ["//visibility:public"],
deps = [
"//player/private:dsl",
"//player/private:xlr",
"//player/private:config",
],
)
Loading

0 comments on commit 8643480

Please sign in to comment.