Creating a Project
The method
createProject(Action) creates a new project as specified by the
given Closure. Inside the closure the ICreateProjectApi is available.
Mandatory parameters are:
projectNameprojectFolder
The new project is not opened and usable until IProjectRef.openProject(Transformer) is called on the returned IProjectRef.
scriptTask('taskName', DV_APPLICATION) {
code {
def newProject = projects.createProject {
projectName 'NewProject'
projectFolder paths.resolveTempPath('projectFolder')
}
scriptLogger.info("Project created and saved to: $newProject")
// Now open the project
newProject.openProject{
// Inside here the project and project settings can be used
}
}
}
The next is a more sophisticated example of creating a project with multiple settings:
scriptTask('taskName', DV_APPLICATION) {
code {
def newProject = projects.createProject {
projectName 'NewProject'
projectFolder paths.resolveTempPath('projectFolder')
author 'projectAuthor'
version '0.9'
}
}
}
++++++
+++TheICreateProjectApi contains the methods to parameterize the creation of a new project.+++
Mandatory Settings
+++
+++projectName(String)
Specifies the name of the newly created CFG6 project file. The following constraint was applied:- Constraints.IS_VALID_FILE_NAME+++Constraints.IS_VALID_PROJECT_NAME+++
+++
+++projectFolder(Object)
Specify the folder in which to create the new CFG6 project. The value given here is converted toPath. The following
constraints were applied: - Constraints.IS_ABSOLUTE +++Constraints.IS_ABSOLUTE+++
- Constraints.IS_CREATABLE_FOLDER +++Constraints.IS_CREATABLE_FOLDER+++
Optional Project Settings
+++
+++Author
The author for the new project can be specified withsetAuthor(String). This is an optional parameter defaulting to the name of the currently
logged-in user if the parameter is not provided explicitly.
The following constraints apply:
- Constraints.IS_NON_EMPTY_STRING +++Constraints.IS_NON_EMPTY_STRING+++
+++
+++Version
The version for the new project can be specified withsetVersion(Object). This is an optional parameter defaulting to "1.0" if the parameter is not
provided explicitly. The value given here is converted to IVersion using ScriptConverters.TO_VERSION +++ScriptConverters.TO_VERSION+++.
The following constraints apply:
- Constraints.IS_NOT_NULL +++Constraints.IS_NOT_NULL+++
Target Settings
+++
+++UsegetProjectTarget() or projectTarget(Action) to specify the new project's
target settings for compiler, derivatives and pin layouts.
+++
+++ICreateProjectTargetApi contains the API to specify the new project's target
settings.
+++
+++Available Derivatives
getAvailableDerivatives() returns all possible input values for setDerivative(DerivativeInfo).
+++
+++Derivative
Set the derivative for the new project withsetDerivative(DerivativeInfo). The new default project derivative refers to the first element in the
collection returned by getAvailableDerivatives(). Call setDerivative(DerivativeInfo) if you would like change the derivative.
+++
+++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 the 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 new default project compiler refers to the first element in the
collection returned by getAvailableCompilers(). Call setCompiler(ImplementationProperty) if you would like change the compiler.
+++
+++Available Pin Layouts
getAvailablePinLayouts() returns all possible input values for setPinLayout(ImplementationProperty). Note: the available pin
layouts depend on the currently configured derivative. This method will return the empty collection if no derivative has been configured at the time it is called.
+++
+++Pin Layout
Set the pin layout of the selected derivative for the new project withsetPinLayout(ImplementationProperty). The new default project pinLayout
refers to the first element in the collection returned by getAvailablePinLayouts(). Call setPinLayout(ImplementationProperty) if you would like change the
pinLayout.
Project Type Settings
+++
+++
Note: If no projectType settings will be set, the standard type will be used.
Use type(EEnvironmentProjectType) to specify the projects type setting.
+++Use domain(EEnvironmentProjectTypeDomain) to specify the projects domain type setting.+++
import com.vector.cfg.core.project.EEnvironmentProjectTypeDomain
import com.vector.cfg.core.project.EEnvironmentProjectType
scriptTask('taskName', DV_APPLICATION) {
code {
def tmpFolder = paths.resolveTempPath('projectFolder')
def newProject = projects.createProject {
projectName 'NewProject'
projectFolder tmpFolder
// Remove those settings to use the Standard ProjectType
projectType{
type EEnvironmentProjectType.SOFTWARE_CLUSTER_CONNECTION
domain EEnvironmentProjectTypeDomain.GLOBAL_RESOURCE_DB
}
}
}
}
Post Build Settings
+++
+++UsegetPostBuild() or postBuild(Action) to specify the new project's post
build settings for Post-build selectable and or loadable projects.
+++
+++ICreateProjectPostBuildApi contains the API to specify the new project's
post build settings.
+++
+++Project Folder Settings
+++
+++UsegetFolders() or folders(Action) to specify the new project's folders
settings.
+++
+++ICreateProjectFolderApi contains the methods to specify the new project's folders
settings.
def newProject = projects.createProject {
projectName 'NewProject'
projectFolder projectFolderToSet
folders {
applicationComponentFilesFolder tempPath.resolve("applComp")
autosarFilesFolder tempPath.resolve("autosar")
ecucFileStructure EEcucFileStructure.SINGLE_FILE
logFilesFolder tempPath.resolve("logFiles")
measurementAndCalibrationFilesFolder tempPath.resolve("mAndCal")
moduleFilesFolder tempPath.resolve("modules")
serviceComponentFilesFolder tempPath.resolve("serviceComps")
templatesFolder tempPath.resolve("templates")
timingExtensionFolder tempPath.resolve("timingExt")
vttModuleFilesFolder tempPath.resolve("vtt")
}
}
+++
+++Module Files Folder
Set the module files folder for the new project withsetModuleFilesFolder(Object). This is an optional parameter defaulting to
"../Output/Source/GenData" if the parameter is not provided explicitly. The value given here is converted to Path using ScriptConverters.TO_PATH
+++ScriptConverters.TO_PATH+++. Normally an absolute path should be given here, which will be relativized to the correct settings file.
The following constraints apply:
Constraints.IS_ABSOLUTE+++Constraints.IS_CREATABLE_FOLDER+++
+++
+++Templates Folder
Set the templates folder for the new project withsetTemplatesFolder(Object). This is an optional parameter defaulting to
"../Output/Source/Templates" if the parameter is not provided explicitly.
The value given here is converted to Path using ScriptConverters.TO_PATH +++ScriptConverters.TO_PATH+++. Normally an absolute path should be given here,
which will be relativized to the correct settings file.
The following constraints apply:
Constraints.IS_ABSOLUTE+++Constraints.IS_ABSOLUTE+++
+++
+++Service Components Folder
Set the service component files folder for the new project withsetServiceComponentFilesFolder(Object). This is an optional
parameter defaulting to "../Output/Config/SoftwareComponents" if the parameter is not provided explicitly.
The value given here is converted to Path using ScriptConverters.TO_PATH +++ScriptConverters.TO_PATH+++. Normally an absolute path should be given here,
which will be relativized to the correct settings file.
The following constraints apply:
Constraints.IS_ABSOLUTE+++Constraints.IS_ABSOLUTE+++
+++
+++Application Components Folder
Set the application component files folder for the new project withsetApplicationComponentFilesFolder(Object). This is an
optional parameter defaulting to "../Config/AppComponents" if the parameter is not provided explicitly.
The value given here is converted to Path using ScriptConverters.TO_PATH +++ScriptConverters.TO_PATH+++. Normally an absolute path should be given here,
which will be relativized to the correct settings file.
The following constraints apply:
Constraints.IS_ABSOLUTE+++Constraints.IS_ABSOLUTE+++
+++
+++Log Files Folder
Set the log files folder for the new project withsetLogFilesFolder(Object). This is an optional parameter defaulting to "../Output/Log"
if the parameter is not provided explicitly.
The value given here is converted to Path using ScriptConverters.TO_PATH +++ScriptConverters.TO_PATH+++. Normally an absolute path should be given here,
which will be relativized to the correct settings file.
The following constraints apply:
Constraints.IS_ABSOLUTE+++Constraints.IS_ABSOLUTE+++
+++
+++Measurement And Calibration Files Folder
Set the measurement and calibration files folder for the new project withsetMeasurementAndCalibrationFilesFolder(Object). This is an optional parameter defaulting to "../Output/Source/McData" if the parameter is not provided explicitly.
The folder object passed to the method is converted to Path using ScriptConverters.TO_PATH +++ScriptConverters.TO_PATH+++. Normally an absolute path
should be given here, which will be relativized to the correct settings file.
The following constraints apply:
Constraints.IS_ABSOLUTE+++Constraints.IS_ABSOLUTE+++
+++
+++AUTOSAR Files Folder
Set the AUTOSAR files folder for the new project withsetAutosarFilesFolder(Object). This is an optional parameter defaulting to
"../Config/AUTOSAR" if the parameter is not provided explicitly.
The value given here is converted to Path using ScriptConverters.TO_PATH +++ScriptConverters.TO_PATH+++. Normally an absolute path should be given here,
which will be relativized to the correct settings file.
The following constraints apply:
Constraints.IS_ABSOLUTE+++Constraints.IS_ABSOLUTE+++
ECUC File Structure
+++
+++The literals ofEEcucFileStructure define the alternative ECUC file structures supported by
the new project. The following alternatives are supported:
+++
+++SINGLE_FILE results in a single ECUC file containing all module
configurations.
+++
+++ONE_FILE_PER_MODULE results in a separate ECUC file for each module
configuration all located in a common folder.
+++
+++ONE_FILE_IN_SEPARATE_FOLDER_PER_MODULE results in a separate ECUC file for each module configuration each located in its separate folder.
+++
+++Set the ECUC file structure to use for the new project with the methodsetEcucFileStructure(EEcucFileStructure). This is an optional parameter defaulting to EEcucFileStructure.SINGLE_FILE if the parameter is not provided
explicitly.
External References
+++
+++UsegetExternalReferences() ()} or
externalReferences(Action) to specify the new project's external references.
+++
+++DEV Workspace
Set the DaVinci Developer workspace for the new project withsetDaVinciDeveloperWorkspace(Object). This is an optional parameter defaulting
to "../Config/AppConfig" if the parameter is not provided explicitly.
The value given here is converted to Path using ScriptConverters.TO_PATH +++ScriptConverters.TO_PATH+++. Normally an absolute path should be given here,
which will be relativized to the correct settings file.
The following constraints apply:
Constraints.IS_DCF_FILE+++Constraints.IS_DCF_FILE+++Constraints.IS_ABSOLUTE+++Constraints.IS_ABSOLUTE+++
Additional BSWMD modules
IProjectAdditionalBswmdApi.getAdditionalBswmd()
Returns the list of path to the additional BSWMD Module Definition folders.
IProjectAdditionalBswmdApi.addAdditionalBswmd(Object)
Adds additional BSWMD files folder. The Path is ignored if it is already present.
IProjectAdditionalBswmdApi.replaceAdditionalBswmd(Object, Object)
Replaces an additional BSWMD files folder. If the #additionalBswmdFolderOld is not present, the #additionalBswmdFolderNew is added at the end similar to
addAdditionalBswmd(Object).
IProjectAdditionalBswmdApi.removeAdditionalBswmd(Object)
Removes an additional BSWMD files folder. No change if the path to be removed is absent.
IProjectAdditionalBswmdApi.clearAdditionalBswmds()
Removes all additional BSWMD files folders.