Skip to content
zerovian edited this page Feb 26, 2020 · 29 revisions

Quickstart Guide

To use this plugin locally:

  1. Clone this repository to your local filesystem via the command:

    • git clone https://github.com/progress/latte.git
  2. Ensure that the DLC environment variable is set to your OpenEdge installation directory.

    • export DLC=/path/to/dlc
  3. cd into the latte repository and run ./gradlew build

    • This builds jars of this plugin in latte/build/libs. The version consists of the name, the artifact id, and the version number. The full version is found at the tail end of the build log.
    • ./gradlew build builds jars and runs the unit tests. To simply build the jars, run ./gradlew assemble
  4. In your local filesystem, create a gradle standalone project.

    • This can be done by either running gradle init or by simply creating your own build.gradle in a directory.
  5. Add the folder containing the jars as a repository and add Latte to your classpath so you can apply Latte to your project by adding this code to your build.gradle:

import oe.espresso.latte.*

buildscript {

    repositories {
        flatDir {
          dirs '/pathe/to/latte/build/libs/'
        }
    }


  dependencies {
    classpath "oe.espresso.latte:latte:<version>"
  }
}

apply plugin: 'oe.espresso.latte'
  1. Now you can use Latte tasks in your project. The following are some examples:
apply plugin: 'base'

// This sets some global variables to the plugin, such as propath and where 
// rcode is stored
abl { 
    propath = files('src')
    rcodeDir = 'build/rcode'
}
    
// This is a new task added to Latte, all of its options match the PCT task
// PCTCreateDatabase (found here: https://github.com/Riverside-Software/pct/wiki/PCTCreateDatabase)
task createDB(type: CreateDatabase) {
    dbName = "sports2020"
    destDir = "${buildDir}/db"
    sourceDb = "/path/to/dlc/sports2020.db"
    largeFiles = true
}

// This is a new task added in Latte, all of its options match the PCT task
// PCTConnection (found here: https://github.com/Riverside-Software/pct/wiki/PCTConnection) 
// This creates a reusable DBConnection with the id 'sports2020' that was created
// in the task above.
task connectDB(type: DBConnection) {
    dependsOn createDB
    dbName = 'sports2020'
    dbDir = "${buildDir}/db/"
    id = 'sports2020'
    singleUser = true
}

// This is a new task added in Latte, all of its options match the PCT task
// PCTLoadSchema (found here: https://github.com/Riverside-Software/pct/wiki/PCTLoadSchema) 
// This example loads all schema files in a folder that ends with a .df into a database.
// This uses the database connection of the task connectDB by referring to its id.
task updateSchema(type: LoadSchema) {
    dependsOn connectDB

    source 'src/schema'
    include '*.df'

    refid = "sports2020"
}

// This is a default task found in the original grabl project found 
// at https://grabl.gitlab.io/
task compileCode(type: CompileAblTask) {
    dependsOn updateSchema
 
    source('src/abl')
    include('**/*.p')

    dbConnections << 'sports2020'

    destinationDir = file("${buildDir}/compiled")
}

// This is a new task added in Latte, all of its options match the PCT task
// PCTLibrary (found here: https://github.com/Riverside-Software/pct/wiki/PCTLibrary)
task createPL(type: CreateProcedureLibrary) {
    dependsOn compileCode

    destFile = "build/foo.pl"
    basedir = "${buildDir}/compiled"
    includes= "**/*.r"
}

You can run these tasks with the command ./gradlew taskname, for example ./gradlew createPL.