Home

Awesome

Gradle Plugin for Eta

CircleCI Gradle Plugin Portal Gradle Plugin Portal Gradle Plugin Portal

A gradle plugin for building Eta projects via the Etlas build tool.

Requirements

This plugin requires that Gradle 4.3+ is used.

Using the Plugin

Plugin DSL

Eta Base Plugin

This is used for configuring your Eta/Etlas versions for your entire project. You can only do such configuration in the root project.

NOTE: Both the Eta Plugin and the Eta Android Plugin apply the Eta Base Plugin by default, so if you import either one, it is not required to import this one!

plugins {
    id 'com.typelead.eta.base' version '0.8.1'
}

Eta Plugin

This is used for standard JVM projects.

plugins {
    id 'com.typelead.eta' version '0.8.1'
}

Eta Android Plugin

This is used for Android projects.

plugins {
    id 'com.typelead.eta.android' version '0.8.1'
}

Legacy Method

Before applying any of the plugins, you should add the following in the build.gradle for your root project.

buildscript {
  repositories {
    maven {
      url 'https://plugins.gradle.org/m2/'
    }
  }
  dependencies {
    classpath 'gradle.plugin.com.typelead:gradle-eta:0.8.1'
  }
}

Eta Base Plugin

apply plugin: 'eta-base'

Eta Plugin

apply plugin: 'eta'

Eta Android Plugin

apply plugin: 'eta-android'

Building from Source

If you're interested in hacking on the plugin or trying out the latest version, you can install it from source.

Source Installation

git clone https://github.com/typelead/gradle-eta
cd gradle-eta
./gradlew pTML

Then, in your build.gradle you can add:

buildscript {
  repositories {
    mavenLocal()

    dependencies {
      classpath 'com.typelead:gradle-eta:latest.release'
    }
  }
}

Quick Start

Library

eta {
  version = '0.7.2b1'
  etlasVersion = '1.3.0.0'
}

Executable

apply plugin: 'application'

eta {
  version = '0.7.2b1'
  etlasVersion = '1.3.0.0'
}

Android Application

eta {
  version = '0.7.2b1'
  etlasVersion = '1.3.0.0'
}

See the examples and src/test/testData directories for more examples.

Configuration

You can use the top-level eta extension for some basic global configurations.

NOTE: The eta extension is only available in the root project! It will not be available in subprojects of a multi-module build because the configuration applies to all projects in the build.

Properties:

Dependencies

You can add Eta dependencies (from Hackage or elsewhere) as follows:

dependencies {
    compile eta('text:1.2.2.2')
}

The general format is eta([package-name]:[version-or-version-range]).

Ivy version range notation is supported.

Tasks

The Eta Gradle Plugin adds the following tasks:

Root Project Tasks

Per-Project, Per-SourceSet Tasks

For the main source set, the tasks are installDependenciesEta and compileEta.

Conditional Tasks

If the application plugin is enabled as well, the run task will run the main function defined in src/main/eta/Main.hs.

Standard Tasks

The standard Gradle tasks like build, assemble, so on will work as expected and will trigger compilation of the required Eta source sets.