Skip to content

Commit bea0e62

Browse files
add basic bazel files (eclipse-score#10)
Co-authored-by: Kai Graeper <Kai.Graeper@etas.com>
1 parent 271e011 commit bea0e62

File tree

12 files changed

+587
-2
lines changed

12 files changed

+587
-2
lines changed

.bazelignore

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

.bazelrc

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/
15+
common --registry=https://bcr.bazel.build
16+
17+
18+
# Flags needed by score-baselibs and communication modules.
19+
# Do not add more!
20+
build --@score-baselibs//score/mw/log/detail/flags:KUse_Stub_Implementation_Only=False
21+
build --@score-baselibs//score/mw/log/flags:KRemote_Logging=False
22+
build --@score-baselibs//score/json:base_library=nlohmann
23+
build --@communication//score/mw/com/flags:tracing_library=stub
24+
25+
# stop legacy behavior of creating __init__.py files
26+
build --incompatible_default_to_explicit_init_py
27+
build --incompatible_strict_action_env
28+
build --experimental_retain_test_configuration_across_testonly #https://github.com/bazelbuild/bazel/issues/6842
29+
30+
test --test_tag_filters=-manual
31+
test --test_output=errors
32+
33+
build:_bl_common --host_platform=@score_bazel_platforms//:x86_64-linux
34+
35+
# This config is for internal module usage ONLY.
36+
build:bl-x86_64-linux --config=_bl_common
37+
build:bl-x86_64-linux --platforms=@score_bazel_platforms//:x86_64-linux
38+
build:bl-x86_64-linux --extra_toolchains=@gcc_toolchain//:host_gcc_12
39+
40+
# This config is for internal module usage ONLY.
41+
build:bl-x86_64-qnx --config=_bl_common
42+
build:bl-x86_64-qnx --platforms=@score_bazel_platforms//:x86_64-qnx
43+
build:bl-x86_64-qnx --extra_toolchains=@toolchains_qnx_qcc//:qcc_x86_64
44+
45+
# This config is for internal module usage ONLY.
46+
test:bl-x86_64-linux --config=_bl_common
47+
test:bl-x86_64-linux --build_tests_only
48+
test:bl-x86_64-linux --test_tag_filters=-manual
49+
test:bl-x86_64-linux --test_output=errors
50+
51+
52+
# config from communication .bazelrc file
53+
# unshare /dev/shm and /tmp
54+
test --sandbox_tmpfs_path=/dev/shm
55+
test --sandbox_tmpfs_path=/tmp
56+
57+
# user specific overrides (like proxy settings)
58+
try-import %workspace%/user.bazelrc

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8.3.1
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
# Workflow configuration for S-CORE CI - Bazel Build & Test baselibs
15+
# This workflow runs Bazel build and test when triggered by specific pull request events.
16+
17+
name: Bazel Build some repositories
18+
on:
19+
workflow_dispatch:
20+
push:
21+
jobs:
22+
integration_test:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4.2.2
27+
- name: Setup Bazel
28+
uses: bazel-contrib/setup-bazel@0.15.0
29+
with:
30+
# Avoid downloading Bazel every time.
31+
bazelisk-cache: true
32+
# Store build cache per workflow.
33+
disk-cache: ${{ github.workflow }}
34+
# Share repository cache between workflows.
35+
repository-cache: true
36+
- name: Show disk space before build
37+
run: |
38+
echo 'Disk space before build:'
39+
df -h
40+
echo 'Inode usage before build:'
41+
df -i
42+
echo 'Largest top-level directories:'
43+
du -h -d 1 2>/dev/null | sort -h | tail -n 20 || true
44+
- name: Bazel build targets
45+
run: |
46+
echo 'Starting Bazel build (disk space snapshot):'
47+
df -h | sed 's/^/PRE-BUILD DF /'
48+
./integration_test.sh
49+
- name: Show disk space after build
50+
if: always()
51+
run: |
52+
echo 'Disk space after build:'
53+
df -h
54+
echo 'Inode usage after build:'
55+
df -i
56+
echo 'Largest top-level directories after build:'
57+
du -h -d 1 2>/dev/null | sort -h | tail -n 20 || true
58+
- name: Publish build summary
59+
if: always()
60+
run: |
61+
if [ -f _logs/build_summary.md ]; then
62+
{
63+
echo '## Bazel Build Summary'
64+
echo
65+
# Append the markdown directly so tables render (no leading indentation)
66+
cat _logs/build_summary.md
67+
} >> "$GITHUB_STEP_SUMMARY"
68+
else
69+
echo "No build summary file found (_logs/build_summary.md)" >> "$GITHUB_STEP_SUMMARY"
70+
fi
71+
- name: Upload logs artifact
72+
if: always()
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: bazel-build-logs
76+
path: _logs/
77+
if-no-files-found: warn
78+
retention-days: 14

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Bazel
22
bazel-*
33
MODULE.bazel.lock
4+
user.bazelrc
5+
6+
_logs
47

58
# Ruff
69
.ruff_cache

BUILD

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
# load("@score_docs_as_code//:docs.bzl", "docs")
15+
16+
# docs(
17+
# data = [
18+
# # TODO: add all modules that have docs
19+
# ],
20+
# source_dir = "docs",
21+
# )
22+
23+
# Simple filegroup target to demonstrate the build system works
24+
filegroup(
25+
name = "readme",
26+
srcs = ["README.md"],
27+
visibility = ["//visibility:public"],
28+
)

MODULE.bazel

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
module(
15+
name = "score_reference_integration",
16+
version = "0.0.0",
17+
compatibility_level = 0,
18+
)
19+
20+
include("//:score_modules.MODULE.bazel")
21+
22+
# for building documentation, verifying traceability etc.
23+
bazel_dep(name = "score_platform", version = "0.3.0")
24+
bazel_dep(name = "score_bazel_platforms", version = "0.0.2")
25+
26+
# QNX toolchain
27+
bazel_dep(name = "score_toolchains_qnx", version = "0.0.2")
28+
toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx")
29+
toolchains_qnx.sdp(
30+
sha256 = "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63",
31+
strip_prefix = "installation",
32+
url = "https://www.qnx.com/download/download/79858/installation.tgz",
33+
)
34+
use_repo(toolchains_qnx, "toolchains_qnx_sdp")
35+
use_repo(toolchains_qnx, "toolchains_qnx_qcc")
36+
37+
#gcc toolchain for baselibs
38+
bazel_dep(name = "score_toolchains_gcc", version = "0.5", dev_dependency=False)
39+
gcc = use_extension("@score_toolchains_gcc//extentions:gcc.bzl", "gcc", dev_dependency=False)
40+
gcc.toolchain(
41+
url = "https://github.com/eclipse-score/toolchains_gcc_packages/releases/download/0.0.1/x86_64-unknown-linux-gnu_gcc12.tar.gz",
42+
sha256 = "457f5f20f57528033cb840d708b507050d711ae93e009388847e113b11bf3600",
43+
strip_prefix = "x86_64-unknown-linux-gnu",
44+
)
45+
gcc.extra_features(
46+
features = [
47+
"minimal_warnings",
48+
"treat_warnings_as_errors",
49+
],
50+
)
51+
gcc.warning_flags(
52+
minimal_warnings = ["-Wall", "-Wno-error=deprecated-declarations", "-Wno-error=narrowing"],
53+
strict_warnings = ["-Wextra", "-Wpedantic"],
54+
treat_warnings_as_errors = ["-Werror"],
55+
)
56+
use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc")
57+
register_toolchains("@gcc_toolchain//:all")
58+
59+
# LLVM Toolchains
60+
bazel_dep(name = "toolchains_llvm", version = "1.2.0") # persistency module uses 1.2.0 and does not work with 1.4.0 yet
61+
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
62+
llvm.toolchain(
63+
cxx_standard = {"": "c++17"},
64+
llvm_version = "19.1.0",
65+
)
66+
use_repo(llvm, "llvm_toolchain")
67+
use_repo(llvm, "llvm_toolchain_llvm")
68+
69+
register_toolchains("@llvm_toolchain//:all")
70+
71+
## needed additions to build
72+
bazel_dep(name = "testing-utils")
73+
git_override(
74+
module_name = "testing-utils",
75+
commit = "a847c7464cfa47e000141631d1223b92560d2e58", # tag v0.2.0
76+
remote = "https://github.com/qorix-group/testing_tools.git",
77+
)
78+
79+
# # TODO: What is this for?
80+
archive_override(
81+
module_name = "rules_boost",
82+
strip_prefix = "rules_boost-master",
83+
urls = ["https://github.com/nelhage/rules_boost/archive/refs/heads/master.tar.gz"],
84+
)
85+
86+
# # TODO: we cannot use communication without including TRLC here?
87+
bazel_dep(name = "trlc", version = "0.0.0")
88+
git_override(
89+
module_name = "trlc",
90+
remote = "https://github.com/bmw-software-engineering/trlc.git",
91+
commit = "650b51a47264a4f232b3341f473527710fc32669", # trlc-2.0.2 release
92+
)
93+
94+
# System/Basics
95+
96+
## Python
97+
bazel_dep(name = "rules_python", version = "1.4.1")
98+
99+
PYTHON_VERSION = "3.12"
100+
101+
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
102+
python.toolchain(
103+
configure_coverage_tool = True,
104+
is_default = True,
105+
python_version = PYTHON_VERSION,
106+
)
107+
use_repo(python)

0 commit comments

Comments
 (0)