Skip to content
/ Gloc Public

A Gradle plugin which I used as an example at my talk at the Droidcon Italy 18

Notifications You must be signed in to change notification settings

StefMa/Gloc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gloc

A Gradle Plugin which counts the lines of code in given directories.

Droidcon Italy 18:
I gave a talk at the Droidcon Italy 18 in Turin where I used that Plugin as an example to demonstrate how to write a Gradle Plugin. Slides of my Talk are available at Speaker Deck.

How to use

As the Plugin isn't published anywhere you have to do so first. For "manual testing" you can simply push it to your local maven repo. Just call:

./gradlew clean build publishToMavenLocal

After that you are able to use/apply that plugin (even in this project) like this:

// settings.gradle.kts
pluginManagement {
  repositories {
    gradlePluginPortal()
    mavenLocal()
  }
}

// build.gradke.kts
plugins {
  id("guru.stefma.gloc") version "0.0.1"
}

gloc {
  enabled = true
  dirs = arrayOf("src/main", "src/test")
}

Extension configuration

The extension provide two properties:

  • enabled - which will enable or disable the plugin
  • dirs - a array of file pathes which defines where to count the lines of code

Task

The plugin provides the task called gloc.
If you can run it for the first time it will - well - run and SUCCESS. Meaning the task was executed.

If you run it for the second time - without cleaning the buid/ dir and changing the input (the dirs property) - it will be UP-TO-DATE.

Running it with the Gradle build cache enabled it wil be - if you run it the second time - use the output from the cache. The output should be FROM-CACHE

About

A Gradle plugin which I used as an example at my talk at the Droidcon Italy 18

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages