OpenOffice Gradle Integration

From Apache OpenOffice Wiki
Revision as of 01:58, 5 January 2016 by Cmarcum (Talk | contribs)

Jump to: navigation, search

Overview

Gradle is a modern build framework for Java and Apache Groovy applications and is released under the Apache 2.0 License. Gradle build scripts are written in Groovy rather than XML. Gradle manages the project dependencies which are fetched from local or remote Maven or Ivy repositories or Gradle can use local files as well.

There a few parallel efforts to this with the first being a Groovy UNO Extension that adds convenience methods to the Java UNO API's that allow much less code when using Groovy compared to Java.

The second effort is Lazybones templates to create Gradle build based UNO Extensions. Lazybones is a project creation tool that allows you to create a new project structure for any framework or library for which the tool has a template. The first and only template completed so far is for an OpenOffice Client. Lazybones is release under the Apache 2.0 License.

Getting Started

Getting the ToolChain

A convenient method of getting Gradle, Groovy, and Lazybones is to use SdkMan. SdkMan is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. It provides a convenient Command Line Interface (CLI) and API for installing, switching, removing and listing Candidates. SdkMan is released under the Apache 2.0 License.

On UNIX based machines enter the following at the command prompt:

   curl -s http://get.sdkman.io | bash 

See the SdkMan website for a link to a windows version.

To install the latest version of Lazybones:

   sdk install lazybones

Repeat if needed for Groovy and Gradle:

   sdk install groovy
   sdk install gradle

See SdkMan Usage for all SdkMan commands to list and change default versions. Current versions are:

  • gradle: 2.7
  • groovy: 2.4.5
  • lazybones: 0.8.1

Getting the Source Code

The source can be checked out of the Apache SVN repository. Use "http" for read-only access and committers can use "https".

From the parent directory where you want the working copies.

Checkout the Groovy UNO Extension:

   svn co https://svn.apache.org/repos/asf/openoffice/devtools/guno-extension/trunk guno-extension

Check out the Lazybones Templates:

   svn co https://svn.apache.org/repos/asf/openoffice/devtools/lazybones-templates/trunk lazybones-templates

Building the Groovy Extension

From the guno-extension directory:

  gradle jar

This will run the gradle tasks clean, compileJava, compileGroovy, processResources, classes, groovydoc, and jar.
The jar file will be in ./build/libs and HTML GroovyDocs files in ./build/docs/groovydoc and are similar to JavaDoc files.

Installing the Templates

Until the templates are made available on Bintray the templates can be installed into the local lazybones cache. From the lazybones-templates directory:

   gradle installTemplateAooClient

Verify the template is available:

   lazybones list --cached
Personal tools