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

Installation

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

  1. Open your CLI.

  2. Navigate to the parent directory of the Migration Assistant located inside the Version 6 installation directory (<cfg6 installation>/migration).

  3. 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.

  4. 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 myScriptProject which 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 myScriptProject which 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_backup which contains:

    • A copy of the input CFG5 script project structure

Adapt Script Code

  1. Open the CFG6 script project (migrated in [@sec:ScriptProjectToProjectAssistedFormatConversion:Convert to Version 6 Script Project]) in your IDE.

  2. Open the new .groovy script located inside the directory <script project>/src/main/groovy.

  3. Renew outdated or missing imports of Automation Interface APIs.

  4. Renew removed external libraries and dependencies that are not compatible with the new setup anymore (see the dependencies block in the build.gradle file).

  5. 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

  1. Copy the template Version 6 script project located in <CFG6 installation>/dvcfgpai/_doc/templates/Gradle-Project to a target directory of your choice.

  2. Rename the template copy to match your Version 5 script project name.

  3. 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

  4. Add scriptProject settings in the build.gradle file located inside the root directory of your template copy (see Automation Interface Documentation):

    • Project information: classes, cfgPath, bswPath

    • Project testing environment: testing

  5. Configure the project settings for your IDE (see Automation Interface Documentation).

Adapt Script Code

  1. Open the Version 6 script project (migrated in [@sec:ScriptProjectToProjectManualFormatConversion:Convert to Version 6 Script Project]) in your IDE.

  2. Open the new .groovy script(s) located inside the directory <script project>/src/main/groovy.

  3. Renew outdated or missing imports of Automation Interface APIs.

  4. Add dependencies for external libraries to the dependencies settings in the build.gradle file located in the root directory of your template copy (see Automation Interface Documentation).

  5. 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.