Project Settings

The entrypoint enables querying or modifying the project settings. Every modification of the project settings must be done in a transaction. The following section describes how the project settings of a project can be accessed and modified.

Use getProjectSettings() or projectSettings(Transformer) to specify the project settings for a project.

Project Folder Api

IProjectFolderApi contains the methods to specify the current project's folder settings.

Use getFolder() or folder(Transformer) to specify the folder settings.

IProjectFolderApi contains the methods to specify the current project's folder settings.

Module Files Folder

Get the module files folder for the current project with getModuleFilesFolder().

Module Files Folder

Gets the GenDataVtt folder for the current project with getGenDataVtt().

Templates Folder

Get the templates folder for the current project with getTemplatesFolder().

Service Components Folder

Get the service component files folder for the current project with getServiceComponentFilesFolder().

Application Components Folder

Get the application component files folder for the current project with getApplicationComponentFilesFolder().

Log Files Folder

Get the log files folder for the current project with getLogFilesFolder().

Measurement And Calibration Files Folder

Get the measurement and calibration files folder for the current project with getMeasurementAndCalibrationFilesFolder().

AUTOSAR Files Folder

Get the AUTOSAR files folder for the current project with getAutosarFilesFolder().

Bsw package Folder

Get the bsw package path of the current dvjson project file with getBswPackageFolder().

Timing Extension Folders

Get the TimingExtension folders for the current project with getTimingExtensionFolders().

Structured Extract Folders

Get the structured Extract folder for the current project with getStructuredExtractFolder().

Definition Restriction folder

Get the Definition Restriction files folder for the current project with getDefinitionRestrictionFolder().

Bsw Internal Behavior folder

Get the Bsw Internal Behavior files folder for the current project with getBswInternalBehaviour().

Config Bsw Internal Behavior folder

Get the user-authored (Config) Bsw Internal Behavior files folder for the current project with getUserBswInternalBehaviour().

Target Project Settings

IProjectTargetApi is the entry point for accessing and modifying the target settings.

Use getTarget() or target(Transformer) to specify the target project settings

Use the following methods to access the project settings. The example shows how to use the API.

Access and modify Project Settings - Variant 1
scriptTask("TestsProjectSettings", DV_PROJECT) {
    code {
        activeProject {
            projectSettings {
                transaction {
                    target{

                    // Get the available derivatives as collection
                    def newDerivative = getAvailableDerivatives().getFirst()
                    // Set the derivative setting with the new value
                    derivative(newDerivative)
                    // Returns an Optional containing the new value
                    getDerivative()

                    def newCompiler = getAvailableCompilers().getFirst()
                    compiler(newCompiler)
                    getCompiler()

                    def newPinLayout = getAvailablePinLayouts().getFirst()
                    pinLayout(newPinLayout)
                    getPinLayout()

                    }
                }
            }
        }
    } // code
} // scriptTask

Module

The module which supported Derivatives shall be retrieved.

Available Derivatives

getAvailableDerivatives(String) returns all possible input values for setDerivative(String, DerivativeInfo). Note: This function will return value of getAvailableDerivatives() if module is not hardware-specific.

Module

The module which the derivative shall be set for.

Derivative

Set the derivative for given module with setDerivative(String, DerivativeInfo). The value given here must be one of the values returned by getAvailableDerivatives(String).

Module

The module which derivative setting shall be retrieved.

Get Derivative

getDerivative(String) returns the value of the derivative configured for given module. Note: This function will return value of getDerivative() (potentially null) if no module-specific derivative has been configured.

Available Compilers

getAvailableCompilers() returns all possible input values for setCompiler(ImplementationProperty). Note: the available compilers depend on the currently configured derivative. This method will return an empty collection if no derivative has been configured at the time it is called.

Compiler

Set the compiler for the new project with setCompiler(ImplementationProperty). The value given here must be one of the values returned by getAvailableCompilers().

Get Compiler

getCompiler() returns the value of the current compiler project setting. Note: If no compiler has been configured, it will return null.

Available PinLayouts

getAvailablePinLayouts() returns all possible input values for setPinLayout(ImplementationProperty). Note: The available pin layouts depend on the currently configured derivative. This method will return an empty collection if no derivative has been configured at the time it is called.

PinLayout

Set the pinLayout of the selected derivative for the project with
setPinLayout(ImplementationProperty). The value given here must be one of the values returned by getAvailablePinLayouts().

Get PinLayout

getPinLayout() returns the value of the current pinLayout project setting. Note: If no pinLayout has been configured, it will return null.

UseCase Project Settings

The IProjectUseCaseApi enables querying or modifying the "use case" setting. Use case limits the application of pre-configuration or recommended configuration in particular application cases. The following section describes how an use case can be accessed and modified.

Use getUseCases() or useCases(Transformer) to specify the use case context of the project settings.

IProjectUseCaseApi is the entry point for accessing and modifying the use cases and their values.

Access and modify Use Project Settings UseCases
scriptTask("TestsProjectSettings", DV_PROJECT) {
    code {
        projectSettings {

            // Entry point to access the the useCase context
            useCases {
                transaction {
                    // Get the useCase to modify
                    def useCase = getUseCaseByName("MyPreUseCase")
                    // Get the available values for the useCase to set
                    def availableUseCaseValues = useCase.getAvailableValues()
                    // Get the current useCase value and name
                    def name = useCase.name
                    def value = useCase.value

                    // Set the new useCase value
                    useCase.value availableUseCaseValues[6]
                }
            }
        }
    } // code
} // scriptTask

Available UseCases

The getAvailableUseCases() returns an immutable list of all available IUseCase.

UseCase

The getUseCaseByName(String) returns a IUseCase.

Available values

The getAvailableValues() returns an immutable list of available values for the IUseCase.

Name

getName() returns the name of the current use case.

Value

getValue() returns the value of the current use case.

Value

The setValue(String) sets the use case value. The value to set must be one of the returned list by getAvailableValues().

Accessing Advanced Project Settings

The method advancedProjectSettings(Object, Action) changes CFG6 project settings as specified by the given Closure. Inside the action the IAdvancedProjectSettingsApi is available.
Note: This api can only be used with closed projects.

Setting the Advanced Settings
scriptTask('changeAdvancedSettings', DV_APPLICATION) {
    code { Path projectPath, Path newDcfFilePath ->
        projects.advancedProjectSettings(projectPath){
            Path dcfPath = getDaVinciDeveloperWorkspace()
        }
    }
}

Get DaVinci Developer Workspace

getDaVinciDeveloperWorkspace() returns the current set DaVinci Developer workspace path, or null if the path was not set.

Set DaVinci Developer Workspace

setDaVinciDeveloperWorkspace(Object) sets DaVinci Developer workspace to the project.

Add Application Components Folder

Add an application component files folder for the current project with addApplicationComponentFilesFolder(Object).

The value given here is converted to Path using com.vector.cfg.automation.scripting.api.ScriptConverters.TO_PATH ScriptConverters.TO_PATH. Normally a relative path (to be interpreted relative to the project folder) should be given here.

The following constraints apply:

Remove Application Components Folder

Remove an application component files folder from the existing project with removeApplicationComponentFilesFolder(Object).

Firewall Files Settings

Use getFirewallFiles() to specify the current project's Firewall Files settings in a scope-like way.

IFireFilesApi contains the methods for specifying the current project's Firewall Files settings.

General File

Set the path of the General FIRe file wit setGeneral(Object).

General File

Get the path of the General FIRe file with getGeneral() .

Limp Home File

Set the path of the Limp Home FIRe file with setLimpHome(Object).

Limp Home File

Get the path of the Limp Home FIRe file with getLimpHome().

Sync Files

Calls the IFireFilesSyncService.syncFiles(java.util.Set) to sync all fire files.