Migrate Script Project
This section offers step-by-step guidance for migrating DaVinci Configurator Version 5 Automation Interface script projects to DaVinci Configurator Version 6 script projects in different ways:
To compile and test the migration results, see Verify Migration Result.
Prerequisites
The migration of Version 5 Automation Interface scripts requires the setup of:
License
-
DaVinci Configurator6 (see Licenses)
Installation
-
DaVinci Configurator6 (see Installation)
-
CLI (e.g. CMD, PowerShell, Bash)
-
IDE (see Automation Interface Documentation)
-
JDK (see Automation Interface Documentation)
Input
-
Version 5 script project to migrate
|
Assisted Migration
During migration, the Migration Assistant creates a backup copy of the input script project and transforms the input script project directly.
If the parent directory of the input script project is not intended for changes, choose a more suitable location for your input script project instead.
|
Assisted Migration via Tool
This section describes steps for migrating CFG5 Automation Interface script projects with the help of the Migration Assistant.
Convert to Version 6 Script Project
-
Open your CLI.
-
Navigate to the parent directory of the Migration Assistant located inside the Version 6 installation directory (
<cfg6 installation>/migration). -
Run
pai-migration.exe project -s <path to cfg5 script project>to start the generation of a Version 6 script project from your input Version 5 script project. -
If the generation of the Version 6 script project fails (see CLI status logs of the migration process), follow the error logs to fix your setup and re-run the generation steps once more.
|
Migration Assistant Help
Run pai-migration.exe -h for a more detailed overview of all supported use cases, CLI commands and parameters, and further information.
|
Results
If the generation of the Version 6 script project succeeds, two output directories are created in the parent directory of the input Version 5 script project:
-
A Version 6 script project with transformed files and contents of the input Version 5 script project
-
A backup directory with a copy of the original input Version 5 script project
Example
Input for migration:
-
A Version 5 script project called
myScriptProjectwhich contains:-
A Version 5 script file called
myScriptA.groovy -
A Version 5 script file called
myScriptB.groovy
-
Output of migration:
-
A Version 6 script project directory called
myScriptProjectwhich contains:-
Transformed files and contents of the input Version 5 script project
-
A transformed Gradle project setup (see Automation Interface Documentation).
myScriptProject +---.idea | +---... +---gradle | +---... +---src | +---main | | +---groovy | | | +---myScriptA.groovy | | | +---myScriptB.groovy +---build.gradle +---gradlew +---gradlew.bat +---settings.gradle
-
-
A backup directory called
myScriptProject_legacy_backupwhich contains:-
A copy of the input CFG5 script project structure
-
Adapt Script Code
-
Open the CFG6 script project (migrated in [@sec:ScriptProjectToProjectAssistedFormatConversion:Convert to Version 6 Script Project]) in your IDE.
-
Open the new
.groovyscript located inside the directory<script project>/src/main/groovy. -
Renew outdated or missing imports of Automation Interface APIs.
-
Renew removed external libraries and dependencies that are not compatible with the new setup anymore (see the
dependenciesblock in thebuild.gradlefile). -
Rewrite outdated code that could not be automatically translated to the newly imported Automation Interface APIs.
-
Use your IDE to quickly find and import new packages and give hints about warnings and incompatibilities. IntelliJ IDEA offers highlighting of affected areas.
-
Check the sections API Changes and API Changes Reference to get a detailed overview of changed API references.
Manual Migration
This section describes steps for migrating CFG5 Automation Interface script projects manually.
Convert to Version 6 Script Project
-
Copy the template Version 6 script project located in
<CFG6 installation>/dvcfgpai/_doc/templates/Gradle-Projectto a target directory of your choice. -
Rename the template copy to match your Version 5 script project name.
-
Replace Version 6 template script resources with the script resources from your input Version 5 script project:
-
Script code setup located in
<template copy>/src/main -
Script test setup located in
<template copy>/src/testCfg
-
-
Add
scriptProjectsettings in thebuild.gradlefile located inside the root directory of your template copy (see Automation Interface Documentation):-
Project information:
classes,cfgPath,bswPath -
Project testing environment:
testing
-
-
Configure the project settings for your IDE (see Automation Interface Documentation).
Adapt Script Code
-
Open the Version 6 script project (migrated in [@sec:ScriptProjectToProjectManualFormatConversion:Convert to Version 6 Script Project]) in your IDE.
-
Open the new
.groovyscript(s) located inside the directory<script project>/src/main/groovy. -
Renew outdated or missing imports of Automation Interface APIs.
-
Add dependencies for external libraries to the
dependenciessettings in thebuild.gradlefile located in the root directory of your template copy (see Automation Interface Documentation). -
Rewrite outdated script and test code.
-
Use your IDE to quickly find and import new packages and give hints about warnings and incompatibilities. IntelliJ IDEA offers highlighting of affected areas.
-
Check the sections API Changes and API Changes Reference to get a detailed overview of changed API references.
-
If you’re interested in automatically resolving outdated imports, check the section Migrate Script File Imports.