Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

rules_ecu_config v1.0.3

bazep_dep(name = "rules_ecu_config", version = "1.0.3")

Bazel ruleset for configuring ECU projects.

ecu_config

ecu_config = use_extension("@//:doc/rules_ecu_config_doc.bzl", "ecu_config")
ecu_config.tools(cfg6_path, cfg6_sha256, cfg6_url, dvarjson_path, dvarjson_sha256, dvarjson_url)
ecu_config.project(as_code, bsw_pkg, creation_file, diag_modules, dvjson, evs, extract, modules,
                   update_switches)

Module extension for using a DaVinci project in the Bazel pipeline.

TAG CLASSES

tools

DaVinci tools used for ECU configuration.

Attributes

Name Description Type Mandatory Default
cfg6_path Path of the local DaVinci Configurator install folder. Mutually exclusive with cfg6_url. String optional ""
cfg6_sha256 Cfg6 SHA256 archive checksum. String optional ""
cfg6_url URL of the DaVinci Configurator .deb or .nupkg archive. Mutually exclusive with cfg6_path. String optional ""
dvarjson_path Path of the local dvarjson install folder. Mutually exclusive with dvarjson_url. String optional ""
dvarjson_sha256 dvarjson SHA256 archive checksum. String optional ""
dvarjson_url URL of the dvarjson .deb or .nupkg archive. Mutually exclusive with dvarjson_path. String optional ""

project

Creates a DaVinci project for configuring an ECU and generating the BSW code.

To Bazel the project is made available as repo named like the used dvjson file or the project name given in the creation_file. E.g., for a file named MyProject.dvjson a repo named MyProject is created. Import the repo with use_repo(ecu_config, "MyProject").

Attributes

Name Description Type Mandatory Default
as_code List of as-code .jar files. Each .jar must be tagged with as_code_eac. The .jar files are applied in the order given here. List of labels optional []
bsw_pkg The BSW package folder. Label required
creation_file Project creation file containing general settings. The project name given in this file is taken as repo name. Mutually exclusive with dvjson. Label optional None
diag_modules Diagnostic module .arxml or .json files to import. List of labels optional []
dvjson The existing .dvjson file. This file's name is taken as repo name. Mutually exclusive with creation_file. Label optional None
evs EvaluatedVariantSet (either one .json file or .arxml files). List of labels optional []
extract ECU extract .arxml files. List of labels optional []
modules Module .arxml files to import. List of labels optional []
update_switches String consisting of all switches to apply when running the "project update" command (defaults to "" meaning perform all updates). E.g.: "asr" will only run "automatic reference correction", "solve all" and "RTE config update". The following switches are available:
a: Perform automatic correction of unresolved or inconsistent references.
s: Perform 'solve all' by executing all recommended solving actions of the project.
c: Apply changes from project input files.
r: Apply changes to the RTE configuration.
e: Apply changes from evaluated variant set.
String optional ""

DaVinci Project Repo

The following targets and rules are available from a DaVinci project repo:

  • Use bazel run @MyProject//:open_configurator to open the project in DaVinci Configurator Classic Version 6.
  • Use bazel build @MyProject//:validate to validate the project.

eac_jar

load("@MyProject", "eac_jar")

eac_jar(*, name, deps, srcs, data, resources, add_exports, add_opens, allow_beta_api, bootclasspath,
        javacopts, licenses, neverlink, plugins, runtime_deps, tags, visibility)

Macro for setting up an EaC project resulting in 3 targets (<name> = name provided to the macro):

  • <name> for use in as_code.
  • <name>_jar for building the actual .jar file containing the EaC logic (required for IDE support).
  • <name>_dbg for debugging the EaC logic.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this macro instance. Normally, this is also the name for the macro's main or only target. The names of any other targets that this macro might create will be this name with a string suffix. Name required
deps See Java Rules. List of labels; nonconfigurable optional []
srcs The list of source files that are processed to create the target. This attribute is almost always required; see exceptions below.

Source files of type .java are compiled. In case of generated .java files it is generally advisable to put the generating rule's name here instead of the name of the file itself. This not only improves readability but makes the rule more resilient to future changes: if the generating rule generates different files in the future, you only need to fix one place: the outs of the generating rule. You should not list the generating rule in deps because it is a no-op.

Source files of type .srcjar are unpacked and compiled. (This is useful if you need to generate a set of .java files with a genrule.)

Rules: if the rule (typically genrule or filegroup) generates any of the files listed above, they will be used the same way as described for source files.

Source files of type .properties are treated as resources.



All other files are ignored, as long as there is at least one file of a file type described above. Otherwise an error is raised.



This argument is almost always required, except if you specify the runtime_deps argument.

List of labels optional None
data The list of files needed by this library at runtime. See general comments about data at Typical attributes defined by most build rules.

When building a java_library, Bazel doesn't put these files anywhere; if the data files are generated files then Bazel generates them. When building a test that depends on this java_library Bazel copies or links the data files into the runfiles area.

List of labels optional None
resources A list of data files to include in a Java jar.

Resources may be source files or generated files.



If resources are specified, they will be bundled in the jar along with the usual .class files produced by compilation. The location of the resources inside of the jar file is determined by the project structure. Bazel first looks for Maven's standard directory layout, (a "src" directory followed by a "resources" directory grandchild). If that is not found, Bazel then looks for the topmost directory named "java" or "javatests" (so, for example, if a resource is at <workspace root>/x/java/y/java/z, the path of the resource will be y/java/z. This heuristic cannot be overridden, however, the resource_strip_prefix attribute can be used to specify a specific alternative directory for resource files.

List of labels optional None
add_exports Allow this library to access the given module or package.

This corresponds to the javac and JVM --add-exports= flags.

List of strings optional None
add_opens Allow this library to reflectively access the given module or package.

This corresponds to the javac and JVM --add-opens= flags.

List of strings optional None
allow_beta_api Set to "true" to use beta API. Boolean; nonconfigurable optional None
bootclasspath Restricted API, do not use! Label optional None
javacopts Extra compiler options for this library. Subject to "Make variable" substitution and Bourne shell tokenization.

These compiler options are passed to javac after the global compiler options.

List of strings optional None
licenses - List of strings optional None
neverlink Whether this library should only be used for compilation and not at runtime. Useful if the library will be provided by the runtime environment during execution. Examples of such libraries are the IDE APIs for IDE plug-ins or tools.jar for anything running on a standard JDK.

Note that neverlink = True does not prevent the compiler from inlining material from this library into compilation targets that depend on it, as permitted by the Java Language Specification (e.g., static final constants of String or of primitive types). The preferred use case is therefore when the runtime library is identical to the compilation library.

If the runtime library differs from the compilation library then you must ensure that it differs only in places that the JLS forbids compilers to inline (and that must hold for all future versions of the JLS).

Boolean optional None
plugins See Java Rules. List of labels; nonconfigurable optional []
runtime_deps Libraries to make available to the final binary or test at runtime only. Like ordinary deps, these will appear on the runtime classpath, but unlike them, not on the compile-time classpath. Dependencies needed only at runtime should be listed here. Dependency-analysis tools should ignore targets that appear in both runtime_deps and deps. List of labels optional None
tags See common attributes. List of strings; nonconfigurable optional []
visibility The visibility to be passed to this macro's exported targets. It always implicitly includes the location where this macro is instantiated, so this attribute only needs to be explicitly set if you want the macro's targets to be additionally visible somewhere else. List of labels; nonconfigurable optional

export

load("@MyProject", "export")

export(*, name, args, binding_time, exporter, split_post_build_variants, split_pre_build_variants,
       visibility)

Rule for exporting data from the DaVinci project.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this macro instance. Normally, this is also the name for the macro's main or only target. The names of any other targets that this macro might create will be this name with a string suffix. Name required
args Exporter-specific arguments. List of strings optional []
binding_time Binding time to use for the export. String optional ""
exporter Exporter ID. A list of all IDs is available via the export list command of the DaVinci Configurator Classic CLI. String required
split_post_build_variants Generate separate output for each post-build variant. Boolean optional False
split_pre_build_variants Generate separate output for each pre-build variant. Boolean optional False
visibility The visibility to be passed to this macro's exported targets. It always implicitly includes the location where this macro is instantiated, so this attribute only needs to be explicitly set if you want the macro's targets to be additionally visible somewhere else. List of labels; nonconfigurable optional

flat_extract

load("@MyProject", "flat_extract")

flat_extract(*, name, args, binding_time, exporters, split_post_build_variants,
             split_pre_build_variants, visibility)

Rule for exporting a flat ECU extract from the DaVinci project.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this macro instance. Normally, this is also the name for the macro's main or only target. The names of any other targets that this macro might create will be this name with a string suffix. Name required
args Exporter-specific arguments. List of strings optional []
binding_time Binding time to use for the export. String optional ""
exporters Exporter IDs. A list of all IDs is available via the export list command of the DaVinci Configurator Classic CLI. List of strings required
split_post_build_variants Generate separate output for each post-build variant. Boolean optional False
split_pre_build_variants Generate separate output for each pre-build variant. Boolean optional False
visibility The visibility to be passed to this macro's exported targets. It always implicitly includes the location where this macro is instantiated, so this attribute only needs to be explicitly set if you want the macro's targets to be additionally visible somewhere else. List of labels; nonconfigurable optional

generate

load("@MyProject", "generate")

generate(*, name, excluded, ext_steps, keep_tmp_files, modules, no_save, skip_up_to_date_checks,
         type, visibility)

Rule for generating the BSW code.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this macro instance. Normally, this is also the name for the macro's main or only target. The names of any other targets that this macro might create will be this name with a string suffix. Name required
excluded Modules to exclude from generation, given either by definition (e.g. "/MICROSAR/Rte") or short name (e.g. "Rte"). List of strings optional []
ext_steps External generation steps to execute, given by name. Defaults to executing all steps. List of strings optional []
keep_tmp_files Keep temporary files created during generation. Boolean optional False
modules Modules to generate, given either by definition (e.g. "/MICROSAR/Rte") or short name (e.g. "Rte"). Defaults to generating all modules. List of strings optional []
no_save Prevent saving the project to disk. Boolean optional False
skip_up_to_date_checks Run validation and generation without performing up-to-date checks. Boolean optional False
type Generation target ("REAL" or "VTT"). String optional ""
visibility The visibility to be passed to this macro's exported targets. It always implicitly includes the location where this macro is instantiated, so this attribute only needs to be explicitly set if you want the macro's targets to be additionally visible somewhere else. List of labels; nonconfigurable optional

swct

load("@MyProject", "swct")

swct(*, name, args, components, keep_tmp_files, no_save, visibility)

Rule for generating SWC templates and contract phase headers.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this macro instance. Normally, this is also the name for the macro's main or only target. The names of any other targets that this macro might create will be this name with a string suffix. Name required
args Arguments for certain generators given in the form ":" where is a module definition (e.g. "/MICROSAR/Rte") or short name (e.g. "Rte"). List of strings optional []
components Software components for which a template and/or contract phase header will be generated, given by name specified in the project settings. List of strings optional []
keep_tmp_files Keep temporary files created during generation. Boolean optional False
no_save Prevent saving the project to disk. Boolean optional False
visibility The visibility to be passed to this macro's exported targets. It always implicitly includes the location where this macro is instantiated, so this attribute only needs to be explicitly set if you want the macro's targets to be additionally visible somewhere else. List of labels; nonconfigurable optional