Skip to content
Open
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
33 changes: 33 additions & 0 deletions .github/workflows/crubit_explorer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Part of the Crubit project, under the Apache License v2.0 with LLVM
# Exceptions. See /LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: Crubit Explorer

on:
push:
branches: [ "main" ]
paths:
- 'crubit_explorer/**'
pull_request:
branches: [ "main" ]
paths:
- 'crubit_explorer/**'

permissions:
contents: read

jobs:
crubit_explorer:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
- name: Build and test Crubit Explorer
run: |
cd crubit_explorer
cd frontend
npm i --package-lock-only
npx pnpm import
cd ..
bazel build //:server
bazel test //:server_test
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ bazel_dep(name = "rules_foreign_cc", version = "0.15.0")
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
crate.from_cargo(
name = "crate_index",
lockfile = "//:Cargo.Bazel.lock",
cargo_lockfile = "//:Cargo.lock",
lockfile = "//:Cargo.Bazel.lock",
manifests = [
"//:Cargo.toml",
],
Expand All @@ -52,7 +52,7 @@ crubit_toolchains.configure(
llvm_version = "22.1.0",
rust_version = "nightly/2026-07-01",
)
use_repo(crubit_toolchains, "llvm_toolchain", "rust_toolchains", "llvm_version_check")
use_repo(crubit_toolchains, "llvm_toolchain", "llvm_version_check", "rust_toolchains")

register_toolchains(
"@rust_toolchains//:all",
Expand Down
1 change: 1 addition & 0 deletions cc_bindings_from_rs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ crubit_rust_binary(
"not_run",
"notap",
],
visibility = ["//visibility:public"],
deps = [
":cmdline",
":cpp_api_from_rust_lib",
Expand Down
2 changes: 1 addition & 1 deletion cc_bindings_from_rs/cc_bindings_from_rs_sh_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function delete_all_test_outputs() {
rm -rf "$STDERR_PATH" "$STDOUT_PATH" "$H_OUT_PATH" "$RS_OUT_PATH" "$TARGET_JSON_PATH"
}

readonly CC_BINDINGS_FROM_RS_PATH="${RUNFILES}/cc_bindings_from_rs/cc_bindings_from_rs"
readonly CC_BINDINGS_FROM_RS_PATH="${RUNFILES}/rules_crubit/cc_bindings_from_rs/cc_bindings_from_rs"
readonly SYSROOT_PATH="${RUNFILES}/${G3_SYSROOT_PATH}"
readonly DEFAULT_CLANG_FORMAT_EXE_PATH="${CRUBIT_CLANG_FORMAT_EXE_PATH}"

Expand Down
1 change: 1 addition & 0 deletions crubit_explorer/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import %workspace%/../.bazelrc
1 change: 1 addition & 0 deletions crubit_explorer/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9.2.0
58 changes: 40 additions & 18 deletions crubit_explorer/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
# Exceptions. See /LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load(
"@rules_crubit//common:crubit_wrapper_macros_oss.bzl",
"crubit_rust_binary",
"crubit_rust_test",
)
load("@rules_license//rules:license.bzl", "license")
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_test")

package(
default_applicable_licenses = [":license"],
Expand All @@ -15,35 +19,53 @@ license(
package_name = "crubit_explorer",
)

rust_binary(
crubit_rust_binary(
name = "server",
srcs = ["src/main.rs"],
data = [
"//frontend:build",
"@rules_crubit//cc_bindings_from_rs",
"@rules_rust//rust/toolchain:current_rustc_files",
"@rules_rust//rust/toolchain:current_rustc_lib_files",
],
edition = "2024",
env = {
"RUSTC_RUNFILES_PATH": "$(rlocationpath @rules_rust//rust/toolchain:current_rustc_files)",
},
visibility = ["//visibility:public"],
deps = [
"@crate_index//:axum", # v0_8
"@crate_index//:base64", # v0_22
"@crate_index//:serde", # v1
"@crate_index//:serde_json", # v1
"@crate_index//:tempfile", # v3
"@crate_index//:tokio", # v1
"@crate_index//:tower-http",
"@crubit_explorer_crates//:axum",
"@crubit_explorer_crates//:base64",
"@crubit_explorer_crates//:serde",
"@crubit_explorer_crates//:serde_json",
"@crubit_explorer_crates//:tempfile",
"@crubit_explorer_crates//:tokio",
"@rules_rust//tools/runfiles",
],
)

rust_test(
crubit_rust_test(
name = "server_test",
size = "small",
srcs = ["src/main.rs"],
data = [
"//frontend:build",
"@rules_crubit//cc_bindings_from_rs",
"@rules_rust//rust/toolchain:current_rustc_files",
"@rules_rust//rust/toolchain:current_rustc_lib_files",
],
edition = "2024",
env = {
"RUSTC_RUNFILES_PATH": "$(rlocationpath @rules_rust//rust/toolchain:current_rustc_files)",
},
deps = [
"@crate_index//:axum", # v0_8
"@crate_index//:base64", # v0_22
"@crate_index//:serde", # v1
"@crate_index//:serde_json", # v1
"@crate_index//:tempfile", # v3
"@crate_index//:tokio", # v1
"@crate_index//:tower", # v0_5
"@crate_index//:tower-http",
"@crubit_explorer_crates//:axum",
"@crubit_explorer_crates//:base64",
"@crubit_explorer_crates//:serde",
"@crubit_explorer_crates//:serde_json",
"@crubit_explorer_crates//:tempfile",
"@crubit_explorer_crates//:tokio",
"@crubit_explorer_crates//:tower",
"@rules_rust//tools/runfiles",
],
)
40 changes: 33 additions & 7 deletions crubit_explorer/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,46 @@ module(

bazel_dep(name = "rules_rust", version = "0.71.3")
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_crubit")
local_path_override(
module_name = "rules_crubit",
path = "..",
)

bazel_dep(name = "aspect_rules_js", version = "2.1.0")
bazel_dep(name = "rules_nodejs", version = "6.7.5")

rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = "2024",
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
node.toolchain(node_version = "20.11.1")
use_repo(node, "nodejs_toolchains")

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
npm.npm_translate_lock(
name = "npm",
pnpm_lock = "//frontend:pnpm-lock.yaml",
)
use_repo(rust, "rust_toolchains")
use_repo(npm, "npm")

register_toolchains("@rust_toolchains//:all")
crubit_toolchains = use_extension("@rules_crubit//bazel:extensions.bzl", "crubit_toolchains")
crubit_toolchains.configure(
llvm_version = "22.1.0",
rust_version = "nightly/2026-07-01",
)

register_toolchains("@rust_toolchains//:all", "@llvm_toolchain//:all")

use_repo(
crubit_toolchains,
"llvm_toolchain",
"llvm_version_check",
"rust_toolchains",
)

# Crate Universe to import dependencies from Cargo.toml
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
crate.from_cargo(
name = "crate_index",
name = "crubit_explorer_crates",
cargo_lockfile = "//:Cargo.lock",
manifests = ["//:Cargo.toml"],
)
use_repo(crate, "crate_index")
use_repo(crate, "crubit_explorer_crates")
37 changes: 37 additions & 0 deletions crubit_explorer/frontend/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Part of the Crubit project, under the Apache License v2.0 with LLVM
# Exceptions. See /LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("@npm//:defs.bzl", "npm_link_all_packages")
load("@npm//frontend:@angular/cli/package_json.bzl", "bin")

package(
default_applicable_licenses = ["//:license"],
)

npm_link_all_packages(name = "node_modules")

bin.ng(
name = "build",
srcs = [
"angular.json",
"package.json",
"tsconfig.app.json",
"tsconfig.json",
":node_modules",
] + glob([
"public/**/*",
"src/**/*",
]),
args = [
"build",
"--configuration",
"production",
],
chdir = "frontend",
# Angular build with modern application builder outputs to dist/frontend.
out_dirs = [
"dist/frontend",
],
visibility = ["//visibility:public"],
)
106 changes: 106 additions & 0 deletions crubit_explorer/frontend/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// Part of the Crubit project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"frontend": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"inlineTemplate": true,
"inlineStyle": true,
"skipTests": true
},
"@schematics/angular:class": {
"skipTests": true
},
"@schematics/angular:directive": {
"skipTests": true
},
"@schematics/angular:guard": {
"skipTests": true
},
"@schematics/angular:interceptor": {
"skipTests": true
},
"@schematics/angular:pipe": {
"skipTests": true
},
"@schematics/angular:resolver": {
"skipTests": true
},
"@schematics/angular:service": {
"skipTests": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/frontend",
"index": "src/index.html",
"main": "src/main.ts",
"preserveSymlinks": false,
"polyfills": "zone.js",
"tsConfig": "tsconfig.app.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kB",
"maximumError": "4kB"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "frontend:build:production"
},
"development": {
"buildTarget": "frontend:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n"
}
}
}
}
}
34 changes: 34 additions & 0 deletions crubit_explorer/frontend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "frontend",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
},
"private": true,
"dependencies": {
"@angular/animations": "^18.2.0",
"@angular/common": "^18.2.0",
"@angular/compiler": "^18.2.0",
"@angular/core": "^18.2.0",
"@angular/forms": "^18.2.0",
"@angular/platform-browser": "^18.2.0",
"@angular/platform-browser-dynamic": "^18.2.0",
"@angular/router": "^18.2.0",
"@monaco-editor/loader": "^1.7.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.10"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.2.21",
"@angular/cli": "^18.2.21",
"@angular/compiler-cli": "^18.2.0",
"typescript": "~5.5.2"
},
"pnpm": {
"onlyBuiltDependencies": []
}
}
Binary file added crubit_explorer/frontend/public/favicon.ico
Binary file not shown.
Loading
Loading