Skip to content

Commit efd3c19

Browse files
authored
bazel build + aib integration (#56)
* bazel build + aib integration Signed-off-by: Leonardo Rossetti <[email protected]> * remove rpm toolchain from root toolchain defintion Signed-off-by: Leonardo Rossetti <[email protected]> --------- Signed-off-by: Leonardo Rossetti <[email protected]>
1 parent 7219fc7 commit efd3c19

20 files changed

+435
-35
lines changed

.bazelrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ build:bl-x86_64-qnx --config=_bl_common
4242
build:bl-x86_64-qnx --platforms=@score_bazel_platforms//:x86_64-qnx
4343
build:bl-x86_64-qnx --extra_toolchains=@toolchains_qnx_qcc//:qcc_x86_64
4444

45+
# This config is for internal module usage ONLY.
46+
build:bl-x86_64-linux-autosd --config=_bl_common
47+
build:bl-x86_64-linux-autosd --define=score_sw_platform=autosd
48+
build:bl-x86_64-linux-autosd --platforms=@score_bazel_platforms//:x86_64-linux
49+
build:bl-x86_64-linux-autosd --extra_toolchains=@autosd_10_gcc_repo//:gcc_toolchain_linux_x86_64
50+
build:bl-x86_64-linux-autosd --force_pic
51+
4552
# This config is for internal module usage ONLY.
4653
test:bl-x86_64-linux --config=_bl_common
4754
test:bl-x86_64-linux --build_tests_only

.github/workflows/build_and_test_autosd.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ jobs:
2323
build:
2424
name: build-and-test-autosd
2525
runs-on: ubuntu-latest
26-
defaults:
27-
run:
28-
working-directory: autosd/build
2926

3027
steps:
3128
- name: Checkout repository
@@ -37,31 +34,46 @@ jobs:
3734
- name: Install System Dependencies
3835
run: |
3936
sudo apt-get update -y
40-
sudo apt-get install -y podman curl qemu-system
37+
sudo apt-get install -y podman curl qemu-system createrepo-c
38+
39+
- name: Build Lola Demo
40+
run: |
41+
bazel build --config=bl-x86_64-linux-autosd //:lola-demo
42+
working-directory: ./autosd
43+
44+
- name: Copy RPMs
45+
run: |
46+
set -e
47+
mkdir -p ./build/rpms
48+
cp bazel-out/k8-fastbuild/bin/lola-demo-1.0.0-1.x86_64.rpm ./build/rpms
49+
cp bazel-out/k8-fastbuild/bin/lola-demo-1.0.0-1.src.rpm ./build/rpms
50+
createrepo_c ./build/rpms/
51+
ls -l ./build/rpms/
52+
working-directory: ./autosd
4153

4254
- name: Install AIB Tools
4355
run: |
44-
curl -o auto-image-builder.sh "https://gitlab.com/CentOS/automotive/src/automotive-image-builder/-/raw/main/auto-image-builder.sh"
56+
curl -o auto-image-builder.sh "https://gitlab.com/lrossett/automotive-image-builder/-/raw/script-fix/auto-image-builder.sh?ref_type=heads"
4557
chmod +x auto-image-builder.sh
4658
4759
curl -o automotive-image-runner "https://gitlab.com/CentOS/automotive/src/automotive-image-builder/-/raw/main/automotive-image-runner"
4860
chmod +x automotive-image-runner
61+
working-directory: ./autosd/build
4962

5063
- name: Build lola-demo.aib.yml
5164
run: |
52-
sudo ./auto-image-builder.sh build \
65+
sudo ./auto-image-builder.sh build-deprecated \
5366
--distro autosd10 \
5467
--mode package \
5568
--target qemu \
5669
--export qcow2 \
5770
--define-file vars.yml \
5871
--define-file vars-devel.yml \
59-
lola-demo.aib.yml \
72+
image.aib.yml \
6073
disk.qcow2
6174
6275
sudo chown $(id -u) disk.qcow2
63-
64-
mv disk.qcow2 ../disk.qcow2
76+
working-directory: ./autosd/build
6577

6678
- name: Enable KVM group perms
6779
run: |
@@ -80,6 +92,12 @@ jobs:
8092
sshcmd 'bluechictl start agent-qm lola-ipc-sub.service'
8193
sleep 5
8294
sshcmd '/usr/bin/lola-ipc-test'
83-
working-directory: ./autosd
95+
working-directory: ./autosd/build
8496
env:
8597
SSH_PASSWORD: password
98+
99+
- name: Archive QEMU disk image
100+
uses: actions/upload-artifact@v4
101+
with:
102+
name: autosd10-score-reference_integration-x86_64.qcow2
103+
path: autosd/build/disk.qcow2

MODULE.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ module(
2020
include("//:score_modules.MODULE.bazel")
2121
include("//:score_toolchains.MODULE.bazel")
2222

23-
2423
## Python
2524
bazel_dep(name = "rules_python", version = "1.4.1")
2625

autosd/.bazelrc

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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 --@score_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+
# build --incompatible_enable_cc_toolchain_resolution
47+
build:bl-x86_64-linux-autosd --config=_bl_common
48+
build:bl-x86_64-linux-autosd --platforms=@score_bazel_platforms//:x86_64-linux
49+
build:bl-x86_64-linux-autosd --extra_toolchains=@autosd_10_gcc_repo//:gcc_toolchain_linux_x86_64
50+
build:bl-x86_64-linux-autosd --force_pic
51+
52+
# This config is for internal module usage ONLY.
53+
test:bl-x86_64-linux --config=_bl_common
54+
test:bl-x86_64-linux --build_tests_only
55+
test:bl-x86_64-linux --test_tag_filters=-manual
56+
test:bl-x86_64-linux --test_output=errors
57+
58+
59+
# config from communication .bazelrc file
60+
# unshare /dev/shm and /tmp
61+
test --sandbox_tmpfs_path=/dev/shm
62+
test --sandbox_tmpfs_path=/tmp
63+
64+
# Java
65+
build --java_language_version=17
66+
build --tool_java_language_version=17
67+
build --java_runtime_version=remotejdk_17
68+
build --tool_java_runtime_version=remotejdk_17
69+
70+
# user specific overrides (like proxy settings)
71+
try-import %workspace%/user.bazelrc

autosd/BUILD.bazel

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2024 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+
load("@rules_rpm//rpm:defs.bzl", "rpm_package")
14+
15+
rpm_package(
16+
name = "lola-demo",
17+
binaries = [
18+
"@score_communication//score/mw/com/example/ipc_bridge:ipc_bridge_cpp",
19+
],
20+
config_dir = "/etc/lola",
21+
data = [
22+
"@score_communication//score/mw/com/example/ipc_bridge:etc/mw_com_config.json",
23+
],
24+
data_dir = "/usr/share/lola/examples",
25+
description = "LOLA middleware communication libraries for development including core communication, configuration components, and example client/server binaries for testing",
26+
libraries = [
27+
"@score_communication//score/mw/com:com",
28+
"@score_communication//score/mw/com:config_schema",
29+
],
30+
summary = "LOLA Demo",
31+
version = "1.0.0",
32+
)

autosd/MODULE.bazel

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,60 @@
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
1313
module(
14-
name = "score_ri_autosd",
14+
name = "os_autosd_reference_integration",
1515
version = "0.0.1",
16-
compatibility_level = 0,
16+
)
17+
18+
include("//:score_modules.MODULE.bazel")
19+
include("//:score_toolchains.MODULE.bazel")
20+
21+
## Python
22+
bazel_dep(name = "rules_python", version = "1.4.1")
23+
24+
PYTHON_VERSION = "3.12"
25+
26+
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
27+
python.toolchain(
28+
configure_coverage_tool = True,
29+
is_default = True,
30+
python_version = PYTHON_VERSION,
31+
)
32+
use_repo(python)
33+
34+
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True)
35+
pip.parse(
36+
hub_name = "pip_score_venv_test",
37+
python_version = PYTHON_VERSION,
38+
requirements_lock = "//feature_integration_tests/python_test_cases:requirements.txt.lock",
39+
)
40+
use_repo(pip, "pip_score_venv_test")
41+
42+
# communication module dependencies
43+
# archive_override are not forwarded by bazel_dep, so we need to redefine it here
44+
bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost")
45+
archive_override(
46+
module_name = "rules_boost",
47+
strip_prefix = "rules_boost-master",
48+
urls = ["https://github.com/nelhage/rules_boost/archive/refs/heads/master.tar.gz"],
49+
)
50+
51+
# git_override are not forwarded by bazel_dep, so we need to redefine it here
52+
bazel_dep(name = "trlc")
53+
git_override(
54+
module_name = "trlc",
55+
commit = "650b51a47264a4f232b3341f473527710fc32669", # trlc-2.0.2 release
56+
remote = "https://github.com/bmw-software-engineering/trlc.git",
57+
)
58+
59+
# imports for the feature showcase module
60+
bazel_dep(name = "rules_rust", version = "0.61.0")
61+
bazel_dep(name = "score_itf", version = "0.1.0")
62+
bazel_dep(name = "score_crates", version = "0.0.4")
63+
64+
# RPM packaging support
65+
bazel_dep(name = "rules_rpm", version = "0.1.0")
66+
git_override(
67+
module_name = "rules_rpm",
68+
branch = "main",
69+
remote = "https://github.com/bilelmoussaoui/bazel-rpm.git",
1770
)

autosd/build/files/lola-ipc-pub.service

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ After=network.target
1616

1717
[Service]
1818
Type=simple
19-
WorkingDirectory=/usr/share/score-communication/examples/ipc_bridge/etc/
19+
WorkingDirectory=/usr/share/lola/examples
2020
ExecStart=/usr/bin/ipc_bridge_cpp --mode skeleton --num-cycles 5 --cycle-time 1000 --service_instance_manifest mw_com_config.json
2121
Restart=on-failure
2222
RestartSec=5
2323
RemainAfterExit=yes
2424

2525
[Install]
2626
WantedBy=multi-user.target
27-

autosd/build/files/lola-ipc-sub.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Description=LoLa IPC Subscriber
1616
After=network.target
1717

1818
[Service]
19-
WorkingDirectory=/usr/share/score-communication/examples/ipc_bridge/etc/
19+
WorkingDirectory=/usr/share/lola/examples
2020
ExecStart=/usr/bin/ipc_bridge_cpp --mode proxy --num-cycles 5 --cycle-time 1000 --service_instance_manifest mw_com_config.json
2121
Restart=on-failure
2222
RestartSec=5

autosd/build/files/lola-ipc-test.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ After=proxy@agent-main_lola-ipc-pub.service
1717

1818
[Service]
1919
Type=oneshot
20-
ExecStart=/bin/bash /usr/local/bin/lola-ipc-test
20+
ExecStart=/bin/bash /usr/bin/lola-ipc-test
2121
RemainAfterExit=yes
Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
1313
#
14-
name: esdv-score-lola-0.5
14+
name: score-autosd
1515

1616
image:
1717
selinux_mode: permissive
@@ -22,16 +22,12 @@ content:
2222
- id: epel
2323
baseurl: https://dl.fedoraproject.org/pub/epel/10/Everything/$arch/
2424
- id: score
25-
baseurl: https://download.copr.fedorainfracloud.org/results/pingou/score-playground/epel-10-$arch/
25+
baseurl: file:///host/rpms
2626
rpms:
2727
- vim-enhanced
2828
- gdb
2929
- strace
3030
- boost-devel
31-
- score-baselibs
32-
- score-communication
33-
- score-communication-performance-benchmarks
34-
- score-communication-examples
3531
- tree
3632
- dnf
3733
# For testing the image only:
@@ -42,6 +38,8 @@ content:
4238
- bluechi-controller
4339
- bluechi-agent
4440
- bluechi-ctl
41+
# score
42+
- lola-demo
4543

4644
make_dirs:
4745
- path: /etc/containers/systemd/qm.container.d
@@ -51,11 +49,6 @@ content:
5149

5250
# Configure shared socket directory via tmpfiles
5351
add_files:
54-
# lola config files
55-
- path: /usr/lib/tmpfiles.d/lola_ipc.conf
56-
text: |
57-
# Lola shared memory segment folder
58-
D! /dev/shm/lola_qm 0755 root root
5952
- path: /usr/lib/tmpfiles.d/lola_disc.conf
6053
text: |
6154
# Lola service discovery folder
@@ -64,7 +57,7 @@ content:
6457
text: |
6558
# Mount shared IPC directory for lola
6659
[Container]
67-
Volume=/dev/shm/lola_qm:/dev/shm/lola_qm
60+
Volume=/dev/shm:/dev/shm
6861
Volume=/tmp/mw_com_lola:/tmp/mw_com_lola
6962
- path: /etc/containers/systemd/qm.container.d/11-bluechi-socket.conf
7063
text: |
@@ -104,13 +97,11 @@ qm:
10497
- id: epel
10598
baseurl: https://dl.fedoraproject.org/pub/epel/10/Everything/$arch/
10699
- id: score
107-
baseurl: https://download.copr.fedorainfracloud.org/results/pingou/score-playground/epel-10-$arch/
100+
baseurl: file:///host/rpms
108101
rpms:
109102
- boost-devel
110-
- score-baselibs
111-
- score-communication-examples
112-
- score-communication
113103
- bluechi-agent
104+
- lola-demo
114105
add_files:
115106
# lola service files
116107
- path: /etc/systemd/system/lola-ipc-sub.service

0 commit comments

Comments
 (0)