Migration GUIDE

This migration guide will help you migrating your current project to a new build.gradle, this will allow for more customization, and allow you to decide if you want to use Kotlin 1.2 or Kotlin 1.3 . We will be building furhat-commons with Kotlin 1.3 from 1.11.0 onwards, and we recommend using Kotlin 1.3 in skills.

Start by copying the New Build Gradle section (at the end of this guide) into a file called new_build.gradle. Once you finish the following steps, delete your old build.gradle and rename new_build.gradle to build.gradle.

In the build.gradle file of your skill there is a dependencies block, that will look something like this

dependencies{
    compile 'com.furhatrobotics.furhatos:furhat-commons:1.9.0'
    //Maybe a few other dependencies your skill uses
}

It may have a few more lines other than the com.furhatrobotics.furhatos:furhat-commons line above. You may also be using a different version of furhat-commons than the example above.

There is a correlated block called repositories, which may look like this

repositories {
    mavenLocal()
    maven { url "http://furhatrobotics.bintray.com/furhat" }
    jcenter()
    //Maybe a few more repository links
}

This block tells the dependencies block where to find the files it needs to compile.

If your dependencies and repositories block look the same as in the example build.gradle, just replace your current build.gradle with the new build.gradle. If not, use the new build.gradle and replace the repositories and dependencies blocks with the blocks from your build.gradle.

When building your Skill with furhat-commons earlier than 1.11.0 you may get a warning that furhat-commons uses the kotlin 1.2 api. This should not cause any issues.

Kotlin 1.3

The provided build.gradle uses Kotlin 1.3. If you would prefer your skill to use 1.2, or need to use 1.2, change the 1.3 in the following 2 lines in both the compileKotin and compileTestKotlin blocks:

apiVersion = "1.3"
languageVersion = "1.3"

To

apiVersion = "1.2"
languageVersion = "1.2"

We recommend upgrading to Kotlin 1.3, as going forward from 1.11.0 will be providing our libraries in Kotlin 1.3. If for any reason you encounter issues with co-routines when upgrading to Kotlin 1.3, we recommend reading this post by the Kotlin team on how to migrate.

New Build Gradle

plugins {
   id "org.jetbrains.kotlin.jvm" version "1.3.31"
   id 'com.github.johnrengelman.shadow' version '2.0.4'
}

apply plugin: 'java'
apply plugin: 'kotlin'

//Defines what version of Java to use.
sourceCompatibility = 1.8

//Defines how Kotlin should compile.
compileKotlin {
   sourceCompatibility = JavaVersion.VERSION_1_8
   targetCompatibility = JavaVersion.VERSION_1_8

   kotlinOptions {
       //Defines what jvm bytecode to use, 1.8 rather than 1.6
       jvmTarget = "1.8"
       apiVersion = "1.3"
       languageVersion = "1.3"
   }
}

//Defines how Kotlin should compile when testingTry to keep it the same as compileKotlin.
compileTestKotlin {
   sourceCompatibility = JavaVersion.VERSION_1_8
   targetCompatibility = JavaVersion.VERSION_1_8

   kotlinOptions {
       //Defines what jvm bytecode to use, 1.8 rather than 1.6
       jvmTarget = "1.8"
       apiVersion = "1.3"
       languageVersion = "1.3"
   }
}

repositories {
   mavenLocal()
   maven { url "http://furhatrobotics.bintray.com/furhat" }
   jcenter()
}

dependencies {
   compile 'com.furhatrobotics.furhatos:furhat-commons:1.11.0'
}

//These new blocks are needed to package your project into a working skill file. 
jar {
   def lowerCasedName = baseName.toLowerCase()
   def normalizedName = lowerCasedName.substring(0,1).toUpperCase() + lowerCasedName.substring(1)
   manifest.attributes(
           'Class-Path': configurations.compile.collect { it.getName() }.join(' '),
           'Main-Class': "furhatos.app.${lowerCasedName}.${normalizedName}Skill"
   )
}

shadowJar {
   manifest {
       exclude '**/Log4j2Plugins.dat'
       exclude '**/node_modules'
   }
   from "skill.properties"
   from "assets"
   extension 'skill'
}