Skip to content

Commit d3d0649

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix_release_and_platform
# Conflicts: # score_modules.MODULE.bazel
2 parents d313646 + 9ab62c1 commit d3d0649

12 files changed

+233
-6
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "eclipse-s-core",
33
"image": "ghcr.io/eclipse-score/devcontainer:v1.1.0",
4+
"postCreateCommand": "bash .devcontainer/prepare_workspace.sh",
45
"postStartCommand": "ssh-keygen -f '/home/vscode/.ssh/known_hosts' -R '[localhost]:2222' || true"
56
}

.devcontainer/prepare_workspace.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# Install pipx
5+
sudo apt update
6+
sudo apt install -y pipx
7+
8+
# Install gita
9+
pipx install gita
10+
11+
# Enable bash autocompletion for gita
12+
echo "eval \"\$(register-python-argcomplete gita -s bash)\"" >> ~/.bashrc
13+
14+
# Set GITA_PROJECT_HOME environment variable
15+
echo "export GITA_PROJECT_HOME=$(pwd)/.gita" >> ~/.bashrc
16+
GITA_PROJECT_HOME=$(pwd)/.gita
17+
mkdir -p "$GITA_PROJECT_HOME"
18+
export GITA_PROJECT_HOME
19+
20+
# Generate workspace metadata files from known_good.json:
21+
# - .gita-workspace.csv
22+
python3 tools/known_good_to_workspace_metadata.py --known-good known_good.json --gita-workspace .gita-workspace.csv

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ __pycache__/
2222
/_build
2323
/docs/ubproject.toml
2424
/docs/_collections
25+
26+
# Workspace files
27+
/score_*/
28+
/.gita/
29+
/.gita-workspace.csv

.vscode/tasks.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Update workspace metadata from known good",
6+
"type": "shell",
7+
"command": "python3",
8+
"args": [
9+
"tools/known_good_to_workspace_metadata.py"
10+
],
11+
"problemMatcher": []
12+
},
13+
{
14+
"label": "Switch Bazel modules to local_path_overrides",
15+
"type": "shell",
16+
"command": "python3",
17+
"args": [
18+
"tools/update_module_from_known_good.py",
19+
"--override-type",
20+
"local_path"
21+
],
22+
"problemMatcher": []
23+
},
24+
{
25+
"label": "Switch Bazel modules to git_overrides",
26+
"type": "shell",
27+
"command": "python3",
28+
"args": [
29+
"tools/update_module_from_known_good.py",
30+
"--override-type",
31+
"git"
32+
]
33+
},
34+
{
35+
"label": "Gita: Generate workspace",
36+
"type": "shell",
37+
"command": "gita",
38+
"args": [
39+
"clone",
40+
"--preserve-path",
41+
"--from-file",
42+
".gita-workspace.csv"
43+
],
44+
"problemMatcher": []
45+
}
46+
]
47+
}

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,47 @@ Execute `bazel query //feature_showcase/...` to obtain list of targets that You
5757
bazel build --config bl-x86_64-linux @score_orchestrator//src/... --verbose_failures
5858
```
5959

60+
## Workspace support
61+
62+
You can obtain a complete S-CORE workspace, i.e. a git checkout of all modules from `known_good.json`, on the specific branches / commits, integrated into one Bazel build.
63+
This helps with cross-module development, debugging, and generally "trying out things".
64+
65+
> [!NOTE]
66+
> The startup of the [S-CORE devcontainer](https://github.com/eclipse-score/devcontainer) [integrated in this repository](.devcontainer/) already installs supported workspace managers and generates the required metadata.
67+
> You can do this manually as well, of course (e.g. if you do not use the devcontainer).
68+
> Take a look at `.devcontainer/prepare_workspace.sh`, which contains the setup script.
69+
70+
> [!NOTE]
71+
> Not all Bazel targets are supported yet.
72+
> Running `./scripts/integration_test.sh` will work, though.
73+
> Take a look at the [Known Issues](#known-issues-️) below to see which Bazel targets are available and working.
74+
75+
The supported workspace managers are:
76+
77+
| Name | Description |
78+
|------|-------------|
79+
| [Gita](https://github.com/nosarthur/gita) | "a command-line tool to manage multiple git repos" |
80+
81+
A description of how to use these workspace managers, together with their advantages and drawbacks, is beyond the scope of this document.
82+
In case of doubt, choose the first.
83+
84+
### Initialization of the workspace
85+
86+
> [!WARNING]
87+
> This will change the file `score_modules.MODULE.bazel`.
88+
> Do **not** commit these changes!
89+
90+
1. Switch to local path overrides, using the VSCode Task (`Terminal`->`Run Task...`) "Switch Bazel modules to `local_path_overrides`".
91+
Note that you can switch back to `git_overrides` (the default) using the task "Switch Bazel modules to `git_overrides`"
92+
93+
2. Run VSCode Task "<Name>: Generate workspace", e.g. "Gita: Generate workspace".
94+
This will clone all modules using the chosen workspace manager.
95+
The modules will be in sub-directories starting with `score_`.
96+
Note that the usage of different workspace managers is mutually exclusive.
97+
98+
When you now run Bazel, it will use the local working copies of all modules and not download them from git remotes.
99+
You can make local changes to each module, which will be directly reflected in the next Bazel run.
100+
60101
## Known Issues ⚠️
61102

62103
### Orchestrator

known_good.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
"version": "0.1.2",
1818
"repo": "https://github.com/eclipse-score/communication.git"
1919
},
20+
"score_logging": {
21+
"version": "0.0.4",
22+
"hash": "d3624d52151fcde9c8351867353a8baf59a269cd",
23+
"repo": "https://github.com/eclipse-score/logging.git",
24+
"branch": "score_05_beta"
25+
},
2026
"score_persistency": {
2127
"version": "0.2.1",
2228
"repo": "https://github.com/eclipse-score/persistency.git"

scripts/integration_test.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ declare -A BUILD_TARGET_GROUPS=(
2121
[score_orchestrator]="@score_orchestrator//src/..."
2222
[score_test_scenarios]="@score_test_scenarios//test_scenarios_rust:test_scenarios_rust @score_test_scenarios//test_scenarios_cpp:test_scenarios_cpp"
2323
[score_feo]="-- @score_feo//... -@score_feo//:docs -@score_feo//:ide_support -@score_feo//:needs_json"
24+
[score_logging]="@score_logging//score/... \
25+
--@score_baselibs//score/memory/shared/flags:use_typedshmd=False \
26+
--@score_baselibs//score/json:base_library=nlohmann \
27+
--@score_logging//score/datarouter/build_configuration_flags:persistent_logging=False \
28+
--@score_logging//score/datarouter/build_configuration_flags:persistent_config_feature_enabled=False \
29+
--@score_logging//score/datarouter/build_configuration_flags:enable_nonverbose_dlt=False \
30+
--@score_logging//score/datarouter/build_configuration_flags:enable_dynamic_configuration_in_datarouter=False \
31+
--@score_logging//score/datarouter/build_configuration_flags:dlt_file_transfer_feature=False \
32+
--@score_logging//score/datarouter/build_configuration_flags:use_local_vlan=True "
2433
)
2534

2635
# Parse command line arguments

scripts/run_unit_tests.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ declare -A UT_TARGET_GROUPS=(
2323
[orchestrator]="@score_orchestrator//src/..." # ok
2424
[kyron]="@score_kyron//:unit_tests" # ok
2525
[feo]="@score_feo//... --build_tests_only" # ok (flag required or error from docs)
26+
[logging]="@score_logging//score/... \
27+
--@score_baselibs//score/memory/shared/flags:use_typedshmd=False \
28+
--@score_baselibs//score/json:base_library=nlohmann \
29+
--@score_logging//score/datarouter/build_configuration_flags:persistent_logging=False \
30+
--@score_logging//score/datarouter/build_configuration_flags:persistent_config_feature_enabled=False \
31+
--@score_logging//score/datarouter/build_configuration_flags:enable_nonverbose_dlt=False \
32+
--@score_logging//score/datarouter/build_configuration_flags:enable_dynamic_configuration_in_datarouter=False \
33+
--@score_logging//score/datarouter/build_configuration_flags:dlt_file_transfer_feature=False \
34+
--@score_logging//score/datarouter/build_configuration_flags:use_local_vlan=True \
35+
--test_tag_filters=-manual \
36+
-- -@score_logging//score/datarouter/test/ut/ut_logging:dltprotocolUT \
37+
-@score_logging//score/datarouter/test/ut/ut_logging:persistentLogConfigUT \
38+
-@score_logging//score/datarouter/test/ut/ut_logging:socketserverConfigUT \
39+
-@score_logging//score/mw/log/legacy_non_verbose_api:unit_test "
2640
)
2741

2842
# Markdown table header
@@ -69,4 +83,4 @@ column -t -s $'\t' "${SUMMARY_FILE}" > "${SUMMARY_FILE}.tmp" && mv "${SUMMARY_FI
6983
if [[ $any_failed -ne 0 ]]; then
7084
echo "Some unit test groups failed. Exiting with non-zero status."
7185
exit 1
72-
fi
86+
fi

tools/get_module_info.py

100644100755
File mode changed.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env python3
2+
import argparse
3+
import json
4+
import csv
5+
6+
MODULES_CSV_HEADER = [
7+
"repo_url",
8+
"name",
9+
"workspace_path",
10+
"version",
11+
"hash",
12+
"branch"
13+
]
14+
15+
def main():
16+
parser = argparse.ArgumentParser(description="Convert known_good.json to workspace metadata files for gita and git submodules.")
17+
18+
parser.add_argument("--known-good", dest="known_good", default="known_good.json", help="Path to known_good.json")
19+
parser.add_argument("--gita-workspace", dest="gita_workspace", default=".gita-workspace.csv", help="File to output gita workspace metadata")
20+
args = parser.parse_args()
21+
22+
with open(args.known_good, "r") as f:
23+
data = json.load(f)
24+
25+
modules = data.get("modules", {})
26+
27+
gita_metadata = []
28+
for name, info in modules.items():
29+
repo_url = info.get("repo", "")
30+
if not repo_url:
31+
raise RuntimeError("repo must not be empty")
32+
33+
# default branch: main
34+
branch = info.get("branch", "main")
35+
36+
# if no hash is given, use branch
37+
hash_ = info.get("hash", branch)
38+
39+
# workspace_path is not available in known_good.json, default to name of repository
40+
workspace_path = name
41+
42+
# gita format: {url},{name},{path},{prop['type']},{repo_flags},{branch}
43+
row = [repo_url, name, workspace_path, "", "", hash_]
44+
gita_metadata.append(row)
45+
46+
with open(args.gita_workspace, "w", newline="") as f:
47+
writer = csv.writer(f)
48+
for row in gita_metadata:
49+
writer.writerow(row)
50+
51+
if __name__ == "__main__":
52+
main()

0 commit comments

Comments
 (0)