Skip to content
Alan Estrada edited this page Jun 4, 2019 · 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/dambenso/Progress-Grabl.git
  1. cd into the Progress-Grabl repository and run ./gradlew build
  • This will build up the jars of this plugin in Progress-Grabl/build/libs. The version number will be shown in the build log, which will look something like: Inferred project: grabl, version: 0.2.0-dev+develop.4f6aab9. This version number will be important in the next step.
  • ./gradlew build will build jars and run the unit tests. To simply build the jars, run ./gradlew assemble
  1. 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.
  1. Add the folder containing the jars as a repository and add Progress-Grabl to your classpath by adding this code to your build.gradle:
buildscript {
    repositories {
        flatDir { dirs '../Progress-Grabl/build/libs/' }
    }
    dependencies {
        // Remember to replace this version number with your own version
        classpath "io.gitlab.grabl:grabl:0.2.0-dev+develop.4f6aab9"
    }
}
    
allprojects {
    repositories {
        jcenter()
    }
}
    
apply plugin: 'io.gitlab.grabl.grabl'
  1. Now you can use the gradle tasks in that build.gradle, like so:
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 default task found in the original grabl project found here: https://grabl.gitlab.io/
compileAbl {
    source('src/abl')
    include('**/*.p')
    
    destinationDir = abl.rcodeDir
}
    
// This is a new task added in Progress-Grabl, all of its options match the PCT task
// PCTCreateDatabase (found here: https://github.com/Riverside-Software/pct/wiki/PCTCreateDatabase)
task createDb(type: io.gitlab.grabl.CreateDatabase) {
    dbName = "foofoo"
    destDir = "build"
    sourceDb = '/psc/120/dlc/sports2020.db'
    largeFiles = true
}

// This is a new task added in Progress-Grabl, all of its options match the PCT task
// PCTLibrary (found here: https://github.com/Riverside-Software/pct/wiki/PCTLibrary)
task createPL(type: io.gitlab.grabl.CreateProcedureLibrary) {
    destFile = 'this.pl'
    cpInternal = 'UTF-8'
    defaultExcludes = false
}

// This is a new task added in Progress-Grabl, 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 'foodb'
task createConnection(type: io.gitlab.grabl.DBConnection) {
    dbName = 'sports2020'
    dbDir = 'testdb/'
    id = 'foodb'
    singleUser = true
}

// This is a new task added in Progress-Grabl, 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 reuses the database connection of the task createConnection by referring to its id.
task loadSchema(type: io.gitlab.grabl.LoadSchema) {
    dependsOn createConnection

    source 'schema'
    include '*.df'

    refid = "foodb"
}