Bot extension gradle plugin

Bot extension gradle plugin allows to deploy bot extension to a configured target.

Requires

Usage

  1. Add smarty plugin repository to settings.gradle:

    pluginManagement {
        repositories {
            maven { url 'https://smarty.lite-games.com/repository/public' }
        }
    }
  2. Declare smarty-bot-extension plugin in build.gradle

    plugins {
        id 'com.litegames.smarty-bot-extension' version '0.0.1'
    }
  3. Configure smarty bot extension deployment:

    smartyBotExtension {
        deploy {
            files {
                extension {
                    src jar.archivePath
                    dst "<<ProjectName>>BotExtension.jar"
                }
            }
    
            target(com.litegames.smarty.bot.extension.config.api.deploy.AwsTarget) {
                uri "s3://smarty-bots-repository/<<ProjectShortName>>"
                accessKey project.ext["<<ProjectShortName>>.botserver.accesskey"]
                secretKey project.ext["<<ProjectShortName>>.botserver.secretkey"]
            }
        }
    }
  4. Put target credentials in ~/.gradle/gradle.properties:

    <<ProjectShortName>>.botserver.accesskey=ACCESSKEY
    <<ProjectShortName>>.botserver.secretkey=SECRETKEY
  5. For more insight, check Smarty Alpha Bot Extension example project

Other options

Configure deploy environments

By default there are two deploy environments:

  • production - saved under "prod" subfolder

  • development - saved under "dev" subfolder

smartyBotExtension {
    // ...

    deploy {
        // Optional environment configuration.
        environments {
            production {
                targetDir "prod"
            }
            development {
                targetDir "dev"
            }
        }

    // ...
}

Deploy to http server

smartyBotExtension {
    deploy {
        // ...

        target(com.litegames.smarty.bot.extension.config.api.deploy.HttpTarget) {
            uri "https:dev.lite-games.com/repository/<<ProjectShortName>>"
            userName project.ext["<<ProjectShortName>>.botserver.username"]
            password project.ext["<<ProjectShortName>>.botserver.password"]
        }

        // ...
    }
}

Configuration full syntax

smartyBotExtension {
    deploy {
        // Files configuraiton [required]
        files {
            extension {
                // src: File - source file
                src jar.archivePath
                // dst: String - destination file name
                //   (will be uploaded to ${target.uri}/${environment/targetDir}/${dst})
                dst "<<ProjectName>>BotExtension.jar"
            }
        }

        // Environments configuration [optional]
        environments {
            production {
                targetDir "prod"
            }
            development {
                targetDir "dev"
            }
        }

        // Target configuration [required]
        // - AWS target configuration example
        target(com.litegames.smarty.bot.extension.config.api.deploy.AwsTarget) {
            uri "s3://smarty-bots-repository/<<ProjectShortName>>"
            accessKey project.ext["<<ProjectShortName>>.botserver.accesskey"]
            secretKey project.ext["<<ProjectShortName>>.botserver.secretkey"]
        }

        // - Http target configuration example
        target(com.litegames.smarty.bot.extension.config.api.deploy.HttpTarget) {
            uri "https://dev.lite-games.com/repository/<<ProjectShortName>>"
            userName project.ext["<<ProjectShortName>>.botserver.username"]
            password project.ext["<<ProjectShortName>>.botserver.password"]
        }
    }
}

Troubleshooting

Gradle configuration fails

Changelog

[0.0.1] - 2019-03-12

  • First version.