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
18 changes: 3 additions & 15 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,15 @@
# Use Bzlmod for dependency management
common --enable_bzlmod

# Auto-select platform config (linux/macos/windows)
common --enable_platform_specific_config

# Python configuration
build --incompatible_default_to_explicit_init_py

# Test output
test --test_output=errors

# C++ configuration (platform-specific)
build:linux --cxxopt=-std=c++17
build:linux --host_cxxopt=-std=c++17
build:macos --cxxopt=-std=c++17
build:macos --host_cxxopt=-std=c++17
build:windows --cxxopt=/std:c++20
build:windows --host_cxxopt=/std:c++20

# Windows: exclude Rust targets and shell-based tests
# (rules_rust toolchain cannot build, sh_test scripts cannot execute on Windows)
build:windows --build_tag_filters=-requires-rust,-requires-shell
test:windows --test_tag_filters=-requires-rust,-requires-shell
# C++ configuration
build --cxxopt=-std=c++17
build --host_cxxopt=-std=c++17

# Java configuration - use Java 17 for records support
build --java_language_version=17
Expand Down
19 changes: 6 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest]
bazel-version: ["7.x", "8.x", "9.x"]
steps:
- name: Checkout code
Expand All @@ -57,14 +57,12 @@ jobs:
bazel-${{ matrix.os }}-

- name: Run Bazel tests
shell: bash
env:
USE_BAZEL_VERSION: ${{ matrix.bazel-version }}
run: |
bazel test --config=ci --repository_cache="$HOME/.cache/bazel-repo" //... --test_output=errors

- name: Build all targets
shell: bash
env:
USE_BAZEL_VERSION: ${{ matrix.bazel-version }}
run: |
Expand All @@ -91,11 +89,8 @@ jobs:
run: bazel build --config=ci --config=typecheck --repository_cache="$HOME/.cache/bazel-repo" //...

failure-tests:
name: Failure Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
name: Failure Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -106,12 +101,11 @@ jobs:
path: |
~/.cache/bazel-repo-failure
~/.cache/bazelisk
key: bazel-failure-tests-${{ matrix.os }}-${{ hashFiles('MODULE.bazel.lock') }}
key: bazel-failure-tests-ubuntu-latest-${{ hashFiles('MODULE.bazel.lock') }}
restore-keys: |
bazel-failure-tests-${{ matrix.os }}-
bazel-failure-tests-ubuntu-latest-

- name: Run failure tests
shell: bash
run: |
export BAZEL_EXTRA_OPTS="--config=ci --repository_cache=$HOME/.cache/bazel-repo-failure"
./fire/starlark/failure_test/run_failure_tests.sh
Expand All @@ -121,7 +115,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout code
Expand All @@ -139,7 +133,6 @@ jobs:
bazel-integration-${{ matrix.os }}-

- name: Run integration test
shell: bash
run: |
export BAZEL_EXTRA_OPTS="--config=ci --repository_cache=$HOME/.cache/bazel-repo"
cd integration_test
Expand Down
60 changes: 0 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,63 +360,3 @@ generate_format_specification(
out = "FORMAT_SPECIFICATION.md",
)
```

## Windows Support

FIRE supports Windows with the following limitations:

### Rust code generation

The `rules_rust` toolchain cannot build on Windows due to an upstream linker
issue with the process_wrapper. All Rust targets must be tagged with
`requires-rust` so they are automatically excluded on Windows via `.bazelrc`:

```starlark
rust_library(
name = "my_params_rs",
srcs = [":my_params_rs_src"],
tags = ["requires-rust"],
)
```

### Shell-based test rules

`release_readiness_test` generates a shell script as its test executable, which
Windows cannot run via `CreateProcessW`. Tag these targets with `requires-shell`
to exclude them on Windows:

```starlark
release_readiness_test(
name = "release_readiness",
report = ":release_report",
tags = ["requires-shell"],
)
```

### Platform configuration

Windows exclusions are handled automatically via `.bazelrc` platform config.
Projects consuming FIRE should include these lines in their `.bazelrc`:

```text
common --enable_platform_specific_config

build:windows --build_tag_filters=-requires-rust,-requires-shell
test:windows --test_tag_filters=-requires-rust,-requires-shell
```

### C++ standard

Windows (MSVC) requires C++20 for designated initializer support. Configure
in `.bazelrc`:

```text
build:windows --cxxopt=/std:c++20
build:windows --host_cxxopt=/std:c++20
```

### File encoding

Python scripts that read or write files containing Unicode characters (e.g.,
`✓`, `⚠️`) must specify `encoding="utf-8"` explicitly, as Windows defaults to
`cp1252`.
4 changes: 0 additions & 4 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ generate_rust_parameters(
rust_library(
name = "vehicle_params_rs",
srcs = [":vehicle_params_rs_src"],
tags = ["requires-rust"],
)

# Second Rust library
Expand All @@ -121,7 +120,6 @@ generate_rust_parameters(
rust_library(
name = "vehicle_params_rs_alt",
srcs = [":vehicle_params_rs_alt_src"],
tags = ["requires-rust"],
)

# C++ tests
Expand Down Expand Up @@ -178,15 +176,13 @@ rust_test(
name = "vehicle_params_rust_test",
srcs = ["vehicle_params_test.rs"],
crate_root = "vehicle_params_test.rs",
tags = ["requires-rust"],
deps = [":vehicle_params_rs"],
)

rust_test(
name = "vehicle_params_rust_alt_test",
srcs = ["vehicle_params_alt_test.rs"],
crate_root = "vehicle_params_alt_test.rs",
tags = ["requires-rust"],
deps = [":vehicle_params_rs_alt"],
)

Expand Down
1 change: 1 addition & 0 deletions fire/starlark/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ py_test(
py_library(
name = "config_models",
srcs = ["config_models.py"],
data = ["default_fire_config.yaml"],
visibility = ["//visibility:public"],
deps = [
"@pip//pydantic",
Expand Down
93 changes: 7 additions & 86 deletions fire/starlark/config_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,89 +92,9 @@ def known_fields(self) -> list[str]:
return [fd.display_name.lower() for fd in self.field_definitions.values()]


_DEFAULT_CONFIG_YAML = """\
fire_config_version: 1

field_definitions:
sil:
display_name: "SIL"
type: enum
values:
- "ASIL-A"
- "ASIL-B"
- "ASIL-C"
- "ASIL-D"
- "SIL-1"
- "SIL-2"
- "SIL-3"
- "SIL-4"
- "DAL-A"
- "DAL-B"
- "DAL-C"
- "DAL-D"
- "DAL-E"
- "PL-a"
- "PL-b"
- "PL-c"
- "PL-d"
- "QM"
allow_todo: true
description: "Safety Integrity Level (ISO 26262, IEC 61508, DO-178C/DO-254, ISO 13849, QM)"

sec:
display_name: "Sec"
type: bool
allow_todo: true
description: "Security relevance flag"

version:
display_name: "Version"
type: int
min_value: 1
allow_todo: false
description: "Requirement version, positive integer >= 1"

parent:
display_name: "Parent"
type: parent_link
allow_todo: true
allow_multiple: true
description: "Markdown link(s) to parent requirement(s)"

document_types:
sysreq:
suffix: ".sysreq.md"
display_name: "System Requirement"
description: "High-level system requirements"
required_fields:
- sil
- sec
- version
optional_fields:
- parent

swreq:
suffix: ".swreq.md"
display_name: "Software Requirement"
description: "Implementation-level software requirements"
required_fields:
- sil
- sec
- version
optional_fields:
- parent

regreq:
suffix: ".regreq.md"
display_name: "Regulatory Requirement"
description: "Regulatory obligations (SIL/Sec optional)"
required_fields:
- version
optional_fields:
- sil
- sec
- parent
"""
def _default_config_path() -> Path:
"""Return the path to the built-in default_fire_config.yaml."""
return Path(__file__).parent / "default_fire_config.yaml"


def load_config(config_path: str | Path | None = None) -> FireConfig:
Expand All @@ -183,10 +103,11 @@ def load_config(config_path: str | Path | None = None) -> FireConfig:
When *config_path* is ``None``, the built-in default is used.
"""
if config_path is None:
raw = yaml.safe_load(_DEFAULT_CONFIG_YAML)
config_path = _default_config_path()
else:
config_path = Path(config_path)
with open(config_path, encoding="utf-8") as f:
raw = yaml.safe_load(f)

with open(config_path) as f:
raw = yaml.safe_load(f)

return FireConfig.model_validate(raw)
2 changes: 1 addition & 1 deletion fire/starlark/config_models_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def test_load_custom_config(self, tmp_path):
},
}
config_file = tmp_path / "fire_config.yaml"
config_file.write_text(yaml.dump(config_data), encoding="utf-8")
config_file.write_text(yaml.dump(config_data))
cfg = load_config(config_file)
assert "handbook" in cfg.document_types
assert cfg.document_types["handbook"].suffix == ".handbook.md"
Expand Down
3 changes: 0 additions & 3 deletions fire/starlark/failure_test/parameter_version/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ generate_rust_parameters(
rust_library(
name = "test_params_rs",
srcs = [":test_params_rust_src"],
tags = ["requires-rust"],
)

# Generate Java code (directory of per-param-version .java files)
Expand Down Expand Up @@ -131,7 +130,6 @@ rust_binary(
tags = [
"failure_test",
"manual",
"requires-rust",
"version_too_old",
],
deps = [":test_params_rs"],
Expand Down Expand Up @@ -174,7 +172,6 @@ rust_binary(
tags = [
"failure_test",
"manual",
"requires-rust",
"version_upgraded",
],
deps = [":test_params_rs"],
Expand Down
6 changes: 3 additions & 3 deletions fire/starlark/file_io_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def read_file_safe(file_path: str) -> tuple[str | None, str | None]:
... process(content)
"""
try:
with open(file_path, "r", encoding="utf-8") as f:
with open(file_path) as f:
return f.read(), None
except FileNotFoundError:
return None, f"File not found: {file_path}"
Expand Down Expand Up @@ -57,7 +57,7 @@ def load_yaml_safe(file_path: str) -> tuple[Any | None, str | None]:
... process(data)
"""
try:
with open(file_path, "r", encoding="utf-8") as f:
with open(file_path) as f:
data = yaml.safe_load(f)
return data, None
except FileNotFoundError:
Expand Down Expand Up @@ -86,7 +86,7 @@ def write_yaml_safe(file_path: str, data: Any) -> str | None:
... print(f"Failed: {error}")
"""
try:
with open(file_path, "w", encoding="utf-8") as f:
with open(file_path, "w") as f:
yaml.safe_dump(data, f, default_flow_style=False, sort_keys=False)
return None
except PermissionError:
Expand Down
2 changes: 1 addition & 1 deletion fire/starlark/generate_format_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def main() -> int:
config = load_config(args.config)
content = generate_format_spec(config)

with open(args.out, "w", encoding="utf-8") as f:
with open(args.out, "w") as f:
f.write(content)
f.write("\n")

Expand Down
Loading
Loading