Skip to content
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
12 changes: 12 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Calque Bazel Configuration

# Output and UI
common --color=yes

# Test options
test --test_output=errors

# Lint configuration
build:lint --aspects=//tools/lint:linters.bzl%ktlint,//tools/lint:linters.bzl%buildifier
build:lint --output_groups=rules_lint_human
build:lint --@aspect_rules_lint//lint:fail_on_violation
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9.3.0
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{kt,kts}]
indent_size = 4
max_line_length = 120
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true

[*.{bazel,bzl}]
indent_size = 4

[*.{json,yaml,yml,md}]
indent_size = 2
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
push:
branches: [main]
pull_request:

jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.19.1
with:
bazelisk-cache: true
repository-cache: true

- name: Check formatting
run: bazelisk run //:format.check

- name: Lint all targets
run: bazelisk build --config=lint //...

- name: Build all targets
run: bazelisk build //...

- name: Test all targets
run: bazelisk test //...
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Bazel output symlinks
bazel-*

# IDE files
.idea/
*.iml
.vscode/
.DS_Store
16 changes: 16 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package(default_visibility = ["//visibility:public"])

exports_files([
".editorconfig",
"ktlint-baseline.xml",
])

alias(
name = "format",
actual = "//tools/format:format",
)

alias(
name = "format.check",
actual = "//tools/format:format.check",
)
37 changes: 37 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module(
name = "calque",
version = "0.0.1",
)

bazel_dep(name = "rules_jvm_external", version = "7.2")
bazel_dep(name = "rules_kotlin", version = "2.4.20")
bazel_dep(name = "rules_java", version = "9.9.0")
bazel_dep(name = "aspect_rules_lint", version = "2.9.1")

bazel_dep(name = "buildifier_prebuilt", version = "10.1.0", dev_dependency = True)

# Maven dependencies
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
artifacts = [
"junit:junit:4.13.2",
"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0",
"org.jetbrains.kotlinx:kotlinx-coroutines-test:1.11.0",
"org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0",
"org.xerial:sqlite-jdbc:3.53.4.0",
],
known_contributing_modules = ["protobuf"],
repositories = [
"https://repo1.maven.org/maven2",
],
)
use_repo(maven, "maven")

# Lint & Format tools
format_tools = use_extension("@aspect_rules_lint//format:extensions.bzl", "tools")
format_tools.ktfmt()
use_repo(format_tools, "ktfmt")

lint_tools = use_extension("@aspect_rules_lint//lint:extensions.bzl", "tools")
lint_tools.ktlint()
use_repo(lint_tools, "com_github_pinterest_ktlint")
1,272 changes: 1,272 additions & 0 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package(default_visibility = ["//visibility:public"])
1 change: 1 addition & 0 deletions core/linguistics/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package(default_visibility = ["//visibility:public"])
3 changes: 3 additions & 0 deletions ktlint-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8" ?>
<baseline version="1.0">
</baseline>
24 changes: 24 additions & 0 deletions tools/format/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
load("@aspect_rules_lint//format:defs.bzl", "format_multirun")
load("@rules_java//java:defs.bzl", "java_binary")

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

java_binary(
name = "ktfmt",
main_class = "com.facebook.ktfmt.cli.Main",
runtime_deps = ["@ktfmt//jar"],
)

format_multirun(
name = "format",
kotlin = ":ktfmt",
kotlin_check_args = [
"--kotlinlang-style",
"--set-exit-if-changed",
"--dry-run",
],
kotlin_fix_args = ["--kotlinlang-style"],
shell = "@aspect_rules_lint//format:shfmt",
starlark = "@buildifier_prebuilt//:buildifier",
visibility = ["//visibility:public"],
)
1 change: 1 addition & 0 deletions tools/lint/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package(default_visibility = ["//visibility:public"])
19 changes: 19 additions & 0 deletions tools/lint/linters.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""Linter aspects for Calque."""

load("@aspect_rules_lint//lint:buildifier.bzl", "lint_buildifier_aspect")
load("@aspect_rules_lint//lint:ktlint.bzl", "lint_ktlint_aspect")
load("@aspect_rules_lint//lint:lint_test.bzl", "lint_test")

ktlint = lint_ktlint_aspect(
binary = Label("@com_github_pinterest_ktlint//file"),
editorconfig = Label("//:.editorconfig"),
baseline_file = Label("//:ktlint-baseline.xml"),
)

ktlint_test = lint_test(aspect = ktlint)

buildifier = lint_buildifier_aspect(
binary = Label("@buildifier_prebuilt//:buildifier"),
)

buildifier_test = lint_test(aspect = buildifier)
1 change: 1 addition & 0 deletions tools/preprocessor/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package(default_visibility = ["//visibility:public"])
Loading