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 withgetModuleFilesFolder().
Service Components Folder
Get the service component files folder for the current project withgetServiceComponentFilesFolder().
Application Components Folder
Get the application component files folder for the current project withgetApplicationComponentFilesFolder().
Measurement And Calibration Files Folder
Get the measurement and calibration files folder for the current project withgetMeasurementAndCalibrationFilesFolder().
AUTOSAR Files Folder
Get the AUTOSAR files folder for the current project withgetAutosarFilesFolder().
Bsw package Folder
Get the bsw package path of the current dvjson project file withgetBswPackageFolder().
Timing Extension Folders
Get the TimingExtension folders for the current project withgetTimingExtensionFolders().
Structured Extract Folders
Get the structured Extract folder for the current project withgetStructuredExtractFolder().
Definition Restriction folder
Get the Definition Restriction files folder for the current project withgetDefinitionRestrictionFolder().
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.
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
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.
Derivative
Set the derivative for given module withsetDerivative(String, DerivativeInfo). The value given here must be one of the values returned by
getAvailableDerivatives(String).
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 withsetCompiler(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.
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.
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
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.
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 withaddApplicationComponentFilesFolder(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:
Constraints.IS_CREATABLE_FOLDERConstraints.IS_CREATABLE_FOLDER