Skip to content

Commit 02e77fe

Browse files
authored
Merge pull request #1 from AnySoftKeyboard/setup-bazel-rules-lint
Set up Bazel workspace structure, rules_lint formatters/linters, and CI
2 parents 704e1cb + 184681d commit 02e77fe

15 files changed

Lines changed: 1450 additions & 0 deletions

File tree

‎.bazelrc‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Calque Bazel Configuration
2+
3+
# Output and UI
4+
common --color=yes
5+
6+
# Test options
7+
test --test_output=errors
8+
9+
# Lint configuration
10+
build:lint --aspects=//tools/lint:linters.bzl%ktlint,//tools/lint:linters.bzl%buildifier
11+
build:lint --output_groups=rules_lint_human
12+
build:lint --@aspect_rules_lint//lint:fail_on_violation

‎.bazelversion‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9.3.0

‎.editorconfig‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.{kt,kts}]
12+
indent_size = 4
13+
max_line_length = 120
14+
ij_kotlin_allow_trailing_comma = true
15+
ij_kotlin_allow_trailing_comma_on_call_site = true
16+
17+
[*.{bazel,bzl}]
18+
indent_size = 4
19+
20+
[*.{json,yaml,yml,md}]
21+
indent_size = 2

‎.github/workflows/ci.yml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
build-and-test:
10+
name: Build and Test
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Bazel
18+
uses: bazel-contrib/setup-bazel@0.19.1
19+
with:
20+
bazelisk-cache: true
21+
repository-cache: true
22+
23+
- name: Check formatting
24+
run: bazelisk run //:format.check
25+
26+
- name: Lint all targets
27+
run: bazelisk build --config=lint //...
28+
29+
- name: Build all targets
30+
run: bazelisk build //...
31+
32+
- name: Test all targets
33+
run: bazelisk test //...

‎.gitignore‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Bazel output symlinks
2+
bazel-*
3+
4+
# IDE files
5+
.idea/
6+
*.iml
7+
.vscode/
8+
.DS_Store

‎BUILD.bazel‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
exports_files([
4+
".editorconfig",
5+
"ktlint-baseline.xml",
6+
])
7+
8+
alias(
9+
name = "format",
10+
actual = "//tools/format:format",
11+
)
12+
13+
alias(
14+
name = "format.check",
15+
actual = "//tools/format:format.check",
16+
)

‎MODULE.bazel‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
module(
2+
name = "calque",
3+
version = "0.0.1",
4+
)
5+
6+
bazel_dep(name = "rules_jvm_external", version = "7.2")
7+
bazel_dep(name = "rules_kotlin", version = "2.4.20")
8+
bazel_dep(name = "rules_java", version = "9.9.0")
9+
bazel_dep(name = "aspect_rules_lint", version = "2.9.1")
10+
11+
bazel_dep(name = "buildifier_prebuilt", version = "10.1.0", dev_dependency = True)
12+
13+
# Maven dependencies
14+
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
15+
maven.install(
16+
artifacts = [
17+
"junit:junit:4.13.2",
18+
"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0",
19+
"org.jetbrains.kotlinx:kotlinx-coroutines-test:1.11.0",
20+
"org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0",
21+
"org.xerial:sqlite-jdbc:3.53.4.0",
22+
],
23+
known_contributing_modules = ["protobuf"],
24+
repositories = [
25+
"https://repo1.maven.org/maven2",
26+
],
27+
)
28+
use_repo(maven, "maven")
29+
30+
# Lint & Format tools
31+
format_tools = use_extension("@aspect_rules_lint//format:extensions.bzl", "tools")
32+
format_tools.ktfmt()
33+
use_repo(format_tools, "ktfmt")
34+
35+
lint_tools = use_extension("@aspect_rules_lint//lint:extensions.bzl", "tools")
36+
lint_tools.ktlint()
37+
use_repo(lint_tools, "com_github_pinterest_ktlint")

‎MODULE.bazel.lock‎

Lines changed: 1272 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/BUILD.bazel‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package(default_visibility = ["//visibility:public"])

‎core/linguistics/BUILD.bazel‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package(default_visibility = ["//visibility:public"])

0 commit comments

Comments
 (0)