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

reorganize files #15

Merged
merged 16 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazelignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
.gitignore
docs
external
example/ignored_folder
test
4 changes: 0 additions & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
startup --windows_enable_symlinks
common --enable_bzlmod
build --enable_platform_specific_config
build --incompatible_use_platforms_repo_for_constraints
build --incompatible_enable_cc_toolchain_resolution
build --incompatible_strict_action_env
build --enable_runfiles
build --noincompatible_remove_rule_name_parameter
query --noincompatible_remove_rule_name_parameter

# Temporary until https://github.com/grailbio/bazel-toolchain/pull/198 is merged
build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux

common:ci --announce_rc
common:ci --disk_cache=~/.cache/bazel-disk-cache
build:ci -c opt
Expand Down
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.2.1
19 changes: 5 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,13 @@ jobs:
test-windows:
runs-on: windows-latest
steps:
- uses: actions/cache@v3
with:
path: |
/Users/runneradmin/AppData/Local/bazelisk
/Users/runneradmin/.cache/bazel-disk-cache
key: ${{runner.os}}-bazel-cache
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: .\test.ps1
working-directory: test
test-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v3
with:
path: |
~/.cache/bazelisk
~/.cache/bazel-disk-cache
key: ${{runner.os}}-bazel-cache
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: sudo chmod +x ./test/test.sh
- run: ./test.sh
working-directory: test
14 changes: 5 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/bazel-*
/user.bazelrc
bazel-*
user.bazelrc
*.bazel.lock

# https://github.com/hedronvision/bazel-compile-commands-extractor
/compile_commands.json
/external

# clangd
/.cache/
compile_commands.json
external
.cache
9 changes: 0 additions & 9 deletions .vscode/settings.json

This file was deleted.

15 changes: 0 additions & 15 deletions .vscode/tasks.json

This file was deleted.

35 changes: 5 additions & 30 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,40 +1,15 @@
load("@stardoc//stardoc:stardoc.bzl", "stardoc")
load("@bzlws//:index.bzl", "bzlws_copy")
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("//rules:bzlws_copy.bzl", "bzlws_copy")

package(default_visibility = ["//visibility:public"])

exports_files(["index.bzl", "repo.bzl"])

stardoc(
name = "docs",
tags = ["manual"],
input = "index.bzl",
out = "index.md",
deps = [":rules_cc"],
)

# SEE: https://github.com/bazelbuild/stardoc/issues/92
bzl_library(
name = "rules_cc",
tags = ["manual"],
srcs = [
"@rules_cc//cc:action_names.bzl",
"@rules_cc//cc:defs.bzl",
"@rules_cc//cc:find_cc_toolchain.bzl",
"@rules_cc//cc/private/rules_impl:cc_flags_supplier.bzl",
"@rules_cc//cc/private/rules_impl:cc_flags_supplier_lib.bzl",
"@rules_cc//cc/private/rules_impl:compiler_flag.bzl",
],
visibility = ["//visibility:public"],
)

bzlws_copy(
name = "docs_copy",
name = "update_docs",
out = "docs/{FILENAME}",
tags = ["manual"],
force = True,
srcs = [
":docs",
"//rules:bzlws_copy_doc",
"//rules:bzlws_link_doc",
"//rules:bzlws_extract_doc",
],
)
18 changes: 17 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,20 @@ bazel_dep(name = "bazel_skylib", version = "1.6.1")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "yaml-cpp", version = "0.8.0")

bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.7.0", dev_dependency = True)
bazel_dep(name = "toolchains_llvm", version = "1.0.0", dev_dependency = True)
bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
git_override(
module_name = "hedron_compile_commands",
commit = "204aa593e002cbd177d30f11f54cff3559110bb9",
remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git",
)

llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm", dev_dependency = True)
llvm.toolchain(llvm_version = "17.0.6")
use_repo(llvm, "llvm_toolchain")

register_toolchains(
"@llvm_toolchain//:all",
dev_dependency = True,
)
37 changes: 0 additions & 37 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -1,38 +1 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("//:faux_repo.bzl", "faux_repo")

faux_repo(name = "faux_repo")

http_archive(
name = "hedron_compile_commands",
sha256 = "f5cf960d7477b95546a96b05397129969133ec0c1af9889e5d02ebe42dba6abd",
strip_prefix = "bazel-compile-commands-extractor-2a72a3b761e21a0405995b323a3b765d93bd6df4",
url = "https://github.com/hedronvision/bazel-compile-commands-extractor/archive/2a72a3b761e21a0405995b323a3b765d93bd6df4.tar.gz",
)

load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup")

hedron_compile_commands_setup()

http_archive(
name = "com_grail_bazel_toolchain",
sha256 = "aae35819d7fad92047f7ffcc3e7d0c360b6f35b893ff51f74b21f13434528d2c",
strip_prefix = "bazel-toolchain-42fa12b88d85404d29434c43a3a0400c1221a70e",
url = "https://github.com/grailbio/bazel-toolchain/archive/42fa12b88d85404d29434c43a3a0400c1221a70e.zip",
)

load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies")

bazel_toolchain_dependencies()

load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")

llvm_toolchain(
name = "llvm_toolchain",
llvm_version = "16.0.4",
)

load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")

llvm_register_toolchains()
19 changes: 0 additions & 19 deletions bazel/platforms/BUILD.bazel

This file was deleted.

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



<a id="bzlws_copy"></a>

## bzlws_copy

<pre>
load("@bzlws//rules:bzlws_copy.bzl", "bzlws_copy")

bzlws_copy(<a href="#bzlws_copy-name">name</a>, <a href="#bzlws_copy-srcs">srcs</a>, <a href="#bzlws_copy-out">out</a>, <a href="#bzlws_copy-force">force</a>, <a href="#bzlws_copy-strip_filepath_prefix">strip_filepath_prefix</a>, <a href="#bzlws_copy-metafile_path">metafile_path</a>, <a href="#bzlws_copy-substitutions">substitutions</a>,
<a href="#bzlws_copy-stamp_substitutions">stamp_substitutions</a>, <a href="#bzlws_copy-visibility">visibility</a>, <a href="#bzlws_copy-tags">tags</a>, <a href="#bzlws_copy-kwargs">kwargs</a>)
</pre>

Copy generated files into workspace directory

```python
load("@bzlws//rules:bzlws_copy.bzl", "bzlws_copy")
```


**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="bzlws_copy-name"></a>name | Name used for executable target | `None` |
| <a id="bzlws_copy-srcs"></a>srcs | List of files that should be copied | `None` |
| <a id="bzlws_copy-out"></a>out | Output path within the workspace. Certain strings get replaced with workspace status values and information about the `srcs`. This happens in 2 phases.<br><br>**Phase 1:**<br><br>The [workspace status](https://docs.bazel.build/versions/master/user-manual.html#workspace_status) stamp values get replaced in this format: `{KEY}`. For example if you would like to have the name of the host machine in your output path you would put `out = "my/path/{BUILD_HOST}/{FILENAME}"`<br><br>**Phase 2:**<br><br>The following gets replaced about each items in `srcs`<br><br>`{BAZEL_LABEL_NAME}` - Label name<br><br>`{BAZEL_LABEL_PACKAGE}` - Label package<br><br>`{BAZEL_LABEL_WORKSPACE_NAME}` - Workspace name of the label<br><br>`{BAZEL_FULL_LABEL}` - Fulll label string<br><br>`{BAZEL_LABEL}` - Full label without the workspace name<br><br>`{EXT}` - File extension (with the dot)<br><br>`{EXTNAME}` - File extension name (without the dot)<br><br>`{FILENAME}` - File name with extension<br><br>`{FILEPATH}` - File path. https://bazel.build/rules/lib/File#path<br><br>`{BASENAME}` - Path basename | `None` |
| <a id="bzlws_copy-force"></a>force | Overwrite existing paths even if they are not files | `None` |
| <a id="bzlws_copy-strip_filepath_prefix"></a>strip_filepath_prefix | Strip prefix of `{FILEPATH}` | `""` |
| <a id="bzlws_copy-metafile_path"></a>metafile_path | Path to metafile | `""` |
| <a id="bzlws_copy-substitutions"></a>substitutions | BzlwsInfo label keyed, string valued, dictionary. The values will be replaced in the source files with the values from the `bazel info` command. The available BzlwsInfo targets are in the `@bzlws//info` package. | `{}` |
| <a id="bzlws_copy-stamp_substitutions"></a>stamp_substitutions | Workspace status keyed, string valued, dictionary. The values will be replaced in the sources files the values from the workspace status matching the key. | `{}` |
| <a id="bzlws_copy-visibility"></a>visibility | visibility of the executable target | `None` |
| <a id="bzlws_copy-tags"></a>tags | forwarded to underlying targets | `[]` |
| <a id="bzlws_copy-kwargs"></a>kwargs | rest of arguments get passed to underlying targets | none |


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



<a id="bzlws_extract"></a>

## bzlws_extract

<pre>
load("@bzlws//rules:bzlws_extract.bzl", "bzlws_extract")

bzlws_extract(<a href="#bzlws_extract-name">name</a>, <a href="#bzlws_extract-srcs">srcs</a>, <a href="#bzlws_extract-out">out</a>, <a href="#bzlws_extract-force">force</a>, <a href="#bzlws_extract-strip_filepath_prefix">strip_filepath_prefix</a>, <a href="#bzlws_extract-metafile_path">metafile_path</a>, <a href="#bzlws_extract-visibility">visibility</a>, <a href="#bzlws_extract-kwargs">kwargs</a>)
</pre>



**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="bzlws_extract-name"></a>name | <p align="center"> - </p> | `None` |
| <a id="bzlws_extract-srcs"></a>srcs | <p align="center"> - </p> | `None` |
| <a id="bzlws_extract-out"></a>out | <p align="center"> - </p> | `None` |
| <a id="bzlws_extract-force"></a>force | <p align="center"> - </p> | `None` |
| <a id="bzlws_extract-strip_filepath_prefix"></a>strip_filepath_prefix | <p align="center"> - </p> | `""` |
| <a id="bzlws_extract-metafile_path"></a>metafile_path | <p align="center"> - </p> | `""` |
| <a id="bzlws_extract-visibility"></a>visibility | <p align="center"> - </p> | `None` |
| <a id="bzlws_extract-kwargs"></a>kwargs | <p align="center"> - </p> | none |


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



<a id="bzlws_link"></a>

## bzlws_link

<pre>
load("@bzlws//rules:bzlws_link.bzl", "bzlws_link")

bzlws_link(<a href="#bzlws_link-name">name</a>, <a href="#bzlws_link-srcs">srcs</a>, <a href="#bzlws_link-out">out</a>, <a href="#bzlws_link-force">force</a>, <a href="#bzlws_link-strip_filepath_prefix">strip_filepath_prefix</a>, <a href="#bzlws_link-metafile_path">metafile_path</a>, <a href="#bzlws_link-visibility">visibility</a>, <a href="#bzlws_link-kwargs">kwargs</a>)
</pre>

Symlink generated files into workspace directory

```python
load("@bzlws//:index.bzl", "bzlws_link")
```


**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="bzlws_link-name"></a>name | Name used for executable target | `None` |
| <a id="bzlws_link-srcs"></a>srcs | List of files that should be symlinked | `None` |
| <a id="bzlws_link-out"></a>out | Output path within the workspace. Certain strings get replaced with workspace status values and information about the `srcs`. This happens in 2 phases.<br><br>**Phase 1:**<br><br>The [workspace status](https://docs.bazel.build/versions/master/user-manual.html#workspace_status) stamp values get replaced in this format: `{KEY}`. For example if you would like to have the name of the host machine in your output path you would put `out = "my/path/{BUILD_HOST}/{FILENAME}"`<br><br>**Phase 2:**<br><br>The following gets replaced about each items in `srcs`<br><br>`{BAZEL_LABEL_NAME}` - Label name<br><br>`{BAZEL_LABEL_PACKAGE}` - Label package<br><br>`{BAZEL_LABEL_WORKSPACE_NAME}` - Workspace name of the label<br><br>`{BAZEL_FULL_LABEL}` - Fulll label string<br><br>`{BAZEL_LABEL}` - Full label without the workspace name<br><br>`{EXT}` - File extension (with the dot)<br><br>`{EXTNAME}` - File extension name (without the dot)<br><br>`{FILENAME}` - File name with extension<br><br>`{FILEPATH}` - File path. https://bazel.build/rules/lib/File#path<br><br>`{BASENAME}` - Path basename | `None` |
| <a id="bzlws_link-force"></a>force | Overwrite existing paths even if they are not symlinks | `None` |
| <a id="bzlws_link-strip_filepath_prefix"></a>strip_filepath_prefix | Strip prefix of `{FILEPATH}` | `""` |
| <a id="bzlws_link-metafile_path"></a>metafile_path | Path to metafile | `""` |
| <a id="bzlws_link-visibility"></a>visibility | visibility of the executable target | `None` |
| <a id="bzlws_link-kwargs"></a>kwargs | rest of arguments get passed to underlying targets | none |


65 changes: 0 additions & 65 deletions docs/index.md

This file was deleted.

Loading